Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1387952lqe; Mon, 8 Apr 2024 07:36:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVVz8PqUEafr/6QrB2ksv5EiZFgPln/GMb00svaKxLZtY/90kN5JNVHPzypZoudXLEaQYpXg3LTZBMZVUJVQmGYOxfDSYMnCBrVIQXDAw== X-Google-Smtp-Source: AGHT+IG6UKaDfS945LONQL8+cj8pmugwcWNjgwovi/aAoHO8IgOhjaM0+05G0OUpZE4KJUbLz3AC X-Received: by 2002:a17:907:1c26:b0:a51:d7c8:300c with SMTP id nc38-20020a1709071c2600b00a51d7c8300cmr2080722ejc.17.1712586998829; Mon, 08 Apr 2024 07:36:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712586998; cv=pass; d=google.com; s=arc-20160816; b=Bhnj5KRRJY/OGuGJa5cRnN0aP7fNtqb9YdYqxW6sxwrmU8Sfdok1B3XIkm+PlS98Tm TmTA++AZGKQtXgqgtZVgVio3ZbQ6JLGoH+0t805ikkfHkPgvYPFhAkz7UyBgUpbD3SF8 1GpEmjUZxNNut32Xme9qcsur4NbM5L10amtr0Le0A09+38U1OiLLX1g8RFW5x/G/8Q2z OB0cT9XVrStS1AWfGRt3XgfBp9u/a+TTc/Cl4RvCeUGTKEXCanDwhv2Q+QqgELxS++8w /Yn6S1eKmNJ2GA0Kf/U9CODzmkf6oZ8YKAQ/qmcLvJrziOn5daFG5nKL56+qsye7/SiH JxvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=HLImobEPZznORyc/WCud4eu71GPBDbbHtA/ZDIXEBEU=; fh=zksavzlPHApBsxYlQDKAw+IXsG5HYcj9AljPMh8rBME=; b=k2Xr66N31V67PhYMYYkXuCefTmwboX7I1ZugZLVHiIZvu4FTWmZo30dv3c2zCoblED RcrwUnoO4GGTHmq27vwKEnCyCokqCWgRqOkkpJnBBTxRfvF98k+sbgy8U+2VdbXPblZi t87K58Fb2/g/4JL5eSgGUXs9H68DtNJaTvR+F7fGsE4/T1cmaDv1SvFTcMaaz9we+jLz rIH3S45QOHgXyd1fyWHBL6QeiwF0D7fJQzFEfk5tw/bBrvhHn+clEModCi0D4uAKJq7w GiMq9eaNHnsifSkhuTx5X3+E/U2mfgf02LfueChDxG01lHVj9CDp7F7E7fXIIAK2uAUh SnYQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Cg32Qols; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Cg32Qols; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-135526-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135526-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ce23-20020a170906b25700b00a51dc2aac67si680096ejb.975.2024.04.08.07.36.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 07:36:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135526-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Cg32Qols; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=Cg32Qols; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-135526-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135526-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 50DAB1F220DF for ; Mon, 8 Apr 2024 14:36:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E00FA13E8BD; Mon, 8 Apr 2024 14:36:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="Cg32Qols"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="1PLkJLud"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="Cg32Qols"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="1PLkJLud" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C97C1CD21; Mon, 8 Apr 2024 14:36:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712586988; cv=none; b=rT3HWskZsB4h5co9oUtwtiQjsNFC2v5n8BhlVMmAOJRGS612c/T4QGS5ly+xzmeUwac/hhdqmf/NbQCcbgqkzGoj1YH+KXvLG7Yf6LjFQ+QWFK+KcmEcFMemMrhOgo0Mw3VFT3HeQR4GjTYG1kLk+B5+i4ghY/08HRxXAngNHAs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712586988; c=relaxed/simple; bh=+cphjScDx/N1LVEGUDOhYmryp/xfMJ5Vvr5hDEuq1D4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZUnbIADmQ77HBRfSIVsuaIFmPZZCeQAmq4TLCzPya+T6s50G3Pgafzq4BXiYI5e6gYBRv6/C2P0mRagohUex2d9KWXLrv17xCII6Y3hnwLyouFUBVizbVXkSJwP/7VCt97+910XugWVp/bs0tFHT0jJwdAZDpHE1u6kqhOWHWkk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=Cg32Qols; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=1PLkJLud; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=Cg32Qols; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=1PLkJLud; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 378D4229CA; Mon, 8 Apr 2024 14:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1712586984; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HLImobEPZznORyc/WCud4eu71GPBDbbHtA/ZDIXEBEU=; b=Cg32QolsCFAjD8mTI7jyVbL+nlEtamG5yOH6w9yEvtAWkPMu1mpAC6c5XYGov+3h+ByrWq GXe78PL0efcpmDcuX8iCdnECGB+y1fG1qlEv7dzFC8D84TavmxhupMqzFK7ttxr5HygSG+ bfXPfl/GiuVGxDM8lrJLy5yv7pbtjkM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1712586984; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HLImobEPZznORyc/WCud4eu71GPBDbbHtA/ZDIXEBEU=; b=1PLkJLudwmhqPbV9ebbqJT4Hpqh+jkJN2lxpOMUHPyc7hJI3NkP/y+MBBKTnL5TAAl3qb6 riWOndtqNc6Pq5CA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=Cg32Qols; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=1PLkJLud DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1712586984; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HLImobEPZznORyc/WCud4eu71GPBDbbHtA/ZDIXEBEU=; b=Cg32QolsCFAjD8mTI7jyVbL+nlEtamG5yOH6w9yEvtAWkPMu1mpAC6c5XYGov+3h+ByrWq GXe78PL0efcpmDcuX8iCdnECGB+y1fG1qlEv7dzFC8D84TavmxhupMqzFK7ttxr5HygSG+ bfXPfl/GiuVGxDM8lrJLy5yv7pbtjkM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1712586984; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HLImobEPZznORyc/WCud4eu71GPBDbbHtA/ZDIXEBEU=; b=1PLkJLudwmhqPbV9ebbqJT4Hpqh+jkJN2lxpOMUHPyc7hJI3NkP/y+MBBKTnL5TAAl3qb6 riWOndtqNc6Pq5CA== Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 299381332F; Mon, 8 Apr 2024 14:36:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id CzwdCugAFGZzcQAAn2gu4w (envelope-from ); Mon, 08 Apr 2024 14:36:24 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id BEA97A0814; Mon, 8 Apr 2024 16:36:23 +0200 (CEST) Date: Mon, 8 Apr 2024 16:36:23 +0200 From: Jan Kara To: Arnd Bergmann Cc: linux-fsdevel@vger.kernel.org, Mike Marshall , Arnd Bergmann , Alexander Viro , Christian Brauner , Jan Kara , Martin Brandenburg , devel@lists.orangefs.org, Vlastimil Babka , Kees Cook , Justin Stitt , linux-kernel@vger.kernel.org Subject: Re: [PATCH] [RESEND] orangefs: fix out-of-bounds fsid access Message-ID: <20240408143623.t4uj4dbewl4hyoar@quack3> References: <20240408075052.3304511-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240408075052.3304511-1-arnd@kernel.org> X-Spam-Level: X-Spamd-Result: default: False [-4.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; MISSING_XM_UA(0.00)[]; RCPT_COUNT_TWELVE(0.00)[13]; FUZZY_BLOCKED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:dkim,suse.cz:email,suse.com:email,imap2.dmz-prg2.suse.org:helo,imap2.dmz-prg2.suse.org:rdns]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:98:from]; RCVD_TLS_LAST(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.cz:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 378D4229CA X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Flag: NO X-Spam-Score: -4.01 On Mon 08-04-24 09:50:43, Arnd Bergmann wrote: > From: Arnd Bergmann > > orangefs_statfs() copies two consecutive fields of the superblock into > the statfs structure, which triggers a warning from the string fortification > helpers: > > In file included from fs/orangefs/super.c:8: > include/linux/fortify-string.h:592:4: error: call to '__read_overflow2_field' declared with 'warning' attribute: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror,-Wattribute-warning] > __read_overflow2_field(q_size_field, size); > > Change the memcpy() to an individual assignment of the two fields, which helps > both the compiler and human readers understand better what it does. > > Link: https://lore.kernel.org/all/20230622101701.3399585-1-arnd@kernel.org/ > Cc: Alexander Viro > Cc: Christian Brauner > Cc: Jan Kara > Cc: linux-fsdevel@vger.kernel.org > Cc: Mike Marshall > Cc: Martin Brandenburg > Cc: devel@lists.orangefs.org > Signed-off-by: Arnd Bergmann > --- > Resending to VFS maintainers, I sent this a couple of times to the > orangefs maintainers but never got a reply > --- > fs/orangefs/super.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c > index fb4d09c2f531..152478295766 100644 > --- a/fs/orangefs/super.c > +++ b/fs/orangefs/super.c > @@ -201,7 +201,10 @@ static int orangefs_statfs(struct dentry *dentry, struct kstatfs *buf) > (long)new_op->downcall.resp.statfs.files_avail); > > buf->f_type = sb->s_magic; > - memcpy(&buf->f_fsid, &ORANGEFS_SB(sb)->fs_id, sizeof(buf->f_fsid)); > + buf->f_fsid = (__kernel_fsid_t) {{ > + ORANGEFS_SB(sb)->fs_id, > + ORANGEFS_SB(sb)->id, > + }}; Frankly, this initializer is hard to understand for me. Why not simple: buf->f_fsid[0] = ORANGEFS_SB(sb)->fs_id; buf->f_fsid[1] = ORANGEFS_SB(sb)->id; Honza -- Jan Kara SUSE Labs, CR