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: <CAHk-=wjojZuj_it97tBRZiHm-9bP1zUbmVs-g=M2+=DP-kF8EQ@mail.gmail.com>
Date: Mon, 27 May 2024 12:35:12 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: netdev@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH][CFT][experimental] net/socket.c: use straight fdget/fdput (resend)

On Mon, 27 May 2024 at 12:20, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> With just a couple of helpers it would be mostly a cleanup.

Looking around, I think we could even take four bits. Without any
debugging, 'struct file' is 160 bytes on 32-bit, it would not hurt at
all to just force a 16-byte alignment.

In fact, in practice it is aligned more than that - we already use
SLAB_HWCACHE_ALIGN, which in most cases means that it's 64-byte
aligned.

But to be safe, we should specify the 16 bytes in the
kmem_cache_create() call, and we should just make this all very
explicit:

  --- a/fs/file_table.c
  +++ b/fs/file_table.c
  @@ -512,7 +512,7 @@ EXPORT_SYMBOL(__fput_sync);

   void __init files_init(void)
   {
  -     filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0,
  +     filp_cachep = kmem_cache_create("filp", sizeof(struct file), 16,
                                SLAB_TYPESAFE_BY_RCU | SLAB_HWCACHE_ALIGN |
                                SLAB_PANIC | SLAB_ACCOUNT, NULL);
        percpu_counter_init(&nr_files, 0, GFP_KERNEL);
  --- a/include/linux/fs.h
  +++ b/include/linux/fs.h
  @@ -1025,7 +1025,7 @@ struct file {
        errseq_t                f_wb_err;
        errseq_t                f_sb_err; /* for syncfs */
   } __randomize_layout
  -  __attribute__((aligned(4)));       /* lest something weird
decides that 2 is OK */
  +  __attribute__((aligned(16))); /* Up to four tag bits */

   struct file_handle {
        __u32 handle_bytes;

and while four tag bits isn't something to waste, it looks pretty
reasonable here.

               Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ