[PATCH v2] tracing: Add sched_prepare_exec tracepoint

2024-04-11 Thread Marco Elver
sr/bin/tty filename=/usr/bin/tty pid=385 comm=bash <...>-389 [006] . 192.020147: sched_prepare_exec: interp=/usr/bin/dmesg filename=/usr/bin/dmesg pid=389 comm=bash Signed-off-by: Marco Elver --- v2: * Add more documentation. * Also show bprm->interp in trace. * Rename to sched_prepare_exe

Re: [PATCH] tracing: Add new_exec tracepoint

2024-04-10 Thread Marco Elver
On Wed, 10 Apr 2024 at 15:56, Masami Hiramatsu wrote: > > On Mon, 8 Apr 2024 11:01:54 +0200 > Marco Elver wrote: > > > Add "new_exec" tracepoint, which is run right after the point of no > > return but before the current task assumes its new exec ident

Re: [PATCH] tracing: Add new_exec tracepoint

2024-04-10 Thread Marco Elver
On Wed, 10 Apr 2024 at 01:54, Masami Hiramatsu wrote: > > On Tue, 9 Apr 2024 16:45:47 +0200 > Marco Elver wrote: > > > On Tue, 9 Apr 2024 at 16:31, Steven Rostedt wrote: > > > > > > On Mon, 8 Apr 2024 11:01:54 +0200 > > > Marco Elver wrote: &

Re: [PATCH] tracing: Add new_exec tracepoint

2024-04-09 Thread Marco Elver
On Tue, Apr 09, 2024 at 08:46AM -0700, Kees Cook wrote: [...] > > + trace_new_exec(current, bprm); > > + > > All other steps in this function have explicit comments about > what/why/etc. Please add some kind of comment describing why the > tracepoint is where it is, etc. I beefed up the

Re: [PATCH] tracing: Add new_exec tracepoint

2024-04-09 Thread Marco Elver
On Tue, 9 Apr 2024 at 16:31, Steven Rostedt wrote: > > On Mon, 8 Apr 2024 11:01:54 +0200 > Marco Elver wrote: > > > Add "new_exec" tracepoint, which is run right after the point of no > > return but before the current task assumes its new exec ident

[PATCH] tracing: Add new_exec tracepoint

2024-04-08 Thread Marco Elver
lename=/usr/bin/tty pid=385 old_pid=385 <...>-389 [006] . 192.020147: new_exec: filename=/usr/bin/dmesg pid=389 comm=bash bash-389 [006] . 192.021377: sched_process_exec: filename=/usr/bin/dmesg pid=389 old_pid=389 Signed-off-by: Marco Elver --- fs/exe

Re: [PATCH v3 1/3] kasan: switch kunit tests to console tracepoints

2023-12-12 Thread Marco Elver
On Tue, 12 Dec 2023 at 10:19, Paul Heidekrüger wrote: > > On 12.12.2023 00:37, Andrey Konovalov wrote: > > On Tue, Dec 12, 2023 at 12:35 AM Paul Heidekrüger > > wrote: > > > > > > Using CONFIG_FTRACE=y instead of CONFIG_TRACEPOINTS=y produces the same > > > error > > > for me. > > > > > > So >

Re: [PATCH v3 1/3] kasan: switch kunit tests to console tracepoints

2023-12-11 Thread Marco Elver
On Mon, 11 Dec 2023 at 23:48, Paul Heidekrüger wrote: > > On 11.12.2023 21:51, Andrey Konovalov wrote: > > On Mon, Dec 11, 2023 at 7:59 PM Paul Heidekrüger > > wrote: > > > > > > > Hi Paul, > > > > > > > > I've been successfully running KASAN tests with CONFIG_TRACEPOINTS > > > > enabled on

Re: [PATCH] slub: Introduce CONFIG_SLUB_RCU_DEBUG

2023-09-11 Thread Marco Elver
On Fri, 25 Aug 2023 at 23:15, 'Jann Horn' via kasan-dev wrote: > > Currently, KASAN is unable to catch use-after-free in SLAB_TYPESAFE_BY_RCU > slabs because use-after-free is allowed within the RCU grace period by > design. > > Add a SLUB debugging feature which RCU-delays every individual >

Re: [PATCH v4 05/10] signal: Introduce TRAP_PERF si_code and si_perf to siginfo

2021-04-20 Thread Marco Elver
On Tue, 20 Apr 2021 at 23:26, Marek Szyprowski wrote: > > Hi Marco, > > On 08.04.2021 12:36, Marco Elver wrote: > > Introduces the TRAP_PERF si_code, and associated siginfo_t field > > si_perf. These will be used by the perf event subsystem to send signals > > (i

Re: [PATCH 1/3] kfence: await for allocation using wait_event

2021-04-19 Thread Marco Elver
On Mon, 19 Apr 2021 at 11:44, Marco Elver wrote: > > On Mon, 19 Apr 2021 at 11:41, Hillf Danton wrote: > > > > On Mon, 19 Apr 2021 10:50:25 Marco Elver wrote: > > > + > > > + WRITE_ONCE(kfence_timer_waiting, true); > > > +

Re: [PATCH 1/3] kfence: await for allocation using wait_event

2021-04-19 Thread Marco Elver
On Mon, 19 Apr 2021 at 11:41, Hillf Danton wrote: > > On Mon, 19 Apr 2021 10:50:25 Marco Elver wrote: > > + > > + WRITE_ONCE(kfence_timer_waiting, true); > > + smp_mb(); /* See comment in __kfence_alloc(). */ > > This is not needed given task state change i

[PATCH 3/3] kfence: use power-efficient work queue to run delayed work

2021-04-19 Thread Marco Elver
Use the power-efficient work queue, to avoid the pathological case where we keep pinning ourselves on the same possibly idle CPU on systems that want to be power-efficient [1]. [1] https://lwn.net/Articles/731052/ Signed-off-by: Marco Elver --- mm/kfence/core.c | 5 +++-- 1 file changed, 3

[PATCH 2/3] kfence: maximize allocation wait timeout duration

2021-04-19 Thread Marco Elver
://lkml.kernel.org/r/CADYN=9j0dqhizagb0-jz4hobbh+05kmbxb4c0cxms7qi5na...@mail.gmail.com Fix it by computing the timeout duration in terms of the current sysctl_hung_task_timeout_secs value. Signed-off-by: Marco Elver --- mm/kfence/core.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion

[PATCH 1/3] kfence: await for allocation using wait_event

2021-04-19 Thread Marco Elver
() due to the same potential for deadlock as in [1]. Instead, add a level of indirection via an irq_work that is scheduled if we determine that the kfence_timer requires a wake_up(). Fixes: 0ce20dd84089 ("mm: add Kernel Electric-Fence infrastructure") Signed-off-by: Marco Elver

[PATCH 0/3] kfence: optimize timer scheduling

2021-04-19 Thread Marco Elver
remaining as scheduling friendly and power efficient as possible. Crucially, we need to defer the wake_up() to an irq_work, avoiding any potential for deadlock. The result with this series is that on the devices where we observed a power regression, power usage returns back to baseline levels. M

[tip: perf/core] perf: Apply PERF_EVENT_IOC_MODIFY_ATTRIBUTES to children

2021-04-16 Thread tip-bot2 for Marco Elver
The following commit has been merged into the perf/core branch of tip: Commit-ID: 47f661eca0700928012e11c57ea0328f5ccfc3b9 Gitweb: https://git.kernel.org/tip/47f661eca0700928012e11c57ea0328f5ccfc3b9 Author:Marco Elver AuthorDate:Thu, 08 Apr 2021 12:35:57 +02:00 Committer

[tip: perf/core] perf: Support only inheriting events if cloned with CLONE_THREAD

2021-04-16 Thread tip-bot2 for Marco Elver
The following commit has been merged into the perf/core branch of tip: Commit-ID: 2b26f0aa004995f49f7b6f4100dd0e4c39a9ed5f Gitweb: https://git.kernel.org/tip/2b26f0aa004995f49f7b6f4100dd0e4c39a9ed5f Author:Marco Elver AuthorDate:Thu, 08 Apr 2021 12:35:58 +02:00 Committer

[tip: perf/core] signal: Introduce TRAP_PERF si_code and si_perf to siginfo

2021-04-16 Thread tip-bot2 for Marco Elver
The following commit has been merged into the perf/core branch of tip: Commit-ID: fb6cc127e0b6e629252cdd0f77d5a1f49db95b92 Gitweb: https://git.kernel.org/tip/fb6cc127e0b6e629252cdd0f77d5a1f49db95b92 Author:Marco Elver AuthorDate:Thu, 08 Apr 2021 12:36:00 +02:00 Committer

[tip: perf/core] perf: Add support for SIGTRAP on perf events

2021-04-16 Thread tip-bot2 for Marco Elver
The following commit has been merged into the perf/core branch of tip: Commit-ID: 97ba62b278674293762c3d91f724f1bb922f04e0 Gitweb: https://git.kernel.org/tip/97ba62b278674293762c3d91f724f1bb922f04e0 Author:Marco Elver AuthorDate:Thu, 08 Apr 2021 12:36:01 +02:00 Committer

[tip: perf/core] perf: Add support for event removal on exec

2021-04-16 Thread tip-bot2 for Marco Elver
The following commit has been merged into the perf/core branch of tip: Commit-ID: 2e498d0a74e5b88a6689ae1b811f247f91ff188e Gitweb: https://git.kernel.org/tip/2e498d0a74e5b88a6689ae1b811f247f91ff188e Author:Marco Elver AuthorDate:Thu, 08 Apr 2021 12:35:59 +02:00 Committer

[tip: perf/core] selftests/perf_events: Add kselftest for process-wide sigtrap handling

2021-04-16 Thread tip-bot2 for Marco Elver
The following commit has been merged into the perf/core branch of tip: Commit-ID: f2c3c32f45002de19c6dec33f32fd259e82f2557 Gitweb: https://git.kernel.org/tip/f2c3c32f45002de19c6dec33f32fd259e82f2557 Author:Marco Elver AuthorDate:Thu, 08 Apr 2021 12:36:02 +02:00 Committer

[tip: perf/core] selftests/perf_events: Add kselftest for remove_on_exec

2021-04-16 Thread tip-bot2 for Marco Elver
The following commit has been merged into the perf/core branch of tip: Commit-ID: 6216798bf98e82c382922f1b71ecc4a13d6e65cb Gitweb: https://git.kernel.org/tip/6216798bf98e82c382922f1b71ecc4a13d6e65cb Author:Marco Elver AuthorDate:Thu, 08 Apr 2021 12:36:03 +02:00 Committer

Re: [PATCH v4 2/3] mm/slub, kunit: add a KUnit test for SLUB debugging functionality

2021-04-15 Thread Marco Elver
On Thu, 15 Apr 2021 at 12:38, Vlastimil Babka wrote: > > On 4/15/21 12:10 PM, Oliver Glitta wrote: > > ut 13. 4. 2021 o 15:54 Marco Elver napísal(a): > >> > >> On Tue, 13 Apr 2021 at 12:07, wrote: > >> > From: Oliver Glitta > >> > >

Re: [peterz-queue:perf/core 18/22] kernel/events/core.c:6418:22: sparse: sparse: incorrect type in assignment (different address spaces)

2021-04-15 Thread Marco Elver
On Thu, Apr 15, 2021 at 10:48AM +0200, Peter Zijlstra wrote: > On Wed, Apr 14, 2021 at 04:33:22PM +0200, Marco Elver wrote: > > On Wed, Apr 14, 2021 at 10:10PM +0800, kernel test robot wrote: > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git > >

Re: [peterz-queue:perf/core 18/22] kernel/events/core.c:6418:22: sparse: sparse: incorrect type in assignment (different address spaces)

2021-04-14 Thread Marco Elver
info.si_addr = (void *)event->sig_addr; > 6419force_sig_info(); I think it wants the below (feel free to squash into "perf: Add support for SIGTRAP on perf events"). Thanks, -- Marco -- >8 -- From: Marco Elver Date: Wed, 14 Apr 2021 16:26:26 +0

[PATCH 8/9] kcsan: Report observed value changes

2021-04-14 Thread Marco Elver
ed" and "bits changed" lines, which required massaging the message; do not print bits+mask if no mask set. ] Signed-off-by: Marco Elver --- kernel/kcsan/core.c | 5 +++-- kernel/kcsan/kcsan.h | 6 -- kernel/kcsan/report.c | 31 ++- 3 f

[PATCH 9/9] kcsan: Document "value changed" line

2021-04-14 Thread Marco Elver
Update the example reports based on the latest reports generated by kcsan_test module, which now include the "value changed" line. Add a brief description of the "value changed" line. Signed-off-by: Marco Elver --- Documentation/dev-tools/kcsan.rst | 88 ---

[PATCH 7/9] kcsan: Remove kcsan_report_type

2021-04-14 Thread Marco Elver
...@google.com: add updated comments to kcsan_report_*() functions ] Signed-off-by: Marco Elver --- kernel/kcsan/kcsan.h | 33 + kernel/kcsan/report.c | 29 +++-- 2 files changed, 20 insertions(+), 42 deletions(-) diff --git a/kernel/kcsan/kcsan.h b

[PATCH 4/9] kcsan: Fold panic() call into print_report()

2021-04-14 Thread Marco Elver
From: Mark Rutland So that we can add more callers of print_report(), lets fold the panic() call into print_report() so the caller doesn't have to handle this explicitly. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland Signed-off-by: Marco Elver

[PATCH 2/9] kcsan: Distinguish kcsan_report() calls

2021-04-14 Thread Marco Elver
this. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland [ el...@google.com: try to make kcsan_report_*() names more descriptive ] Signed-off-by: Marco Elver --- kernel/kcsan/core.c | 12 kernel/kcsan/kcsan.h | 10 ++ kernel/kcsan/report.c | 26

[PATCH 1/9] kcsan: Simplify value change detection

2021-04-14 Thread Marco Elver
, which makes the code a little easier to read, and will permit reporting the old/new values in subsequent patches. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland Signed-off-by: Marco Elver --- kernel/kcsan/core.c | 40

[PATCH 3/9] kcsan: Refactor passing watchpoint/other_info

2021-04-14 Thread Marco Elver
(). Other than the removal of the check, there should be no functional change as a result of this patch. Signed-off-by: Mark Rutland Signed-off-by: Marco Elver --- kernel/kcsan/report.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/kernel/kcsan/report.c b/kernel

[PATCH 6/9] kcsan: Remove reporting indirection

2021-04-14 Thread Marco Elver
to read, and will permit passing distinct bits of information to print_report() in future. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland [ el...@google.com: retain comment about lockdep_off() ] Signed-off-by: Marco Elver --- kernel/kcsan/report.c | 115

[PATCH 5/9] kcsan: Refactor access_info initialization

2021-04-14 Thread Marco Elver
` as a parameter to kcsan_report(). There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland Signed-off-by: Marco Elver --- kernel/kcsan/report.c | 42 +- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/kernel

[PATCH 0/9] kcsan: Add support for reporting observed value changes

2021-04-14 Thread Marco Elver
riginal draft of the series, it required a rebase and re-test. To not be forgotten and get these changes in sooner than later, Mark kindly agreed to me adopting the series and doing the rebase, a few minor tweaks, and finally re-test. Marco Elver (1): kcsan: Document "value changed"

Re: [PATCH v2] Documentation: dev-tools: Add Testing Overview

2021-04-14 Thread Marco Elver
worth at least having something. Hopefully > this can form the basis for more detailed documentation later. > > Signed-off-by: David Gow Reviewed-by: Marco Elver Looks good to me, thanks. I think one can write whole articles (or even books) about this topic, so it's easy to forget this is a

Re: [PATCH v4 2/3] mm/slub, kunit: add a KUnit test for SLUB debugging functionality

2021-04-13 Thread Marco Elver
e nice if we could run some of these tests with KASAN as well. > Use kunit_resource to count errors in cache and silence bug reports. > Count error whenever slab_bug() or slab_fix() is called or when > the count of pages is wrong. > > Signed-off-by: Oliver Glitta Reviewed-by: Marco

Re: KCSAN: data-race in __jbd2_journal_file_buffer / jbd2_journal_dirty_metadata

2021-04-12 Thread Marco Elver
On Tue, Apr 06, 2021 at 11:01AM -0400, Theodore Ts'o wrote: > On Tue, Apr 06, 2021 at 02:32:33PM +0200, Jan Kara wrote: > > And the comment explains, why we do this unreliable check. Again, if we > > wanted to silence KCSAN, we could use data_race() macro but AFAIU Ted isn't > > very fond of that

Re: [PATCH] Documentation: dev-tools: Add Testing Overview

2021-04-12 Thread Marco Elver
On Sat, 10 Apr 2021 at 13:53, Daniel Latypov wrote: > On Sat, Apr 10, 2021 at 12:05 AM David Gow wrote: [...] > > + > > + > > +Sanitizers > > +== > > + The "sanitizers" have originally been a group of tools that relied on compiler instrumentation to perform various dynamic analysis

[tip: locking/core] kcsan, debugfs: Move debugfs file creation out of early init

2021-04-11 Thread tip-bot2 for Marco Elver
The following commit has been merged into the locking/core branch of tip: Commit-ID: e36299efe7d749976fbdaaf756dee6ef32543c2c Gitweb: https://git.kernel.org/tip/e36299efe7d749976fbdaaf756dee6ef32543c2c Author:Marco Elver AuthorDate:Wed, 03 Mar 2021 10:38:45 +01:00

[tip: locking/core] kcsan: Make test follow KUnit style recommendations

2021-04-11 Thread tip-bot2 for Marco Elver
The following commit has been merged into the locking/core branch of tip: Commit-ID: a146fed56f8a06a6f17ac11ebdc7ca3f396bcb55 Gitweb: https://git.kernel.org/tip/a146fed56f8a06a6f17ac11ebdc7ca3f396bcb55 Author:Marco Elver AuthorDate:Wed, 13 Jan 2021 17:05:56 +01:00

[tip: locking/core] kcsan: Switch to KUNIT_CASE_PARAM for parameterized tests

2021-04-11 Thread tip-bot2 for Marco Elver
The following commit has been merged into the locking/core branch of tip: Commit-ID: f6a149140321274cbd955dee50798fe191841f94 Gitweb: https://git.kernel.org/tip/f6a149140321274cbd955dee50798fe191841f94 Author:Marco Elver AuthorDate:Wed, 13 Jan 2021 17:05:57 +01:00

[tip: locking/core] kcsan: Add missing license and copyright headers

2021-04-11 Thread tip-bot2 for Marco Elver
The following commit has been merged into the locking/core branch of tip: Commit-ID: bd0ccc4afca2d6ae0029cae35c4f1d2e2ade7579 Gitweb: https://git.kernel.org/tip/bd0ccc4afca2d6ae0029cae35c4f1d2e2ade7579 Author:Marco Elver AuthorDate:Fri, 15 Jan 2021 18:09:53 +01:00

[PATCH v4 10/10] perf test: Add basic stress test for sigtrap handling

2021-04-08 Thread Marco Elver
-off-by: Marco Elver --- v4: * Update for new perf_event_attr::sig_data / si_perf handling. v3: * Added to series (per suggestion from Ian Rogers). --- tools/perf/tests/Build | 1 + tools/perf/tests/builtin-test.c | 5 ++ tools/perf/tests/sigtrap.c | 150

[PATCH v4 09/10] tools headers uapi: Sync tools/include/uapi/linux/perf_event.h

2021-04-08 Thread Marco Elver
Sync tool's uapi to pick up the changes adding inherit_thread, remove_on_exec, and sigtrap fields to perf_event_attr. Signed-off-by: Marco Elver --- v4: * Update for new perf_event_attr::sig_data. v3: * Added to series. --- tools/include/uapi/linux/perf_event.h | 12 +++- 1 file

[PATCH v4 08/10] selftests/perf_events: Add kselftest for remove_on_exec

2021-04-08 Thread Marco Elver
Add kselftest to test that remove_on_exec removes inherited events from child tasks. Signed-off-by: Marco Elver --- v3: * Fix for latest libc signal.h. v2: * Add patch to series. --- .../testing/selftests/perf_events/.gitignore | 1 + tools/testing/selftests/perf_events/Makefile | 2

[PATCH v4 06/10] perf: Add support for SIGTRAP on perf events

2021-04-08 Thread Marco Elver
/ybv3rat566k+6...@hirez.programming.kicks-ass.net/ Suggested-by: Peter Zijlstra Acked-by: Dmitry Vyukov Signed-off-by: Marco Elver --- v4: * Generalize setting si_perf and si_addr independent of event type; introduces perf_event_attr::sig_data, which can be set by user space to be propagated to si_perf

[PATCH v4 07/10] selftests/perf_events: Add kselftest for process-wide sigtrap handling

2021-04-08 Thread Marco Elver
framework provides. Signed-off-by: Marco Elver --- v4: * Update for new perf_event_attr::sig_data / si_perf handling. v3: * Fix for latest libc signal.h. v2: * Patch added to series. --- .../testing/selftests/perf_events/.gitignore | 2 + tools/testing/selftests/perf_events/Makefile | 6 + too

[PATCH v4 04/10] perf: Add support for event removal on exec

2021-04-08 Thread Marco Elver
Signed-off-by: Marco Elver --- v3: * Rework based on Peter's "perf: Rework perf_event_exit_event()" added to the beginning of the series. Intermediate attempts between v2 and this v3 can be found here: https://lkml.kernel.org/r/yfm6aaksrlf2n...@elver.google.com v2: *

[PATCH v4 05/10] signal: Introduce TRAP_PERF si_code and si_perf to siginfo

2021-04-08 Thread Marco Elver
Introduces the TRAP_PERF si_code, and associated siginfo_t field si_perf. These will be used by the perf event subsystem to send signals (if requested) to the task where an event occurred. Acked-by: Geert Uytterhoeven # m68k Acked-by: Arnd Bergmann # asm-generic Signed-off-by: Marco Elver

[PATCH v4 03/10] perf: Support only inheriting events if cloned with CLONE_THREAD

2021-04-08 Thread Marco Elver
environment. Link: https://lore.kernel.org/lkml/ybvj6ejr%2fdy2t...@hirez.programming.kicks-ass.net/ Suggested-by: Peter Zijlstra Signed-off-by: Marco Elver --- v2: * Add patch to series. --- include/linux/perf_event.h | 5 +++-- include/uapi/linux/perf_event.h | 3 ++- kernel/events/core.c

[PATCH v4 02/10] perf: Apply PERF_EVENT_IOC_MODIFY_ATTRIBUTES to children

2021-04-08 Thread Marco Elver
As with other ioctls (such as PERF_EVENT_IOC_{ENABLE,DISABLE}), fix up handling of PERF_EVENT_IOC_MODIFY_ATTRIBUTES to also apply to children. Suggested-by: Dmitry Vyukov Reviewed-by: Dmitry Vyukov Signed-off-by: Marco Elver --- kernel/events/core.c | 22 +- 1 file changed

[PATCH v4 01/10] perf: Rework perf_event_exit_event()

2021-04-08 Thread Marco Elver
not find a half baked event. To address this, teach perf_remove_from_context() to special case !ctx->is_active and about DETACH_CHILD. Signed-off-by: Peter Zijlstra (Intel) [ el...@google.com: fix racing parent/child exit in sync_child_event(). ] Signed-off-by: Marco Elver --- v4: * Fix for par

[PATCH v4 00/10] Add support for synchronous signals on perf events

2021-04-08 Thread Marco Elver
Zijlstra in [3]. [2] https://lore.kernel.org/lkml/CACT4Y+YPrXGw+AtESxAgPyZ84TYkNZdP0xpocX2jwVAbZD=-x...@mail.gmail.com/ [3] https://lore.kernel.org/lkml/ybv3rat566k+6...@hirez.programming.kicks-ass.net/ Marco Elver (9): perf: Apply PERF_EVENT_IOC_MODIFY_ATTRIBUTES to children perf: Support on

Re: [PATCH v3 1/2] kunit: add a KUnit test for SLUB debugging functionality

2021-04-08 Thread Marco Elver
On Tue, 6 Apr 2021 at 12:57, Vlastimil Babka wrote: > > > On 4/1/21 11:24 PM, Marco Elver wrote: > > On Thu, 1 Apr 2021 at 21:04, Daniel Latypov wrote: > >> > } > >> > #else > >> > static inline bool slab_add_kunit_e

Re: [PATCH v2] kasan: fix kasan_byte_accessible() to be consistent with actual checks

2021-04-05 Thread Marco Elver
dow_byte; > > > > - return (shadow_byte != KASAN_TAG_INVALID) && > > - (tag == KASAN_TAG_KERNEL || tag == shadow_byte); > > + if (untagged_addr < kasan_shadow_to_mem((void *)KASAN_SHADOW_START)) > > + return false; > > + > > + shadow_byte = READ_ONCE(*(u8 *)kasan_mem_to_shadow(untagged_addr)); > > + return tag == KASAN_TAG_KERNEL || tag == shadow_byte; > > } > > > > #define DEFINE_HWASAN_LOAD_STORE(size) \ > > -- > > 2.31.0.208.g409f899ff0-goog > > > > Reviewed-by: Andrey Konovalov > > Thank you, Peter! Reviewed-by: Marco Elver Thanks!

Re: [PATCH] kfence: unpoison pool region before use

2021-04-03 Thread Marco Elver
On Sat, 3 Apr 2021 at 22:40, Peter Collingbourne wrote: > On Sat, Apr 3, 2021 at 3:03 AM Marco Elver wrote: > > On Sat, 3 Apr 2021 at 07:13, Peter Collingbourne wrote: > > > If the memory region allocated by KFENCE had previously been poisoned, > > > any

Re: [PATCH] kfence: unpoison pool region before use

2021-04-03 Thread Marco Elver
On Sat, 3 Apr 2021 at 16:05, Andrey Konovalov wrote: ... > Which kasan_byte_accessible() call fails? > > KASAN checks shouldn't be performed for KFENCE objects. We have a > number of is_kfence_address() checks in KASAN runtime, but maybe we're > missing some. Perhaps, we should even move those

Re: [PATCH] kfence: unpoison pool region before use

2021-04-03 Thread Marco Elver
SAN (generic, SW_TAGS, and HW_TAGS) to syzkaller testing and ran kfence_test: Tested-by: Marco Elver However, it is unclear to me under which circumstances we actually need this, i.e. something would grab some memblock memory, somehow poison it, and then release the memory back du

Re: [PATCH v3 1/2] kunit: add a KUnit test for SLUB debugging functionality

2021-04-01 Thread Marco Elver
On Thu, 1 Apr 2021 at 21:04, Daniel Latypov wrote: ... > > > --- a/include/linux/slub_def.h > > > +++ b/include/linux/slub_def.h > > > @@ -133,6 +133,8 @@ struct kmem_cache { > > > unsigned int usersize; /* Usercopy region size */ > > > > > > struct kmem_cache_node

Re: [PATCH v3 1/2] kunit: add a KUnit test for SLUB debugging functionality

2021-04-01 Thread Marco Elver
: Oliver Glitta > --- > Changes since v2 > > Use bit operation & instead of logical && as reported by kernel test > robot and Dan Carpenter > > Changes since v1 > > Conversion from kselftest to KUnit test suggested by Marco Elver. > Error silencing

Re: [PATCH] kasan: detect false-positives in tests

2021-03-31 Thread Marco Elver
unit_add_named_resource() call is moved to kasan_test_init(), and the > value of fail_data.report_expected is kept as false in between > KUNIT_EXPECT_KASAN_FAIL() annotations for consistency. > > Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver Thank you! > --- > lib/test_kasan.c |

Re: [PATCH v3 06/11] perf: Add support for SIGTRAP on perf events

2021-03-31 Thread Marco Elver
On Wed, 31 Mar 2021 at 16:51, Peter Zijlstra wrote: > On Wed, Mar 31, 2021 at 02:32:58PM +0200, Marco Elver wrote: > > On Mon, 29 Mar 2021 at 14:07, Peter Zijlstra wrote: > > > > > (and we might already have a problem on some architectures where there > > >

Re: [PATCH v3 06/11] perf: Add support for SIGTRAP on perf events

2021-03-31 Thread Marco Elver
On Mon, 29 Mar 2021 at 14:07, Peter Zijlstra wrote: > (and we might already have a problem on some architectures where there > can be significant time between these due to not having > arch_irq_work_raise(), so ideally we ought to double check current in > your case) I missed this bit -- just

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

2021-03-30 Thread Marco Elver
-by: Marco Elver --- arch/x86/include/asm/kfence.h | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/kfence.h b/arch/x86/include/asm/kfence.h index 97bbb4a9083a..05b48b33baf0 100644 --- a/arch/x86/include/asm/kfence.h +++ b/arch/x86/include/asm/kfence.h

Re: I915 CI-run with kfence enabled, issues found

2021-03-29 Thread Marco Elver
On Mon, 29 Mar 2021 at 23:47, Andy Lutomirski wrote: > > > > On Mar 29, 2021, at 2:34 PM, Marco Elver wrote: > > > > On Mon, 29 Mar 2021 at 23:03, Dave Hansen wrote: > >>> On 3/29/21 10:45 AM, Marco Elver wrote: > >>>> On Mon, 29 Mar 2021

Re: I915 CI-run with kfence enabled, issues found

2021-03-29 Thread Marco Elver
On Mon, 29 Mar 2021 at 23:03, Dave Hansen wrote: > On 3/29/21 10:45 AM, Marco Elver wrote: > > On Mon, 29 Mar 2021 at 19:32, Dave Hansen wrote: > > Doing it to all CPUs is too expensive, and we can tolerate this being > > approximate (nothing bad will happen, KFENCE

Re: [PATCH v3 06/11] perf: Add support for SIGTRAP on perf events

2021-03-29 Thread Marco Elver
On Mon, 29 Mar 2021 at 16:27, Oleg Nesterov wrote: > On 03/29, Peter Zijlstra wrote: > > > > On Thu, Mar 25, 2021 at 09:14:39AM +0100, Marco Elver wrote: > > > @@ -6395,6 +6395,13 @@ static void perf_sigtrap(struct perf_event *event) > > > { >

Re: I915 CI-run with kfence enabled, issues found

2021-03-29 Thread Marco Elver
On Mon, 29 Mar 2021 at 19:32, Dave Hansen wrote: > > On 3/29/21 9:40 AM, Marco Elver wrote: > > It looks like the code path from flush_tlb_one_kernel() to > > invalidate_user_asid()'s this_cpu_ptr() has several feature checks, so > > probably some feature differen

Re: I915 CI-run with kfence enabled, issues found

2021-03-29 Thread Marco Elver
[+Cc x86 maintainers] On Mon, Mar 29, 2021 at 11:11AM +, Sarvela, Tomi P wrote: > Hello, > > I'm Tomi Sarvela, maintainer and original creator of linux i915-CI: > https://intel-gfx-ci.01.org/ > > I got a hint from Martin Peres about kfence functionality in kernel, and it > looked >

Re: [PATCH v3 06/11] perf: Add support for SIGTRAP on perf events

2021-03-29 Thread Marco Elver
On Mon, 29 Mar 2021 at 16:27, Oleg Nesterov wrote: > On 03/29, Peter Zijlstra wrote: > > > > On Thu, Mar 25, 2021 at 09:14:39AM +0100, Marco Elver wrote: > > > @@ -6395,6 +6395,13 @@ static void perf_sigtrap(struct perf_event *event) > > > { >

Re: [PATCH v3 01/11] perf: Rework perf_event_exit_event()

2021-03-25 Thread Marco Elver
On Thu, Mar 25, 2021 at 05:17PM +0100, Marco Elver wrote: [...] > > syzkaller found a crash with stack trace pointing at changes in this > > patch. Can't tell if this is an old issue or introduced in this series. > > Yay, I found a reproducer. v5.12-rc4 is good, and sadly wi

Re: [PATCH v3 01/11] perf: Rework perf_event_exit_event()

2021-03-25 Thread Marco Elver
On Thu, Mar 25, 2021 at 11:17AM +0100, Marco Elver wrote: > On Wed, Mar 24, 2021 at 12:24PM +0100, Marco Elver wrote: > > From: Peter Zijlstra > > > > Make perf_event_exit_event() more robust, such that we can use it from > > other contexts. Specifically the u

Re: [PATCH v3 07/11] perf: Add breakpoint information to siginfo on SIGTRAP

2021-03-25 Thread Marco Elver
On Thu, 25 Mar 2021 at 15:18, Ingo Molnar wrote: > > * Dmitry Vyukov wrote: > > > On Wed, Mar 24, 2021 at 3:05 PM Marco Elver wrote: > > > > > > On Wed, 24 Mar 2021 at 15:01, Peter Zijlstra wrote: > > > > > > > > One last try, I'll leav

Re: [PATCH v3 01/11] perf: Rework perf_event_exit_event()

2021-03-25 Thread Marco Elver
On Wed, Mar 24, 2021 at 12:24PM +0100, Marco Elver wrote: > From: Peter Zijlstra > > Make perf_event_exit_event() more robust, such that we can use it from > other contexts. Specifically the up and coming remove_on_exec. > > For this to work we need to address a few issu

Re: [PATCH v3 06/11] perf: Add support for SIGTRAP on perf events

2021-03-25 Thread Marco Elver
On Wed, Mar 24, 2021 at 12:24PM +0100, Marco Elver wrote: [...] > diff --git a/kernel/events/core.c b/kernel/events/core.c > index b6434697c516..1e4c949bf75f 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -6391,6 +6391,17 @@ void perf_event_wakeup(struct pe

Re: [PATCH v3 07/11] perf: Add breakpoint information to siginfo on SIGTRAP

2021-03-25 Thread Marco Elver
On Wed, 24 Mar 2021 at 15:15, Dmitry Vyukov wrote: > On Wed, Mar 24, 2021 at 3:12 PM Dmitry Vyukov wrote: > > > On Wed, 24 Mar 2021 at 15:01, Peter Zijlstra wrote: > > > > > > > > One last try, I'll leave it alone now, I promise :-) > > > > > > This looks like it does what you suggested,

Re: [PATCH] kernel: kcov: fix a typo in comment

2021-03-24 Thread Marco Elver
On Thu, 25 Mar 2021 at 00:04, Andrew Morton wrote: > On Tue, 23 Mar 2021 23:32:57 +0100 Marco Elver wrote: > > On Tue, 23 Mar 2021 at 07:45, 'Dmitry Vyukov' via kasan-dev > > wrote: > > > On Tue, Mar 23, 2021 at 7:24 AM tl455047 wrote: > > >

Re: [PATCH v3 07/11] perf: Add breakpoint information to siginfo on SIGTRAP

2021-03-24 Thread Marco Elver
On Wed, 24 Mar 2021 at 15:01, Peter Zijlstra wrote: > > One last try, I'll leave it alone now, I promise :-) This looks like it does what you suggested, thanks! :-) I'll still need to think about it, because of the potential problem with modify-signal-races and what the user's synchronization

Re: [PATCH v3 07/11] perf: Add breakpoint information to siginfo on SIGTRAP

2021-03-24 Thread Marco Elver
On Wed, 24 Mar 2021 at 14:21, Peter Zijlstra wrote: > > On Wed, Mar 24, 2021 at 02:01:56PM +0100, Peter Zijlstra wrote: > > On Wed, Mar 24, 2021 at 01:53:48PM +0100, Peter Zijlstra wrote: > > > On Wed, Mar 24, 2021 at 12:24:59PM +0100, Marco Elver wrote: > > > > E

[PATCH v3 10/11] tools headers uapi: Sync tools/include/uapi/linux/perf_event.h

2021-03-24 Thread Marco Elver
Sync tool's uapi to pick up the changes adding inherit_thread, remove_on_exec, and sigtrap fields to perf_event_attr. Signed-off-by: Marco Elver --- v3: * Added to series. --- tools/include/uapi/linux/perf_event.h | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools

[PATCH v3 09/11] selftests/perf_events: Add kselftest for remove_on_exec

2021-03-24 Thread Marco Elver
Add kselftest to test that remove_on_exec removes inherited events from child tasks. Signed-off-by: Marco Elver --- v3: * Fix for latest libc signal.h. v2: * Add patch to series. --- .../testing/selftests/perf_events/.gitignore | 1 + tools/testing/selftests/perf_events/Makefile | 2

[PATCH v3 11/11] perf test: Add basic stress test for sigtrap handling

2021-03-24 Thread Marco Elver
-off-by: Marco Elver --- v3: * Added to series (per suggestion from Ian Rogers). --- tools/perf/tests/Build | 1 + tools/perf/tests/builtin-test.c | 5 ++ tools/perf/tests/sigtrap.c | 148 tools/perf/tests/tests.h| 1 + 4 files changed

[PATCH v3 07/11] perf: Add breakpoint information to siginfo on SIGTRAP

2021-03-24 Thread Marco Elver
to user space. Signed-off-by: Marco Elver --- v2: * Add comment about si_perf==0. --- kernel/events/core.c | 16 1 file changed, 16 insertions(+) diff --git a/kernel/events/core.c b/kernel/events/core.c index 1e4c949bf75f..0316d39e8c8f 100644 --- a/kernel/events/core.c +++ b

[PATCH v3 06/11] perf: Add support for SIGTRAP on perf events

2021-03-24 Thread Marco Elver
synchronous signals on perf events in the task where an event (such as breakpoints) triggered. Link: https://lore.kernel.org/lkml/ybv3rat566k+6...@hirez.programming.kicks-ass.net/ Suggested-by: Peter Zijlstra Acked-by: Dmitry Vyukov Signed-off-by: Marco Elver --- v2: * Use atomic_set(_count, 1

[PATCH v3 08/11] selftests/perf_events: Add kselftest for process-wide sigtrap handling

2021-03-24 Thread Marco Elver
framework provides. Signed-off-by: Marco Elver --- v3: * Fix for latest libc signal.h. v2: * Patch added to series. --- .../testing/selftests/perf_events/.gitignore | 2 + tools/testing/selftests/perf_events/Makefile | 6 + tools/testing/selftests/perf_events/config| 1 + tools/testing

[PATCH v3 05/11] signal: Introduce TRAP_PERF si_code and si_perf to siginfo

2021-03-24 Thread Marco Elver
Introduces the TRAP_PERF si_code, and associated siginfo_t field si_perf. These will be used by the perf event subsystem to send signals (if requested) to the task where an event occurred. Acked-by: Geert Uytterhoeven # m68k Acked-by: Arnd Bergmann # asm-generic Signed-off-by: Marco Elver

[PATCH v3 04/11] perf: Add support for event removal on exec

2021-03-24 Thread Marco Elver
Signed-off-by: Marco Elver --- v3: * Rework based on Peter's "perf: Rework perf_event_exit_event()" added to the beginning of the series. Intermediate attempts between v2 and this v3 can be found here: https://lkml.kernel.org/r/yfm6aaksrlf2n...@elver.google.com v2: *

[PATCH v3 03/11] perf: Support only inheriting events if cloned with CLONE_THREAD

2021-03-24 Thread Marco Elver
environment. Link: https://lore.kernel.org/lkml/ybvj6ejr%2fdy2t...@hirez.programming.kicks-ass.net/ Suggested-by: Peter Zijlstra Signed-off-by: Marco Elver --- v2: * Add patch to series. --- include/linux/perf_event.h | 5 +++-- include/uapi/linux/perf_event.h | 3 ++- kernel/events/core.c

[PATCH v3 02/11] perf: Apply PERF_EVENT_IOC_MODIFY_ATTRIBUTES to children

2021-03-24 Thread Marco Elver
-by: Marco Elver --- kernel/events/core.c | 22 +- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 57de8d436efd..37d106837962 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -3199,16 +3199,36 @@ static

[PATCH v3 01/11] perf: Rework perf_event_exit_event()

2021-03-24 Thread Marco Elver
not find a half baked event. To address this, teach perf_remove_from_context() to special case !ctx->is_active and about DETACH_CHILD. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Marco Elver --- v3: * New dependency for series: https://lkml.kernel.org/r/YFn/i3akf+

[PATCH v3 00/11] Add support for synchronous signals on perf events

2021-03-24 Thread Marco Elver
kNZdP0xpocX2jwVAbZD=-x...@mail.gmail.com/ [3] https://lore.kernel.org/lkml/ybv3rat566k+6...@hirez.programming.kicks-ass.net/ Marco Elver (10): perf: Apply PERF_EVENT_IOC_MODIFY_ATTRIBUTES to children perf: Support only inheriting events if cloned with CLONE_THREAD perf: Add support for event removal on exec

Re: [PATCH] kernel: kcov: fix a typo in comment

2021-03-23 Thread Marco Elver
On Tue, 23 Mar 2021 at 07:45, 'Dmitry Vyukov' via kasan-dev wrote: > On Tue, Mar 23, 2021 at 7:24 AM tl455047 wrote: > > > > Fixed a typo in comment. > > > > Signed-off-by: tl455047 > > Reviewed-by: Dmitry Vyukov > > +Andrew, linux-mm as KCOV patches are generally merged into mm. > > Thanks

Re: [PATCH RFC v2 8/8] selftests/perf: Add kselftest for remove_on_exec

2021-03-23 Thread Marco Elver
On Tue, Mar 23, 2021 at 10:47AM +0100, Marco Elver wrote: > On Tue, 23 Mar 2021 at 04:10, Ian Rogers wrote: > > On Mon, Mar 22, 2021 at 6:24 AM Marco Elver wrote: > > > On Wed, Mar 10, 2021 at 11:41AM +0100, Marco Elver wrote: > > > > Add kselftest to test that re

Re: [PATCH RFC v2 8/8] selftests/perf: Add kselftest for remove_on_exec

2021-03-23 Thread Marco Elver
On Tue, Mar 23, 2021 at 03:45PM +0100, Peter Zijlstra wrote: > On Tue, Mar 23, 2021 at 11:32:03AM +0100, Peter Zijlstra wrote: > > And at that point there's very little value in still using > > perf_event_exit_event()... let me see if there's something to be done > > about that. > > I ended up

Re: [PATCH] kasan: fix hwasan build for gcc

2021-03-23 Thread Marco Elver
mmand line arguments use llvm specific syntax. > > Change it to use the cc-param macro instead, which works on both > clang and gcc. > > Signed-off-by: Arnd Bergmann Reviewed-by: Marco Elver Although I think you need to rebase against either -mm or -next, because there have

Re: [PATCH RFC v2 8/8] selftests/perf: Add kselftest for remove_on_exec

2021-03-23 Thread Marco Elver
On Tue, Mar 23, 2021 at 11:41AM +0100, Marco Elver wrote: > On Tue, 23 Mar 2021 at 11:32, Peter Zijlstra wrote: [...] > > > + if (parent_event) { > > > /* > > > + * Remove event fr

Re: [PATCH RFC v2 8/8] selftests/perf: Add kselftest for remove_on_exec

2021-03-23 Thread Marco Elver
On Tue, 23 Mar 2021 at 11:32, Peter Zijlstra wrote: > > On Tue, Mar 23, 2021 at 10:52:41AM +0100, Marco Elver wrote: > > > with efs->func==__perf_event_enable. I believe it's sufficient to add > > > > mutex_lock(_event->child_mutex); &g

Re: [PATCH RFC v2 8/8] selftests/perf: Add kselftest for remove_on_exec

2021-03-23 Thread Marco Elver
On Mon, Mar 22, 2021 at 05:42PM +0100, Peter Zijlstra wrote: > On Mon, Mar 22, 2021 at 02:24:40PM +0100, Marco Elver wrote: > > To make compatible with more recent libc, we'll need to fixup the tests > > with the below. > > OK, that reprodiced things here, thanks!

  1   2   3   4   5   6   7   8   9   10   >