lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 3 Mar 2022 15:12:33 +0100
From:   Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To:     Toke Høiland-Jørgensen <toke@...hat.com>
Cc:     netdev@...r.kernel.org, bpf@...r.kernel.org,
        Alexei Starovoitov <ast@...nel.org>,
        Andrii Nakryiko <andrii@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        "David S. Miller" <davem@...emloft.net>,
        Ingo Molnar <mingo@...hat.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Jesper Dangaard Brouer <hawk@...nel.org>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>, Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Yonghong Song <yhs@...com>
Subject: Re: [PATCH net] xdp: xdp_mem_allocator can be NULL in
 trace_mem_connect().

On 2022-03-03 14:59:47 [+0100], Toke Høiland-Jørgensen wrote:
> Sebastian Andrzej Siewior <bigeasy@...utronix.de> writes:
> 
> > Since the commit mentioned below __xdp_reg_mem_model() can return a NULL
> > pointer. This pointer is dereferenced in trace_mem_connect() which leads
> > to segfault. It can be reproduced with enabled trace events during ifup.
> >
> > Only assign the arguments in the trace-event macro if `xa' is set.
> > Otherwise set the parameters to 0.
> >
> > Fixes: 4a48ef70b93b8 ("xdp: Allow registering memory model without rxq reference")
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> 
> Hmm, so before the commit you mention, the tracepoint wasn't triggered
> at all in the code path that now sets xdp_alloc is NULL. So I'm
> wondering if we should just do the same here? Is the trace event useful
> in all cases?

Correct. It says:
|              ip-1230    [003] .....     3.053473: mem_connect: mem_id=0 mem_type=PAGE_SHARED allocator=0000000000000000 ifindex=2

> Alternatively, if we keep it, I think the mem.id and mem.type should be
> available from rxq->mem, right?

Yes, if these are the same things. In my case they are also 0:

|              ip-1245    [000] .....     3.045684: mem_connect: mem_id=0 mem_type=PAGE_SHARED allocator=0000000000000000 ifindex=2
|        ifconfig-1332    [003] .....    21.030879: mem_connect: mem_id=0 mem_type=PAGE_SHARED allocator=0000000000000000 ifindex=3

So depends on what makes sense that tp can be skipped for xa == NULL or
remain with
               __entry->mem_id         = rxq->mem.id;
               __entry->mem_type       = rxq->mem.type;
	       __entry->allocator      = xa ? xa->allocator : NULL;

if it makes sense.

> -Toke

Sebastian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ