[PATCH v3] tun: bail out from tun_get_user() if the skb is empty

2017-09-28 Thread Alexander Potapenko
(, 0, sizeof(struct ifreq)); strcpy((char*)_name, "gre0"); req.ifr_flags = IFF_UP | IFF_MULTICAST; ioctl(tun_fd, TUNSETIFF, ); ioctl(sock, SIOCSIFFLAGS, "gre0"); write(tun_fd, "hi", 0); return 0; } ====== Signed

Re: [PATCH 1/1] mm/page_owner: ignore everything below the IRQ entry point

2017-12-05 Thread Alexander Potapenko
generic file so that page_owner can also > do same filteration. > > Initial KASAN commit > id=be7635e7287e0e8013af3c89a6354a9e0182594c > > Signed-off-by: Vaneet Narang > Signed-off-by: Maninder Singh Reviewed-by: Alexander Potapenko > --- > include/linux/stacktrace.h | 25 +++

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-19 Thread Alexander Potapenko
ot;(__sp) > : > [entry]"r"(entry), > [ss]"i"(__KERNEL_DS), > diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c > index b836a7274e12..4457e41378e4 100644 > --- a/arch/x86/mm/fault.c >

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-19 Thread Alexander Potapenko
On Tue, Sep 19, 2017 at 2:55 PM, Alexander Potapenko wrote: > On Tue, Sep 19, 2017 at 11:45 AM, Josh Poimboeuf wrote: >> For inline asm statements which have a CALL instruction, we list the >> stack pointer as a constraint to convince GCC to ensure the frame >> po

[PATCH v2] lib/stackdepot: use a non-instrumented version of memcmp()

2017-11-17 Thread Alexander Potapenko
stackdepot used to call memcmp(), which compiler tools normally instrument, therefore every lookup used to unnecessarily call instrumented code. This is somewhat ok in the case of KASAN, but under KMSAN a lot of time was spent in the instrumentation. Signed-off-by: Alexander Potapenko --- v2

[PATCH v2] sctp: fully initialize the IPv6 address in sctp_v6_to_addr()

2017-08-14 Thread Alexander Potapenko
.c:292 == Signed-off-by: Alexander Potapenko Reviewed-by: Xin Long --- v2 is identical to v1, resending per request by Marcelo Ricardo Leitner. --- net/sctp/ipv6.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c

Re: [PATCH] sctp: fully initialize the IPv6 address in sctp_v6_to_addr()

2017-08-14 Thread Alexander Potapenko
On Tue, Aug 8, 2017 at 8:47 PM, Marcelo Ricardo Leitner wrote: > On Tue, Jul 18, 2017 at 04:55:57PM +0200, Alexander Potapenko wrote: >> KMSAN reported use of uninitialized sctp_addr->v4.sin_addr.s_addr and >> sctp_addr->v6.sin6_scope_id in sctp_v6_cmp_addr() (see below). &g

[PATCH] sysctl: don't read uninit memory in deprecated_sysctl_warning()

2017-06-28 Thread Alexander Potapenko
Don't attempt to read the first two elements of name[] unless they were actually copied from the userspace. This bug has been detected by KMSAN. Signed-off-by: Alexander Potapenko --- kernel/sysctl_binary.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel

Re: [PATCH] slub: make sure struct kmem_cache_node is initialized before publication

2017-07-12 Thread Alexander Potapenko
Hi everyone, On Mon, Jul 10, 2017 at 10:32 PM, Andrew Morton wrote: > On Fri, 7 Jul 2017 18:18:31 -0500 (CDT) Christoph Lameter > wrote: > >> On Fri, 7 Jul 2017, Andrew Morton wrote: >> >> > On Fri, 7 Jul 2017 10:34:08 +0200 Alexander Potapenko >>

[PATCH] sctp: don't dereference ptr before leaving _sctp_walk_{params,errors}()

2017-07-13 Thread Alexander Potapenko
return_from_SYSCALL_64+0x0/0x6a arch/x86/entry/entry_64.S:246 == Signed-off-by: Alexander Potapenko --- include/net/sctp/sctp.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sc

Re: [PATCH] sctp: don't dereference ptr before leaving _sctp_walk_{params,errors}()

2017-07-13 Thread Alexander Potapenko
On Thu, Jul 13, 2017 at 8:10 PM, Alexander Potapenko wrote: > If the iterator (|pos.p| or |err|) has already reached the end of > chunk, we shouldn't access iterator->length. > > This bug has been detected by KMSAN. For the following pair of system > calls: > > sock

Re: [PATCH] sctp: don't dereference ptr before leaving _sctp_walk_{params,errors}()

2017-07-13 Thread Alexander Potapenko
On Thu, Jul 13, 2017 at 8:14 PM, Alexander Potapenko wrote: > On Thu, Jul 13, 2017 at 8:10 PM, Alexander Potapenko > wrote: >> If the iterator (|pos.p| or |err|) has already reached the end of >> chunk, we shouldn't access iterator->length. >> >> Th

Re: [PATCH] sctp: don't dereference ptr before leaving _sctp_walk_{params,errors}()

2017-07-13 Thread Alexander Potapenko
On Thu, Jul 13, 2017 at 8:32 PM, David Miller wrote: > From: Alexander Potapenko > Date: Thu, 13 Jul 2017 20:10:34 +0200 > >> diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h >> index a9519a06a23b..f13632ee33f0 100644 >> --- a/include/net/sctp/sctp.

[PATCH v2] sctp: don't dereference ptr before leaving _sctp_walk_{params,errors}()

2017-07-14 Thread Alexander Potapenko
_from_SYSCALL_64+0x0/0x6a arch/x86/entry/entry_64.S:246 ====== Signed-off-by: Alexander Potapenko --- v2: per comment from David Miller, make sure the whole iterator->length fits into the remaining buffer. --- include/net/

[PATCH v3] sctp: don't dereference ptr before leaving _sctp_walk_{params,errors}()

2017-07-14 Thread Alexander Potapenko
_from_SYSCALL_64+0x0/0x6a arch/x86/entry/entry_64.S:246 ====== Signed-off-by: Alexander Potapenko --- v3: fix compilation v2: per comment from David Miller, make sure the whole iterator->length fits into the remaining buffer

Re: [PATCH v2] sctp: don't dereference ptr before leaving _sctp_walk_{params,errors}()

2017-07-14 Thread Alexander Potapenko
On Fri, Jul 14, 2017 at 5:58 PM, David Miller wrote: > From: Alexander Potapenko > Date: Fri, 14 Jul 2017 12:03:29 +0200 > >> v2: per comment from David Miller, make sure the whole iterator->length >> fits into the remaining buffer. > > Please compile and

[PATCH] ipv6: initialize treq->txhash in cookie_v6_check()

2017-07-14 Thread Alexander Potapenko
process_backlog+0x667/0xba0 net/core/dev.c:4866 napi_poll net/core/dev.c:5268 net_rx_action+0xc95/0x1590 net/core/dev.c:5333 __do_softirq+0x485/0x942 kernel/softirq.c:284 == Signed-off-by: Alexander Potapenko --- net/ipv6

Re: [PATCH v2] sctp: don't dereference ptr before leaving _sctp_walk_{params,errors}()

2017-07-14 Thread Alexander Potapenko
On Fri, Jul 14, 2017 at 7:23 PM, David Miller wrote: > From: Alexander Potapenko > Date: Fri, 14 Jul 2017 18:33:01 +0200 > >> On Fri, Jul 14, 2017 at 5:58 PM, David Miller wrote: >>> From: Alexander Potapenko >>> Date: Fri, 14 Jul 2017 12:03:29 +0200 >>&g

Re: [PATCH] ipv6: initialize treq->txhash in cookie_v6_check()

2017-07-14 Thread Alexander Potapenko
On Fri, Jul 14, 2017 at 7:04 PM, Neal Cardwell wrote: > On Fri, Jul 14, 2017 at 12:54 PM, Alexander Potapenko > wrote: >> KMSAN reported use of uninitialized memory in skb_set_hash_from_sk(), >> which originated from the TCP request socket created in >> cookie_v6_che

Re: [PATCH] slub: make sure struct kmem_cache_node is initialized before publication

2017-07-10 Thread Alexander Potapenko
On Sat, Jul 8, 2017 at 1:18 AM, Christoph Lameter wrote: > On Fri, 7 Jul 2017, Andrew Morton wrote: > >> On Fri, 7 Jul 2017 10:34:08 +0200 Alexander Potapenko >> wrote: >> >> > --- a/mm/slub.c >> > +++ b/mm/slub.c >> > @@ -3389,8 +3389,8 @@

[PATCH] mbcache: initialize entry->e_referenced in mb_cache_entry_create()

2017-07-06 Thread Alexander Potapenko
x94 == Signed-off-by: Alexander Potapenko --- fs/mbcache.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/mbcache.c b/fs/mbcache.c index b19be429d655..fdfe8933ac6b 100644 --- a/fs/mbcache.c +++ b/fs/mbcache.c @@ -93,6 +93,7 @@ int mb_cache_entry_create(struct mb_cache *cache, gfp_t m

[PATCH] slub: make sure struct kmem_cache_node is initialized before publication

2017-07-07 Thread Alexander Potapenko
ons arch/x86/kernel/head64.c:196 [inline] x86_64_start_kernel+0x6cc/0x700 arch/x86/kernel/head64.c:177 verify_cpu+0x0/0xfc == Signed-off-by: Alexander Potapenko --- mm/slub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) d

Re: [PATCH] slub: make sure struct kmem_cache_node is initialized before publication

2017-07-07 Thread Alexander Potapenko
Hi all, On Fri, Jul 7, 2017 at 10:34 AM, Alexander Potapenko wrote: > According to KMSAN (see the report below) it's possible that > unfreeze_partials() accesses >list_lock before it's being > initialized. The initialization normally happens in > init_kmem_cache_node() when i

Re: [PATCH v2] sctp: don't dereference ptr before leaving _sctp_walk_{params,errors}()

2017-07-17 Thread Alexander Potapenko
On Fri, Jul 14, 2017 at 7:54 PM, David Miller wrote: > From: Alexander Potapenko > Date: Fri, 14 Jul 2017 19:33:54 +0200 > >> On Fri, Jul 14, 2017 at 7:23 PM, David Miller wrote: >>> From: Alexander Potapenko >>> Date: Fri, 14 Jul 2017 18:33:01 +0200 >>

[PATCH] ipv4: ipv6: initialize treq->txhash in cookie_v[46]_check()

2017-07-17 Thread Alexander Potapenko
(). Signed-off-by: Alexander Potapenko Fixes: 58d607d3e52f ("tcp: provide skb->hash to synack packets") --- net/ipv4/syncookies.c | 1 + net/ipv6/syncookies.c | 1 + 2 files changed, 2 insertions(+) diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c index 0905cf04c2a4..03ad87

Re: [PATCH] ipv4: ipv6: initialize treq->txhash in cookie_v[46]_check()

2017-07-17 Thread Alexander Potapenko
On Mon, Jul 17, 2017 at 12:35 PM, Alexander Potapenko wrote: > KMSAN reported use of uninitialized memory in skb_set_hash_from_sk(), > which originated from the TCP request socket created in > cookie_v6_check(): > > =

[PATCH] sctp: fully initialize the IPv6 address in sctp_v6_to_addr()

2017-07-18 Thread Alexander Potapenko
.c:292 == Signed-off-by: Alexander Potapenko --- net/sctp/ipv6.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 2a186b201ad2..a15d691829c6 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c @@ -513,6 +513,8 @@ stati

Re: [PATCH] sctp: fully initialize the IPv6 address in sctp_v6_to_addr()

2017-07-18 Thread Alexander Potapenko
On Tue, Jul 18, 2017 at 4:55 PM, Alexander Potapenko wrote: > KMSAN reported use of uninitialized sctp_addr->v4.sin_addr.s_addr and > sctp_addr->v6.sin6_scope_id in sctp_v6_cmp_addr() (see below). > Make sure all fields of an IPv6 address are initialized, which > guarantees th

[PATCH] llist: clang: introduce member_address_is_nonnull()

2017-07-19 Thread Alexander Potapenko
memory). Therefore the loop condition is always true, and the loops become infinite. To work around this, introduce the member_address_is_nonnull() macro, which casts object pointer to uintptr_t, thus letting the member pointer to be NULL. Signed-off-by: Alexander Potapenko --- include/linux/llist.

[PATCH v3] net: don't call strlen on non-terminated string in dev_set_alias()

2017-06-01 Thread Alexander Potapenko
KMSAN reported a use of uninitialized memory in dev_set_alias(), which was caused by calling strlcpy() (which in turn called strlen()) on the user-supplied non-terminated string. Signed-off-by: Alexander Potapenko --- v3: removed the multi-line comment v2: fixed an off-by-one error spotted

Re: [PATCH v3] net: don't call strlen on non-terminated string in dev_set_alias()

2017-06-01 Thread Alexander Potapenko
On Thu, Jun 1, 2017 at 3:47 PM, Yury Norov wrote: > On Thu, Jun 01, 2017 at 02:38:29PM +0200, Alexander Potapenko wrote: >> KMSAN reported a use of uninitialized memory in dev_set_alias(), >> which was caused by calling strlcpy() (which in turn called strlen()) >> on

Re: [PATCH v3] net: don't call strlen on non-terminated string in dev_set_alias()

2017-06-01 Thread Alexander Potapenko
On Thu, Jun 1, 2017 at 4:04 PM, Yury Norov wrote: > On Thu, Jun 01, 2017 at 03:50:33PM +0200, Alexander Potapenko wrote: >> On Thu, Jun 1, 2017 at 3:47 PM, Yury Norov wrote: >> > On Thu, Jun 01, 2017 at 02:38:29PM +0200, Alexander Potapenko wrote: >> >> KMSAN r

Re: [PATCH v2 18/18] arm64: select ARCH_SUPPORTS_LTO_CLANG

2017-11-23 Thread Alexander Potapenko
s to the > kernels memory model are resolved?" I would hope the two are > orthogonal and that we'd take them and then test them even more > extensively than the developer has in order to find out. > >> It would be good to get something similar to LKMM into KTSAN, for >> examp

Re: [PATCH v4 2/5] kasan/Makefile: Support LLVM style asan parameters.

2017-12-08 Thread Alexander Potapenko
cc-param,asan-globals=1) \ > + $(call > cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \ > + $(call cc-param,asan-stack=1) \ > + $(call cc-param,asan-use-after-scope=1) > + endif > + > endif > > CFLAGS_KASAN += $(call cc-opt

[PATCH v2 1/3] kcov: support comparison operands collection

2017-10-09 Thread Alexander Potapenko
value. Signed-off-by: Victor Chibotaru Signed-off-by: Alexander Potapenko Cc: Dmitry Vyukov Cc: Andrey Konovalov Cc: Andrew Morton Cc: Mark Rutland Cc: Alexander Popov Cc: Andrey Ryabinin Cc: Kees Cook Cc: Vegard Nossum Cc: Quentin Casasnovas Cc: syzkal...@googlegroups.com Cc: linux

[PATCH v2 3/3] kcov: update documentation

2017-10-09 Thread Alexander Potapenko
From: Victor Chibotaru The updated documentation describes new KCOV mode for collecting comparison operands. Signed-off-by: Victor Chibotaru Signed-off-by: Alexander Potapenko Cc: Dmitry Vyukov Cc: Andrey Konovalov Cc: Andrew Morton Cc: Mark Rutland Cc: Alexander Popov Cc: Andrey

[PATCH v2 2/3] Makefile: support flag -fsanitizer-coverage=trace-cmp

2017-10-09 Thread Alexander Potapenko
From: Victor Chibotaru The flag enables Clang instrumentation of comparison operations (currently not supported by GCC). This instrumentation is needed by the new KCOV device to collect comparison operands. Signed-off-by: Victor Chibotaru Signed-off-by: Alexander Potapenko Cc: Dmitry Vyukov

[PATCH v3 2/3] Makefile: support flag -fsanitizer-coverage=trace-cmp

2017-10-10 Thread Alexander Potapenko
From: Victor Chibotaru The flag enables Clang instrumentation of comparison operations (currently not supported by GCC). This instrumentation is needed by the new KCOV device to collect comparison operands. Signed-off-by: Victor Chibotaru Signed-off-by: Alexander Potapenko Cc: Dmitry Vyukov

[PATCH 3/3] kcov: update documentation

2017-10-10 Thread Alexander Potapenko
From: Victor Chibotaru The updated documentation describes new KCOV mode for collecting comparison operands. Signed-off-by: Victor Chibotaru Signed-off-by: Alexander Potapenko Cc: Dmitry Vyukov Cc: Andrey Konovalov Cc: Andrew Morton Cc: Mark Rutland Cc: Alexander Popov Cc: Andrey

Re: [PATCH v2 2/3] Makefile: support flag -fsanitizer-coverage=trace-cmp

2017-10-10 Thread Alexander Potapenko
On Mon, Oct 9, 2017 at 8:53 AM, Andrey Ryabinin wrote: > > > On 10/09/2017 06:05 PM, Alexander Potapenko wrote: > >> v2: - updated KCOV_ENABLE_COMPARISONS description >> --- >> Makefile | 5 +++-- >> lib/Kconfig.debug| 10 ++ >&g

Re: [PATCH v2 1/3] kcov: support comparison operands collection

2017-10-10 Thread Alexander Potapenko
On Mon, Oct 9, 2017 at 8:46 AM, Mark Rutland wrote: > Hi, > > I look forward to using this! :) > > I just have afew comments below. > > On Mon, Oct 09, 2017 at 05:05:19PM +0200, Alexander Potapenko wrote: >> +/* >> + * Defines the format for the types of collec

[PATCH v3 1/3] kcov: support comparison operands collection

2017-10-10 Thread Alexander Potapenko
value. Signed-off-by: Victor Chibotaru Signed-off-by: Alexander Potapenko Cc: Dmitry Vyukov Cc: Andrey Konovalov Cc: Andrew Morton Cc: Mark Rutland Cc: Alexander Popov Cc: Andrey Ryabinin Cc: Kees Cook Cc: Vegard Nossum Cc: Quentin Casasnovas Cc: syzkal...@googlegroups.com Cc: linux

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

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 sysfs ch

Re: [PATCH 1/4] tracing: add error_report trace points

2021-01-13 Thread Alexander Potapenko
On Wed, Jan 13, 2021 at 10:10 PM Steven Rostedt wrote: > > On Wed, 13 Jan 2021 10:16:54 +0100 > Alexander Potapenko wrote: > > > +DECLARE_EVENT_CLASS(error_report_template, > > + TP_PROTO(const char *error_detector, unsigned long id), > > Ins

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

2021-01-14 Thread Alexander Potapenko
On Thu, Jan 14, 2021 at 1:06 AM Andrew Morton wrote: > > On Wed, 13 Jan 2021 10:16:55 +0100 Alexander Potapenko > wrote: > > > With the introduction of various production error-detection tools, such as > > MTE-based KASAN and KFENCE, the need arises to efficiently not

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

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

2021-01-22 Thread Alexander Potapenko
> 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-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 KFENC

Re: [PATCH v2 09/14] kasan: adapt kmalloc_uaf2 test to HW_TAGS mode

2021-01-13 Thread Alexander Potapenko
58ef2804ff465d8eb07434a300bf36388d55 > Signed-off-by: Andrey Konovalov Reviewed-by: Alexander Potapenko > --- > lib/test_kasan.c | 11 +++ > 1 file changed, 11 insertions(+) > > diff --git a/lib/test_kasan.c b/lib/test_kasan.c > index 283feda9882a..a1a35d75ee1e 100644 >

Re: [PATCH v2 04/14] kasan: add macros to simplify checking test constraints

2021-01-13 Thread Alexander Potapenko
ros and use them. > > > > Link: > > https://linux-review.googlesource.com/id/I237484a7fddfedf4a4aae9cc61ecbcdbe85a0a63 > > Suggested-by: Alexander Potapenko > > Signed-off-by: Andrey Konovalov > > Nice! > > Reviewed-by: Marco Elver Reviewed-by: Alexander Potapenko

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

2021-01-07 Thread Alexander Potapenko
On Wed, Dec 30, 2020 at 1:46 PM wrote: > > From: Yogesh Lal > > Use STACK_HASH_ORDER_SHIFT to configure STACK_HASH_SIZE. I think "ORDER_SHIFT" is somewhat redundant, as "SMTH_ORDER" already means this is a power of two we'll be using for shifting. Leaving this up to you. Alex

[PATCH 0/4] Add sysfs interface to collect reports from debugging tools

2021-01-13 Thread Alexander Potapenko
to use this new feature. Alexander Potapenko (4): tracing: add error_report trace points lib: add error_report_notify to collect debugging tools' reports kfence: use error_report_start and error_report_end tracepoints kasan: use error_report_start and error_report_end tracepoints include

[PATCH 1/4] tracing: add error_report trace points

2021-01-13 Thread Alexander Potapenko
-by: Alexander Potapenko --- include/trace/events/error_report.h | 51 + kernel/trace/Makefile | 1 + kernel/trace/error_report-traces.c | 11 +++ 3 files changed, 63 insertions(+) create mode 100644 include/trace/events/error_report.h create mode

[PATCH 4/4] kasan: use error_report_start and error_report_end tracepoints

2021-01-13 Thread Alexander Potapenko
Cc: linux...@kvack.org Signed-off-by: Alexander Potapenko --- mm/kasan/report.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mm/kasan/report.c b/mm/kasan/report.c index c0fb21797550..fd015dd5dd39 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c

[PATCH 2/4] lib: add error_report_notify to collect debugging tools' reports

2021-01-13 Thread Alexander Potapenko
: Petr Mladek Cc: Steven Rostedt Cc: Sergey Senozhatsky Cc: linux...@kvack.org Signed-off-by: Alexander Potapenko --- lib/Kconfig.debug | 14 ++ lib/Makefile | 2 + lib/error_report_notify.c | 278 ++ 3 files changed, 294 insertions

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

2021-01-13 Thread Alexander Potapenko
Cc: linux...@kvack.org Signed-off-by: Alexander Potapenko --- mm/kfence/report.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/kfence/report.c b/mm/kfence/report.c index 4dedc2ff8f28..5c063b5b2227 100644 --- a/mm/kfence/report.c +++ b/mm/kfence/report.c @@ -9,6 +9,7 @@ #include

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

2021-01-15 Thread Alexander Potapenko
On Thu, Jan 14, 2021 at 10:51 AM Alexander Potapenko wrote: > > On Thu, Jan 14, 2021 at 1:06 AM Andrew Morton > wrote: > > > > On Wed, 13 Jan 2021 10:16:55 +0100 Alexander Potapenko > > wrote: > > > > > With the introduction of various production erro

Re: [PATCH 1/4] tracing: add error_report trace points

2021-01-15 Thread Alexander Potapenko
On Thu, Jan 14, 2021 at 3:52 PM Steven Rostedt wrote: > > On Thu, 14 Jan 2021 08:49:57 +0100 > Alexander Potapenko wrote: > > > We'll need to explicitly list the enum values once again in > > __print_symbolic(), right? E.g.: > > > > enum debug

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

2021-01-15 Thread Alexander Potapenko
to use this new feature. v2: - added ABI documentation for /sys/kernel/error_report/ - changed error_report_start and error_report end tracepoints to take a fixed set of values for the error detector Alexander Potapenko (5): tracing: add error_report trace points lib: add

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

2021-01-15 Thread Alexander Potapenko
: Petr Mladek Cc: Steven Rostedt Cc: Sergey Senozhatsky Cc: linux...@kvack.org Signed-off-by: Alexander Potapenko --- v2: - s/memory error reports/error reports from debugging tools/ (per Andrew Morton's comment) - change error_report_start and error_report_end prototypes to accept enum

[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

[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
-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) --- include/trace/events/error_report.h | 84 + kernel/trace/Makefile

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?

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 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 15/15] kasan: don't run tests when KASAN is not enabled

2021-01-15 Thread Alexander Potapenko
s://linux-review.googlesource.com/id/I6447af436a69a94bfc35477f6bf4e2122948355e > > 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 12/15] kasan: fix bug detection via ksize for HW_TAGS mode

2021-01-15 Thread Alexander Potapenko
_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 11/15] kasan: move _RET_IP_ to inline wrappers

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

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

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

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

2021-01-15 Thread Alexander Potapenko
t 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 GmbH Erika-Mann-Straße, 33 80636 Mün

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 >

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 v2 3/5] docs: ABI: add /sys/kernel/error_report/ documentation

2021-01-18 Thread Alexander Potapenko
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 > duplicated by instances.

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 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 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(_reports); > > > + schedule_delayed_work(_done, 0); > > > > Why delayed work when it gets queued immediately? > > Because error reports may be sent from a place where waiting is >

Re: [PATCH v3 01/10] mm: add Kernel Electric-Fence infrastructure

2020-10-05 Thread Alexander Potapenko
On Tue, Sep 29, 2020 at 5:06 PM Mark Rutland wrote: > > On Tue, Sep 29, 2020 at 04:51:29PM +0200, Marco Elver wrote: > > On Tue, 29 Sep 2020 at 16:24, Mark Rutland wrote: > > [...] > > > > > > From other sub-threads it sounds like these addresses are not part of > > > the linear/direct map.

Re: [PATCH v4 05/11] mm, kfence: insert KFENCE hooks for SLUB

2020-10-05 Thread Alexander Potapenko
> > + p[i] = object; > > + continue; > > + } > > + > > + object = c->freelist; > > if (unlikely(!object)) { > > /* > > * We may have

Re: [PATCH v3 06/10] kfence, kasan: make KFENCE compatible with KASAN

2020-09-29 Thread Alexander Potapenko
On Tue, Sep 29, 2020 at 2:21 PM Andrey Konovalov wrote: > > On Mon, Sep 21, 2020 at 3:26 PM Marco Elver wrote: > > > > From: Alexander Potapenko > > > > We make KFENCE compatible with KASAN for testing KFENCE itself. In > > particular, KASAN helps to catch

Re: [PATCH v3 01/10] mm: add Kernel Electric-Fence infrastructure

2020-09-29 Thread Alexander Potapenko
On Tue, Sep 29, 2020 at 4:24 PM Mark Rutland wrote: > > On Mon, Sep 21, 2020 at 03:26:02PM +0200, Marco Elver wrote: > > From: Alexander Potapenko > > > > This adds the Kernel Electric-Fence (KFENCE) infrastructure. KFENCE is a > > low-overhead sampling-based memory

Re: [PATCH v3 03/10] arm64, kfence: enable KFENCE for ARM64

2020-09-29 Thread Alexander Potapenko
> > On x86 we just do `char __kfence_pool[KFENCE_POOL_SIZE] ...;` to > > statically allocate the pool. On arm64 this doesn't seem to work > > because static memory doesn't have struct pages? > > Are you using virt_to_page() directly on that statically-allocated > __kfence_pool? If so you'll need

Re: [PATCH v3 03/10] arm64, kfence: enable KFENCE for ARM64

2020-09-29 Thread Alexander Potapenko
> required interface in . Currently, the arm64 version does > > not yet use a statically allocated memory pool, at the cost of a pointer > > load for each is_kfence_address(). > > > > Reviewed-by: Dmitry Vyukov > > Co-developed-by: Alexander Potapenko > > Signed

Re: [PATCH RFC v2 2/6] mm/slab: Perform init_on_free earlier

2020-09-30 Thread Alexander Potapenko
er Popov Reviewed-by: Alexander Potapenko > --- > mm/slab.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/mm/slab.c b/mm/slab.c > index 3160dff6fd76..5140203c5b76 100644 > --- a/mm/slab.c > +++ b/mm/slab.c > @@ -3414,6 +3414,9 @@ static vo

Re: [PATCH v3 03/10] arm64, kfence: enable KFENCE for ARM64

2020-10-01 Thread Alexander Potapenko
Mark, > If you need virt_to_page() to work, the address has to be part of the > linear/direct map. > > If you need to find the struct page for something that's part of the > kernel image you can use virt_to_page(lm_alias(x)). > > > Looks like filling page table entries (similarly to what's being

Re: [PATCH v2 04/10] mm, kfence: insert KFENCE hooks for SLAB

2020-09-17 Thread Alexander Potapenko
using size classes, so e.g. when allocating 272 bytes the object will be padded to 512. As a result, placing that object at the end of the page won't really help to detect out-of-bound accesses that are off by less than 270 bytes. We probably need to better clarify this in the patch description. -

Re: [PATCH v2 05/10] mm, kfence: insert KFENCE hooks for SLUB

2020-09-17 Thread Alexander Potapenko
.kernel.org/linux-arm-kernel/CAG_fn=XMc8NPZPFtUE=rdoR=xjh4f+txzs-w5n4vuawktjc...@mail.gmail.com/ -- Alexander Potapenko Software Engineer Google Germany GmbH Erika-Mann-Straße, 33 80636 München Geschäftsführer: Paul Manicle, Halimah DeLaine Prado Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg

Re: [PATCH v2 0/3] add fault injection to user memory access

2020-08-31 Thread Alexander Potapenko
> This series looks good to me. Great! Which tree do fault injection patches normally go to? > Reviewed-by: Akinobu Mita Reviewed-by: Alexander Potapenko

Re: [PATCH v2 0/3] add fault injection to user memory access

2020-08-31 Thread Alexander Potapenko
Hi Andrew, On Mon, Aug 31, 2020 at 6:27 PM Akinobu Mita wrote: > > Andrew, > > Could you take a look at this series, and consider taking in -mm tree? Please consider picking v3 patches that address Peter's comments instead. > > 2020年9月1日(火) 0:49 Alexander Potapenko : >

Re: KMSAN: uninit-value in search_by_key

2020-09-21 Thread Alexander Potapenko
On Mon, Sep 21, 2020 at 12:02 PM syzbot wrote: > > Hello, > > syzbot found the following issue on: > > HEAD commit:c5a13b33 kmsan: clang-format core > git tree: https://github.com/google/kmsan.git master > console output: https://syzkaller.appspot.com/x/log.txt?x=173525ab90 > kernel

Re: [PATCH v3 03/10] arm64, kfence: enable KFENCE for ARM64

2020-09-21 Thread Alexander Potapenko
> required interface in . Currently, the arm64 version does > > not yet use a statically allocated memory pool, at the cost of a pointer > > load for each is_kfence_address(). > > > > Reviewed-by: Dmitry Vyukov > > Co-developed-by: Alexander Potapenko > > Signed

Re: [PATCH v3 03/10] arm64, kfence: enable KFENCE for ARM64

2020-09-21 Thread Alexander Potapenko
On Mon, Sep 21, 2020 at 4:58 PM Alexander Potapenko wrote: > > On Mon, Sep 21, 2020 at 4:31 PM Will Deacon wrote: > > > > On Mon, Sep 21, 2020 at 03:26:04PM +0200, Marco Elver wrote: > > > Add architecture specific implementation details for KFENCE and enable

Re: [PATCH RFC 01/10] mm: add Kernel Electric-Fence infrastructure

2020-09-10 Thread Alexander Potapenko
On Thu, Sep 10, 2020 at 5:43 PM Dmitry Vyukov wrote: > > + /* Calculate address for this allocation. */ > > + if (right) > > + meta->addr += PAGE_SIZE - size; > > + meta->addr = ALIGN_DOWN(meta->addr, cache->align); > > I would move this ALIGN_DOWN under the

Re: [PATCH v3] lib: stackdepot: Add support to configure STACK_HASH_SIZE

2020-12-11 Thread Alexander Potapenko
On Thu, Dec 10, 2020 at 6:01 AM wrote: > > From: Yogesh Lal > > Add a kernel parameter stack_hash_order to configure STACK_HASH_SIZE. > > Aim is to have configurable value for STACK_HASH_SIZE, so that one > can configure it depending on usecase there by reducing the static > memory overhead. > >

Re: [PATCH v3] lib: stackdepot: Add support to configure STACK_HASH_SIZE

2020-12-11 Thread Alexander Potapenko
On Fri, Dec 11, 2020 at 1:45 PM Vijayanand Jitta wrote: > > > > On 12/11/2020 2:06 PM, Alexander Potapenko wrote: > > On Thu, Dec 10, 2020 at 6:01 AM wrote: > >> > >> From: Yogesh Lal > >> > >> Add a kernel parameter stack_hash_order

Re: [PATCH v3] lib: stackdepot: Add support to configure STACK_HASH_SIZE

2020-12-21 Thread Alexander Potapenko
On Mon, Dec 21, 2020 at 12:15 PM Vijayanand Jitta wrote: > > > > On 12/18/2020 2:10 PM, Vijayanand Jitta wrote: > > > > > > On 12/17/2020 4:24 PM, Alexander Potapenko wrote: > >>>> Can you provide an example of a use case in which the user wants to

<    1   2   3   4   5   6   7   8   9   10   >