linux-stable/fs/afs
Linus Torvalds 507160f46c netfs: gcc-12: temporarily disable '-Wattribute-warning' for now
This is a pure band-aid so that I can continue merging stuff from people
while some of the gcc-12 fallout gets sorted out.

In particular, gcc-12 is very unhappy about the kinds of pointer
arithmetic tricks that netfs does, and that makes the fortify checks
trigger in afs and ceph:

  In function ‘fortify_memset_chk’,
      inlined from ‘netfs_i_context_init’ at include/linux/netfs.h:327:2,
      inlined from ‘afs_set_netfs_context’ at fs/afs/inode.c:61:2,
      inlined from ‘afs_root_iget’ at fs/afs/inode.c:543:2:
  include/linux/fortify-string.h:258:25: warning: call to ‘__write_overflow_field’ declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
    258 |                         __write_overflow_field(p_size_field, size);
        |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and the reason is that netfs_i_context_init() is passed a 'struct inode'
pointer, and then it does

        struct netfs_i_context *ctx = netfs_i_context(inode);

        memset(ctx, 0, sizeof(*ctx));

where that netfs_i_context() function just does pointer arithmetic on
the inode pointer, knowing that the netfs_i_context is laid out
immediately after it in memory.

This is all truly disgusting, since the whole "netfs_i_context is laid
out immediately after it in memory" is not actually remotely true in
general, but is just made to be that way for afs and ceph.

See for example fs/cifs/cifsglob.h:

  struct cifsInodeInfo {
        struct {
                /* These must be contiguous */
                struct inode    vfs_inode;      /* the VFS's inode record */
                struct netfs_i_context netfs_ctx; /* Netfslib context */
        };
	[...]

and realize that this is all entirely wrong, and the pointer arithmetic
that netfs_i_context() is doing is also very very wrong and wouldn't
give the right answer if netfs_ctx had different alignment rules from a
'struct inode', for example).

Anyway, that's just a long-winded way to say "the gcc-12 warning is
actually quite reasonable, and our code happens to work but is pretty
disgusting".

This is getting fixed properly, but for now I made the mistake of
thinking "the week right after the merge window tends to be calm for me
as people take a breather" and I did a sustem upgrade.  And I got gcc-12
as a result, so to continue merging fixes from people and not have the
end result drown in warnings, I am fixing all these gcc-12 issues I hit.

Including with these kinds of temporary fixes.

Cc: Kees Cook <keescook@chromium.org>
Cc: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/all/AEEBCF5D-8402-441D-940B-105AA718C71F@chromium.org/
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2022-06-09 11:29:36 -07:00
..
Kconfig afs: Convert afs to use the new fscache API 2022-01-07 13:44:47 +00:00
Makefile afs: Convert afs to use the new fscache API 2022-01-07 13:44:47 +00:00
addr_list.c afs: Use kfree_rcu() instead of casting kfree() to rcu_callback_t 2020-03-13 10:47:33 -07:00
afs.h afs: Implement client support for the YFSVL.GetCellName RPC op 2020-06-04 15:37:57 +01:00
afs_cm.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
afs_fs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
afs_vl.h afs: Implement client support for the YFSVL.GetCellName RPC op 2020-06-04 15:37:57 +01:00
callback.c afs: Try to avoid taking RCU read lock when checking vnode validity 2021-09-13 09:10:39 +01:00
cell.c afs: Convert afs to use the new fscache API 2022-01-07 13:44:47 +00:00
cmservice.c afs: Fix tracepoint string placement with built-in AFS 2021-07-21 15:08:35 +01:00
dir.c afs: Fix infinite loop found by xfstest generic/676 2022-06-01 11:11:51 -07:00
dir_edit.c afs: Use folios in directory handling 2021-11-10 21:17:09 +00:00
dir_silly.c afs: Fix kerneldoc warning shown up by W=1 2021-10-04 22:04:44 +01:00
dynroot.c netfs: Add a netfs inode context 2022-03-18 09:29:05 +00:00
file.c afs: Convert to release_folio 2022-05-09 23:12:32 -04:00
flock.c fs: remove mandatory file locking support 2021-08-23 06:15:36 -04:00
fs_operation.c afs: Fix speculative status fetches 2021-05-01 11:55:36 -07:00
fs_probe.c afs: Fix corruption in reads at fpos 2G-4G from an OpenAFS server 2021-09-13 09:14:21 +01:00
fsclient.c afs: Fix corruption in reads at fpos 2G-4G from an OpenAFS server 2021-09-13 09:14:21 +01:00
inode.c netfs: gcc-12: temporarily disable '-Wattribute-warning' for now 2022-06-09 11:29:36 -07:00
internal.h afs: Convert to release_folio 2022-05-09 23:12:32 -04:00
main.c afs: Convert afs to use the new fscache API 2022-01-07 13:44:47 +00:00
misc.c afs: Adjust ACK interpretation to try and cope with NAT 2022-05-22 21:03:02 +01:00
mntpt.c afs: Stop listxattr() from listing "afs.*" attributes 2021-03-15 17:09:54 +00:00
proc.c proc: remove PDE_DATA() completely 2022-01-22 08:33:37 +02:00
protocol_afs.h afs: Fix corruption in reads at fpos 2G-4G from an OpenAFS server 2021-09-13 09:14:21 +01:00
protocol_uae.h afs: Add support for the UAE error table 2019-06-28 18:37:53 +01:00
protocol_yfs.h afs: Fix corruption in reads at fpos 2G-4G from an OpenAFS server 2021-09-13 09:14:21 +01:00
rotate.c afs: Adjust ACK interpretation to try and cope with NAT 2022-05-22 21:03:02 +01:00
rxrpc.c rxrpc, afs: Fix selection of abort codes 2022-05-22 21:03:02 +01:00
security.c afs: Prefer struct_size over open coded arithmetic 2022-04-26 10:20:00 -05:00
server.c afs: Fix mmap coherency vs 3rd-party changes 2021-09-13 09:10:39 +01:00
server_list.c afs: Reorganise volume and server trees to be rooted on the cell 2020-06-04 15:37:57 +01:00
super.c Netfs prep for write helpers 2022-03-31 15:49:36 -07:00
vl_alias.c afs: Add tracing for cell refcount and active user count 2020-10-16 14:39:21 +01:00
vl_list.c afs: Don't use VL probe running state to make decisions outside probe code 2020-08-20 18:21:28 +01:00
vl_probe.c afs: Don't use VL probe running state to make decisions outside probe code 2020-08-20 18:21:28 +01:00
vl_rotate.c afs: Add tracing for cell refcount and active user count 2020-10-16 14:39:21 +01:00
vlclient.c afs: Fix fall-through warnings for Clang 2021-05-25 07:30:34 -10:00
volume.c afs: Convert afs to use the new fscache API 2022-01-07 13:44:47 +00:00
write.c Networking changes for 5.19. 2022-05-25 12:22:58 -07:00
xattr.c afs: Stop listxattr() from listing "afs.*" attributes 2021-03-15 17:09:54 +00:00
xdr_fs.h afs: Fix directory entry size calculation 2021-01-04 12:25:19 +00:00
yfsclient.c afs: Set mtime from the client for yfs create operations 2021-11-02 09:42:26 +00:00