[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190908132822.5ac2fbe1@carbon>
Date: Sun, 8 Sep 2019 13:28:22 +0200
From: Jesper Dangaard Brouer <brouer@...hat.com>
To: Toke Høiland-Jørgensen <toke@...hat.com>
Cc: brouer@...hat.com, ast@...nel.org, bpf@...r.kernel.org,
daniel@...earbox.net, davem@...emloft.net, hawk@...nel.org,
jakub.kicinski@...ronome.com, john.fastabend@...il.com,
kafai@...com, linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
songliubraving@...com, syzkaller-bugs@...glegroups.com, yhs@...com,
syzbot+4e7a85b1432052e8d6f8@...kaller.appspotmail.com
Subject: Re: [PATCH bpf-next] xdp: Fix race in dev_map_hash_update_elem()
when replacing element
On Sun, 8 Sep 2019 09:20:16 +0100
Toke Høiland-Jørgensen <toke@...hat.com> wrote:
> syzbot found a crash in dev_map_hash_update_elem(), when replacing an
> element with a new one. Jesper correctly identified the cause of the crash
> as a race condition between the initial lookup in the map (which is done
> before taking the lock), and the removal of the old element.
>
> Rather than just add a second lookup into the hashmap after taking the
> lock, fix this by reworking the function logic to take the lock before the
> initial lookup.
>
> Fixes: 6f9d451ab1a3 ("xdp: Add devmap_hash map type for looking up devices by hashed index")
> Reported-and-tested-by: syzbot+4e7a85b1432052e8d6f8@...kaller.appspotmail.com
> Signed-off-by: Toke Høiland-Jørgensen <toke@...hat.com>
Acked-by: Jesper Dangaard Brouer <brouer@...hat.com>
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
Powered by blists - more mailing lists