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]
Message-ID: <652128.1654884394@warthog.procyon.org.uk>
Date:   Fri, 10 Jun 2022 19:06:34 +0100
From:   David Howells <dhowells@...hat.com>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     dhowells@...hat.com, Jeff Layton <jlayton@...nel.org>,
        Kees Cook <keescook@...omium.org>,
        Jonathan Corbet <corbet@....net>,
        Eric Van Hensbergen <ericvh@...il.com>,
        Latchesar Ionkov <lucho@...kov.net>,
        Dominique Martinet <asmadeus@...ewreck.org>,
        Christian Schoenebeck <linux_oss@...debyte.com>,
        Marc Dionne <marc.dionne@...istor.com>,
        Xiubo Li <xiubli@...hat.com>,
        Ilya Dryomov <idryomov@...il.com>,
        Steve French <smfrench@...il.com>,
        William Kucharski <william.kucharski@...cle.com>,
        "Matthew Wilcox (Oracle)" <willy@...radead.org>,
        Dave Chinner <david@...morbit.com>,
        "open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
        v9fs-developer@...ts.sourceforge.net,
        linux-afs@...ts.infradead.org, ceph-devel@...r.kernel.org,
        CIFS <linux-cifs@...r.kernel.org>,
        samba-technical@...ts.samba.org,
        linux-fsdevel <linux-fsdevel@...r.kernel.org>,
        linux-hardening@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] netfs: Fix gcc-12 warning by embedding vfs inode in netfs_i_context

Linus Torvalds <torvalds@...ux-foundation.org> wrote:

> Side note: I think this could have been done with an unnamed union as
> 
>         struct my_inode {
>                 union {
>                         struct inode            vfs_inode;
>                         struct netfs_inode netfs_inode;
>                 };
>         [...]
> 
> instead, with the rule that 'netfs_inode' always starts with a 'struct inode'.

I'm slightly wary of that, lest struct netfs_inode gets randomised.  I'm not
sure how likely that would be without netfs_inode getting explicitly marked.

> But in a lot of cases you really could do so much better: you *have* a
> "struct netfs_inode" to begin with, but you converted it to just
> "struct inode *", and now you're converting it back.
> 
> Look at that AFS code, for example, where we have afs_vnode_cache() doing
> 
>         return netfs_i_cookie(&vnode->netfs.inode);
> 
> and look how it *had* a netfs structure, and it was passing it to a
> netfs function, but it explicitly passed the WRONG TYPE, so now we've
> lost the type information and it is using that cast to fake it all
> back.

Yeah, I didn't look at those as they didn't cause warnings, but you're right -
those should take struct netfs_inode pointers in some cases, rather than
struct inode.

Note that some functions, such as netfs_readpage() and netfs_readpages() do
need to take struct inode pointers as I'm trying to get the VFS ops to jump
into netfslib and get all the VM interface stuff out of the network
filesystems - the idea being that the network filesystem will provide netfslib
primarily with two functions: do a read op and do a write op.

I'll have a look at your patch in a bit.

Thanks,
David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ