Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2932941iog; Mon, 20 Jun 2022 07:46:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vvfNU3srHBoiT0/+ezuyTRX0g7OVVAbxwDxYSGGl/mDhrLe80seUUA1zaRk7ldEdXZycd8 X-Received: by 2002:a17:902:c40a:b0:163:d38e:3049 with SMTP id k10-20020a170902c40a00b00163d38e3049mr24086439plk.87.1655736377207; Mon, 20 Jun 2022 07:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655736377; cv=none; d=google.com; s=arc-20160816; b=ihxiO0cq9xY6qHbfaOUpqp2z4yQ+n1r48k0q26T7eQE19hx0CRDNq3/BGdDOvoWANZ D0UbJZ9vjQJ+rq02Fz3MKedvEp+WWraJKaZw8Qy3TEvN1+XG1NlOEIMKwMnvTrizcDFZ glmuFISHW0CivRN0e2/8TQULSpAPyIzoG4eZe2XBuKgPjkkjTjQ/oqJ6Autw2/hKLvcO 0WF4I/6GFA3gmqnIsjPhRnvl1uC8tWjE1VReZyJOmaEc/cvMf29cf982X0yOUEqscJlD yx/nl6VUQLEtZgurWobN60Uln2FzwJI9xQlcjBYC1INay6vPcpOQcfRXehEd+oR744v+ f5Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=c7GoqTUsnP6N3FOT47ogXJjls5kd4mviWsartx4wMmk=; b=ClICozdsxAewu1nCe+9JHev2w+8fjPFEHMxFJvSkAFYrTi2PJi9yKSWxsbP/X2hFj6 1DQHHTA3Q5jG0b2omVMI3wHJY0GE3NRDOKGzviioS3J+f5XiAWdITJXRRD5Q6EO4QzO7 ZKf2eGQceNQQ/Ihi+uuliEFcTn4vNIRd+0TAiyid4xbly6nkj0rCaq1zIfnROthyA1XU KvwF9Zuvb/vNVxIG3xXAOOh1Lu37pSNzYECg4htT8woI9UAX3ii4yW31CJIzS7sTSYmb WRCFR4guaqK1eRNzxPkMGFinQYb9z0l4K1OdWGSk7RJorxQPvO/jMukgDpvHOyMxDkQV ImwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ODvCNQfC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d14-20020a056a00198e00b004fe3a6ea856si16656605pfl.176.2022.06.20.07.46.05; Mon, 20 Jun 2022 07:46:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ODvCNQfC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243442AbiFTM4T (ORCPT + 99 others); Mon, 20 Jun 2022 08:56:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243130AbiFTMzq (ORCPT ); Mon, 20 Jun 2022 08:55:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDD0B18B2F; Mon, 20 Jun 2022 05:54:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E4AA2614EC; Mon, 20 Jun 2022 12:54:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBC22C3411B; Mon, 20 Jun 2022 12:54:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729687; bh=g6hV2nEfu4q7fWk0v9EQw/74GXzsuzsOm5CE2k8SdLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ODvCNQfCAbtAiCfo6e112jcux+saC0jVByG7CxSrJyKM/Vp1UPUyrZEV1T5TJJGm1 bygBgAu1mDUbGxGtfYMWan/2hgLy8OltttJwQVvgWp4nyk1NQQJiJAPoLcLwpH4v19 sHSwbSPRwiAU7YPCEFSZcI6rn6FfD+XjTfDX+6CI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , David Howells , Linus Torvalds , Sasha Levin Subject: [PATCH 5.18 043/141] netfs: gcc-12: temporarily disable -Wattribute-warning for now Date: Mon, 20 Jun 2022 14:49:41 +0200 Message-Id: <20220620124730.809601885@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Torvalds [ Upstream commit 507160f46c55913955d272ebf559d63809a8e560 ] 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 Cc: David Howells Link: https://lore.kernel.org/all/AEEBCF5D-8402-441D-940B-105AA718C71F@chromium.org/ Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/afs/inode.c | 3 +++ fs/ceph/inode.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/fs/afs/inode.c b/fs/afs/inode.c index 30b066299d39..65b439cd53d2 100644 --- a/fs/afs/inode.c +++ b/fs/afs/inode.c @@ -25,6 +25,9 @@ #include "internal.h" #include "afs_fs.h" +// Temporary: netfs does disgusting things with inode pointers +#pragma GCC diagnostic ignored "-Wattribute-warning" + static const struct inode_operations afs_symlink_inode_operations = { .get_link = page_get_link, }; diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 63113e2a4890..83739dae5268 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -20,6 +20,9 @@ #include "cache.h" #include +// Temporary: netfs does disgusting things with inode pointers +#pragma GCC diagnostic ignored "-Wattribute-warning" + /* * Ceph inode operations * -- 2.35.1