From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CDF45EE57C1 for ; Wed, 11 Sep 2024 15:55:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mq89zarZHhJc3eUtKCqJj+FYL8Z6cF9NETyRPs7X1rU=; b=xLwBrjy4VJv7nEcwTPJF81lm0A uzu4iyRcwHZh+nM1lYPsmL135uxLIvNQP8e0e75oaQeXu9o/+doXoDmg6uwPO8Mfw+dN9cm4k8vnN tu69k5dt6lZfAQdsOIY/WIm69kI8JpwRVNVpVkxbQSfv/yNrwro75Y4o11vcCtkrVzJVRBhNDAN5r n0AN/rroznviiRzVe3YNW3lRvTWFrmK1syHKvCAXmtxL2m1jVeX+mty4i6FYRu30q6n6vGre4g6ft hAOWiGYQyw6/caNIrpgPGcTvgwaSv0wJfs18//AhEdp8ZqxD9aVhZgjykKqE7QBdSqEo6wCq9mfTT WYp/fong==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1soPgY-0000000AFjQ-0sFy; Wed, 11 Sep 2024 15:55:14 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1soPPs-0000000ABgq-3Ko0 for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2024 15:38:02 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 59B021007; Wed, 11 Sep 2024 08:38:29 -0700 (PDT) Received: from bogus (e107155-lin.cambridge.arm.com [10.1.198.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1E7663F73B; Wed, 11 Sep 2024 08:37:59 -0700 (PDT) Date: Wed, 11 Sep 2024 16:37:56 +0100 From: Sudeep Holla To: "Arnd Bergmann" Cc: "Arnd Bergmann" , "Cristian Marussi" , "Jens Wiklander" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] firmware: arm_ffa: avoid string-fortify warningn in export_uuid() Message-ID: References: <20240909110938.247976-1-arnd@kernel.org> <0ae7475f-f53a-45e3-a484-667820042724@app.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0ae7475f-f53a-45e3-a484-667820042724@app.fastmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240911_083800_897248_21BEED64 X-CRM114-Status: GOOD ( 29.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Sep 11, 2024 at 02:44:25PM +0000, Arnd Bergmann wrote: > On Wed, Sep 11, 2024, at 14:14, Sudeep Holla wrote: > > On Mon, Sep 09, 2024 at 11:09:24AM +0000, Arnd Bergmann wrote: > >> From: Arnd Bergmann > >> > >> Copying to a 16 byte structure into an 8-byte struct member > >> causes a compile-time warning: > >> > >> In file included from drivers/firmware/arm_ffa/driver.c:25: > >> In function 'fortify_memcpy_chk', > >> inlined from 'export_uuid' at include/linux/uuid.h:88:2, > >> inlined from 'ffa_msg_send_direct_req2' at drivers/firmware/arm_ffa/driver.c:488:2: > >> include/linux/fortify-string.h:571:25: error: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Werror=attribute-warning] > >> 571 | __write_overflow_field(p_size_field, size); > >> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >> > >> Use a union for the conversion instead and make sure the byte order > >> is fixed in the process. > >> > > > > Thanks for spotting and fixing the issue. I tested enabling > > CONFIG_FORTIFY_SOURCE but couldn't hit this with gcc 13 and clang 20 > > Unfortunately I also don't have a reproducer at the moment, > but I know it was from a randconfig build with gcc-14.2. I tried > another few hundred randconfigs now with my patch reverted but it > didn't come back. I assume it only shows up in rare combinations > of some options, > Oh OK. > Do you have any additional information on the endianess question? > Is this arm_ffa firmware code supposed to work with big-endian > kernels? > I am trying to check if that is a requirement. Also the specification doesn't have any specific mention about it. Since it executes on the same AP cores as Linux in different EL, I assume the entire stack must be running same endian-ness. I will check internally. Unlike SCMI, I haven't tested FF-A with big-endian kernel so far. > > Also do you want this sent as fix on top of my FF-A PR now or after -rc1 ? > > Earlier would be better I think. I usually have one set of > bugfixes before rc1 even if it doesn't make it into the > first set of branches. > I will try to send earlier unless this endian-ness triggers more questions. I will update here anyways. -- Regards, Sudeep