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: Wed, 29 May 2024 12:00:10 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: "Abhishek Chauhan (ABC)" <quic_abchauha@...cinc.com>, 
 Willem de Bruijn <willemdebruijn.kernel@...il.com>, 
 "David S. Miller" <davem@...emloft.net>, 
 Eric Dumazet <edumazet@...gle.com>, 
 Jakub Kicinski <kuba@...nel.org>, 
 Paolo Abeni <pabeni@...hat.com>, 
 netdev@...r.kernel.org, 
 linux-kernel@...r.kernel.org, 
 Andrew Halaney <ahalaney@...hat.com>, 
 Martin KaFai Lau <martin.lau@...nel.org>, 
 Martin KaFai Lau <martin.lau@...ux.dev>, 
 Daniel Borkmann <daniel@...earbox.net>, 
 bpf <bpf@...r.kernel.org>
Cc: kernel@...cinc.com, 
 syzbot+d7b227731ec589e7f4f0@...kaller.appspotmail.com, 
 syzbot+30a35a2e9c5067cc43fa@...kaller.appspotmail.com
Subject: Re: [PATCH net] net: validate SO_TXTIME clockid coming from userspace

Abhishek Chauhan (ABC) wrote:
> 
> 
> On 5/29/2024 6:58 AM, Willem de Bruijn wrote:
> > minor: double space before userspace
> > 
> > Abhishek Chauhan wrote:
> >> Currently there are no strict checks while setting SO_TXTIME
> >> from userspace. With the recent development in skb->tstamp_type
> >> clockid with unsupported clocks results in warn_on_once, which causes
> >> unnecessary aborts in some systems which enables panic on warns.
> >>
> >> Add validation in setsockopt to support only CLOCK_REALTIME,
> >> CLOCK_MONOTONIC and CLOCK_TAI to be set from userspace.
> >>
> >> Link: https://lore.kernel.org/netdev/bc037db4-58bb-4861-ac31-a361a93841d3@linux.dev/
> >> Link: https://lore.kernel.org/lkml/20240509211834.3235191-1-quic_abchauha@quicinc.com/
> > 
> > These discussions can be found directly from the referenced commit?
> > If any, I'd like to the conversation we had that arrived at this
> > approach.
> > 
> Not Directly but from the patch series. 
> 1. First link is for why we introduced skb->tstamp_type 
> 2. Second link points to the series were we discussed on two approach to solve the problem 
> one being limit the skclockid to just TAI,MONO and REALTIME. 

Ah, I missed that.
Perhaps point directly to the start of that follow-up conversation?

https://lore.kernel.org/lkml/6bdba7b6-fd22-4ea5-a356-12268674def1@quicinc.com/

> 
> 
> >> Fixes: 1693c5db6ab8 ("net: Add additional bit to support clockid_t timestamp type")
> >> Reported-by: syzbot+d7b227731ec589e7f4f0@...kaller.appspotmail.com
> >> Closes: https://syzkaller.appspot.com/bug?extid=d7b227731ec589e7f4f0
> >> Reported-by: syzbot+30a35a2e9c5067cc43fa@...kaller.appspotmail.com
> >> Closes: https://syzkaller.appspot.com/bug?extid=30a35a2e9c5067cc43fa
> >> Signed-off-by: Abhishek Chauhan <quic_abchauha@...cinc.com>
> >> ---
> >>  net/core/sock.c | 16 ++++++++++++++++
> >>  1 file changed, 16 insertions(+)
> >>
> >> diff --git a/net/core/sock.c b/net/core/sock.c
> >> index 8629f9aecf91..f8374be9d8c9 100644
> >> --- a/net/core/sock.c
> >> +++ b/net/core/sock.c
> >> @@ -1083,6 +1083,17 @@ bool sockopt_capable(int cap)
> >>  }
> >>  EXPORT_SYMBOL(sockopt_capable);
> >>  
> >> +static int sockopt_validate_clockid(int value)
> > 
> > sock_txtime.clockid has type __kernel_clockid_t.
> > 
> 
>  __kernel_clockid_t is typedef of int.  

It is now, but the stricter type definition exists for a reason.
Try to keep the strict types where possible. Besides aiding
syntactic checks, it also helps self document code.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ