kernelci.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] selftests/lkdtm: add config and turn off CFI_FORWARD_PROTO
@ 2022-02-17 20:56 Usama
  2022-02-17 20:56 ` [PATCH 2/2] selftests/lkdtm: add config Usama
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Usama @ 2022-02-17 20:56 UTC (permalink / raw)
  To: Kees Cook, Shuah Khan
  Cc: Muhammad Usama Anjum, kernel, kernelci, Greg Kroah-Hartman,
	Shuah Khan, linux-kselftest, linux-kernel

Add config options which are needed for LKDTM sub-tests.
STACKLEAK_ERASING test needs GCC_PLUGIN_STACKLEAK config.
READ_AFTER_FREE and READ_BUDDY_AFTER_FREE tests need
INIT_ON_FREE_DEFAULT_ON config.

CFI_FORWARD_PROTO always fails as there is no active CFI system of some
kind. Turn it off for now by default until proper support.

Cc: Kees Cook <keescook@chromium.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixes: 46d1a0f03d66 ("selftests/lkdtm: Add tests for LKDTM targets")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
 tools/testing/selftests/lkdtm/config    | 2 ++
 tools/testing/selftests/lkdtm/tests.txt | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/lkdtm/config b/tools/testing/selftests/lkdtm/config
index 46f39ee762086..adc9fa60057c5 100644
--- a/tools/testing/selftests/lkdtm/config
+++ b/tools/testing/selftests/lkdtm/config
@@ -2,8 +2,10 @@ CONFIG_LKDTM=y
 CONFIG_DEBUG_LIST=y
 CONFIG_SLAB_FREELIST_HARDENED=y
 CONFIG_FORTIFY_SOURCE=y
+CONFIG_GCC_PLUGIN_STACKLEAK=y
 CONFIG_HARDENED_USERCOPY=y
 CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT=y
+CONFIG_INIT_ON_FREE_DEFAULT_ON=y
 CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
 CONFIG_UBSAN=y
 CONFIG_UBSAN_BOUNDS=y
diff --git a/tools/testing/selftests/lkdtm/tests.txt b/tools/testing/selftests/lkdtm/tests.txt
index 6b36b7f5dcf96..aa947b0ce1eeb 100644
--- a/tools/testing/selftests/lkdtm/tests.txt
+++ b/tools/testing/selftests/lkdtm/tests.txt
@@ -72,7 +72,7 @@ USERCOPY_STACK_FRAME_FROM
 USERCOPY_STACK_BEYOND
 USERCOPY_KERNEL
 STACKLEAK_ERASING OK: the rest of the thread stack is properly erased
-CFI_FORWARD_PROTO
+#CFI_FORWARD_PROTO
 FORTIFIED_STRSCPY
 FORTIFIED_OBJECT
 FORTIFIED_SUBOBJECT
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/2] selftests/lkdtm: add config
  2022-02-17 20:56 [PATCH 1/2] selftests/lkdtm: add config and turn off CFI_FORWARD_PROTO Usama
@ 2022-02-17 20:56 ` Usama
  2022-02-18 15:32   ` Usama
  2022-03-09 19:23   ` Kees Cook
  2022-02-18 15:31 ` [PATCH 1/2] selftests/lkdtm: add config and turn off CFI_FORWARD_PROTO Usama
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 15+ messages in thread
From: Usama @ 2022-02-17 20:56 UTC (permalink / raw)
  To: Kees Cook, Shuah Khan, Greg Kroah-Hartman
  Cc: Muhammad Usama Anjum, kernel, kernelci, linux-kselftest, linux-kernel

Add config option which is needed for SLAB_LINEAR_OVERFLOW test. It
needs KASAN enabled.

Cc: Kees Cook <keescook@chromium.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixes: 9c4f6ebc3665 ("lkdtm/heap: Add vmalloc linear overflow test")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
 tools/testing/selftests/lkdtm/config | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/lkdtm/config b/tools/testing/selftests/lkdtm/config
index adc9fa60057c5..4e8af0f712f74 100644
--- a/tools/testing/selftests/lkdtm/config
+++ b/tools/testing/selftests/lkdtm/config
@@ -7,6 +7,7 @@ CONFIG_HARDENED_USERCOPY=y
 CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT=y
 CONFIG_INIT_ON_FREE_DEFAULT_ON=y
 CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
+CONFIG_KASAN=y
 CONFIG_UBSAN=y
 CONFIG_UBSAN_BOUNDS=y
 CONFIG_UBSAN_TRAP=y
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] selftests/lkdtm: add config and turn off CFI_FORWARD_PROTO
  2022-02-17 20:56 [PATCH 1/2] selftests/lkdtm: add config and turn off CFI_FORWARD_PROTO Usama
  2022-02-17 20:56 ` [PATCH 2/2] selftests/lkdtm: add config Usama
@ 2022-02-18 15:31 ` Usama
  2022-02-28  7:06 ` Usama
  2022-03-09 19:22 ` Kees Cook
  3 siblings, 0 replies; 15+ messages in thread
From: Usama @ 2022-02-18 15:31 UTC (permalink / raw)
  To: Kees Cook, Shuah Khan
  Cc: usama.anjum, kernel, kernelci, Greg Kroah-Hartman, Shuah Khan,
	linux-kselftest, linux-kernel

On 2/18/22 1:56 AM, Muhammad Usama Anjum wrote:
> Add config options which are needed for LKDTM sub-tests.
> STACKLEAK_ERASING test needs GCC_PLUGIN_STACKLEAK config.
> READ_AFTER_FREE and READ_BUDDY_AFTER_FREE tests need
> INIT_ON_FREE_DEFAULT_ON config.
> 
> CFI_FORWARD_PROTO always fails as there is no active CFI system of some
> kind. Turn it off for now by default until proper support.
> 
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Fixes: 46d1a0f03d66 ("selftests/lkdtm: Add tests for LKDTM targets")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Reported-by: "kernelci.org bot" <bot@kernelci.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] selftests/lkdtm: add config
  2022-02-17 20:56 ` [PATCH 2/2] selftests/lkdtm: add config Usama
@ 2022-02-18 15:32   ` Usama
  2022-03-09 19:23   ` Kees Cook
  1 sibling, 0 replies; 15+ messages in thread
From: Usama @ 2022-02-18 15:32 UTC (permalink / raw)
  To: Kees Cook, Shuah Khan, Greg Kroah-Hartman
  Cc: usama.anjum, kernel, kernelci, linux-kselftest, linux-kernel

On 2/18/22 1:56 AM, Muhammad Usama Anjum wrote:
> Add config option which is needed for SLAB_LINEAR_OVERFLOW test. It
> needs KASAN enabled.
> 
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Fixes: 9c4f6ebc3665 ("lkdtm/heap: Add vmalloc linear overflow test")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Reported-by: "kernelci.org bot" <bot@kernelci.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] selftests/lkdtm: add config and turn off CFI_FORWARD_PROTO
  2022-02-17 20:56 [PATCH 1/2] selftests/lkdtm: add config and turn off CFI_FORWARD_PROTO Usama
  2022-02-17 20:56 ` [PATCH 2/2] selftests/lkdtm: add config Usama
  2022-02-18 15:31 ` [PATCH 1/2] selftests/lkdtm: add config and turn off CFI_FORWARD_PROTO Usama
@ 2022-02-28  7:06 ` Usama
  2022-03-08 11:17   ` Usama
  2022-03-09 19:22 ` Kees Cook
  3 siblings, 1 reply; 15+ messages in thread
From: Usama @ 2022-02-28  7:06 UTC (permalink / raw)
  To: Kees Cook, Shuah Khan
  Cc: usama.anjum, kernel, kernelci, Greg Kroah-Hartman, Shuah Khan,
	linux-kselftest, linux-kernel

Hi,

Any thoughts?

On 2/18/22 1:56 AM, Muhammad Usama Anjum wrote:
> Add config options which are needed for LKDTM sub-tests.
> STACKLEAK_ERASING test needs GCC_PLUGIN_STACKLEAK config.
> READ_AFTER_FREE and READ_BUDDY_AFTER_FREE tests need
> INIT_ON_FREE_DEFAULT_ON config.
> 
> CFI_FORWARD_PROTO always fails as there is no active CFI system of some
> kind. Turn it off for now by default until proper support.
> 
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Fixes: 46d1a0f03d66 ("selftests/lkdtm: Add tests for LKDTM targets")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
>  tools/testing/selftests/lkdtm/config    | 2 ++
>  tools/testing/selftests/lkdtm/tests.txt | 2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/lkdtm/config b/tools/testing/selftests/lkdtm/config
> index 46f39ee762086..adc9fa60057c5 100644
> --- a/tools/testing/selftests/lkdtm/config
> +++ b/tools/testing/selftests/lkdtm/config
> @@ -2,8 +2,10 @@ CONFIG_LKDTM=y
>  CONFIG_DEBUG_LIST=y
>  CONFIG_SLAB_FREELIST_HARDENED=y
>  CONFIG_FORTIFY_SOURCE=y
> +CONFIG_GCC_PLUGIN_STACKLEAK=y
>  CONFIG_HARDENED_USERCOPY=y
>  CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT=y
> +CONFIG_INIT_ON_FREE_DEFAULT_ON=y
>  CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
>  CONFIG_UBSAN=y
>  CONFIG_UBSAN_BOUNDS=y
> diff --git a/tools/testing/selftests/lkdtm/tests.txt b/tools/testing/selftests/lkdtm/tests.txt
> index 6b36b7f5dcf96..aa947b0ce1eeb 100644
> --- a/tools/testing/selftests/lkdtm/tests.txt
> +++ b/tools/testing/selftests/lkdtm/tests.txt
> @@ -72,7 +72,7 @@ USERCOPY_STACK_FRAME_FROM
>  USERCOPY_STACK_BEYOND
>  USERCOPY_KERNEL
>  STACKLEAK_ERASING OK: the rest of the thread stack is properly erased
> -CFI_FORWARD_PROTO
> +#CFI_FORWARD_PROTO
>  FORTIFIED_STRSCPY
>  FORTIFIED_OBJECT
>  FORTIFIED_SUBOBJECT

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] selftests/lkdtm: add config and turn off CFI_FORWARD_PROTO
  2022-02-28  7:06 ` Usama
@ 2022-03-08 11:17   ` Usama
  0 siblings, 0 replies; 15+ messages in thread
From: Usama @ 2022-03-08 11:17 UTC (permalink / raw)
  To: Kees Cook, linux-kselftest
  Cc: usama.anjum, kernel, kernelci, Greg Kroah-Hartman, Shuah Khan,
	linux-kernel, Shuah Khan

Reminder!

On 2/28/22 12:06 PM, Muhammad Usama Anjum wrote:
> Hi,
> 
> Any thoughts?
> 
> On 2/18/22 1:56 AM, Muhammad Usama Anjum wrote:
>> Add config options which are needed for LKDTM sub-tests.
>> STACKLEAK_ERASING test needs GCC_PLUGIN_STACKLEAK config.
>> READ_AFTER_FREE and READ_BUDDY_AFTER_FREE tests need
>> INIT_ON_FREE_DEFAULT_ON config.
>>
>> CFI_FORWARD_PROTO always fails as there is no active CFI system of some
>> kind. Turn it off for now by default until proper support.
>>
>> Cc: Kees Cook <keescook@chromium.org>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> Fixes: 46d1a0f03d66 ("selftests/lkdtm: Add tests for LKDTM targets")
>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>> ---
>>  tools/testing/selftests/lkdtm/config    | 2 ++
>>  tools/testing/selftests/lkdtm/tests.txt | 2 +-
>>  2 files changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/lkdtm/config b/tools/testing/selftests/lkdtm/config
>> index 46f39ee762086..adc9fa60057c5 100644
>> --- a/tools/testing/selftests/lkdtm/config
>> +++ b/tools/testing/selftests/lkdtm/config
>> @@ -2,8 +2,10 @@ CONFIG_LKDTM=y
>>  CONFIG_DEBUG_LIST=y
>>  CONFIG_SLAB_FREELIST_HARDENED=y
>>  CONFIG_FORTIFY_SOURCE=y
>> +CONFIG_GCC_PLUGIN_STACKLEAK=y
>>  CONFIG_HARDENED_USERCOPY=y
>>  CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT=y
>> +CONFIG_INIT_ON_FREE_DEFAULT_ON=y
>>  CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
>>  CONFIG_UBSAN=y
>>  CONFIG_UBSAN_BOUNDS=y
>> diff --git a/tools/testing/selftests/lkdtm/tests.txt b/tools/testing/selftests/lkdtm/tests.txt
>> index 6b36b7f5dcf96..aa947b0ce1eeb 100644
>> --- a/tools/testing/selftests/lkdtm/tests.txt
>> +++ b/tools/testing/selftests/lkdtm/tests.txt
>> @@ -72,7 +72,7 @@ USERCOPY_STACK_FRAME_FROM
>>  USERCOPY_STACK_BEYOND
>>  USERCOPY_KERNEL
>>  STACKLEAK_ERASING OK: the rest of the thread stack is properly erased
>> -CFI_FORWARD_PROTO
>> +#CFI_FORWARD_PROTO
>>  FORTIFIED_STRSCPY
>>  FORTIFIED_OBJECT
>>  FORTIFIED_SUBOBJECT

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] selftests/lkdtm: add config and turn off CFI_FORWARD_PROTO
  2022-02-17 20:56 [PATCH 1/2] selftests/lkdtm: add config and turn off CFI_FORWARD_PROTO Usama
                   ` (2 preceding siblings ...)
  2022-02-28  7:06 ` Usama
@ 2022-03-09 19:22 ` Kees Cook
  2022-03-10 17:21   ` Usama
  3 siblings, 1 reply; 15+ messages in thread
From: Kees Cook @ 2022-03-09 19:22 UTC (permalink / raw)
  To: Muhammad Usama Anjum
  Cc: Shuah Khan, kernel, kernelci, Greg Kroah-Hartman, Shuah Khan,
	linux-kselftest, linux-kernel

On Fri, Feb 18, 2022 at 01:56:19AM +0500, Muhammad Usama Anjum wrote:
> Add config options which are needed for LKDTM sub-tests.
> STACKLEAK_ERASING test needs GCC_PLUGIN_STACKLEAK config.
> READ_AFTER_FREE and READ_BUDDY_AFTER_FREE tests need
> INIT_ON_FREE_DEFAULT_ON config.
> 
> CFI_FORWARD_PROTO always fails as there is no active CFI system of some
> kind. Turn it off for now by default until proper support.

Building under LTO Clang on arm64, this is available. What's the right
way to add a CONFIG that isn't always available?

-Kees

> 
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Fixes: 46d1a0f03d66 ("selftests/lkdtm: Add tests for LKDTM targets")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
>  tools/testing/selftests/lkdtm/config    | 2 ++
>  tools/testing/selftests/lkdtm/tests.txt | 2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/lkdtm/config b/tools/testing/selftests/lkdtm/config
> index 46f39ee762086..adc9fa60057c5 100644
> --- a/tools/testing/selftests/lkdtm/config
> +++ b/tools/testing/selftests/lkdtm/config
> @@ -2,8 +2,10 @@ CONFIG_LKDTM=y
>  CONFIG_DEBUG_LIST=y
>  CONFIG_SLAB_FREELIST_HARDENED=y
>  CONFIG_FORTIFY_SOURCE=y
> +CONFIG_GCC_PLUGIN_STACKLEAK=y
>  CONFIG_HARDENED_USERCOPY=y
>  CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT=y
> +CONFIG_INIT_ON_FREE_DEFAULT_ON=y
>  CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
>  CONFIG_UBSAN=y
>  CONFIG_UBSAN_BOUNDS=y
> diff --git a/tools/testing/selftests/lkdtm/tests.txt b/tools/testing/selftests/lkdtm/tests.txt
> index 6b36b7f5dcf96..aa947b0ce1eeb 100644
> --- a/tools/testing/selftests/lkdtm/tests.txt
> +++ b/tools/testing/selftests/lkdtm/tests.txt
> @@ -72,7 +72,7 @@ USERCOPY_STACK_FRAME_FROM
>  USERCOPY_STACK_BEYOND
>  USERCOPY_KERNEL
>  STACKLEAK_ERASING OK: the rest of the thread stack is properly erased
> -CFI_FORWARD_PROTO
> +#CFI_FORWARD_PROTO
>  FORTIFIED_STRSCPY
>  FORTIFIED_OBJECT
>  FORTIFIED_SUBOBJECT
> -- 
> 2.30.2
> 

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] selftests/lkdtm: add config
  2022-02-17 20:56 ` [PATCH 2/2] selftests/lkdtm: add config Usama
  2022-02-18 15:32   ` Usama
@ 2022-03-09 19:23   ` Kees Cook
  2022-03-10 17:22     ` Usama
  1 sibling, 1 reply; 15+ messages in thread
From: Kees Cook @ 2022-03-09 19:23 UTC (permalink / raw)
  To: Muhammad Usama Anjum
  Cc: Shuah Khan, Greg Kroah-Hartman, kernel, kernelci,
	linux-kselftest, linux-kernel

On Fri, Feb 18, 2022 at 01:56:20AM +0500, Muhammad Usama Anjum wrote:
> Add config option which is needed for SLAB_LINEAR_OVERFLOW test. It
> needs KASAN enabled.

I'd prefer this use the SLAB_DEBUG options -- KASAN is very heavy.

-Kees

> 
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Fixes: 9c4f6ebc3665 ("lkdtm/heap: Add vmalloc linear overflow test")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
>  tools/testing/selftests/lkdtm/config | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/lkdtm/config b/tools/testing/selftests/lkdtm/config
> index adc9fa60057c5..4e8af0f712f74 100644
> --- a/tools/testing/selftests/lkdtm/config
> +++ b/tools/testing/selftests/lkdtm/config
> @@ -7,6 +7,7 @@ CONFIG_HARDENED_USERCOPY=y
>  CONFIG_RANDOMIZE_KSTACK_OFFSET_DEFAULT=y
>  CONFIG_INIT_ON_FREE_DEFAULT_ON=y
>  CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
> +CONFIG_KASAN=y
>  CONFIG_UBSAN=y
>  CONFIG_UBSAN_BOUNDS=y
>  CONFIG_UBSAN_TRAP=y
> -- 
> 2.30.2
> 

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] selftests/lkdtm: add config and turn off CFI_FORWARD_PROTO
  2022-03-09 19:22 ` Kees Cook
@ 2022-03-10 17:21   ` Usama
  2022-04-14 11:31     ` Usama
  0 siblings, 1 reply; 15+ messages in thread
From: Usama @ 2022-03-10 17:21 UTC (permalink / raw)
  To: Kees Cook
  Cc: usama.anjum, Shuah Khan, kernel, kernelci, Greg Kroah-Hartman,
	Shuah Khan, linux-kselftest, linux-kernel

On 3/10/22 12:22 AM, Kees Cook wrote:
> On Fri, Feb 18, 2022 at 01:56:19AM +0500, Muhammad Usama Anjum wrote:
>> Add config options which are needed for LKDTM sub-tests.
>> STACKLEAK_ERASING test needs GCC_PLUGIN_STACKLEAK config.
>> READ_AFTER_FREE and READ_BUDDY_AFTER_FREE tests need
>> INIT_ON_FREE_DEFAULT_ON config.
>>
>> CFI_FORWARD_PROTO always fails as there is no active CFI system of some
>> kind. Turn it off for now by default until proper support.
> 
> Building under LTO Clang on arm64, this is available. What's the right
> way to add a CONFIG that isn't always available?
> 
> -Kees
Yeah, as you had mentioned
(https://github.com/kernelci/kernelci-project/issues/84#issuecomment-1042015431):

CFI_FORWARD_PROTO is going to fail unless there is an active CFI system
in place of some kind. Right now this depends on arm64+Clang. In the
future, this will be arch-agnostic+Clang, but for the moment, it should
be safe to exclude this test.

In this patch, I'm turning off CFI_FORWARD_PROTO by default here. We can
re-enable it when it becomes arch agnostic. CFI_FORWARD_PROTO cannot be
turned off by using a config. Please let me know your thoughts otherwise.

-- 
Muhammad Usama Anjum

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] selftests/lkdtm: add config
  2022-03-09 19:23   ` Kees Cook
@ 2022-03-10 17:22     ` Usama
  2022-03-15 11:55       ` Usama
  0 siblings, 1 reply; 15+ messages in thread
From: Usama @ 2022-03-10 17:22 UTC (permalink / raw)
  To: Kees Cook
  Cc: usama.anjum, Shuah Khan, Greg Kroah-Hartman, kernel, kernelci,
	linux-kselftest, linux-kernel

On 3/10/22 12:23 AM, Kees Cook wrote:
> On Fri, Feb 18, 2022 at 01:56:20AM +0500, Muhammad Usama Anjum wrote:
>> Add config option which is needed for SLAB_LINEAR_OVERFLOW test. It
>> needs KASAN enabled.
> 
> I'd prefer this use the SLAB_DEBUG options -- KASAN is very heavy.
I'll test it out and update in the next patch version.

-- 
Muhammad Usama Anjum

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] selftests/lkdtm: add config
  2022-03-10 17:22     ` Usama
@ 2022-03-15 11:55       ` Usama
  2022-04-04  7:50         ` Usama
  0 siblings, 1 reply; 15+ messages in thread
From: Usama @ 2022-03-15 11:55 UTC (permalink / raw)
  To: Kees Cook
  Cc: usama.anjum, Shuah Khan, Greg Kroah-Hartman, kernel, kernelci,
	linux-kselftest, linux-kernel

On 3/10/22 10:22 PM, Muhammad Usama Anjum wrote:
> On 3/10/22 12:23 AM, Kees Cook wrote:
>> On Fri, Feb 18, 2022 at 01:56:20AM +0500, Muhammad Usama Anjum wrote:
>>> Add config option which is needed for SLAB_LINEAR_OVERFLOW test. It
>>> needs KASAN enabled.
>>
>> I'd prefer this use the SLAB_DEBUG options -- KASAN is very heavy.
> I'll test it out and update in the next patch version.
> I've tested by removing KASAN and adding the following config:
CONFIG_SLAB=y
CONFIG_DEBUG_SLAB=y

The result of SLAB_LINEAR_OVERFLOW test doesn't remain deterministic in
this config. The task never crashes and hence stack trace never appears.
When executed several times we get "Slab corruption" logs and after some
more tries whole kernel crashes. I've not used DEBUG_SLAB before and not
sure if this is the expected behavior. If we aren't sure, we can keep
KASAN turned on instead.

-- 
Muhammad Usama Anjum

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] selftests/lkdtm: add config
  2022-03-15 11:55       ` Usama
@ 2022-04-04  7:50         ` Usama
  2022-04-16 21:13           ` Kees Cook
  0 siblings, 1 reply; 15+ messages in thread
From: Usama @ 2022-04-04  7:50 UTC (permalink / raw)
  To: Kees Cook
  Cc: usama.anjum, Shuah Khan, Greg Kroah-Hartman, kernel, kernelci,
	linux-kselftest, linux-kernel

Hi Kees,

Any thoughts?

On 3/15/22 4:55 PM, Muhammad Usama Anjum wrote:
> On 3/10/22 10:22 PM, Muhammad Usama Anjum wrote:
>> On 3/10/22 12:23 AM, Kees Cook wrote:
>>> On Fri, Feb 18, 2022 at 01:56:20AM +0500, Muhammad Usama Anjum wrote:
>>>> Add config option which is needed for SLAB_LINEAR_OVERFLOW test. It
>>>> needs KASAN enabled.
>>>
>>> I'd prefer this use the SLAB_DEBUG options -- KASAN is very heavy.
>> I'll test it out and update in the next patch version.
>> I've tested by removing KASAN and adding the following config:
> CONFIG_SLAB=y
> CONFIG_DEBUG_SLAB=y
> 
> The result of SLAB_LINEAR_OVERFLOW test doesn't remain deterministic in
> this config. The task never crashes and hence stack trace never appears.
> When executed several times we get "Slab corruption" logs and after some
> more tries whole kernel crashes. I've not used DEBUG_SLAB before and not
> sure if this is the expected behavior. If we aren't sure, we can keep
> KASAN turned on instead.
> 

-- 
Muhammad Usama Anjum

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] selftests/lkdtm: add config and turn off CFI_FORWARD_PROTO
  2022-03-10 17:21   ` Usama
@ 2022-04-14 11:31     ` Usama
  2022-04-16 21:06       ` Kees Cook
  0 siblings, 1 reply; 15+ messages in thread
From: Usama @ 2022-04-14 11:31 UTC (permalink / raw)
  To: Kees Cook, Shuah Khan, linux-kselftest
  Cc: usama.anjum, kernel, kernelci, Greg Kroah-Hartman, Shuah Khan,
	linux-kernel

Any thoughts?

On 3/10/22 10:21 PM, Muhammad Usama Anjum wrote:
> On 3/10/22 12:22 AM, Kees Cook wrote:
>> On Fri, Feb 18, 2022 at 01:56:19AM +0500, Muhammad Usama Anjum wrote:
>>> Add config options which are needed for LKDTM sub-tests.
>>> STACKLEAK_ERASING test needs GCC_PLUGIN_STACKLEAK config.
>>> READ_AFTER_FREE and READ_BUDDY_AFTER_FREE tests need
>>> INIT_ON_FREE_DEFAULT_ON config.
>>>
>>> CFI_FORWARD_PROTO always fails as there is no active CFI system of some
>>> kind. Turn it off for now by default until proper support.
>>
>> Building under LTO Clang on arm64, this is available. What's the right
>> way to add a CONFIG that isn't always available?
>>
>> -Kees
> Yeah, as you had mentioned
> (https://github.com/kernelci/kernelci-project/issues/84#issuecomment-1042015431):
> 
> CFI_FORWARD_PROTO is going to fail unless there is an active CFI system
> in place of some kind. Right now this depends on arm64+Clang. In the
> future, this will be arch-agnostic+Clang, but for the moment, it should
> be safe to exclude this test.
> 
> In this patch, I'm turning off CFI_FORWARD_PROTO by default here. We can
> re-enable it when it becomes arch agnostic. CFI_FORWARD_PROTO cannot be
> turned off by using a config. Please let me know your thoughts otherwise.
> 

-- 
Muhammad Usama Anjum

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/2] selftests/lkdtm: add config and turn off CFI_FORWARD_PROTO
  2022-04-14 11:31     ` Usama
@ 2022-04-16 21:06       ` Kees Cook
  0 siblings, 0 replies; 15+ messages in thread
From: Kees Cook @ 2022-04-16 21:06 UTC (permalink / raw)
  To: Muhammad Usama Anjum
  Cc: Shuah Khan, linux-kselftest, kernel, kernelci,
	Greg Kroah-Hartman, Shuah Khan, linux-kernel

On Thu, Apr 14, 2022 at 04:31:42PM +0500, Muhammad Usama Anjum wrote:
> Any thoughts?
> 
> On 3/10/22 10:21 PM, Muhammad Usama Anjum wrote:
> > On 3/10/22 12:22 AM, Kees Cook wrote:
> >> On Fri, Feb 18, 2022 at 01:56:19AM +0500, Muhammad Usama Anjum wrote:
> >>> Add config options which are needed for LKDTM sub-tests.
> >>> STACKLEAK_ERASING test needs GCC_PLUGIN_STACKLEAK config.
> >>> READ_AFTER_FREE and READ_BUDDY_AFTER_FREE tests need
> >>> INIT_ON_FREE_DEFAULT_ON config.
> >>>
> >>> CFI_FORWARD_PROTO always fails as there is no active CFI system of some
> >>> kind. Turn it off for now by default until proper support.
> >>
> >> Building under LTO Clang on arm64, this is available. What's the right
> >> way to add a CONFIG that isn't always available?
> >>
> >> -Kees
> > Yeah, as you had mentioned
> > (https://github.com/kernelci/kernelci-project/issues/84#issuecomment-1042015431):
> > 
> > CFI_FORWARD_PROTO is going to fail unless there is an active CFI system
> > in place of some kind. Right now this depends on arm64+Clang. In the
> > future, this will be arch-agnostic+Clang, but for the moment, it should
> > be safe to exclude this test.
> > 
> > In this patch, I'm turning off CFI_FORWARD_PROTO by default here. We can
> > re-enable it when it becomes arch agnostic. CFI_FORWARD_PROTO cannot be
> > turned off by using a config. Please let me know your thoughts otherwise.

I don't like the idea of disabling the test because this means it won't
have any output in CI systems to examine at all. I'd much rather have
tests that are expecting to fail to report XFAIL from the kernel
instead. (See things like lkdtm_UNSET_SMEP.)

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 2/2] selftests/lkdtm: add config
  2022-04-04  7:50         ` Usama
@ 2022-04-16 21:13           ` Kees Cook
  0 siblings, 0 replies; 15+ messages in thread
From: Kees Cook @ 2022-04-16 21:13 UTC (permalink / raw)
  To: Muhammad Usama Anjum
  Cc: Shuah Khan, Greg Kroah-Hartman, kernel, kernelci,
	linux-kselftest, linux-kernel

On Mon, Apr 04, 2022 at 12:50:01PM +0500, Muhammad Usama Anjum wrote:
> Hi Kees,
> 
> Any thoughts?
> 
> On 3/15/22 4:55 PM, Muhammad Usama Anjum wrote:
> > On 3/10/22 10:22 PM, Muhammad Usama Anjum wrote:
> >> On 3/10/22 12:23 AM, Kees Cook wrote:
> >>> On Fri, Feb 18, 2022 at 01:56:20AM +0500, Muhammad Usama Anjum wrote:
> >>>> Add config option which is needed for SLAB_LINEAR_OVERFLOW test. It
> >>>> needs KASAN enabled.
> >>>
> >>> I'd prefer this use the SLAB_DEBUG options -- KASAN is very heavy.
> >> I'll test it out and update in the next patch version.
> >> I've tested by removing KASAN and adding the following config:
> > CONFIG_SLAB=y
> > CONFIG_DEBUG_SLAB=y

I recommend slub instead:

CONFIG_SLUB=y
CONFIG_SLUB_DEBUG=y

and one more, see below...

> > 
> > The result of SLAB_LINEAR_OVERFLOW test doesn't remain deterministic in
> > this config. The task never crashes and hence stack trace never appears.
> > When executed several times we get "Slab corruption" logs and after some
> > more tries whole kernel crashes. I've not used DEBUG_SLAB before and not
> > sure if this is the expected behavior. If we aren't sure, we can keep
> > KASAN turned on instead.

I think you need to enable the actual kmem debugging with a boot param
("slub_debug=ZF"), or with CONFIG_SLUB_DEBUG_ON=y.

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-04-16 21:13 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-17 20:56 [PATCH 1/2] selftests/lkdtm: add config and turn off CFI_FORWARD_PROTO Usama
2022-02-17 20:56 ` [PATCH 2/2] selftests/lkdtm: add config Usama
2022-02-18 15:32   ` Usama
2022-03-09 19:23   ` Kees Cook
2022-03-10 17:22     ` Usama
2022-03-15 11:55       ` Usama
2022-04-04  7:50         ` Usama
2022-04-16 21:13           ` Kees Cook
2022-02-18 15:31 ` [PATCH 1/2] selftests/lkdtm: add config and turn off CFI_FORWARD_PROTO Usama
2022-02-28  7:06 ` Usama
2022-03-08 11:17   ` Usama
2022-03-09 19:22 ` Kees Cook
2022-03-10 17:21   ` Usama
2022-04-14 11:31     ` Usama
2022-04-16 21:06       ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).