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]
Message-ID: <65eb037ebbd4a_1356ef29497@willemb.c.googlers.com.notmuch>
Date: Fri, 08 Mar 2024 07:24:30 -0500
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Juntong Deng <juntong.deng@...look.com>, 
 Willem de Bruijn <willemdebruijn.kernel@...il.com>, 
 davem@...emloft.net, 
 edumazet@...gle.com, 
 kuba@...nel.org, 
 pabeni@...hat.com
Cc: netdev@...r.kernel.org, 
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] net/packet: Add getsockopt support for
 PACKET_COPY_THRESH

Juntong Deng wrote:
> On 2024/3/8 19:43, Willem de Bruijn wrote:
> > Juntong Deng wrote:
> >> Currently getsockopt does not support PACKET_COPY_THRESH,
> >> and we are unable to get the value of PACKET_COPY_THRESH
> >> socket option through getsockopt.
> >>
> >> This patch adds getsockopt support for PACKET_COPY_THRESH.
> >>
> >> Signed-off-by: Juntong Deng <juntong.deng@...look.com>
> >> ---
> >>   net/packet/af_packet.c | 3 +++
> >>   1 file changed, 3 insertions(+)
> >>
> >> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> >> index 0db31ca4982d..65042edd1a97 100644
> >> --- a/net/packet/af_packet.c
> >> +++ b/net/packet/af_packet.c
> >> @@ -4090,6 +4090,9 @@ static int packet_getsockopt(struct socket *sock, int level, int optname,
> >>   	case PACKET_VNET_HDR_SZ:
> >>   		val = READ_ONCE(po->vnet_hdr_sz);
> >>   		break;
> >> +	case PACKET_COPY_THRESH:
> >> +		val = pkt_sk(sk)->copy_thresh;
> >> +		break;
> > 
> > This is probably a good opportunity to use READ_ONCE/WRITE_ONCE for
> > this variable that can be modified and read concurrently.
> > 
> > Alternatively I can fix up all three locations in a follow-on patch.
> > 
> > No concerns with adding the getsockopt itself.
> > 
> >>   	case PACKET_VERSION:
> >>   		val = po->tp_version;
> >>   		break;
> >> -- 
> >> 2.39.2
> >>
> > 
> > 
> 
> Thanks for reviewing.
> 
> So, do I need to send PATCH V2 to add READ_ONCE?
> 
> Or do you want you to use a follow-on patch to fix all three locations 
> at once?

Please use READ_ONCE and convert the existing accesses to copy_thresh
in the same patch to READ_ONCE/WRITE_ONCE. That's simplest.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ