[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzaCmCM5zuSrtUDvR8Y+nf=3FF8+mSjQHytn=N5fBZV40w@mail.gmail.com>
Date: Fri, 5 Nov 2021 11:54:27 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Alan Maguire <alan.maguire@...cle.com>
Cc: ardb@...nel.org, Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Alexei Starovoitov <ast@...nel.org>,
Zi Shen Lim <zlim.lnx@...il.com>,
Andrii Nakryiko <andrii@...nel.org>, Martin Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
john fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, andreyknvl@...il.com,
vincenzo.frascino@....com, Mark Rutland <mark.rutland@....com>,
Sami Tolvanen <samitolvanen@...gle.com>, joey.gouly@....com,
maz@...nel.org, daizhiyuan@...tium.com.cn, jthierry@...hat.com,
Tian Tao <tiantao6@...ilicon.com>,
Peter Collingbourne <pcc@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>, rppt@...nel.org,
Jisheng.Zhang@...aptics.com,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
open list <linux-kernel@...r.kernel.org>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH v2 bpf-next 2/2] selftests/bpf: add exception handling
selftests for tp_bpf program
On Fri, Nov 5, 2021 at 10:11 AM Alan Maguire <alan.maguire@...cle.com> wrote:
>
> Exception handling is triggered in BPF tracing programs when
> a NULL pointer is dereferenced; the exception handler zeroes the
> target register and execution of the BPF program progresses.
>
> To test exception handling then, we need to trigger a NULL pointer
> dereference for a field which should never be zero; if it is, the
> only explanation is the exception handler ran. task->task_works
> is the NULL pointer chosen (for a new task from fork() no work
> is associated), and the task_works->func field should not be zero
> if task_works is non-NULL. Test verifies task_works and
> task_works->func are 0.
>
> Signed-off-by: Alan Maguire <alan.maguire@...cle.com>
> ---
> tools/testing/selftests/bpf/prog_tests/exhandler.c | 43 ++++++++++++++++++++++
> tools/testing/selftests/bpf/progs/exhandler_kern.c | 43 ++++++++++++++++++++++
> 2 files changed, 86 insertions(+)
> create mode 100644 tools/testing/selftests/bpf/prog_tests/exhandler.c
> create mode 100644 tools/testing/selftests/bpf/progs/exhandler_kern.c
>
The test looks good, thank you!
Acked-by: Andrii Nakryiko <andrii@...nel.org>
[...]
Powered by blists - more mailing lists