ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
February 2021
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
30 participants
434 discussions
Start a n
N
ew thread
[reactos] 37/100: [SETUPLIB] Lock the volume before writing MBR boot code
by Jérôme Gardou
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=76ac898bc55a6c4c40a4f…
commit 76ac898bc55a6c4c40a4f1b503bcb0aac0d51dd0 Author: Jérôme Gardou <jerome.gardou(a)reactos.org> AuthorDate: Thu Dec 3 17:13:38 2020 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Wed Feb 3 09:41:22 2021 +0100 [SETUPLIB] Lock the volume before writing MBR boot code --- base/setup/lib/bootsup.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/base/setup/lib/bootsup.c b/base/setup/lib/bootsup.c index 37f7bdb43ab..b1e11d108d4 100644 --- a/base/setup/lib/bootsup.c +++ b/base/setup/lib/bootsup.c @@ -555,7 +555,7 @@ InstallBootCodeToDisk( IN PCWSTR RootPath, IN PFS_INSTALL_BOOTCODE InstallBootCode) { - NTSTATUS Status; + NTSTATUS Status, LockStatus; UNICODE_STRING Name; OBJECT_ATTRIBUTES ObjectAttributes; IO_STATUS_BLOCK IoStatusBlock; @@ -584,9 +584,32 @@ InstallBootCodeToDisk( if (!NT_SUCCESS(Status)) return Status; + /* Lock the volume */ + LockStatus = NtFsControlFile(PartitionHandle, NULL, NULL, NULL, &IoStatusBlock, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0); + if (!NT_SUCCESS(LockStatus)) + { + DPRINT1("Unable to lock the volume before installing boot code. Status 0x%08x. Expect problems.\n", LockStatus); + } + /* Install the bootcode (MBR, VBR) */ Status = InstallBootCode(SrcPath, PartitionHandle, PartitionHandle); + /* dismount & Unlock the volume */ + if (NT_SUCCESS(LockStatus)) + { + LockStatus = NtFsControlFile(PartitionHandle, NULL, NULL, NULL, &IoStatusBlock, FSCTL_DISMOUNT_VOLUME, NULL, 0, NULL, 0); + if (!NT_SUCCESS(LockStatus)) + { + DPRINT1("Unable to unlock the volume after installing boot code. Status 0x%08x. Expect problems.\n", LockStatus); + } + + LockStatus = NtFsControlFile(PartitionHandle, NULL, NULL, NULL, &IoStatusBlock, FSCTL_UNLOCK_VOLUME, NULL, 0, NULL, 0); + if (!NT_SUCCESS(LockStatus)) + { + DPRINT1("Unable to unlock the volume after installing boot code. Status 0x%08x. Expect problems.\n", LockStatus); + } + } + /* Close the partition */ NtClose(PartitionHandle); @@ -1076,6 +1099,7 @@ InstallFatBootcodeToPartition( DPRINT1("Install FAT32 bootcode: %S ==> %S\n", SrcPath, SystemRootPath->Buffer); Status = InstallBootCodeToDisk(SrcPath, SystemRootPath->Buffer, InstallFat32BootCode); + DPRINT1("Status: 0x%08X\n", Status); if (!NT_SUCCESS(Status)) { DPRINT1("InstallBootCodeToDisk(FAT32) failed (Status %lx)\n", Status);
3 years, 9 months
1
0
0
0
[reactos] 36/100: [NTOSKRNL] Address issues raised in PR 3361 review
by Jérôme Gardou
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d2fa434cb7849442c9813…
commit d2fa434cb7849442c9813ca3daac83882114cecd Author: Jérôme Gardou <jerome.gardou(a)reactos.org> AuthorDate: Wed Dec 2 15:17:28 2020 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Wed Feb 3 09:41:22 2021 +0100 [NTOSKRNL] Address issues raised in PR 3361 review --- ntoskrnl/cache/section/data.c | 4 ---- ntoskrnl/mm/ARM3/section.c | 8 ++++++++ ntoskrnl/mm/section.c | 39 ++++++++++++++++----------------------- 3 files changed, 24 insertions(+), 27 deletions(-) diff --git a/ntoskrnl/cache/section/data.c b/ntoskrnl/cache/section/data.c index 1ec6a3326d9..fa83080eddb 100644 --- a/ntoskrnl/cache/section/data.c +++ b/ntoskrnl/cache/section/data.c @@ -274,8 +274,6 @@ MmFinalizeSegment(PMM_SECTION_SEGMENT Segment) DPRINT("Finalize segment %p\n", Segment); - __debugbreak(); - MmLockSectionSegment(Segment); RemoveEntryList(&Segment->ListOfSegments); if (Segment->Flags & MM_DATAFILE_SEGMENT) { @@ -622,8 +620,6 @@ MiFreeSegmentPage(PMM_SECTION_SEGMENT Segment, ULONG_PTR Entry; PFILE_OBJECT FileObject = Segment->FileObject; - __debugbreak(); - Entry = MmGetPageEntrySectionSegment(Segment, FileOffset); DPRINTC("MiFreeSegmentPage(%p:%I64x -> Entry %Ix\n", Segment, diff --git a/ntoskrnl/mm/ARM3/section.c b/ntoskrnl/mm/ARM3/section.c index 9ea36637a22..dde3b2d8cc4 100644 --- a/ntoskrnl/mm/ARM3/section.c +++ b/ntoskrnl/mm/ARM3/section.c @@ -1094,6 +1094,14 @@ MiMapViewInSystemSpace(IN PVOID Section, *ViewSize = SectionSize - SectionOffset->QuadPart; } + /* Check overflow */ + if ((SectionOffset->QuadPart + *ViewSize) < SectionOffset->QuadPart) + { + DPRINT1("Integer overflow between size & offset!\n"); + MiDereferenceControlArea(ControlArea); + return STATUS_INVALID_VIEW_SIZE; + } + /* Check if the caller wanted a larger section than the view */ if (SectionOffset->QuadPart + *ViewSize > SectionSize) { diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c index 6dcf764d7a1..e39f82d0f22 100644 --- a/ntoskrnl/mm/section.c +++ b/ntoskrnl/mm/section.c @@ -2050,7 +2050,7 @@ MmCreatePhysicalMemorySection(VOID) /* * Create the section mapping physical memory */ - SectionSize.QuadPart = ~((ULONG_PTR)0); + SectionSize.QuadPart = MmNumberOfPhysicalPages * PAGE_SIZE; InitializeObjectAttributes(&Obj, &Name, OBJ_PERMANENT | OBJ_KERNEL_EXCLUSIVE, @@ -2192,7 +2192,6 @@ MmCreateDataFileSection(PSECTION *SectionObject, (PVOID*)&Section); if (!NT_SUCCESS(Status)) { - ObDereferenceObject(FileObject); return(Status); } /* @@ -2240,7 +2239,6 @@ MmCreateDataFileSection(PSECTION *SectionObject, if (MaximumSize.QuadPart == 0) { ObDereferenceObject(Section); - ObDereferenceObject(FileObject); return STATUS_MAPPED_FILE_SIZE_ZERO; } } @@ -2254,7 +2252,6 @@ MmCreateDataFileSection(PSECTION *SectionObject, if (!NT_SUCCESS(Status)) { ObDereferenceObject(Section); - ObDereferenceObject(FileObject); return(STATUS_SECTION_NOT_EXTENDED); } } @@ -2263,7 +2260,6 @@ MmCreateDataFileSection(PSECTION *SectionObject, if (FileObject->SectionObjectPointer == NULL) { ObDereferenceObject(Section); - ObDereferenceObject(FileObject); return STATUS_INVALID_FILE_FOR_SECTION; } @@ -2274,7 +2270,6 @@ MmCreateDataFileSection(PSECTION *SectionObject, if (Status != STATUS_SUCCESS) { ObDereferenceObject(Section); - ObDereferenceObject(FileObject); return(Status); } @@ -2305,7 +2300,6 @@ MmCreateDataFileSection(PSECTION *SectionObject, //KeSetEvent((PVOID)&FileObject->Lock, IO_NO_INCREMENT, FALSE); MiReleasePfnLock(OldIrql); ObDereferenceObject(Section); - ObDereferenceObject(FileObject); return(STATUS_NO_MEMORY); } @@ -2329,6 +2323,7 @@ MmCreateDataFileSection(PSECTION *SectionObject, ExInitializeFastMutex(&Segment->Lock); Segment->FileObject = FileObject; + ObReferenceObject(FileObject); Segment->Image.FileOffset = 0; Segment->Protection = SectionPageProtection; @@ -2370,9 +2365,6 @@ MmCreateDataFileSection(PSECTION *SectionObject, } MmUnlockSectionSegment(Segment); - - /* The segment already has a reference to a file object. Don't bother keeping one.*/ - ObDereferenceObject(FileObject); } Section->SizeOfSection = MaximumSize; @@ -3053,7 +3045,6 @@ MmCreateImageSection(PSECTION *SectionObject, (PVOID*)(PVOID)&Section); if (!NT_SUCCESS(Status)) { - ObDereferenceObject(FileObject); return(Status); } @@ -3093,17 +3084,14 @@ MmCreateImageSection(PSECTION *SectionObject, NTSTATUS StatusExeFmt; PMM_SECTION_SEGMENT DataSectionObject; - ImageSectionObject = ExAllocatePoolWithTag(NonPagedPool, sizeof(MM_IMAGE_SECTION_OBJECT), TAG_MM_SECTION_SEGMENT); + ImageSectionObject = ExAllocatePoolZero(NonPagedPool, sizeof(MM_IMAGE_SECTION_OBJECT), TAG_MM_SECTION_SEGMENT); if (ImageSectionObject == NULL) { MiReleasePfnLock(OldIrql); - ObDereferenceObject(FileObject); ObDereferenceObject(Section); return(STATUS_NO_MEMORY); } - RtlZeroMemory(ImageSectionObject, sizeof(MM_IMAGE_SECTION_OBJECT)); - ImageSectionObject->SegFlags = MM_SEGMENT_INCREATE; ImageSectionObject->RefCount = 1; FileObject->SectionObjectPointer->ImageSectionObject = ImageSectionObject; @@ -3172,7 +3160,6 @@ MmCreateImageSection(PSECTION *SectionObject, ExFreePoolWithTag(ImageSectionObject, TAG_MM_SECTION_SEGMENT); ObDereferenceObject(Section); - ObDereferenceObject(FileObject); return(Status); } @@ -3194,12 +3181,15 @@ MmCreateImageSection(PSECTION *SectionObject, ExFreePool(ImageSectionObject->Segments); ExFreePool(ImageSectionObject); ObDereferenceObject(Section); - ObDereferenceObject(FileObject); return(Status); } OldIrql = MiAcquirePfnLock(); ImageSectionObject->SegFlags &= ~MM_SEGMENT_INCREATE; + + /* Take a ref on the file on behalf of the newly created structure */ + ObReferenceObject(FileObject); + MiReleasePfnLock(OldIrql); Status = StatusExeFmt; @@ -3213,9 +3203,6 @@ MmCreateImageSection(PSECTION *SectionObject, Section->Segment = (PSEGMENT)ImageSectionObject; - /* We let the Image Section Object hold the reference */ - ObDereferenceObject(FileObject); - Status = STATUS_SUCCESS; } //KeSetEvent((PVOID)&FileObject->Lock, IO_NO_INCREMENT, FALSE); @@ -3693,8 +3680,10 @@ NtQuerySection( _SEH2_TRY { *((SECTION_BASIC_INFORMATION*)SectionInformation) = Sbi; - if (ResultLength) + if (ResultLength != NULL) + { *ResultLength = sizeof(Sbi); + } } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -3718,7 +3707,9 @@ NtQuerySection( PSECTION_IMAGE_INFORMATION Sii = (PSECTION_IMAGE_INFORMATION)SectionInformation; *Sii = ImageSectionObject->ImageInformation; if (ResultLength != NULL) + { *ResultLength = sizeof(*Sii); + } } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -4374,6 +4365,7 @@ MmCreateSection (OUT PVOID * Section, SectionPageProtection, AllocationAttributes, FileObject); + ObDereferenceObject(FileObject); } #ifndef NEWCC else if (FileObject != NULL) @@ -4386,6 +4378,7 @@ MmCreateSection (OUT PVOID * Section, AllocationAttributes, FileObject, FileHandle != NULL); + ObDereferenceObject(FileObject); } #else else if (FileHandle != NULL || FileObject != NULL) @@ -4393,8 +4386,8 @@ MmCreateSection (OUT PVOID * Section, Status = MmCreateCacheSection(SectionObject, DesiredAccess, ObjectAttributes, - SizeOfSection, - InitialPageProtection, + MaximumSize, + SectionPageProtection, AllocationAttributes, FileObject); }
3 years, 9 months
1
0
0
0
[reactos] 35/100: [NTOS:CC] Fix Vacb size usage & check
by Jérôme Gardou
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=70c62aa2c9e5b4bdabb05…
commit 70c62aa2c9e5b4bdabb05ac5b92f6c56ee166fac Author: Jérôme Gardou <jerome.gardou(a)reactos.org> AuthorDate: Wed Dec 2 12:39:58 2020 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Wed Feb 3 09:41:22 2021 +0100 [NTOS:CC] Fix Vacb size usage & check --- ntoskrnl/cc/view.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c index 0e07eb7f1b6..de4a75ea8f7 100644 --- a/ntoskrnl/cc/view.c +++ b/ntoskrnl/cc/view.c @@ -388,7 +388,6 @@ CcRosMarkDirtyVacb ( { KIRQL oldIrql; PROS_SHARED_CACHE_MAP SharedCacheMap; - ULONG Length = VACB_MAPPING_GRANULARITY; SharedCacheMap = Vacb->SharedCacheMap; @@ -398,12 +397,9 @@ CcRosMarkDirtyVacb ( ASSERT(!Vacb->Dirty); InsertTailList(&DirtyVacbListHead, &Vacb->DirtyVacbListEntry); -#if 0 - if (Vacb->FileOffset.QuadPart + Length > SharedCacheMap->SectionSize.QuadPart) - Length = SharedCacheMap->SectionSize.QuadPart - Vacb->FileOffset.QuadPart; -#endif - CcTotalDirtyPages += PAGE_ROUND_UP(Length) / PAGE_SIZE; - Vacb->SharedCacheMap->DirtyPages += PAGE_ROUND_UP(Length) / PAGE_SIZE; + /* FIXME: There is no reason to account for the whole VACB. */ + CcTotalDirtyPages += VACB_MAPPING_GRANULARITY / PAGE_SIZE; + Vacb->SharedCacheMap->DirtyPages += VACB_MAPPING_GRANULARITY / PAGE_SIZE; CcRosVacbIncRefCount(Vacb); /* Move to the tail of the LRU list */ @@ -430,7 +426,6 @@ CcRosUnmarkDirtyVacb ( { KIRQL oldIrql; PROS_SHARED_CACHE_MAP SharedCacheMap; - ULONG Length = VACB_MAPPING_GRANULARITY; SharedCacheMap = Vacb->SharedCacheMap; @@ -447,12 +442,8 @@ CcRosUnmarkDirtyVacb ( RemoveEntryList(&Vacb->DirtyVacbListEntry); InitializeListHead(&Vacb->DirtyVacbListEntry); -#if 0 - if (Vacb->FileOffset.QuadPart + Length > SharedCacheMap->SectionSize.QuadPart) - Length = SharedCacheMap->SectionSize.QuadPart - Vacb->FileOffset.QuadPart; -#endif - CcTotalDirtyPages -= PAGE_ROUND_UP(Length) / PAGE_SIZE; - Vacb->SharedCacheMap->DirtyPages -= PAGE_ROUND_UP(Length) / PAGE_SIZE; + CcTotalDirtyPages -= VACB_MAPPING_GRANULARITY / PAGE_SIZE; + Vacb->SharedCacheMap->DirtyPages -= VACB_MAPPING_GRANULARITY / PAGE_SIZE; CcRosVacbDecRefCount(Vacb); @@ -718,8 +709,11 @@ CcRosEnsureVacbResident( ASSERT((Offset + Length) <= VACB_MAPPING_GRANULARITY); - if ((Vacb->FileOffset.QuadPart + Offset) > Vacb->SharedCacheMap->FileSize.QuadPart) + if ((Vacb->FileOffset.QuadPart + Offset) > Vacb->SharedCacheMap->SectionSize.QuadPart) + { + DPRINT1("Vacb read beyond the file size!\n"); return FALSE; + } BaseAddress = (PVOID)((ULONG_PTR)Vacb->BaseAddress + Offset);
3 years, 9 months
1
0
0
0
[reactos] 34/100: [NTOS/CC] Be more precise when notifying Mm about dirty pages
by Jérôme Gardou
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c74cbf0c0bed7ae9831c2…
commit c74cbf0c0bed7ae9831c23527931907de55379cc Author: Jérôme Gardou <jerome.gardou(a)reactos.org> AuthorDate: Wed Dec 2 12:30:48 2020 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Wed Feb 3 09:41:22 2021 +0100 [NTOS/CC] Be more precise when notifying Mm about dirty pages --- ntoskrnl/cc/copy.c | 10 ++++++++++ ntoskrnl/cc/pin.c | 5 +++++ ntoskrnl/cc/view.c | 3 --- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ntoskrnl/cc/copy.c b/ntoskrnl/cc/copy.c index 17b7a366d17..f92040aa0b2 100644 --- a/ntoskrnl/cc/copy.c +++ b/ntoskrnl/cc/copy.c @@ -586,6 +586,11 @@ CcCopyWrite ( Buffer = (PVOID)((ULONG_PTR)Buffer + VacbLength); CurrentOffset += VacbLength; Length -= VacbLength; + + /* Tell Mm */ + Status = MmMakePagesDirty(NULL, Add2Ptr(Vacb->BaseAddress, VacbOffset), VacbLength); + if (!NT_SUCCESS(Status)) + ExRaiseStatus(Status); } _SEH2_FINALLY { @@ -829,6 +834,11 @@ CcZeroData ( WriteOffset.QuadPart += VacbLength; Length -= VacbLength; + + /* Tell Mm */ + Status = MmMakePagesDirty(NULL, Add2Ptr(Vacb->BaseAddress, VacbOffset), VacbLength); + if (!NT_SUCCESS(Status)) + ExRaiseStatus(Status); } _SEH2_FINALLY { diff --git a/ntoskrnl/cc/pin.c b/ntoskrnl/cc/pin.c index 189ba480305..0d5642b9932 100644 --- a/ntoskrnl/cc/pin.c +++ b/ntoskrnl/cc/pin.c @@ -540,6 +540,11 @@ CcSetDirtyPinnedData ( CCTRACE(CC_API_DEBUG, "Bcb=%p Lsn=%p\n", Bcb, Lsn); + /* Tell Mm */ + MmMakePagesDirty(NULL, + Add2Ptr(iBcb->Vacb->BaseAddress, iBcb->PFCB.MappedFileOffset.QuadPart - iBcb->Vacb->FileOffset.QuadPart), + iBcb->PFCB.MappedLength); + if (!iBcb->Vacb->Dirty) { CcRosMarkDirtyVacb(iBcb->Vacb); diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c index a14635f2135..0e07eb7f1b6 100644 --- a/ntoskrnl/cc/view.c +++ b/ntoskrnl/cc/view.c @@ -420,9 +420,6 @@ CcRosMarkDirtyVacb ( CcScheduleLazyWriteScan(FALSE); } KeReleaseQueuedSpinLock(LockQueueMasterLock, oldIrql); - - /* Tell Mm */ - MmMakePagesDirty(NULL, Vacb->BaseAddress, Length); } VOID
3 years, 9 months
1
0
0
0
[reactos] 33/100: [NTOS:CC] Fix releasing VACB when an exception is raised in CcZeroData & CcCopyWrite
by Jérôme Gardou
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c295d6b229fc679a38eae…
commit c295d6b229fc679a38eaea2f0797b7ffb139478d Author: Jérôme Gardou <jerome.gardou(a)reactos.org> AuthorDate: Wed Dec 2 12:28:38 2020 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Wed Feb 3 09:41:22 2021 +0100 [NTOS:CC] Fix releasing VACB when an exception is raised in CcZeroData & CcCopyWrite --- ntoskrnl/cc/copy.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ntoskrnl/cc/copy.c b/ntoskrnl/cc/copy.c index ced4271fc9b..17b7a366d17 100644 --- a/ntoskrnl/cc/copy.c +++ b/ntoskrnl/cc/copy.c @@ -557,8 +557,9 @@ CcCopyWrite ( return FALSE; /* FIXME: Honor FileObject FO_WRITE_THROUGH flag */ + ASSERT((FileOffset->QuadPart + Length) <= SharedCacheMap->SectionSize.QuadPart); - ASSERT((FileOffset->QuadPart + Length) <= SharedCacheMap->FileSize.QuadPart); + ASSERT((FileObject->Flags & FO_WRITE_THROUGH) == 0); CurrentOffset = FileOffset->QuadPart; while(CurrentOffset < WriteEnd) @@ -577,7 +578,6 @@ CcCopyWrite ( { if (!CcRosEnsureVacbResident(Vacb, Wait, FALSE, VacbOffset, VacbLength)) { - CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE); return FALSE; } @@ -589,7 +589,8 @@ CcCopyWrite ( } _SEH2_FINALLY { - CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, TRUE, FALSE); + /* Do not mark the VACB as dirty if an exception was raised */ + CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, !_SEH2_AbnormalTermination(), FALSE); } _SEH2_END; } @@ -821,7 +822,6 @@ CcZeroData ( { if (!CcRosEnsureVacbResident(Vacb, Wait, FALSE, VacbOffset, VacbLength)) { - CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, FALSE, FALSE); return FALSE; } @@ -832,7 +832,8 @@ CcZeroData ( } _SEH2_FINALLY { - CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, TRUE, FALSE); + /* Do not mark the VACB as dirty if an exception was raised */ + CcRosReleaseVacb(SharedCacheMap, Vacb, TRUE, !_SEH2_AbnormalTermination(), FALSE); } _SEH2_END; }
3 years, 9 months
1
0
0
0
[reactos] 32/100: [NTOS:CC] Rewrite the non-cached path of CcZeroData
by Jérôme Gardou
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7f47f032969cac0eaaf32…
commit 7f47f032969cac0eaaf3246a3e0ae9da3008aeb1 Author: Jérôme Gardou <jerome.gardou(a)reactos.org> AuthorDate: Wed Dec 2 12:27:32 2020 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Wed Feb 3 09:41:22 2021 +0100 [NTOS:CC] Rewrite the non-cached path of CcZeroData --- ntoskrnl/cc/copy.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/ntoskrnl/cc/copy.c b/ntoskrnl/cc/copy.c index 5bb14cc210a..ced4271fc9b 100644 --- a/ntoskrnl/cc/copy.c +++ b/ntoskrnl/cc/copy.c @@ -759,25 +759,25 @@ CcZeroData ( PMDL Mdl; ULONG i; ULONG CurrentLength; + PPFN_NUMBER PfnArray; - Mdl = _alloca(MmSizeOfMdl(NULL, MAX_ZERO_LENGTH)); + /* Setup our Mdl */ + Mdl = IoAllocateMdl(NULL, min(Length, MAX_ZERO_LENGTH), FALSE, FALSE, NULL); + if (!Mdl) + ExRaiseStatus(STATUS_INSUFFICIENT_RESOURCES); + PfnArray = MmGetMdlPfnArray(Mdl); + for (i = 0; i < BYTES_TO_PAGES(Mdl->ByteCount); i++) + PfnArray[i] = CcZeroPage; + Mdl->MdlFlags |= MDL_PAGES_LOCKED; + + /* Perform the write sequencially */ while (Length > 0) { - if (Length + WriteOffset.QuadPart % PAGE_SIZE > MAX_ZERO_LENGTH) - { - CurrentLength = MAX_ZERO_LENGTH - WriteOffset.QuadPart % PAGE_SIZE; - } - else - { - CurrentLength = Length; - } - MmInitializeMdl(Mdl, (PVOID)(ULONG_PTR)WriteOffset.QuadPart, CurrentLength); - Mdl->MdlFlags |= MDL_PAGES_LOCKED; - for (i = 0; i < ((Mdl->Size - sizeof(MDL)) / sizeof(ULONG)); i++) - { - ((PPFN_NUMBER)(Mdl + 1))[i] = CcZeroPage; - } + CurrentLength = min(Length, MAX_ZERO_LENGTH); + + Mdl->ByteCount = CurrentLength; + KeInitializeEvent(&Event, NotificationEvent, FALSE); Status = IoSynchronousPageWrite(FileObject, Mdl, &WriteOffset, &Event, &Iosb); if (Status == STATUS_PENDING) @@ -791,12 +791,15 @@ CcZeroData ( } if (!NT_SUCCESS(Status)) { - return FALSE; + IoFreeMdl(Mdl); + ExRaiseStatus(Status); } WriteOffset.QuadPart += CurrentLength; Length -= CurrentLength; } + IoFreeMdl(Mdl); + return TRUE; }
3 years, 9 months
1
0
0
0
[reactos] 31/100: [NTOS:CC] Remove unused functions
by Jérôme Gardou
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=36e18aab35049f5e4cb36…
commit 36e18aab35049f5e4cb36d0751993f9af40e27cd Author: Jérôme Gardou <jerome.gardou(a)reactos.org> AuthorDate: Wed Dec 2 12:14:49 2020 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Wed Feb 3 09:41:22 2021 +0100 [NTOS:CC] Remove unused functions --- ntoskrnl/cc/view.c | 59 ------------------------------------------ ntoskrnl/include/internal/cc.h | 15 ----------- 2 files changed, 74 deletions(-) diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c index ddbe77e22af..a14635f2135 100644 --- a/ntoskrnl/cc/view.c +++ b/ntoskrnl/cc/view.c @@ -466,65 +466,6 @@ CcRosUnmarkDirtyVacb ( } } -NTSTATUS -NTAPI -CcRosMarkDirtyFile ( - PROS_SHARED_CACHE_MAP SharedCacheMap, - LONGLONG FileOffset) -{ - PROS_VACB Vacb; - - ASSERT(SharedCacheMap); - - DPRINT("CcRosMarkDirtyVacb(SharedCacheMap 0x%p, FileOffset %I64u)\n", - SharedCacheMap, FileOffset); - - Vacb = CcRosLookupVacb(SharedCacheMap, FileOffset); - if (Vacb == NULL) - { - KeBugCheck(CACHE_MANAGER); - } - - CcRosReleaseVacb(SharedCacheMap, Vacb, Vacb->Valid, TRUE, FALSE); - - return STATUS_SUCCESS; -} - -/* - * Note: this is not the contrary function of - * CcRosMapVacbInKernelSpace() - */ -NTSTATUS -NTAPI -CcRosUnmapVacb ( - PROS_SHARED_CACHE_MAP SharedCacheMap, - LONGLONG FileOffset, - BOOLEAN NowDirty) -{ - PROS_VACB Vacb; - - ASSERT(SharedCacheMap); - - DPRINT("CcRosUnmapVacb(SharedCacheMap 0x%p, FileOffset %I64u, NowDirty %u)\n", - SharedCacheMap, FileOffset, NowDirty); - - Vacb = CcRosLookupVacb(SharedCacheMap, FileOffset); - if (Vacb == NULL) - { - return STATUS_UNSUCCESSFUL; - } - - ASSERT(Vacb->MappedCount != 0); - if (InterlockedDecrement((PLONG)&Vacb->MappedCount) == 0) - { - CcRosVacbDecRefCount(Vacb); - } - - CcRosReleaseVacb(SharedCacheMap, Vacb, Vacb->Valid, NowDirty, FALSE); - - return STATUS_SUCCESS; -} - static BOOLEAN CcRosFreeUnusedVacb ( diff --git a/ntoskrnl/include/internal/cc.h b/ntoskrnl/include/internal/cc.h index 9e186a61d11..862a759ef7a 100644 --- a/ntoskrnl/include/internal/cc.h +++ b/ntoskrnl/include/internal/cc.h @@ -342,14 +342,6 @@ BOOLEAN NTAPI CcInitializeCacheManager(VOID); -NTSTATUS -NTAPI -CcRosUnmapVacb( - PROS_SHARED_CACHE_MAP SharedCacheMap, - LONGLONG FileOffset, - BOOLEAN NowDirty -); - PROS_VACB NTAPI CcRosLookupVacb( @@ -361,13 +353,6 @@ VOID NTAPI CcInitCacheZeroPage(VOID); -NTSTATUS -NTAPI -CcRosMarkDirtyFile( - PROS_SHARED_CACHE_MAP SharedCacheMap, - LONGLONG FileOffset -); - VOID NTAPI CcRosMarkDirtyVacb(
3 years, 9 months
1
0
0
0
[reactos] 30/100: [NTOS/MM] Force flushing when the page is dirtified in user mode
by Jérôme Gardou
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7dab3583cc4c80304df61…
commit 7dab3583cc4c80304df61658fe4b1eeea8983f5e Author: Jérôme Gardou <jerome.gardou(a)reactos.org> AuthorDate: Wed Dec 2 12:12:11 2020 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Wed Feb 3 09:41:22 2021 +0100 [NTOS/MM] Force flushing when the page is dirtified in user mode --- ntoskrnl/mm/section.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c index f3b30dedaed..6dcf764d7a1 100644 --- a/ntoskrnl/mm/section.c +++ b/ntoskrnl/mm/section.c @@ -4620,7 +4620,7 @@ MmRosFlushVirtualMemory( if (Entry != 0) { /* This will write the page to disk, if needed */ - MmCheckDirtySegment(Segment, &SegmentOffset, MmIsDirtyPage(Process, CurrentAddress), FALSE); + MmCheckDirtySegment(Segment, &SegmentOffset, Process ? MmIsDirtyPage(Process, CurrentAddress) : FALSE, FALSE); Iosb->Information += PAGE_SIZE; } SegmentOffset.QuadPart += PAGE_SIZE; @@ -4694,7 +4694,10 @@ MmCheckDirtySegment( /* Drop the reference we got */ Entry = MAKE_SSE(Page << PAGE_SHIFT, SHARE_COUNT_FROM_SSE(Entry) - 1); - if (DirtyAgain) Entry = DIRTY_SSE(Entry); + if (DirtyAgain) + { + Entry = DIRTY_SSE(Entry); + } MmSetPageEntrySectionSegment(Segment, Offset, Entry); }
3 years, 9 months
1
0
0
0
[reactos] 29/100: [NTOS:MM] Do not limit ourselves in reading or writing the file
by Jérôme Gardou
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=91edefa11e4d7230155dc…
commit 91edefa11e4d7230155dcaafe052a6fd10d7dd57 Author: Jérôme Gardou <jerome.gardou(a)reactos.org> AuthorDate: Wed Dec 2 11:40:25 2020 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Wed Feb 3 09:41:22 2021 +0100 [NTOS:MM] Do not limit ourselves in reading or writing the file --- ntoskrnl/mm/section.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c index 8df9b99cfb8..f3b30dedaed 100644 --- a/ntoskrnl/mm/section.c +++ b/ntoskrnl/mm/section.c @@ -214,16 +214,9 @@ MiWritePage(PMM_SECTION_SEGMENT Segment, PMDL Mdl = (PMDL)MdlBase; PFILE_OBJECT FileObject = Segment->FileObject; LARGE_INTEGER FileOffset; - PFSRTL_COMMON_FCB_HEADER Fcb = FileObject->FsContext; FileOffset.QuadPart = Segment->Image.FileOffset + SegOffset; - /* Check if we are not writing off-limit */ - if (FileOffset.QuadPart >= Fcb->AllocationSize.QuadPart) - { - return STATUS_SUCCESS; - } - RtlZeroMemory(MdlBase, sizeof(MdlBase)); MmInitializeMdl(Mdl, NULL, PAGE_SIZE); MmBuildMdlFromPages(Mdl, &Page); @@ -1179,18 +1172,15 @@ MiReadPage(PMEMORY_AREA MemoryArea, PMDL Mdl = (PMDL)MdlBase; PFILE_OBJECT FileObject = MemoryArea->SectionData.Segment->FileObject; LARGE_INTEGER FileOffset; - PFSRTL_COMMON_FCB_HEADER Fcb = FileObject->FsContext; FileOffset.QuadPart = MemoryArea->SectionData.Segment->Image.FileOffset + SegOffset; + DPRINT("Reading file at offset %08x:%08x\n", FileOffset.HighPart, FileOffset.LowPart); + Status = MmRequestPageMemoryConsumer(MC_USER, FALSE, Page); if (!NT_SUCCESS(Status)) return Status; - /* Check if we are beyond the file */ - if (FileOffset.QuadPart > Fcb->FileSize.QuadPart) - return STATUS_SUCCESS; - RtlZeroMemory(MdlBase, sizeof(MdlBase)); MmInitializeMdl(Mdl, NULL, PAGE_SIZE); MmBuildMdlFromPages(Mdl, Page); @@ -1204,6 +1194,7 @@ MiReadPage(PMEMORY_AREA MemoryArea, KeWaitForSingleObject(&Event, WrPageIn, KernelMode, FALSE, NULL); Status = IoStatus.Status; } + if (Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA) { MmUnmapLockedPages (Mdl->MappedSystemVa, Mdl); @@ -4539,6 +4530,7 @@ MmMakePagesResident( MmUnlockAddressSpace(AddressSpace); /* FIXME: Read the whole range at once instead of one page at a time */ + /* Ignore file size, as Cc already checked on its side. */ Status = MiReadPage(MemoryArea, SegmentOffset.QuadPart, &Page); if (!NT_SUCCESS(Status)) {
3 years, 9 months
1
0
0
0
[reactos] 28/100: [FASTFAT_NEW] Enable the driver
by Jérôme Gardou
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c05f3d8d1ce5641f1768e…
commit c05f3d8d1ce5641f1768ecd775a375a34e368cf9 Author: Jérôme Gardou <jerome.gardou(a)reactos.org> AuthorDate: Wed Dec 2 11:17:59 2020 +0100 Commit: Jérôme Gardou <jerome.gardou(a)reactos.org> CommitDate: Wed Feb 3 09:41:22 2021 +0100 [FASTFAT_NEW] Enable the driver --- drivers/filesystems/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/filesystems/CMakeLists.txt b/drivers/filesystems/CMakeLists.txt index 7485d433b5a..3d5277dfa74 100644 --- a/drivers/filesystems/CMakeLists.txt +++ b/drivers/filesystems/CMakeLists.txt @@ -2,7 +2,8 @@ add_subdirectory(btrfs) add_subdirectory(cdfs) add_subdirectory(ext2) -add_subdirectory(fastfat) +#add_subdirectory(fastfat) +add_subdirectory(fastfat_new) add_subdirectory(ffs) add_subdirectory(fs_rec) add_subdirectory(msfs)
3 years, 9 months
1
0
0
0
← Newer
1
...
35
36
37
38
39
40
41
...
44
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Results per page:
10
25
50
100
200