Skip to content

Commit e2e021e

Browse files
committed
Initial commit
0 parents  commit e2e021e

File tree

12 files changed

+1240
-0
lines changed

12 files changed

+1240
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Build results
2+
[Dd]ebug/
3+
[Rr]elease/
4+
[Xx]64/
5+
[Xx]86/
6+
7+
# Visual Studio 2015 cache/options directory
8+
.vs/
9+

LICENSE

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// Copyright 2021 OSR Open Systems Resources, Inc.
3+
// All rights reserved.
4+
//
5+
// Redistribution and use in source and binary forms, with or without
6+
// modification, are permitted provided that the following conditions are met:
7+
//
8+
// 1. Redistributions of source code must retain the above copyright notice,
9+
// this list of conditions and the following disclaimer.
10+
//
11+
// 2. Redistributions in binary form must reproduce the above copyright notice,
12+
// this list of conditions and the following disclaimer in the documentation
13+
// and/or other materials provided with the distribution.
14+
//
15+
// 3. Neither the name of the copyright holder nor the names of its
16+
// contributors may be used to endorse or promote products derived from this
17+
// software without specific prior written permission.
18+
//
19+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22+
// ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24+
// CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27+
// CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE)
28+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29+
// POSSIBILITY OF SUCH DAMAGE
30+
//

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# i30Flt #
2+
3+
@jonasLyk reported a REALLY interesting corruption error reported by NTFS:
4+
5+
https://twitter.com/jonasLyk/status/1347900440000811010
6+
7+
Triggering the notification only requires that you visit a particular path on an NTFS volume.
8+
9+
Our research indicates that the “file corrupt” error bubbles up from a network query open, so it’s sufficient to just call GetFileAttributes to see the behavior.
10+
We think the bug is in all the changes around case sensitivity...There’s a memory compare of “$i30” with “$I30” before the descent into chaos. Also if you use “$I30”
11+
in the offending command you don’t get the problem.
12+
13+
The directory is not really corrupt at this point and the volume is not immediately corrupted by this change. The result is ugly though, so we though we'd mitigate the
14+
problem while we wait for the real fix to arrive.
15+
16+
This filter blocks any attempts to open a stream that begins with ":$i30:". This blocks more than just the intended path (e.g. ":$i30:$index_allocation") but we believe
17+
the mpact of this to be minimal.
18+
19+
# Building the sample #
20+
The provided solution builds using the 2004 WDK.
21+
22+
# Installing the sample #
23+
You can install the filter with the following command line:
24+
25+
RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultInstall 132 i30flt.inf
26+
27+
You'll also need to import the manifest in order to decode the events sent to the event log:
28+
29+
wevtuil im i30flt.man
30+
31+
The filter will automatically load and do its thing on subsequent reboots. To uninstall the filter execute the following:
32+
33+
34+
RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection DefaultUninstall 132 i30flt.inf

Src/OsrSuppress.h

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
//
2+
// Copyright 2021 OSR Open Systems Resources, Inc.
3+
// All rights reserved.
4+
//
5+
// Redistribution and use in source and binary forms, with or without
6+
// modification, are permitted provided that the following conditions are met:
7+
//
8+
// 1. Redistributions of source code must retain the above copyright notice,
9+
// this list of conditions and the following disclaimer.
10+
//
11+
// 2. Redistributions in binary form must reproduce the above copyright notice,
12+
// this list of conditions and the following disclaimer in the documentation
13+
// and/or other materials provided with the distribution.
14+
//
15+
// 3. Neither the name of the copyright holder nor the names of its
16+
// contributors may be used to endorse or promote products derived from this
17+
// software without specific prior written permission.
18+
//
19+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22+
// ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24+
// CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27+
// CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE)
28+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29+
// POSSIBILITY OF SUCH DAMAGE
30+
//
31+
#pragma once
32+
33+
///////////////////////////
34+
// W4 Warnings //
35+
///////////////////////////
36+
37+
//
38+
// The following are C/C++ compiler warnings at W4 that we suppress globally
39+
//
40+
41+
#pragma warning(disable: 4201) // don't use nameless struct/union
42+
43+
44+
//////////////////////////////////////
45+
// Code Analysis Warnings //
46+
//////////////////////////////////////
47+
48+
//
49+
// The following are Code Analysis warnings that we suppress globally. This
50+
// allows us to use the "All Rules" ruleset and get everything possible while
51+
// ignoring things that don't make sense for this solution
52+
//
53+
54+
//
55+
// GSL Warnings
56+
//
57+
#pragma warning(disable: 26429) // Symbol can be marked not_null
58+
#pragma warning(disable: 26438) // Avoid goto
59+
#pragma warning(disable: 26440) // Function can be declared noexcept
60+
#pragma warning(disable: 26446) // Prefer gsl::at()
61+
#pragma warning(disable: 26448) // Consider using gsl::finally
62+
#pragma warning(disable: 26476) // Use variant instead of naked union
63+
#pragma warning(disable: 26477) // Use nullptr rather than NULL
64+
#pragma warning(disable: 26481) // Don't use pointer arithmetic
65+
#pragma warning(disable: 26482) // Only index using constant expressions
66+
#pragma warning(disable: 26485) // No array to pointer decay
67+
#pragma warning(disable: 26486) // Don't pass a pointer that may be invalid
68+
#pragma warning(disable: 26487) // Don't return a pointer that may be invalid
69+
#pragma warning(disable: 26489) // Don't deref a pointer that may be invalid
70+
#pragma warning(disable: 26493) // Don't use C-style casts
71+
#pragma warning(disable: 26494) // Always initialize an object
72+
73+
//
74+
// Native Code Warnings
75+
//
76+
// Note that we'll suppress any, "you're using executable memory" warnings that
77+
// pop up. This would be bad if we didn't also set POOL_NX_OPTIN_XXX
78+
//
79+
#if (!defined(POOL_NX_OPTIN) && !defined(POOL_NX_OPTIN_AUTO))
80+
#error "Must opt in to NX pool!"
81+
#endif
82+
83+
#pragma warning(disable: 6320) // Don't use EXCEPTION_EXECUTE_HANDLER
84+
#pragma warning(disable: 28159) // Use error logging instead of KeBugCheckEx
85+
#pragma warning(disable: 28160) // Must succeed pool allocations are forbidden
86+
#pragma warning(disable: 30030) // Must use MdlMappingNoExecute

0 commit comments

Comments
 (0)