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:   Fri, 23 Nov 2018 11:09:06 -0800 (PST)
From:   David Miller <davem@...emloft.net>
To:     willemdebruijn.kernel@...il.com
Cc:     netdev@...r.kernel.org, johann.baudy@...-log.net,
        anandhkrishnan@...il.com, willemb@...gle.com
Subject: Re: [PATCH net] packet: copy user buffers before orphan or clone

From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
Date: Tue, 20 Nov 2018 13:00:18 -0500

> From: Willem de Bruijn <willemb@...gle.com>
> 
> tpacket_snd sends packets with user pages linked into skb frags. It
> notifies that pages can be reused when the skb is released by setting
> skb->destructor to tpacket_destruct_skb.
> 
> This can cause data corruption if the skb is orphaned (e.g., on
> transmit through veth) or cloned (e.g., on mirror to another psock).
> 
> Create a kernel-private copy of data in these cases, same as tun/tap
> zerocopy transmission. Reuse that infrastructure: mark the skb as
> SKBTX_ZEROCOPY_FRAG, which will trigger copy in skb_orphan_frags(_rx).
> 
> Unlike other zerocopy packets, do not set shinfo destructor_arg to
> struct ubuf_info. tpacket_destruct_skb already uses that ptr to notify
> when the original skb is released and a timestamp is recorded. Do not
> change this timestamp behavior. The ubuf_info->callback is not needed
> anyway, as no zerocopy notification is expected.
> 
> Mark destructor_arg as not-a-uarg by setting the lower bit to 1. The
> resulting value is not a valid ubuf_info pointer, nor a valid
> tpacket_snd frame address. Add skb_zcopy_.._nouarg helpers for this.
> 
> The fix relies on features introduced in commit 52267790ef52 ("sock:
> add MSG_ZEROCOPY"), so can be backported as is only to 4.14.
> 
> Tested with from `./in_netns.sh ./txring_overwrite` from
> http://github.com/wdebruij/kerneltools/tests
> 
> Fixes: 69e3c75f4d54 ("net: TX_RING and packet mmap")
> Reported-by: Anand H. Krishnan <anandhkrishnan@...il.com>
> Signed-off-by: Willem de Bruijn <willemb@...gle.com>

Applied, and queued up for -stable.  Thanks for the backporting notes.

Any chance those tests from your kerneltools repo can make their way
into selftests?

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ