<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/misc/lkdtm/bugs.c, branch linux-5.12.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.12.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.12.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-07-19T08:01:22Z</updated>
<entry>
<title>lkdtm/bugs: XFAIL UNALIGNED_LOAD_STORE_WRITE</title>
<updated>2021-07-19T08:01:22Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2021-06-23T20:39:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4821ae11969b7605154b56a354a3dd3557c0ea34'/>
<id>urn:sha1:4821ae11969b7605154b56a354a3dd3557c0ea34</id>
<content type='text'>
commit a15676ac8f24a9ac5fd881cf17be4be13fa0910a upstream.

When built under CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS, this test is
expected to fail (i.e. not trip an exception).

Fixes: 46d1a0f03d66 ("selftests/lkdtm: Add tests for LKDTM targets")
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20210623203936.3151093-5-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>lkdtm: tests for FORTIFY_SOURCE</title>
<updated>2020-12-16T06:46:16Z</updated>
<author>
<name>Daniel Axtens</name>
</author>
<published>2020-12-16T04:43:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d96938daae2a2ae20e5d3d38ddb85d8afdaee628'/>
<id>urn:sha1:d96938daae2a2ae20e5d3d38ddb85d8afdaee628</id>
<content type='text'>
Add code to test both:

 - runtime detection of the overrun of a structure. This covers the
   __builtin_object_size(x, 0) case. This test is called FORTIFY_OBJECT.

 - runtime detection of the overrun of a char array within a structure.
   This covers the __builtin_object_size(x, 1) case which can be used
   for some string functions. This test is called FORTIFY_SUBOBJECT.

Link: https://lkml.kernel.org/r/20201122162451.27551-3-laniel_francis@privacyrequired.com
Signed-off-by: Daniel Axtens &lt;dja@axtens.net&gt;
Signed-off-by: Francis Laniel &lt;laniel_francis@privacyrequired.com&gt;
Suggested-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Daniel Micay &lt;danielmicay@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>lkdtm: remove set_fs-based tests</title>
<updated>2020-09-09T02:21:34Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2020-09-03T14:22:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c6f7c753f71cccb21d1a7f0c1127ce7804374c5e'/>
<id>urn:sha1:c6f7c753f71cccb21d1a7f0c1127ce7804374c5e</id>
<content type='text'>
Once we can't manipulate the address limit, we also can't test what
happens when the manipulation is abused.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>misc: lkdtm: bugs: At least try to use popuated variable</title>
<updated>2020-06-29T16:45:52Z</updated>
<author>
<name>Lee Jones</name>
</author>
<published>2020-06-26T13:05:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f049c545465de225d0ceb036b2dd08c5cfd31344'/>
<id>urn:sha1:f049c545465de225d0ceb036b2dd08c5cfd31344</id>
<content type='text'>
The result may not be intereresting, but not using a set variable
is bad form and causes W=1 kernel builds to complain.

Fixes the following W=1 warning(s):

 drivers/misc/lkdtm/bugs.c: In function ‘lkdtm_STACK_GUARD_PAGE_LEADING’:
 drivers/misc/lkdtm/bugs.c:331:25: warning: variable ‘byte’ set but not used [-Wunused-but-set-variable]
 331 | volatile unsigned char byte;
 | ^~~~
 drivers/misc/lkdtm/bugs.c: In function ‘lkdtm_STACK_GUARD_PAGE_TRAILING’:
 drivers/misc/lkdtm/bugs.c:345:25: warning: variable ‘byte’ set but not used [-Wunused-but-set-variable]
 345 | volatile unsigned char byte;
 | ^~~~

Cc: Kees Cook &lt;keescook@chromium.org&gt;
Acked-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Lee Jones &lt;lee.jones@linaro.org&gt;
Link: https://lore.kernel.org/r/20200626130525.389469-5-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>lkdtm: Make arch-specific tests always available</title>
<updated>2020-06-29T16:41:39Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2020-06-25T20:37:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ae56942c14740c2963222efdc36c667ab19555ef'/>
<id>urn:sha1:ae56942c14740c2963222efdc36c667ab19555ef</id>
<content type='text'>
I'd like arch-specific tests to XFAIL when on a mismatched architecture
so that we can more easily compare test coverage across all systems.
Lacking kernel configs or CPU features count as a FAIL, not an XFAIL.

Additionally fixes a build failure under 32-bit UML.

Fixes: b09511c253e5 ("lkdtm: Add a DOUBLE_FAULT crash type on x86")
Fixes: cea23efb4de2 ("lkdtm/bugs: Make double-fault test always available")
Fixes: 6cb6982f42cb ("lkdtm: arm64: test kernel pointer authentication")
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20200625203704.317097-5-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>lkdtm: Avoid more compiler optimizations for bad writes</title>
<updated>2020-06-29T16:41:39Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2020-06-25T20:37:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=464e86b4abadfc490f426954b431e2ec6a9d7bd2'/>
<id>urn:sha1:464e86b4abadfc490f426954b431e2ec6a9d7bd2</id>
<content type='text'>
It seems at least Clang is able to throw away writes it knows are
destined for read-only memory, which makes things like the WRITE_RO test
fail, as the write gets elided. Instead, force the variable to be
volatile, and make similar changes through-out other tests in an effort
to avoid needing to repeat fixing these kinds of problems. Also includes
pr_err() calls in failure paths so that kernel logs are more clear in
the failure case.

Reported-by: Prasad Sodagudi &lt;psodagud@codeaurora.org&gt;
Suggested-by: Sami Tolvanen &lt;samitolvanen@google.com&gt;
Fixes: 9ae113ce5faf ("lkdtm: add tests for additional page permissions")
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20200625203704.317097-2-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>lkdtm: bugs: Fix spelling mistake</title>
<updated>2020-04-23T14:30:09Z</updated>
<author>
<name>Gustavo A. R. Silva</name>
</author>
<published>2020-04-01T18:28:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c56851576b1809f6523e48c1e5da6e3becfd57cb'/>
<id>urn:sha1:c56851576b1809f6523e48c1e5da6e3becfd57cb</id>
<content type='text'>
Fix spelling mistake s/Intentially/Intentionally

Signed-off-by: Gustavo A. R. Silva &lt;gustavo@embeddedor.com&gt;
Acked-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20200401182855.GA16253@embeddedor
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>drivers/misc/lkdtm/bugs.c: add arithmetic overflow and array bounds checks</title>
<updated>2020-04-07T17:43:44Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2020-04-07T03:12:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ae2e1aad3e48e495878d9f149e437a308bfdaefa'/>
<id>urn:sha1:ae2e1aad3e48e495878d9f149e437a308bfdaefa</id>
<content type='text'>
Adds LKDTM tests for arithmetic overflow (both signed and unsigned), as
well as array bounds checking.

Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Acked-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Cc: Alexander Potapenko &lt;glider@google.com&gt;
Cc: Andrey Konovalov &lt;andreyknvl@google.com&gt;
Cc: Andrey Ryabinin &lt;aryabinin@virtuozzo.com&gt;
Cc: Ard Biesheuvel &lt;ard.biesheuvel@linaro.org&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Cc: Elena Petrova &lt;lenaptr@google.com&gt;
Cc: "Gustavo A. R. Silva" &lt;gustavo@embeddedor.com&gt;
Link: http://lkml.kernel.org/r/20200227193516.32566-4-keescook@chromium.org
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>lkdtm: arm64: test kernel pointer authentication</title>
<updated>2020-03-18T09:50:21Z</updated>
<author>
<name>Amit Daniel Kachhap</name>
</author>
<published>2020-03-13T09:05:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6cb6982f42cbfaf5e50af1069451a8828231ffb9'/>
<id>urn:sha1:6cb6982f42cbfaf5e50af1069451a8828231ffb9</id>
<content type='text'>
This test is specific for arm64. When in-kernel Pointer Authentication
config is enabled, the return address stored in the stack is signed.
This feature helps in ROP kind of attack. If any parameters used to
generate the pac (&lt;key, sp, lr&gt;) is modified then this will fail in
the authentication stage and will lead to abort.

This test changes the input parameter APIA kernel keys to cause abort.
The pac computed from the new key can be same as last due to hash
collision so this is retried for few times as there is no reliable way
to compare the pacs. Even though this test may fail even after retries
but this may cause authentication failure at a later stage in earlier
function returns.

This test can be invoked as,
echo CORRUPT_PAC &gt; /sys/kernel/debug/provoke-crash/DIRECT

or as below if inserted as a module,
insmod lkdtm.ko cpoint_name=DIRECT cpoint_type=CORRUPT_PAC cpoint_count=1

[   13.118166] lkdtm: Performing direct entry CORRUPT_PAC
[   13.118298] lkdtm: Clearing PAC from the return address
[   13.118466] Unable to handle kernel paging request at virtual address bfff8000108648ec
[   13.118626] Mem abort info:
[   13.118666]   ESR = 0x86000004
[   13.118866]   EC = 0x21: IABT (current EL), IL = 32 bits
[   13.118966]   SET = 0, FnV = 0
[   13.119117]   EA = 0, S1PTW = 0

Signed-off-by: Amit Daniel Kachhap &lt;amit.kachhap@arm.com&gt;
Acked-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
</content>
</entry>
<entry>
<title>lkdtm/bugs: fix build error in lkdtm_UNSET_SMEP</title>
<updated>2020-01-14T14:41:04Z</updated>
<author>
<name>Brendan Higgins</name>
</author>
<published>2019-12-13T00:35:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0e31e3573f0cd94d7b821117db854187ffc85765'/>
<id>urn:sha1:0e31e3573f0cd94d7b821117db854187ffc85765</id>
<content type='text'>
When building ARCH=um with CONFIG_UML_X86=y and CONFIG_64BIT=y we get
the build errors:

drivers/misc/lkdtm/bugs.c: In function ‘lkdtm_UNSET_SMEP’:
drivers/misc/lkdtm/bugs.c:288:8: error: implicit declaration of function ‘native_read_cr4’ [-Werror=implicit-function-declaration]
  cr4 = native_read_cr4();
        ^~~~~~~~~~~~~~~
drivers/misc/lkdtm/bugs.c:290:13: error: ‘X86_CR4_SMEP’ undeclared (first use in this function); did you mean ‘X86_FEATURE_SMEP’?
  if ((cr4 &amp; X86_CR4_SMEP) != X86_CR4_SMEP) {
             ^~~~~~~~~~~~
             X86_FEATURE_SMEP
drivers/misc/lkdtm/bugs.c:290:13: note: each undeclared identifier is reported only once for each function it appears in
drivers/misc/lkdtm/bugs.c:297:2: error: implicit declaration of function ‘native_write_cr4’; did you mean ‘direct_write_cr4’? [-Werror=implicit-function-declaration]
  native_write_cr4(cr4);
  ^~~~~~~~~~~~~~~~
  direct_write_cr4

So specify that this block of code should only build when
CONFIG_X86_64=y *AND* CONFIG_UML is unset.

Signed-off-by: Brendan Higgins &lt;brendanhiggins@google.com&gt;
Acked-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20191213003522.66450-1-brendanhiggins@google.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
