linux-stable/fs/ceph
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
..
acl.c vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
addr.c A big pile of assorted fixes and improvements for the filesystem with 2022-06-02 08:59:39 -07:00
cache.c netfs: Add a netfs inode context 2022-03-18 09:29:05 +00:00
cache.h Netfs prep for write helpers 2022-03-31 15:49:36 -07:00
caps.c ceph: try to queue a writeback if revoking fails 2022-05-25 20:45:14 +02:00
ceph_frag.c
debugfs.c ceph: use tracked average r/w/m latencies to display metrics in debugfs 2022-03-21 13:35:16 +01:00
dir.c ceph: fix memory leak in ceph_readdir when note_last_dentry returns error 2022-03-21 13:35:16 +01:00
export.c ceph: shut down access to inode when async create fails 2021-11-08 03:29:51 +01:00
file.c ceph: fix setting of xattrs on async created inodes 2022-05-10 09:48:31 +02:00
inode.c netfs: gcc-12: temporarily disable '-Wattribute-warning' for now 2022-06-09 11:29:36 -07:00
io.c ceph: fix kerneldoc copypasta over ceph_start_io_direct 2021-04-27 23:52:23 +02:00
io.h ceph: add buffered/direct exclusionary locking for reads and writes 2019-09-16 12:06:25 +02:00
ioctl.c ceph: consider inode's last read/write when calculating wanted caps 2020-03-30 12:42:42 +02:00
ioctl.h
Kconfig ceph: conversion to new fscache API 2022-01-11 22:13:01 +00:00
locks.c ceph: eliminate req->r_wait_for_completion from ceph_mds_request 2022-03-01 18:26:36 +01:00
Makefile ceph: add dentry lease metric support 2020-06-01 13:22:51 +02:00
mds_client.c ceph: fix decoding of client session messages flags 2022-05-25 20:45:14 +02:00
mds_client.h ceph: switch TASK_INTERRUPTIBLE to TASK_KILLABLE 2022-05-25 20:45:14 +02:00
mdsmap.c ceph: fix mdsmap decode when there are MDS's beyond max_mds 2021-11-08 03:29:52 +01:00
metric.c ceph: include average/stdev r/w/m latency in mds metrics 2022-03-21 13:35:16 +01:00
metric.h ceph: include average/stdev r/w/m latency in mds metrics 2022-03-21 13:35:16 +01:00
quota.c ceph: fix statfs for subdir mounts 2022-05-25 20:45:14 +02:00
snap.c ceph: misc fix for code style and logs 2022-03-01 18:26:37 +01:00
strings.c ceph: add getvxattr op 2022-03-01 18:26:37 +01:00
super.c ceph: disable updating the atime since cephfs won't maintain it 2022-05-25 20:45:14 +02:00
super.h ceph: fix statfs for subdir mounts 2022-05-25 20:45:14 +02:00
util.c ceph: move net/ceph/ceph_fs.c to fs/ceph/util.c 2020-01-27 16:53:40 +01:00
xattr.c ceph: allow ceph.dir.rctime xattr to be updatable 2022-05-25 20:45:13 +02:00