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, 21 Nov 2013 13:18:04 -0500 (EST)
From:	David Miller <davem@...emloft.net>
To:	dborkman@...hat.com
Cc:	netdev@...r.kernel.org, noureddine@...stanetworks.com,
	greearb@...delatech.com, eric.dumazet@...il.com
Subject: Re: [PATCH v3] packet: fix use after free race in send path when
 dev is released

From: Daniel Borkmann <dborkman@...hat.com>
Date: Thu, 21 Nov 2013 16:50:58 +0100

> Salam reported a use after free bug in PF_PACKET that occurs when
> we're sending out frames on a socket bound device and suddenly the
> net device is being unregistered. It appears that commit 827d9780
> introduced a possible race condition between {t,}packet_snd() and
> packet_notifier(). In the case of a bound socket, packet_notifier()
> can drop the last reference to the net_device and {t,}packet_snd()
> might end up suddenly sending a packet over a freed net_device.
> 
> To avoid reverting 827d9780 and thus introducing a performance
> regression compared to the current state of things, we decided to
> hold a cached RCU protected pointer to the net device and maintain
> it on write side via bind spin_lock protected register_prot_hook()
> and __unregister_prot_hook() calls.
> 
> In {t,}packet_snd() path, we access this pointer under rcu_read_lock
> through packet_cached_dev_get() that holds reference to the device
> to prevent it from being freed through packet_notifier() while
> we're in send path. This is okay to do as dev_put()/dev_hold() are
> per-cpu counters, so this should not be a performance issue. Also,
> the code simplifies a bit as we don't need need_rls_dev anymore.
> 
> Fixes: 827d978037d7 ("af-packet: Use existing netdev reference for bound sockets.")
> Reported-by: Salam Noureddine <noureddine@...stanetworks.com>
> Signed-off-by: Daniel Borkmann <dborkman@...hat.com>
> Signed-off-by: Salam Noureddine <noureddine@...stanetworks.com>

Applied and queued up for -stable, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ