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: <836595da2ba742cb790b8dd2a3c14ae4@linux.dev>
Date:   Fri, 24 Sep 2021 02:49:51 +0000
From:   yajun.deng@...ux.dev
To:     "Eric Dumazet" <eric.dumazet@...il.com>, davem@...emloft.net,
        kuba@...nel.org
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] net: socket: integrate sockfd_lookup() and
 sockfd_lookup_light()

September 24, 2021 12:49 AM, "Eric Dumazet" <eric.dumazet@...il.com> wrote:

> On 9/21/21 11:31 PM, Yajun Deng wrote:
> 
>> As commit 6cb153cab92a("[NET]: use fget_light() in net/socket.c") said,
>> sockfd_lookup_light() is lower load than sockfd_lookup(). So we can
>> remove sockfd_lookup() but keep the name. As the same time, move flags
>> to sockfd_put().
> 
> ???
> 
>> Signed-off-by: Yajun Deng <yajun.deng@...ux.dev>
>> ---
>> include/linux/net.h | 8 +++-
>> net/socket.c | 101 +++++++++++++++++---------------------------
>> 2 files changed, 46 insertions(+), 63 deletions(-)
>> 
>> diff --git a/include/linux/net.h b/include/linux/net.h
>> index ba736b457a06..63a179d4f760 100644
>> --- a/include/linux/net.h
>> +++ b/include/linux/net.h
>> @@ -238,8 +238,14 @@ int sock_recvmsg(struct socket *sock, struct msghdr *msg, int flags);
>> struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname);
>> struct socket *sockfd_lookup(int fd, int *err);
>> struct socket *sock_from_file(struct file *file);
>> -#define sockfd_put(sock) fput(sock->file)
>> int net_ratelimit(void);
>> +#define sockfd_put(sock) \
>> +do { \
>> + struct fd *fd = (struct fd *)&sock->file; \
>> + \
>> + if (fd->flags & FDPUT_FPUT) \
>> + fput(sock->file); \
>> +} while (0)
> 
> Really ?
> 
> I wonder how was this tested ?
> 
> We can not store FDPUT_FPUT in the sock itself, for obvious reasons.
> Each thread needs to keep this information private.

The sockfd_lookup() already changed in this patch. FDPUT_FPUT stored in fdget(), precisely in __fget_light().

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ