__u64 *. You can see
evidence of that intent in a3a5113393cc ("selftests/bpf: Add kprobe
session cookie test").
Fix conflict by changing kfunc definition.
Fixes: 5c919acef851 ("bpf: Add support for kprobe session cookie")
Signed-off-by: Daniel Xu
---
kernel/trace/bpf_tr
use case - there is no need to involve
kernel for that.
Signed-off-by: Daniel Xu
---
kernel/bpf/verifier.c | 6 +-
tools/testing/selftests/bpf/Makefile | 3 +-
.../selftests/bpf/prog_tests/ringbuf.c| 50 +++
.../bpf/progs
On Tue, Sep 10, 2024 at 11:36:36AM GMT, Alexei Starovoitov wrote:
> On Mon, Sep 9, 2024 at 5:55 PM Daniel Xu wrote:
> >
> > Right now there exists prog produce / userspace consume and userspace
> > produce / prog consume support. But it is also useful to have prog
>
On Tue, Sep 10, 2024 at 01:41:41PM GMT, Andrii Nakryiko wrote:
> On Tue, Sep 10, 2024 at 11:36 AM Alexei Starovoitov
> wrote:
> >
> > On Mon, Sep 9, 2024 at 5:55 PM Daniel Xu wrote:
> > >
> > > Right now there exists prog produce / userspace consume and us
On Tue, Sep 10, 2024, at 2:07 PM, Daniel Xu wrote:
> On Tue, Sep 10, 2024 at 01:41:41PM GMT, Andrii Nakryiko wrote:
>> On Tue, Sep 10, 2024 at 11:36 AM Alexei Starovoitov
[...]
>
>>
>> Also, Daniel, can you please make sure that dynptr we return for each
>> sam
On Tue, Sep 10, 2024 at 03:21:04PM GMT, Andrii Nakryiko wrote:
> On Tue, Sep 10, 2024 at 3:16 PM Daniel Xu wrote:
> >
> >
> >
> > On Tue, Sep 10, 2024, at 2:07 PM, Daniel Xu wrote:
> > > On Tue, Sep 10, 2024 at 01:41:41PM GMT, Andrii Nakryiko wrote:
> >
On Tue, Sep 10, 2024 at 05:39:55PM GMT, Andrii Nakryiko wrote:
> On Tue, Sep 10, 2024 at 4:44 PM Daniel Xu wrote:
> >
> > On Tue, Sep 10, 2024 at 03:21:04PM GMT, Andrii Nakryiko wrote:
> > > On Tue, Sep 10, 2024 at 3:16 PM Daniel Xu wrote:
> > > >
> > &g
[cc Jesper]
On Tue, Sep 10, 2024, at 8:31 PM, Daniel Xu wrote:
> On Tue, Sep 10, 2024 at 05:39:55PM GMT, Andrii Nakryiko wrote:
>> On Tue, Sep 10, 2024 at 4:44 PM Daniel Xu wrote:
>> >
>> > On Tue, Sep 10, 2024 at 03:21:04PM GMT, Andrii Nakryiko wrote:
>> &g
On Wed, Sep 11, 2024 at 10:32:56AM GMT, Jesper Dangaard Brouer wrote:
>
>
> On 11/09/2024 06.43, Daniel Xu wrote:
> > [cc Jesper]
> >
> > On Tue, Sep 10, 2024, at 8:31 PM, Daniel Xu wrote:
> > > On Tue, Sep 10, 2024 at 05:39:55PM GMT, Andrii Nakryiko wrot
On Thu, Sep 12, 2024, at 2:40 AM, Jesper Dangaard Brouer wrote:
> On 11/09/2024 20.53, Daniel Xu wrote:
>> On Wed, Sep 11, 2024 at 10:32:56AM GMT, Jesper Dangaard Brouer wrote:
>>>
>>>
>>> On 11/09/2024 06.43, Daniel Xu wrote:
>>>> [cc Jesper]
&g
bytes. In these situations, it is
desirable for the programmer to express: "this lookup should never fail,
and if it does, it means I messed up the code". By omitting the null
check, the programmer can "ask" the verifier to double check the logic.
Daniel Xu (2):
bpf: verifier:
Test that nullness elision works for common use cases. For example, we
want to check that both full and subreg stack slots recognized. As well
as multiple lookups. And obviously some bound checks.
Signed-off-by: Daniel Xu
---
.../bpf/progs/verifier_array_access.c | 143
k for when R2 is not a ptr to stack
* Added a check for when stack is uninitialized (no stack slot yet)
* Fix spinlock reg id bumping
* Updated existing tests to account for null elision
* Added test case for when R2 can be both const and non-const
Daniel Xu (2):
bpf: verifier: Support eliding
bytes. In these situations, it is
desirable for the programmer to express: "this lookup should never fail,
and if it does, it means I messed up the code". By omitting the null
check, the programmer can "ask" the verifier to double check the logic.
Signed-off-by: Daniel
Test that nullness elision works for common use cases. For example, we
want to check that both full and subreg stack slots are recognized. As
well as when there's both const and non-const values of R2 leading up to
a lookup. And obviously some bound checks.
Signed-off-by: Daniel Xu
---
..
so that userspace can more easily tell which pages are
duplicate
Daniel Xu (1):
bpf: Introduce iter_pagecache
kernel/bpf/Makefile | 2 +-
kernel/bpf/pagecache_iter.c | 293
2 files changed, 294 insertions(+), 1 deletion(-)
create mode
n the
caller's mount namespace.
Signed-off-by: Daniel Xu
---
kernel/bpf/Makefile | 2 +-
kernel/bpf/pagecache_iter.c | 293
2 files changed, 294 insertions(+), 1 deletion(-)
create mode 100644 kernel/bpf/pagecache_iter.c
diff --git a/kernel/
Hi Christian, thanks for taking a look.
On Thu, Apr 08, 2021 at 09:51:17AM +0200, Christian Brauner wrote:
> On Wed, Apr 07, 2021 at 02:46:10PM -0700, Daniel Xu wrote:
> > There currently does not exist a way to answer the question: "What is in
> > the page cache?". The
On Thu, Apr 08, 2021 at 07:14:01AM +0100, Matthew Wilcox wrote:
> On Wed, Apr 07, 2021 at 02:46:11PM -0700, Daniel Xu wrote:
> > +struct bpf_iter_seq_pagecache_info {
> > + struct mnt_namespace *ns;
> > + struct radix_tree_root superblocks;
>
> Why are you addin
On Thu, Apr 08, 2021 at 10:19:35AM +0200, Christian Brauner wrote:
> On Wed, Apr 07, 2021 at 02:46:11PM -0700, Daniel Xu wrote:
> > This commit introduces the bpf page cache iterator. This iterator allows
> > users to run a bpf prog against each page in the "page cache".
On Thu, Apr 08, 2021 at 04:45:37PM +, Al Viro wrote:
> On Wed, Apr 07, 2021 at 02:46:11PM -0700, Daniel Xu wrote:
>
> > +static void fini_seq_pagecache(void *priv_data)
> > +{
> > + struct bpf_iter_seq_pagecache_info *info = priv_data;
> > + struct radix_
On Thu, Apr 08, 2021 at 04:13:32PM -0700, Darrick J. Wong wrote:
> On Wed, Apr 07, 2021 at 02:46:10PM -0700, Daniel Xu wrote:
> > There currently does not exist a way to answer the question: "What is in
> > the page cache?". There are various heuristics and counters but
On Wed, Mar 3, 2021, at 6:18 PM, Daniel Xu wrote:
> On Wed, Mar 03, 2021 at 03:37:40PM -0500, Steven Rostedt wrote:
> > On Wed, 03 Mar 2021 12:13:08 -0800
> > "Daniel Xu" wrote:
> >
> > > On Wed, Mar 3, 2021, at 11:58 AM, Daniel Xu wrote:
> > > &
osleep+150
do_syscall_64+51
entry_SYSCALL_64_after_hwframe+68
]: 12
Fixes: fc72ae40e303 ("x86/unwind: Make CONFIG_UNWINDER_ORC=y the default in
kconfig for 64-bit")
Signed-off-by: Daniel Xu
---
arch/x86/kernel/unwind_orc.c | 53 +++-
Hi Masami,
On Sat, Mar 06, 2021 at 12:38:57AM +0900, Masami Hiramatsu wrote:
> Hello,
>
> Here is a series of patches for kprobes and stacktracer to fix the kretprobe
> entries in the kernel stack. This was reported by Daniel Xu. I thought that
> was in the bpftrace, but it i
On Fri, Mar 05, 2021 at 07:58:09PM +0900, Masami Hiramatsu wrote:
> On Fri, 5 Mar 2021 18:28:06 +0900
> Masami Hiramatsu wrote:
>
> > Hi Daniel,
> >
> > On Thu, 4 Mar 2021 16:07:52 -0800
> > Daniel Xu wrote:
> >
> > > Getting a stack trace
On Fri, Mar 05, 2021 at 01:32:44PM -0600, Josh Poimboeuf wrote:
> On Fri, Mar 05, 2021 at 11:25:15AM -0800, Daniel Xu wrote:
> > > BTW, is this a regression? or CONFIG_UNWINDER_ORC has this issue before?
> > > It seems that the above commit just changed the default unwind
Hi Masami,
Jakub reported a bug with kretprobe stack traces -- wondering if you've gotten
any bug reports related to stack traces being broken for kretprobes.
I think (can't prove) this used to work:
# bpftrace -e 'kretprobe:__tcp_retransmit_skb { @[kstack()] = count() }'
Attaching 1 pro
On Tue, Mar 02, 2021 at 06:18:23PM -0800, Alexei Starovoitov wrote:
> On Tue, Mar 2, 2021 at 5:46 PM Andy Lutomirski wrote:
> >
> >
> > > On Mar 2, 2021, at 5:22 PM, Alexei Starovoitov
> > > wrote:
> > >
> > > On Tue, Mar 2, 2021 at 1:02 PM Andy Lutomirski
> > > wrote:
> > >>
> > >>
> >
On Wed, Mar 3, 2021, at 11:58 AM, Daniel Xu wrote:
> On Wed, Mar 03, 2021 at 09:26:04AM -0500, Steven Rostedt wrote:
> > On Wed, 3 Mar 2021 13:48:28 +0900
> > Masami Hiramatsu wrote:
> >
> > >
> > > >
> > > > I think (can't prove) th
On Wed, Mar 03, 2021 at 09:26:04AM -0500, Steven Rostedt wrote:
> On Wed, 3 Mar 2021 13:48:28 +0900
> Masami Hiramatsu wrote:
>
> >
> > >
> > > I think (can't prove) this used to work:
>
> Would be good to find out if it did.
I'm installing some older kernels now to check. Will report back.
On Wed, Mar 03, 2021 at 01:48:28PM +0900, Masami Hiramatsu wrote:
> Hi Daniel,
>
> On Tue, 02 Mar 2021 17:15:13 -0800
> "Daniel Xu" wrote:
>
> > Hi Masami,
> >
> > Jakub reported a bug with kretprobe stack traces -- wondering if you've
> &
On Wed, Mar 03, 2021 at 03:37:40PM -0500, Steven Rostedt wrote:
> On Wed, 03 Mar 2021 12:13:08 -0800
> "Daniel Xu" wrote:
>
> > On Wed, Mar 3, 2021, at 11:58 AM, Daniel Xu wrote:
> > > On Wed, Mar 03, 2021 at 09:26:04AM -0500, Steven Rostedt wrote:
> &g
ernel} and probe_read_{user,
kernel}_str helpers")
Signed-off-by: Daniel Xu
---
As mentioned in the v6 discussion, I didn't think it would make a lot
of sense to put a comment in kernel/bpf/hashtab.c:alloc_htab_elem .
I opted to add the comment to bpf_probe_read_user_str_common() b/c it
uninitialized memory
v3 -> v4:
* directly pass userspace pointer to prog
* test more strings of different length
v2 -> v3:
* set pid filter before attaching prog in selftest
* use long instead of int as bpf_probe_read_user_str() retval
* style changes
v1 -> v2:
* add Fixes: tag
* a
gress
bpf_probe_read_user_str() again.
Acked-by: Song Liu
Acked-by: Andrii Nakryiko
Signed-off-by: Daniel Xu
---
.../bpf/prog_tests/probe_read_user_str.c | 71 +++
.../bpf/progs/test_probe_read_user_str.c | 25 +++
2 files changed, 96 insertions(+)
create mode 100644 tools/testing/self
are introduced to the series.
>
> Daniel, can you also test this again? I and Josh discussed a bit different
> method and I've implemented it on this version.
Works great, thanks!
Tested-by: Daniel Xu
>
> This actually changes the kretprobe behavisor a bit, now the instr
n-graph
> tracer in the unwind_next_frame().
>
> Signed-off-by: Masami Hiramatsu
>
I applied your original patchset + Josh's patch + this patch and can
confirm it works for bpftrace + kretprobes.
Tested-by: Daniel Xu
On Sat, Mar 06, 2021 at 10:13:57AM +0900, Masami Hiramatsu wrote:
> On Fri, 5 Mar 2021 11:16:45 -0800
> Daniel Xu wrote:
>
> > Hi Masami,
> >
> > On Sat, Mar 06, 2021 at 12:38:57AM +0900, Masami Hiramatsu wrote:
> > > Hello,
> > >
> > > H
Hi Masami,
Just want to clarify a few points:
On Mon, Mar 08, 2021 at 11:52:10AM +0900, Masami Hiramatsu wrote:
> On Sun, 7 Mar 2021 13:23:33 -0800
> Daniel Xu wrote:
> To help your understanding, let me explain.
>
> If we have a code here
>
> caller_func:
> 0x00
On Thu Aug 22, 2019 at 11:05 AM Peter Zijlstra wrote:
> On Thu, Aug 22, 2019 at 07:54:16AM +, Song Liu wrote:
> > Hi Peter,
> >
> > > On Aug 22, 2019, at 12:47 AM, Peter Zijlstra wrote:
> > >
> > > On Wed, Aug 21, 2019 at 06:43:49PM +, Yonghong Song wrote:
> > >> On 8/21/19 11:31 AM, Pe
es it clear to users what they can
expect to extract from what type of link.
Acked-by: Song Liu
Signed-off-by: Daniel Xu
---
tools/lib/bpf/libbpf.c | 21 +
tools/lib/bpf/libbpf.h | 13 +
tools/lib/bpf/libbpf.map | 4
3 files changed, 38 insertions(+)
diff --
2:
- More descriptive cover letter
- Make API more generic and support uprobes as well
- Use casters/getters for libbpf instead of single getter
- Fix typos
- Remove size field from ioctl struct
- Split out libbpf.h sync to tools dir to separate commit
Daniel Xu (4):
tracing/probe: Add PERF_EVENT_
Acked-by: Andrii Nakryiko
Signed-off-by: Daniel Xu
---
.../selftests/bpf/prog_tests/attach_probe.c | 106 ++
1 file changed, 106 insertions(+)
diff --git a/tools/testing/selftests/bpf/prog_tests/attach_probe.c
b/tools/testing/selftests/bpf/prog_tests/attach_probe.c
index
for [uk]probes
but leave the possibility open for other probes like tracepoint.
Signed-off-by: Daniel Xu
---
include/linux/trace_events.h| 12
include/uapi/linux/perf_event.h | 23 +++
kernel/events/core.c| 20
kernel/trace
Signed-off-by: Daniel Xu
---
tools/include/uapi/linux/perf_event.h | 23 +++
1 file changed, 23 insertions(+)
diff --git a/tools/include/uapi/linux/perf_event.h
b/tools/include/uapi/linux/perf_event.h
index 7198ddd0c6b1..8783d29a807a 100644
--- a/tools/include/uapi/linux
s possible I missed something while reading the code so please let
me know if I am mistaken.
Daniel Xu (5):
perf/core: Add PERF_FORMAT_LOST read_format
perf/core: Sync perf_event.h to tools
libbpf: Add helpers to extract perf fd from bpf_link
libbpf: Set read_format PERF_FORMAT_LOST on kpr
he underlying kprobe
infrastructure and misses from ringbuffer infrastructure.
Signed-off-by: Daniel Xu
---
include/linux/trace_events.h| 1 +
include/uapi/linux/perf_event.h | 5 -
kernel/events/core.c| 39 ++---
kernel/trace/trace_kprobe.c | 8
clear to users what they can
expect to extract from what type of link.
Acked-by: Song Liu
Acked-by: Andrii Nakryiko
Signed-off-by: Daniel Xu
---
tools/lib/bpf/libbpf.c | 21 +
tools/lib/bpf/libbpf.h | 13 +
tools/lib/bpf/libbpf.map | 3 +++
3 files changed
Signed-off-by: Daniel Xu
---
.../selftests/bpf/prog_tests/attach_probe.c | 32 ++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/attach_probe.c
b/tools/testing/selftests/bpf/prog_tests/attach_probe.c
index 5ecc267d98b0
There is no way to get the nmissed count from kprobes that are created
using the perf API. The previous commits added read_format support for
this count. Enable it in this commit.
Signed-off-by: Daniel Xu
---
tools/lib/bpf/libbpf.c | 9 ++---
1 file changed, 6 insertions(+), 3 deletions
Signed-off-by: Daniel Xu
---
tools/include/uapi/linux/perf_event.h | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/include/uapi/linux/perf_event.h
b/tools/include/uapi/linux/perf_event.h
index 7198ddd0c6b1..bd874c7257f0 100644
--- a/tools/include/uapi/linux
On Tue Sep 17, 2019 at 10:32 PM kbuild test robot wrote:
> All errors (new ones prefixed by >>):
>
>kernel/events/core.c: In function 'perf_event_lost':
> >> kernel/events/core.c:4753:11: error: implicit declaration of function
> >> 'perf_kprobe_missed'; did you mean 'perf_release'?
> >> [-W
Hi Jiri,
On Tue Sep 24, 2019 at 10:33 AM Jiri Olsa wrote:
> On Tue, Sep 17, 2019 at 06:30:52AM -0700, Daniel Xu wrote:
>
> SNIP
>
> > + PERF_FORMAT_MAX = 1U << 5, /* non-ABI */
> > };
> >
> > #define PERF_ATTR_SIZE_VER064
On Mon, Aug 19, 2019, at 10:45 AM, Andrii Nakryiko wrote:
> On Fri, Aug 16, 2019 at 3:32 PM Daniel Xu wrote:
> >
> > It is sometimes necessary to perform ioctl's on the underlying perf fd.
> > There is not currently a way to extract the fd given a bpf_link, so add a
On Mon Aug 19, 2019 at 6:26 PM Alexei Starovoitov wrote:
> On Fri, Aug 16, 2019 at 3:33 PM Daniel Xu wrote:
> >
> > It's useful to know [uk]probe's nmissed and nhit stats. For example with
> > tracing tools, it's important to know when events may have been l
Hi Peter,
On Tue Aug 20, 2019 at 4:45 PM Peter Zijlstra wrote:
> On Fri, Aug 16, 2019 at 03:31:46PM -0700, Daniel Xu wrote:
> > It's useful to know [uk]probe's nmissed and nhit stats. For example with
> > tracing tools, it's important to know when events may have be
ve size field from ioctl struct
- Split out libbpf.h sync to tools dir to separate commit
Daniel Xu (4):
tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE ioctl
libbpf: Add helpers to extract perf fd from bpf_link
tracing/probe: Sync perf_event.h to tools
tracing/probe: Add self test for PE
Acked-by: Andrii Nakryiko
Signed-off-by: Daniel Xu
---
.../selftests/bpf/prog_tests/attach_probe.c | 115 ++
1 file changed, 115 insertions(+)
diff --git a/tools/testing/selftests/bpf/prog_tests/attach_probe.c
b/tools/testing/selftests/bpf/prog_tests/attach_probe.c
index
Signed-off-by: Daniel Xu
---
tools/include/uapi/linux/perf_event.h | 23 +++
1 file changed, 23 insertions(+)
diff --git a/tools/include/uapi/linux/perf_event.h
b/tools/include/uapi/linux/perf_event.h
index 7198ddd0c6b1..8783d29a807a 100644
--- a/tools/include/uapi/linux
for [uk]probes
but leave the possibility open for other probes like tracepoint.
Signed-off-by: Daniel Xu
---
include/linux/trace_events.h| 2 ++
include/uapi/linux/perf_event.h | 23 +++
kernel/events/core.c| 20
kernel/trace/trace_kp
es it clear to users what they can
expect to extract from what type of link.
Acked-by: Song Liu
Acked-by: Andrii Nakryiko
Signed-off-by: Daniel Xu
---
tools/lib/bpf/libbpf.c | 21 +
tools/lib/bpf/libbpf.h | 13 +
tools/lib/bpf/libbpf.map | 3 +++
3 files change
On Mon, Aug 12, 2019, at 8:57 AM, Andrii Nakryiko wrote:
> On Fri, Aug 9, 2019 at 2:47 PM Daniel Xu wrote:
> >
> > It's useful to know [uk]probe's nmissed and nhit stats. For example with
> > tracing tools, it's important to know when events may have been l
On Tue, Aug 13, 2019, at 2:47 PM, Song Liu wrote:
> On Fri, Aug 9, 2019 at 2:48 PM Daniel Xu wrote:
> >
> > It's useful to know [uk]probe's nmissed and nhit stats. For example with
> > tracing tools, it's important to know when events may have been lost.
>
es it clear to users what they can
expect to extract from what type of link.
Signed-off-by: Daniel Xu
---
tools/lib/bpf/libbpf.c | 19 +++
tools/lib/bpf/libbpf.h | 8
tools/lib/bpf/libbpf.map | 6 ++
3 files changed, 33 insertions(+)
diff --git a/tools/lib/bpf/libbp
t libbpf.h sync to tools dir to separate commit
Daniel Xu (4):
tracing/probe: Add PERF_EVENT_IOC_QUERY_PROBE ioctl
libbpf: Add helpers to extract perf fd from bpf_link
tracing/probe: Sync perf_event.h to tools
tracing/probe: Add self test for PERF_EVENT_IOC_QUERY_PROBE
include/li
for [uk]probes
but leave the possibility open for other probes like tracepoint.
Signed-off-by: Daniel Xu
---
include/linux/trace_events.h| 12
include/uapi/linux/perf_event.h | 19 +++
kernel/events/core.c| 20
kernel/trace
Signed-off-by: Daniel Xu
---
tools/include/uapi/linux/perf_event.h | 19 +++
1 file changed, 19 insertions(+)
diff --git a/tools/include/uapi/linux/perf_event.h
b/tools/include/uapi/linux/perf_event.h
index 7198ddd0c6b1..65faa9b2a3b4 100644
--- a/tools/include/uapi/linux
Signed-off-by: Daniel Xu
---
.../selftests/bpf/prog_tests/attach_probe.c | 102 ++
1 file changed, 102 insertions(+)
diff --git a/tools/testing/selftests/bpf/prog_tests/attach_probe.c
b/tools/testing/selftests/bpf/prog_tests/attach_probe.c
index 5ecc267d98b0..bb53103ddb66
On Fri, Aug 9, 2019, at 2:47 PM, Daniel Xu wrote:
> It's useful to know [uk]probe's nmissed and nhit stats. For example with
> tracing tools, it's important to know when events may have been lost.
> debugfs currently exposes a control file to get this information, but
>
perviously no way to load BTF on-demand.
This commit exports the bpf_object__load_vmlinux_btf such that we are
able to load BTF on demand.
Signed-off-by: Daniel Xu
---
tools/lib/bpf/libbpf.c | 2 +-
tools/lib/bpf/libbpf.h | 1 +
tools/lib/bpf/libbpf.map | 1 +
3 files changed, 3 insertions(+), 1
Hi Andrii,
On Tue May 26, 2020 at 3:09 PM PST, Andrii Nakryiko wrote:
> On Tue, May 26, 2020 at 7:09 PM Daniel Xu wrote:
> >
> > Right now the libbpf model encourages loading the entire object at once.
> > In this model, libbpf handles loading BTF from vmlinux for us. H
{user, kernel} and probe_read_{user,
kernel}_str helpers")
Signed-off-by: Daniel Xu
---
lib/strncpy_from_user.c | 9 -
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c
index e6d5fcc2cdf3..83180742e729 100644
bae607b0524632b7793 ("[PATCH bpf v3 2/2]
> > selftest/bpf: Test bpf_probe_read_user_str() strips trailing bytes after
> > NUL")
> > url:
> > https://github.com/0day-ci/linux/commits/Daniel-Xu/Fix-bpf_probe_read_user_str-overcopying/20201106-033210
> > base: https
s of different length
v2 -> v3:
* set pid filter before attaching prog in selftest
* use long instead of int as bpf_probe_read_user_str() retval
* style changes
v1 -> v2:
* add Fixes: tag
* add selftest
Daniel Xu (2):
lib/strncpy_from_user.c: Don't overcopy bytes after NUL
gress
bpf_probe_read_user_str() again.
Acked-by: Song Liu
Acked-by: Andrii Nakryiko
Signed-off-by: Daniel Xu
---
.../bpf/prog_tests/probe_read_user_str.c | 71 +++
.../bpf/progs/test_probe_read_user_str.c | 25 +++
2 files changed, 96 insertions(+)
create mode 100644 tools/testing/self
On Wed Nov 11, 2020 at 3:22 PM PST, Andrii Nakryiko wrote:
> On Wed, Nov 11, 2020 at 2:46 PM Daniel Xu wrote:
> >
> > 6ae08ae3dea2 ("bpf: Add probe_read_{user, kernel} and probe_read_{user,
> > kernel}_str helpers") introduced a subtle bug where
> > bpf_pr
ernel} and probe_read_{user,
kernel}_str helpers")
Signed-off-by: Daniel Xu
---
Based on on-list discussion and some off-list discussion with Alexei,
I'd like to propose the v4-style patch without the `(*out & ~mask)`
bit.
We can't really zero out the rest of the buffer due to
> v4:
* directly pass userspace pointer to prog
* test more strings of different length
v2 -> v3:
* set pid filter before attaching prog in selftest
* use long instead of int as bpf_probe_read_user_str() retval
* style changes
v1 -> v2:
* add Fixes: tag
* add selftest
Daniel Xu (2):
lib/strnc
gress
bpf_probe_read_user_str() again.
Acked-by: Song Liu
Acked-by: Andrii Nakryiko
Signed-off-by: Daniel Xu
---
.../bpf/prog_tests/probe_read_user_str.c | 71 +++
.../bpf/progs/test_probe_read_user_str.c | 25 +++
2 files changed, 96 insertions(+)
create mode 100644 tools/testing/self
Hi Linus,
On Mon, Nov 16, 2020 at 02:15:52PM -0800, Linus Torvalds wrote:
> On Mon, Nov 16, 2020 at 1:17 PM Daniel Xu wrote:
> >
> > Based on on-list discussion and some off-list discussion with Alexei,
> > I'd like to propose the v4-style patch without the `(*out &
bytes after the NUL
terminator, it can result in seemingly identical strings occupying
multiple slots in a BPF map. This behavior is subtle and totally
unexpected by the user.
This commit uses the proper word-at-a-time APIs to avoid overcopying.
Signed-off-by: Daniel Xu
---
lib/strncpy_from_user.c
Hi Daniel,
On Wed Nov 4, 2020 at 8:24 AM PST, Daniel Borkmann wrote:
> On 11/4/20 3:29 AM, Daniel Xu wrote:
> > do_strncpy_from_user() may copy some extra bytes after the NUL
> > terminator into the destination buffer. This usually does not matter for
> > normal string oper
On Wed Nov 4, 2020 at 2:36 PM PST, Daniel Borkmann wrote:
> On 11/4/20 9:18 PM, Daniel Xu wrote:
> > On Wed Nov 4, 2020 at 8:24 AM PST, Daniel Borkmann wrote:
> >> On 11/4/20 3:29 AM, Daniel Xu wrote:
> >>> do_strncpy_from_user() may copy some extra bytes after the
gress
bpf_probe_read_user_str() again.
Signed-off-by: Daniel Xu
---
.../bpf/prog_tests/probe_read_user_str.c | 60 +++
.../bpf/progs/test_probe_read_user_str.c | 34 +++
2 files changed, 94 insertions(+)
create mode 100644 tools/testing/selftests/bpf/prog_tests/probe_read_user_
p keys,
as seemingly identical strings can occupy multiple entries in a map.
This patchset fixes the issue and introduces a selftest to prevent
future regressions.
Daniel Xu (2):
lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator
selftest/bpf: Test bpf_probe_read_user_str()
ernel} and probe_read_{user,
kernel}_str helpers")
Signed-off-by: Daniel Xu
---
lib/strncpy_from_user.c | 9 +++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c
index e6d5fcc2cdf3..d084189eb05c 100644
--- a/lib/strncpy_f
On Thu Nov 5, 2020 at 10:16 AM PST, Song Liu wrote:
>
>
> > On Nov 4, 2020, at 6:25 PM, Daniel Xu wrote:
> >
> > do_strncpy_from_user() may copy some extra bytes after the NUL
>
> We have multiple use of "NUL" here, should be "NULL"?
>
>
On Thu Nov 5, 2020 at 10:30 AM PST, Song Liu wrote:
>
>
> > On Nov 4, 2020, at 6:25 PM, Daniel Xu wrote:
> >
> > Previously, bpf_probe_read_user_str() could potentially overcopy the
> > trailing bytes after the NUL due to how do_strncpy_from_user() does the
>
gress
bpf_probe_read_user_str() again.
Signed-off-by: Daniel Xu
---
.../bpf/prog_tests/probe_read_user_str.c | 60 +++
.../bpf/progs/test_probe_read_user_str.c | 34 +++
2 files changed, 94 insertions(+)
create mode 100644 tools/testing/selftests/bpf/prog_tests/probe_read_user_
ges
v1 -> v2:
* add Fixes: tag
* add selftest
Daniel Xu (2):
lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator
selftest/bpf: Test bpf_probe_read_user_str() strips trailing bytes
after NUL
lib/strncpy_from_user.c | 9 ++-
.../bpf/prog_tests/
ernel} and probe_read_{user,
kernel}_str helpers")
Signed-off-by: Daniel Xu
---
lib/strncpy_from_user.c | 9 +++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c
index e6d5fcc2cdf3..82a67dde136b 100644
--- a/lib/strncpy_f
On Thu Nov 5, 2020 at 1:32 PM PST, Andrii Nakryiko wrote:
> On Wed, Nov 4, 2020 at 8:51 PM Daniel Xu wrote:
[...]
> > diff --git a/tools/testing/selftests/bpf/progs/test_probe_read_user_str.c
> > b/tools/testing/selftests/bpf/progs/test_probe_read_user_str.c
> > new file
On Thu Nov 5, 2020 at 3:31 PM PST, Song Liu wrote:
>
>
> > On Nov 5, 2020, at 3:22 PM, Daniel Xu wrote:
> >
> > On Thu Nov 5, 2020 at 1:32 PM PST, Andrii Nakryiko wrote:
> >> On Wed, Nov 4, 2020 at 8:51 PM Daniel Xu wrote:
> > [...]
> >>
gress
bpf_probe_read_user_str() again.
Signed-off-by: Daniel Xu
---
.../bpf/prog_tests/probe_read_user_str.c | 71 +++
.../bpf/progs/test_probe_read_user_str.c | 25 +++
2 files changed, 96 insertions(+)
create mode 100644 tools/testing/selftests/bpf/prog_tests/probe_read_user_str.c
c
ernel} and probe_read_{user,
kernel}_str helpers")
Signed-off-by: Daniel Xu
---
lib/strncpy_from_user.c | 9 +++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c
index e6d5fcc2cdf3..82a67dde136b 100644
--- a/lib/strncpy_f
ttaching prog in selftest
* use long instead of int as bpf_probe_read_user_str() retval
* style changes
v1 -> v2:
* add Fixes: tag
* add selftest
Daniel Xu (2):
lib/strncpy_from_user.c: Don't overcopy bytes after NUL terminator
selftest/bpf: Test bpf_probe_read_user_str() strips trailing b
om_user.c: Don't overcopy bytes after NUL terminator")
> > url:
> > https://github.com/0day-ci/linux/commits/Daniel-Xu/lib-strncpy_from_user-c-Don-t-overcopy-bytes-after-NUL-terminator/20201104-103306
> > base: https://git.kernel.org/cgit/linux/kernel/git/bpf/bpf-next.git mast
Hit send too early.
On Tue, Oct 1, 2024, at 5:07 PM, Daniel Xu wrote:
> On Wed, Sep 25, 2024 at 10:24:01AM GMT, Alexei Starovoitov wrote:
>> On Tue, Sep 24, 2024 at 12:40 PM Daniel Xu wrote:
>> >
>> > +
>> > +/* Returns constant key value if po
On Wed, Sep 25, 2024 at 10:24:01AM GMT, Alexei Starovoitov wrote:
> On Tue, Sep 24, 2024 at 12:40 PM Daniel Xu wrote:
> >
> > +
> > +/* Returns constant key value if possible, else -1 */
> > +static long get_constant_map_key(s
1 - 100 of 145 matches
Mail list logo