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] [day] [month] [year] [list]
Date:   Mon, 28 Feb 2022 12:08:58 +0100
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Baokun Li <libaokun1@...wei.com>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        oliver.sang@...el.com, beibei.si@...el.com, jannh@...gle.com,
        mszeredi@...hat.com, torvalds@...ux-foundation.org,
        yukuai3@...wei.com
Subject: Re: [PATCH 5.4] fget: clarify and improve __fget_files()
 implementation

On Sat, Feb 26, 2022 at 02:32:01PM +0800, Baokun Li wrote:
> From: Linus Torvalds <torvalds@...ux-foundation.org>
> 
> commit e386dfc56f837da66d00a078e5314bc8382fab83 upstream.
> 
> Commit 054aa8d439b9 ("fget: check that the fd still exists after getting
> a ref to it") fixed a race with getting a reference to a file just as it
> was being closed.  It was a fairly minimal patch, and I didn't think
> re-checking the file pointer lookup would be a measurable overhead,
> since it was all right there and cached.
> 
> But I was wrong, as pointed out by the kernel test robot.
> 
> The 'poll2' case of the will-it-scale.per_thread_ops benchmark regressed
> quite noticeably.  Admittedly it seems to be a very artificial test:
> doing "poll()" system calls on regular files in a very tight loop in
> multiple threads.
> 
> That means that basically all the time is spent just looking up file
> descriptors without ever doing anything useful with them (not that doing
> 'poll()' on a regular file is useful to begin with).  And as a result it
> shows the extra "re-check fd" cost as a sore thumb.
> 
> Happily, the regression is fixable by just writing the code to loook up
> the fd to be better and clearer.  There's still a cost to verify the
> file pointer, but now it's basically in the noise even for that
> benchmark that does nothing else - and the code is more understandable
> and has better comments too.
> 
> [ Side note: this patch is also a classic case of one that looks very
>   messy with the default greedy Myers diff - it's much more legible with
>   either the patience of histogram diff algorithm ]
> 
> Link: https://lore.kernel.org/lkml/20211210053743.GA36420@xsang-OptiPlex-9020/
> Link: https://lore.kernel.org/lkml/20211213083154.GA20853@linux.intel.com/
> Reported-by: kernel test robot <oliver.sang@...el.com>
> Tested-by: Carel Si <beibei.si@...el.com>
> Cc: Jann Horn <jannh@...gle.com>
> Cc: Miklos Szeredi <mszeredi@...hat.com>
> Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
> Signed-off-by: Baokun Li <libaokun1@...wei.com>
> ---
>  fs/file.c | 73 +++++++++++++++++++++++++++++++++++++++++++------------
>  1 file changed, 57 insertions(+), 16 deletions(-)

All now queued up, thanks for the backports!

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ