Re: Kernel Bug: "KASAN: slab-out-of-bounds Read in jfs_readdir"

2024-12-20 Thread Alexander Potapenko
On Fri, Dec 20, 2024 at 9:07 AM Haichi Wang wrote: > > Dear Linux maintainers and reviewers: > > We are reporting a Linux kernel bug titled **KASAN: slab-out-of-bounds Read > in jfs_readdir**, discovered using a modified version of Syzkaller. > Hello Haichi, Unfortunately right now the bug is n

Re: [PATCH v6 16/39] kmsan: Expose KMSAN_WARN_ON()

2024-06-21 Thread Alexander Potapenko
eoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v6 32/39] s390/ptdump: Add KMSAN page markers

2024-06-21 Thread Alexander Potapenko
On Fri, Jun 21, 2024 at 2:27 AM Ilya Leoshkevich wrote: > > Add KMSAN vmalloc metadata areas to kernel_page_tables. > > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v5 13/37] kmsan: Support SLAB_POISON

2024-06-20 Thread Alexander Potapenko
uninitialized memory and UAF. > > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v5 36/37] s390/kmsan: Implement the architecture-specific functions

2024-06-20 Thread Alexander Potapenko
On Thu, Jun 20, 2024 at 4:18 PM Alexander Potapenko wrote: > > On Thu, Jun 20, 2024 at 3:38 PM Ilya Leoshkevich wrote: > > > > On Thu, 2024-06-20 at 11:25 +0200, Alexander Gordeev wrote: > > > On Wed, Jun 19, 2024 at 05:44:11PM +0200, Ilya Leoshkevich

Re: [PATCH v5 36/37] s390/kmsan: Implement the architecture-specific functions

2024-06-20 Thread Alexander Potapenko
On Thu, Jun 20, 2024 at 3:38 PM Ilya Leoshkevich wrote: > > On Thu, 2024-06-20 at 11:25 +0200, Alexander Gordeev wrote: > > On Wed, Jun 19, 2024 at 05:44:11PM +0200, Ilya Leoshkevich wrote: > > > > Hi Ilya, > > > > > +static inline bool is_lowcore_addr(void *addr) > > > +{ > > > + return addr >=

Re: [PATCH v5 33/37] s390/uaccess: Add KMSAN support to put_user() and get_user()

2024-06-20 Thread Alexander Potapenko
On Thu, Jun 20, 2024 at 1:19 PM Ilya Leoshkevich wrote: > > On Thu, 2024-06-20 at 10:36 +0200, Alexander Potapenko wrote: > > On Wed, Jun 19, 2024 at 5:45 PM Ilya Leoshkevich > > wrote: > > > > > > put_user() uses inline assembly with precise constraints,

Re: [PATCH v5 17/37] mm: slub: Disable KMSAN when checking the padding bytes

2024-06-20 Thread Alexander Potapenko
ess_enable() is to touch poisoned > metadata without triggering KMSAN, is to unpoison its return value. > However, this approach is too fragile. So simply disable the KMSAN > checks in the respective functions. > > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v5 33/37] s390/uaccess: Add KMSAN support to put_user() and get_user()

2024-06-20 Thread Alexander Potapenko
size); > break; > case 4: > - rc = __get_user_asm((unsigned int *)x, > + rc = __get_user_int((unsigned int *)x, > (unsigned int __user *)ptr, > size)

Re: [PATCH v5 34/37] s390/uaccess: Add the missing linux/instrumented.h #include

2024-06-20 Thread Alexander Potapenko
gt; it directly. > > Suggested-by: Alexander Potapenko > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v5 12/37] kmsan: Introduce memset_no_sanitize_memory()

2024-06-20 Thread Alexander Potapenko
On Wed, Jun 19, 2024 at 5:45 PM Ilya Leoshkevich wrote: > > Add a wrapper for memset() that prevents unpoisoning. This is useful > for filling memory allocator redzones. > > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko > --- > include/linux/kmsan.h |

Re: [PATCH v4 35/35] kmsan: Enable on s390

2024-06-18 Thread Alexander Potapenko
On Thu, Jun 13, 2024 at 5:40 PM Ilya Leoshkevich wrote: > > Now that everything else is in place, enable KMSAN in Kconfig. > > Acked-by: Heiko Carstens > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v4 09/35] kmsan: Expose kmsan_get_metadata()

2024-06-18 Thread Alexander Potapenko
s stored in the lowcore_ptr[] array. > > When lowcore is accessed through virtual address 0, one needs to > resolve metadata for lowcore_ptr[raw_smp_processor_id()]. > > Expose kmsan_get_metadata() to make it possible to do this from the > arch code. > > Signed-off-by: I

Re: [PATCH v4 12/35] kmsan: Support SLAB_POISON

2024-06-18 Thread Alexander Potapenko
On Fri, Jun 14, 2024 at 1:44 AM Ilya Leoshkevich wrote: > > On Thu, 2024-06-13 at 16:30 -0700, SeongJae Park wrote: > > Hi Ilya, > > > > On Thu, 13 Jun 2024 17:34:14 +0200 Ilya Leoshkevich > > wrote: > > > > > Avoid false KMSAN negatives with SLUB_DEBUG by allowing > > > kmsan_slab_free() to pois

Re: [PATCH v4 16/35] mm: slub: Unpoison the memchr_inv() return value

2024-06-18 Thread Alexander Potapenko
On Thu, Jun 13, 2024 at 5:39 PM Ilya Leoshkevich wrote: > > Even though the KMSAN warnings generated by memchr_inv() are suppressed > by metadata_access_enable(), its return value may still be poisoned. > > The reason is that the last iteration of memchr_inv() returns > `*start != value ? start :

Re: [PATCH v4 14/35] kmsan: Do not round up pg_data_t size

2024-06-18 Thread Alexander Potapenko
ble memory, in turn > causing virt_to_page_or_null() in kmsan_init_alloc_meta_for_range() to > return NULL, which leads to kernel panic shortly after. > > Since the padding bytes are not used, drop the rounding. Nice catch, thanks! > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v4 15/35] mm: slub: Let KMSAN access metadata

2024-06-18 Thread Alexander Potapenko
isable() functions to KMSAN. > > Acked-by: Vlastimil Babka > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v4 11/35] kmsan: Allow disabling KMSAN checks for the current task

2024-06-18 Thread Alexander Potapenko
n, where possible. > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v4 32/35] s390/uaccess: Add KMSAN support to put_user() and get_user()

2024-06-18 Thread Alexander Potapenko
On Tue, Jun 18, 2024 at 11:40 AM Ilya Leoshkevich wrote: > > On Tue, 2024-06-18 at 11:24 +0200, Alexander Potapenko wrote: > > On Thu, Jun 13, 2024 at 5:39 PM Ilya Leoshkevich > > wrote: > > > > > > put_user() uses inline assembly with precise constraints,

Re: [PATCH v4 26/35] s390/diag: Unpoison diag224() output buffer

2024-06-18 Thread Alexander Potapenko
inter. While at it, prettify them too. > > Suggested-by: Heiko Carstens > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v4 32/35] s390/uaccess: Add KMSAN support to put_user() and get_user()

2024-06-18 Thread Alexander Potapenko
On Thu, Jun 13, 2024 at 5:39 PM Ilya Leoshkevich wrote: > > put_user() uses inline assembly with precise constraints, so Clang is > in principle capable of instrumenting it automatically. Unfortunately, > one of the constraints contains a dereferenced user pointer, and Clang > does not currently d

Re: [syzbot] [virtualization?] KMSAN: uninit-value in virtqueue_add (4)

2024-01-24 Thread Alexander Potapenko
On Thu, Jan 4, 2024 at 9:45 PM Stefan Hajnoczi wrote: > > On Tue, Jan 02, 2024 at 08:03:46AM -0500, Michael S. Tsirkin wrote: > > On Mon, Jan 01, 2024 at 05:38:24AM -0800, syzbot wrote: > > > Hello, > > > > > > syzbot found the following issue on: > > > > > > HEAD commit:fbafc3e621c3 Merge tag

Re: [PATCH v3 17/34] lib/zlib: Unpoison DFLTCC output buffers

2023-12-22 Thread Alexander Potapenko
memory() calls for the output buffers. > The logic is the same as in [1]. > > [1] > https://github.com/zlib-ng/zlib-ng/commit/1f5ddcc009ac3511e99fc88736a9e1a6381168c5 > > Reported-by: Alexander Gordeev > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko >

Re: [PATCH v3 27/34] s390/irqflags: Do not instrument arch_local_irq_*() with KMSAN

2023-12-22 Thread Alexander Potapenko
variable. Disable instrumentation in the respective functions. They are > very small and it's easy to see that no important metadata updates are > lost because of this. > > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v3 33/34] s390: Implement the architecture-specific kmsan functions

2023-12-20 Thread Alexander Potapenko
shkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v3 24/34] s390/cpumf: Unpoison STCCTM output buffer

2023-12-20 Thread Alexander Potapenko
the whole dest manually with kmsan_unpoison_memory(). > > Reported-by: Alexander Gordeev > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v2 12/33] kmsan: Allow disabling KMSAN checks for the current task

2023-12-11 Thread Alexander Potapenko
On Tue, Nov 21, 2023 at 11:06 PM Ilya Leoshkevich wrote: > > Like for KASAN, it's useful to temporarily disable KMSAN checks around, > e.g., redzone accesses. Introduce kmsan_disable_current() and > kmsan_enable_current(), which are similar to their KASAN counterparts. Initially we used to have t

Re: [PATCH v2 28/33] s390/string: Add KMSAN support

2023-12-11 Thread Alexander Potapenko
64() definitions, depending on whether the code is built with > sanitizers or fortify. This should probably be streamlined, but in the > meantime resolve the issues by introducing the IN_BOOT_STRING_C macro, > similar to the existing IN_ARCH_STRING_C macro. > > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v2 30/33] s390/uaccess: Add KMSAN support to put_user() and get_user()

2023-12-11 Thread Alexander Potapenko
On Tue, Nov 21, 2023 at 11:03 PM Ilya Leoshkevich wrote: > > put_user() uses inline assembly with precise constraints, so Clang is > in principle capable of instrumenting it automatically. Unfortunately, > one of the constraints contains a dereferenced user pointer, and Clang > does not currently

Re: [PATCH v2 32/33] s390: Implement the architecture-specific kmsan functions

2023-12-11 Thread Alexander Potapenko
lloc_low(). > But since this question came up, I should probably add a check and > a WARN_ON_ONCE() here. Yes, please. -- Alexander Potapenko Software Engineer Google Germany GmbH Erika-Mann-Straße, 33 80636 München Geschäftsführer: Paul Manicle, Liana Sebastian Registergericht und -numme

Re: [PATCH v2 25/33] s390/cpacf: Unpoison the results of cpacf_trng()

2023-12-11 Thread Alexander Potapenko
On Tue, Nov 21, 2023 at 11:02 PM Ilya Leoshkevich wrote: > > Prevent KMSAN from complaining about buffers filled by cpacf_trng() > being uninitialized. > > Tested-by: Alexander Gordeev > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v2 32/33] s390: Implement the architecture-specific kmsan functions

2023-12-11 Thread Alexander Potapenko
> +static inline void *arch_kmsan_get_meta_or_null(void *addr, bool is_origin) > +{ > + if (addr >= (void *)&S390_lowcore && > + addr < (void *)(&S390_lowcore + 1)) { > + /* > +* Different lowcores accessed via S390_lowcore are described > +

Re: [PATCH v2 27/33] s390/mm: Define KMSAN metadata for vmalloc and modules

2023-12-11 Thread Alexander Potapenko
> Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko (hope some s390 maintainer acks this as well)

Re: [PATCH v2 10/33] kmsan: Expose kmsan_get_metadata()

2023-12-11 Thread Alexander Potapenko
> +static inline void *kmsan_get_metadata(void *addr, bool is_origin) > +{ > + return NULL; > +} > + > #endif We shouldn't need this part, as kmsan_get_metadata() should never be called in non-KMSAN builds.

Re: [PATCH v2 05/33] kmsan: Fix is_bad_asm_addr() on arches with overlapping address spaces

2023-12-11 Thread Alexander Potapenko
On Tue, Nov 21, 2023 at 11:02 PM Ilya Leoshkevich wrote: > > Comparing pointers with TASK_SIZE does not make sense when kernel and > userspace overlap. Skip the comparison when this is the case. > > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v2 23/33] s390/boot: Add the KMSAN runtime stub

2023-12-08 Thread Alexander Potapenko
an_unpoison_memory() > definition. This produces some runtime overhead, but only when building > with CONFIG_KMSAN. The benefit is that it does not disturb the existing > KMSAN build logic and call sites don't need to be changed. > > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v2 09/33] kmsan: Introduce kmsan_memmove_metadata()

2023-12-08 Thread Alexander Potapenko
On Tue, Nov 21, 2023 at 11:07 PM Ilya Leoshkevich wrote: > > It is useful to manually copy metadata in order to describe the effects > of memmove()-like logic in uninstrumented code or inline asm. Introduce > kmsan_memmove_metadata() for this purpose. > > Signed-off-by: Ilya Leoshkevich > --- >

Re: [PATCH v2 18/33] lib/string: Add KMSAN support to strlcpy() and strlcat()

2023-12-08 Thread Alexander Potapenko
On Tue, Nov 21, 2023 at 11:02 PM Ilya Leoshkevich wrote: > > Currently KMSAN does not fully propagate metadata in strlcpy() and > strlcat(), because they are built with -ffreestanding and call > memcpy(). In this combination memcpy() calls are not instrumented. Is this something specific to s390?

Re: [PATCH v2 04/33] kmsan: Increase the maximum store size to 4096

2023-12-08 Thread Alexander Potapenko
On Tue, Nov 21, 2023 at 11:07 PM Ilya Leoshkevich wrote: > > The inline assembly block in s390's chsc() stores that much. > > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v2 13/33] kmsan: Introduce memset_no_sanitize_memory()

2023-12-08 Thread Alexander Potapenko
> A problem with __memset() is that, at least for me, it always ends > up being a call. There is a use case where we need to write only 1 > byte, so I thought that introducing a call there (when compiling > without KMSAN) would be unacceptable. Wonder what happens with that use case if we e.g. bui

Re: [PATCH v2 19/33] lib/zlib: Unpoison DFLTCC output buffers

2023-12-08 Thread Alexander Potapenko
On Fri, Dec 8, 2023 at 3:14 PM Ilya Leoshkevich wrote: > > On Fri, 2023-12-08 at 14:32 +0100, Alexander Potapenko wrote: > > On Tue, Nov 21, 2023 at 11:07 PM Ilya Leoshkevich > > wrote: > > > > > > The constraints of the DFLTCC inline assembly are not precis

Re: [PATCH v2 26/33] s390/ftrace: Unpoison ftrace_regs in kprobe_ftrace_handler()

2023-12-08 Thread Alexander Potapenko
ngs when running the ftrace testsuite. > > Fix by trusting the assembly code and always unpoisoning ftrace_regs in > kprobe_ftrace_handler(). > > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v2 01/33] ftrace: Unpoison ftrace_regs in ftrace_ops_list_func()

2023-12-08 Thread Alexander Potapenko
arnings when running the ftrace testsuite. I couldn't reproduce these warnings on x86, hope you really need this change on s390 :) > Fix by trusting the architecture-specific assembly code and always > unpoisoning ftrace_regs in ftrace_ops_list_func. > > Signed-off-by: Ily

Re: [PATCH v2 17/33] mm: kfence: Disable KMSAN when checking the canary

2023-12-08 Thread Alexander Potapenko
On Fri, Dec 8, 2023 at 1:53 PM Alexander Potapenko wrote: > > On Tue, Nov 21, 2023 at 11:02 PM Ilya Leoshkevich wrote: > > > > KMSAN warns about check_canary() accessing the canary. > > > > The reason is that, even though set_canary() is properly instrumented > &

Re: [PATCH v2 14/33] kmsan: Support SLAB_POISON

2023-12-08 Thread Alexander Potapenko
On Tue, Nov 21, 2023 at 11:02 PM Ilya Leoshkevich wrote: > > Avoid false KMSAN negatives with SLUB_DEBUG by allowing > kmsan_slab_free() to poison the freed memory, and by preventing > init_object() from unpoisoning new allocations. The usage of > memset_no_sanitize_memory() does not degrade the g

Re: [PATCH v2 13/33] kmsan: Introduce memset_no_sanitize_memory()

2023-12-08 Thread Alexander Potapenko
On Tue, Nov 21, 2023 at 11:06 PM Ilya Leoshkevich wrote: > > Add a wrapper for memset() that prevents unpoisoning. We have __memset() already, won't it work for this case? On the other hand, I am not sure you want to preserve the redzone in its previous state (unless it's known to be poisoned). Y

Re: [PATCH v2 24/33] s390/checksum: Add a KMSAN check

2023-12-08 Thread Alexander Potapenko
-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v2 19/33] lib/zlib: Unpoison DFLTCC output buffers

2023-12-08 Thread Alexander Potapenko
On Tue, Nov 21, 2023 at 11:07 PM Ilya Leoshkevich wrote: > > The constraints of the DFLTCC inline assembly are not precise: they > do not communicate the size of the output buffers to the compiler, so > it cannot automatically instrument it. KMSAN usually does a poor job instrumenting inline asse

Re: [PATCH v2 17/33] mm: kfence: Disable KMSAN when checking the canary

2023-12-08 Thread Alexander Potapenko
ds. > > Unpoisoning the canary is not the right thing to do: only > check_canary() is supposed to ever touch it. Instead, disable KMSAN > checks around canary read accesses. > > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH v2 33/33] kmsan: Enable on s390

2023-11-29 Thread Alexander Potapenko
Hi Ilya, Sorry for this taking so long, I'll probably take a closer look next week. Overall, the s390 part looks good to me, but I wanted to check the x86 behavior once again (and perhaps figure out how to avoid introducing another way to disable KMSAN). Do you happen to have a Git repo with your

Re: [PATCH 28/32] s390/traps: Unpoison the kernel_stack_overflow()'s pt_regs

2023-11-16 Thread Alexander Potapenko
On Wed, Nov 15, 2023 at 9:35 PM Ilya Leoshkevich wrote: > > This is normally done by the generic entry code, but the > kernel_stack_overflow() flow bypasses it. > > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko > --- > arch/s390/kernel/traps.c | 2 ++

Re: [PATCH 26/32] s390/mm: Define KMSAN metadata for vmalloc and modules

2023-11-16 Thread Alexander Potapenko
On Wed, Nov 15, 2023 at 9:35 PM Ilya Leoshkevich wrote: > > The pages for the KMSAN metadata associated with most kernel mappings > are taken from memblock by the common code. However, vmalloc and module > metadata needs to be defined by the architectures. > > Be a little bit more careful than x86

Re: [PATCH 13/32] kmsan: Support SLAB_POISON

2023-11-16 Thread Alexander Potapenko
On Wed, Nov 15, 2023 at 9:34 PM Ilya Leoshkevich wrote: > > Avoid false KMSAN negatives with SLUB_DEBUG by allowing > kmsan_slab_free() to poison the freed memory, and by preventing > init_object() from unpoisoning new allocations. > > Signed-off-by: Ilya Leoshkevich > --- > mm/kmsan/hooks.c | 2

Re: [PATCH 07/32] kmsan: Remove a useless assignment from kmsan_vmap_pages_range_noflush()

2023-11-16 Thread Alexander Potapenko
ata for page operations") > Suggested-by: Alexander Gordeev > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko > --- > mm/kmsan/shadow.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/mm/kmsan/shadow.c b/mm/kmsan/shadow.c > index b9d05aff313e..2

Re: [PATCH 19/32] kmsan: Accept ranges starting with 0 on s390

2023-11-16 Thread Alexander Potapenko
nfig option to describe this situation, so explicitly check for > s390. > > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko (see the nit below) > --- > mm/kmsan/init.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/mm/kmsan/init.c

Re: [PATCH 06/32] kmsan: Fix kmsan_copy_to_user() on arches with overlapping address spaces

2023-11-16 Thread Alexander Potapenko
shkevich Reviewed-by: Alexander Potapenko

Re: [PATCH 14/32] kmsan: Use ALIGN_DOWN() in kmsan_get_metadata()

2023-11-16 Thread Alexander Potapenko
ts. Good catch, thank you! > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH 21/32] s390: Use a larger stack for KMSAN

2023-11-16 Thread Alexander Potapenko
viewed-by: Alexander Gordeev > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH 08/32] kmsan: Remove an x86-specific #include from kmsan.h

2023-11-16 Thread Alexander Potapenko
stens > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko (see the comment below) > > -#include > +#include For the sake of consistency with other KMSAN code, please keep the headers sorted alphabetically.

Re: [PATCH 03/32] kmsan: Disable KMSAN when DEFERRED_STRUCT_PAGE_INIT is enabled

2023-11-16 Thread Alexander Potapenko
KMSAN for now. > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH 02/32] kmsan: Make the tests compatible with kmsan.panic=1

2023-11-16 Thread Alexander Potapenko
sting. Nice! > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH 20/32] s390: Turn off KMSAN for boot, vdso and purgatory

2023-11-16 Thread Alexander Potapenko
On Wed, Nov 15, 2023 at 9:34 PM Ilya Leoshkevich wrote: > > All other sanitizers are disabled for these components as well. > > Reviewed-by: Alexander Gordeev > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko (see a nit below) > --- > arch/s390/boot/

Re: [PATCH 11/32] kmsan: Export panic_on_kmsan

2023-11-16 Thread Alexander Potapenko
to improve the KMSAN usability for > modules. > > Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko

Re: [PATCH 30/32] s390/unwind: Disable KMSAN checks

2023-11-16 Thread Alexander Potapenko
On Thu, Nov 16, 2023 at 10:04 AM Alexander Potapenko wrote: > > On Wed, Nov 15, 2023 at 9:35 PM Ilya Leoshkevich wrote: > > > > The unwind code can read uninitialized frames. Furthermore, even in > > the good case, KMSAN does not emit shadow for backchains. Therefor

Re: [PATCH 30/32] s390/unwind: Disable KMSAN checks

2023-11-16 Thread Alexander Potapenko
On Wed, Nov 15, 2023 at 9:35 PM Ilya Leoshkevich wrote: > > The unwind code can read uninitialized frames. Furthermore, even in > the good case, KMSAN does not emit shadow for backchains. Therefore > disable it for the unwinding functions. > > Signed-off-by: Ilya Leoshkevich > --- > arch/s390/ke

Re: [PATCH 12/32] kmsan: Allow disabling KMSAN checks for the current task

2023-11-16 Thread Alexander Potapenko
On Wed, Nov 15, 2023 at 9:34 PM Ilya Leoshkevich wrote: > > Like for KASAN, it's useful to temporarily disable KMSAN checks around, > e.g., redzone accesses. This example is incorrect, because KMSAN does not have redzones. You are calling these functions from "mm: slub: Let KMSAN access metadata"

Re: [PATCH 00/32] kmsan: Enable on s390

2023-11-16 Thread Alexander Potapenko
On Wed, Nov 15, 2023 at 9:34 PM Ilya Leoshkevich wrote: > > Hi, > > This series provides the minimal support for Kernel Memory Sanitizer on > s390. Kernel Memory Sanitizer is clang-only instrumentation for finding > accesses to uninitialized memory. The clang support for s390 has already > been me

Re: [PATCH v2] nvdimm: Support sizeof(struct page) > MAX_STRUCT_PAGE_SIZE

2023-01-31 Thread Alexander Potapenko
case, since the allocation > is ephemeral for the lifespan of the namespace, there are no explicit > restriction. However, the implicit restriction, of having enough > available "System RAM" to store the page map for the typically large > pmem, still applies. > > Fixes: 6

Re: [PATCH mm] kfence, x86: fix preemptible warning on KPTI-enabled systems

2021-04-01 Thread Alexander Potapenko
disabling preemption around flush_tlb_one_kernel(). > > Link: https://lore.kernel.org/lkml/ygidbaboelggm...@elver.google.com/ > Reported-by: Tomi Sarvela > Signed-off-by: Marco Elver Acked-by: Alexander Potapenko

Re: [PATCH mm] kfence: zero guard page after out-of-bounds access

2021-03-12 Thread Alexander Potapenko
prevent certain information leaks. > > Signed-off-by: Marco Elver Acked-by: Alexander Potapenko > --- > mm/kfence/core.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/mm/kfence/core.c b/mm/kfence/core.c > index 3b8ec938470a..f7106f28443d 100644 > --- a

Re: [PATCH mm] kfence, slab: fix cache_alloc_debugcheck_after() for bulk allocations

2021-03-05 Thread Alexander Potapenko
On Fri, Mar 5, 2021 at 2:31 AM Andrew Morton wrote: > > On Thu, 4 Mar 2021 22:05:48 +0100 Alexander Potapenko > wrote: > > > On Thu, Mar 4, 2021 at 9:53 PM Marco Elver wrote: > > > > > > cache_alloc_debugcheck_after() performs checks on an object, including

Re: [PATCH mm] kfence, slab: fix cache_alloc_debugcheck_after() for bulk allocations

2021-03-04 Thread Alexander Potapenko
On Thu, Mar 4, 2021 at 9:53 PM Marco Elver wrote: > > cache_alloc_debugcheck_after() performs checks on an object, including > adjusting the returned pointer. None of this should apply to KFENCE > objects. While for non-bulk allocations, the checks are skipped when we > allocate via KFENCE, for bu

Re: [PATCH mm] kfence: fix printk format for ptrdiff_t

2021-03-03 Thread Alexander Potapenko
On Wed, Mar 3, 2021 at 1:12 PM Marco Elver wrote: > > Use %td for ptrdiff_t. > > Link: > https://lkml.kernel.org/r/3abbe4c9-16ad-c168-a90f-087978ccd...@csgroup.eu > Reported-by: Christophe Leroy > Signed-off-by: Marco Elver Reviewed-by: Alexander Potapenko

Re: [RFC PATCH v1] powerpc: Enable KFENCE for PPC32

2021-03-02 Thread Alexander Potapenko
> [ 14.998426] BUG: KFENCE: invalid read in > finish_task_switch.isra.0+0x54/0x23c > [ 14.998426] > [ 15.007061] Invalid read at 0x(ptrval): > [ 15.010906] finish_task_switch.isra.0+0x54/0x23c > [ 15.015633] kunit_try_run_case+0x5c/0xd0 > [ 15.019682] kunit_generic_run_threadfn_adap

Re: [PATCH] mm/kasan: switch from strlcpy to strscpy

2021-02-21 Thread Alexander Potapenko
gt; also avoids scanning the whole source string. Looks like a good thing to do. > Signed-off-by: Zhiyuan Dai Acked-by: Alexander Potapenko > --- > mm/kasan/report_generic.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/kasan/report_generic.c b/

Re: [PATCH v5 1/2] lib: stackdepot: Add support to configure STACK_HASH_SIZE

2021-01-22 Thread Alexander Potapenko
On Mon, Jan 18, 2021 at 11:54 PM Randy Dunlap wrote: > > On 1/18/21 1:56 AM, vji...@codeaurora.org wrote: > > From: Yogesh Lal > > > > Use CONFIG_STACK_HASH_ORDER to configure STACK_HASH_SIZE. > > > > Aim is to have configurable value for STACK_HASH_SIZE, > > so depend on use case one can config

Re: [PATCH v5 1/2] lib: stackdepot: Add support to configure STACK_HASH_SIZE

2021-01-22 Thread Alexander Potapenko
gt; Signed-off-by: Vijayanand Jitta Reviewed-by: Alexander Potapenko > --- > lib/Kconfig | 9 + > lib/stackdepot.c | 3 +-- > 2 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/lib/Kconfig b/lib/Kconfig > index b46a9fd..96ee125 100644 > --- a/

Re: [PATCH v2 2/5] lib: add error_report_notify to collect debugging tools' reports

2021-01-21 Thread Alexander Potapenko
Thank you all for the comments! Since concerns have been raised that another error reporting system may quickly go out of control, we've decided to not pursue this solution any further. Instead, we will try to rely on existing ftrace mechanisms to deliver notifications to the userspace, and perfor

Re: [PATCH v2 0/5] Add sysfs interface to collect reports from debugging tools

2021-01-21 Thread Alexander Potapenko
On Fri, Jan 15, 2021 at 2:09 PM Alexander Potapenko wrote: > > On Fri, Jan 15, 2021 at 2:06 PM Vlastimil Babka wrote: > > > > Should have CCd linux-api@, please do next time > Thanks, will do! > Shall I also CC the v2 ABI patch explicitly? I'll be dropping the sys

Re: [PATCH v2 2/5] lib: add error_report_notify to collect debugging tools' reports

2021-01-18 Thread Alexander Potapenko
> > > + > > > + /* Pairs with acquire in last_report_show(). */ > > > + atomic_inc_return_release(&num_reports); > > > + schedule_delayed_work(&reporting_done, 0); > > > > Why delayed work when it gets queued immediately? > > Because error reports may be sent from a place where waiting

Re: [PATCH v2 2/5] lib: add error_report_notify to collect debugging tools' reports

2021-01-18 Thread Alexander Potapenko
On Mon, Jan 18, 2021 at 12:38 PM Petr Mladek wrote: Thanks for your input! Some responses below. > > On Fri 2021-01-15 14:03:33, Alexander Potapenko wrote: > > With the introduction of various production error-detection tools, such as > > MTE-based KASAN and KFENCE,

Re: [PATCH mm 4/4] kfence: add missing copyright header to documentation

2021-01-18 Thread Alexander Potapenko
On Mon, Jan 18, 2021 at 10:22 AM Marco Elver wrote: > > Add missing copyright header to KFENCE documentation. > > Signed-off-by: Marco Elver Reviewed-by: Alexander Potapenko

Re: [PATCH mm 3/4] kfence, arm64: add missing copyright and description header

2021-01-18 Thread Alexander Potapenko
On Mon, Jan 18, 2021 at 10:22 AM Marco Elver wrote: > > Add missing copyright and description header to KFENCE source file. > > Signed-off-by: Marco Elver Reviewed-by: Alexander Potapenko

Re: [PATCH mm 1/4] kfence: add missing copyright and description headers

2021-01-18 Thread Alexander Potapenko
On Mon, Jan 18, 2021 at 10:22 AM Marco Elver wrote: > > Add missing copyright and description headers to KFENCE source files. > > Signed-off-by: Marco Elver Reviewed-by: Alexander Potapenko > --- > If appropriate, to be squashed into: > > mm: add Kernel Elect

Re: [PATCH mm 2/4] kfence, x86: add missing copyright and description header

2021-01-18 Thread Alexander Potapenko
On Mon, Jan 18, 2021 at 10:22 AM Marco Elver wrote: > > Add missing copyright and description header to KFENCE source file. > > Signed-off-by: Marco Elver Reviewed-by: Alexander Potapenko

Re: [PATCH v2 3/5] docs: ABI: add /sys/kernel/error_report/ documentation

2021-01-18 Thread Alexander Potapenko
hat we are planning to do. Also, shall I rename the library/config/etc. accordingly (to e.g. CONFIG_KERNEL_WARN_NOTIFY)? > Use the function in kernel/trace/trace.c: tracer_init_tracefs() to add that > directory. That's for files in the tracefs directory that will not be > duplicate

Re: [PATCH v2 2/5] lib: add error_report_notify to collect debugging tools' reports

2021-01-15 Thread Alexander Potapenko
On Fri, Jan 15, 2021 at 2:50 PM Greg KH wrote: > > Minor comments, if in the future, you really do want to mess around in sysfs: > Thanks! Guess most of these comments apply even if I choose another FS to mess around with. > No copyright notice for the file? While acceptable, odds are your > cor

Re: [PATCH v2 3/5] docs: ABI: add /sys/kernel/error_report/ documentation

2021-01-15 Thread Alexander Potapenko
rt count to ensure it didn't change under their feet. > Also, any reason you didn't cc: the sysfs maintainers? Only my lack of common sense :) I'll add them should the following patches rely on sysfs, thank you! Alex -- Alexander Potapenko Software Engineer Google Germany G

Re: [PATCH v3 08/15] kasan: add compiler barriers to KUNIT_EXPECT_KASAN_FAIL

2021-01-15 Thread Alexander Potapenko
d-off-by: Andrey Konovalov Reviewed-by: Alexander Potapenko

Re: [PATCH v3 11/15] kasan: move _RET_IP_ to inline wrappers

2021-01-15 Thread Alexander Potapenko
iew.googlesource.com/id/I8fb3c06d49671305ee184175a39591bc26647a67 > > Signed-off-by: Andrey Konovalov > > Much nicer! > > Reviewed-by: Marco Elver Reviewed-by: Alexander Potapenko

Re: [PATCH v3 12/15] kasan: fix bug detection via ksize for HW_TAGS mode

2021-01-15 Thread Alexander Potapenko
t; pass _RET_IP_ to __kasan_check_byte(). > > > > Also add a new ksize_uaf() test that checks that a use-after-free is > > detected via ksize() itself, and via plain accesses that happen later. > > > > Link: > > https://linux-review.googlesource.com/id/Iaabf771881d0f9ce1b969f2a62938e99d3308ec5 > > Signed-off-by: Andrey Konovalov > > Reviewed-by: Marco Elver Reviewed-by: Alexander Potapenko

Re: [PATCH v3 14/15] kasan: add a test for kmem_cache_alloc/free_bulk

2021-01-15 Thread Alexander Potapenko
ttps://linux-review.googlesource.com/id/I2a8bf797aecf81baeac61380c567308f319e263d > > Signed-off-by: Andrey Konovalov > > Reviewed-by: Marco Elver Reviewed-by: Alexander Potapenko (see a nit below) > > + cache = kmem_cache_create("test_cache", size, 0, 0, NULL)

Re: [PATCH v3 15/15] kasan: don't run tests when KASAN is not enabled

2021-01-15 Thread Alexander Potapenko
> https://linux-review.googlesource.com/id/I6447af436a69a94bfc35477f6bf4e2122948355e > > Signed-off-by: Andrey Konovalov > > Reviewed-by: Marco Elver Reviewed-by: Alexander Potapenko

Re: [PATCH v3 05/15] kasan: add match-all tag tests

2021-01-15 Thread Alexander Potapenko
gt; > Note, that test #3 causes a significant number (255) of KASAN reports > to be printed during execution for the SW_TAGS mode. > > Link: > https://linux-review.googlesource.com/id/I78f1375efafa162b37f3abcb2c5bc2f3955dfd8e > Reviewed-by: Marco Elver > Signed-off-by: Andrey Konovalov Reviewed-by: Alexander Potapenko

Re: [PATCH v3 03/15] kasan: clean up comments in tests

2021-01-15 Thread Alexander Potapenko
On Thu, Jan 14, 2021 at 8:36 PM Andrey Konovalov wrote: > > Clarify and update comments in KASAN tests. > > Link: > https://linux-review.googlesource.com/id/I6c816c51fa1e0eb7aa3dead6bda1f339d2af46c8 > Reviewed-by: Marco Elver > Signed-off-by: Andrey Konovalov Reviewed-by: Alexander Potapenko

Re: [PATCH v2 0/5] Add sysfs interface to collect reports from debugging tools

2021-01-15 Thread Alexander Potapenko
On Fri, Jan 15, 2021 at 2:06 PM Vlastimil Babka wrote: > > Should have CCd linux-api@, please do next time Thanks, will do! Shall I also CC the v2 ABI patch explicitly?

[PATCH v2 4/5] kfence: use error_report_start and error_report_end tracepoints

2021-01-15 Thread Alexander Potapenko
Cc: linux...@kvack.org Signed-off-by: Alexander Potapenko --- v2: - change error_report_start and error_report_end prototypes to accept enum error_detector instead of char* (as suggested by Steven Rostedt) --- mm/kfence/report.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm

[PATCH v2 5/5] kasan: use error_report_start and error_report_end tracepoints

2021-01-15 Thread Alexander Potapenko
Cc: linux...@kvack.org Signed-off-by: Alexander Potapenko --- v2: - change error_report_start and error_report_end prototypes to accept enum error_detector instead of char* (as suggested by Steven Rostedt) --- mm/kasan/report.c | 15 +-- 1 file changed, 9 insertions(+), 6

[PATCH v2 1/5] tracing: add error_report trace points

2021-01-15 Thread Alexander Potapenko
: Alexander Potapenko --- v2: - change error_report_start and error_report_end prototypes to accept enum error_detector instead of char* (as suggested by Steven Rostedt) --- include/trace/events/error_report.h | 84 + kernel/trace/Makefile

[PATCH v2 3/5] docs: ABI: add /sys/kernel/error_report/ documentation

2021-01-15 Thread Alexander Potapenko
-error_report new file mode 100644 index ..666d039f93a9 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-kernel-error_report @@ -0,0 +1,41 @@ +What: /sys/kernel/error_report/ +Date: January 2021 +Contact: Alexander Potapenko , + Marco Elver

  1   2   3   4   5   6   7   >