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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 606A8C6FD19 for ; Fri, 10 Mar 2023 09:25:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229522AbjCJJZ0 (ORCPT ); Fri, 10 Mar 2023 04:25:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231362AbjCJJYx (ORCPT ); Fri, 10 Mar 2023 04:24:53 -0500 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A16D7616A for ; Fri, 10 Mar 2023 01:21:00 -0800 (PST) Received: by mail-ed1-x530.google.com with SMTP id g3so17894963eda.1 for ; Fri, 10 Mar 2023 01:21:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678439995; h=in-reply-to:references:cc:to:from:subject:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+jlcVFpkc+G4FJ/zWyYH6HfDuPu4pDDui18UUuFFCY0=; b=KpIfO++r8WvXrnTJvTOfvuNYfH6VgFAChtMC07wInTR5iIFREy6p9E2plBwtW+1vkz 4Hq1Dj2pxKQzPB1SP1VsCC/6E0rUirHOb+YgkoUlejq7AWtXqmVy+Aem+NOzcY7lF6r1 qOCC8WQn9yQ5rAYRX6lxPKeYQ5mYkXJT1y6fQKuPn3h3X/ftcjzO/rr4++2gGcxTTFc/ DqOFnzKiQL+KVmYRqOHzngZ+Yn84ya5PV/u488VddbFJy7c5T4iF0xB8CY9JY0WpN41z aA8NBCtDvXqC9oZ4/zITHybhcJlA38vbeLlwcnoGFJz4mOAIkwFFa6nfyUcFIO5OUDYH 4n4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678439995; h=in-reply-to:references:cc:to:from:subject:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=+jlcVFpkc+G4FJ/zWyYH6HfDuPu4pDDui18UUuFFCY0=; b=dB3WUGRSeUqIdeXKAphGeXAEOzy7wPQX2ZUcYMlB67HsqdolQ1GhKNc/KTZgbC1di1 KGf675oQeLbSjDEkAXGCKgBzPOcjiV4TxXf4aBBCSMFiR3uu3V5F6bRuFCKTIkwbWZAY 0Lh1mlXwawzL1XnYcYfgE209zm2Wyr6YV0H8pOv+VqCynDsCWrLOCmPrBMwzzFukB2GZ 0clPLxvOhiHxXmv6Bm6dPzlJszudyvavUV2uD4e4XbrXsBT0cQA+Oj1PAwBRUd8M45Nq APTA+a9/yXo+rqK0BGFhM98zOXeY2yD763S1jONdHtBIi23TM3JYiZfyx8ZjESHZ0gFo l5Zw== X-Gm-Message-State: AO0yUKXOemNkGN+qfQVp7aLXhvSmV9P0qGlP9ZTFNeiBQ+SsxUJdzGph iTrt3oc1ffYNDhqO811KORTeGPnnXUsL3NT1 X-Google-Smtp-Source: AK7set9+zadZW8nty9HJuXsGINTi2feWWxJeUgC6sYMnvOV+ndcdCxmQUC4CTb1WNEhmlyLBqnb9pw== X-Received: by 2002:a17:906:2b19:b0:8b1:7e88:c20e with SMTP id a25-20020a1709062b1900b008b17e88c20emr24127566ejg.41.1678439994881; Fri, 10 Mar 2023 01:19:54 -0800 (PST) Received: from localhost ([2001:b07:5d37:537d:5e25:9ef5:7977:d60c]) by smtp.gmail.com with ESMTPSA id j16-20020a170906279000b008e724dfc44bsm729100ejc.78.2023.03.10.01.19.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Mar 2023 01:19:54 -0800 (PST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 10 Mar 2023 10:19:53 +0100 Message-Id: Subject: Re: [PATCH v1] x86: suppress warning generated by W=1 From: "Vincenzo Palazzo" To: "Greg KH" Cc: , , X-Mailer: aerc 0.14.0 References: <20230309174854.350143-1-vincenzopalazzodev@gmail.com> In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-hardening@vger.kernel.org On Fri Mar 10, 2023 at 8:33 AM CET, Greg KH wrote: > On Thu, Mar 09, 2023 at 06:48:54PM +0100, Vincenzo Palazzo wrote: > > suppress unused warnings and fix the error that there is > > with the W=3D1 enabled. > > Why are you building with that option enabled? It's not a normal one at > all. I was using this option because I would like to see if my c code has warnings, but currently it is not possible compile the kernel with=20 W=3D1. Maybe I'm missing a little bit of history here, this is not the correct option to compile the kernel with -Wall? Or it is the wrong way to compile the kernel with -Wall, so at this point another good patch if we do not want to see the warnings, is rework the W=3D1 to allow a subset of warnings, like the one in this patch? > > >=20 > > Warning generated > >=20 > > arch/x86/entry/common.c:238:24: error: no previous prototype for =E2=80= =98do_SYSENTER_32=E2=80=99 [-Werror=3Dmissing-prototypes] > > 238 | __visible noinstr long do_SYSENTER_32(struct pt_regs *regs) > >=20 > > Signed-off-by: Vincenzo Palazzo > > --- > > arch/x86/entry/common.c | 3 +++ > > 1 file changed, 3 insertions(+) > >=20 > > diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c > > index 6c2826417b33..8f17b2c3e9de 100644 > > --- a/arch/x86/entry/common.c > > +++ b/arch/x86/entry/common.c > > @@ -234,6 +234,9 @@ __visible noinstr long do_fast_syscall_32(struct pt= _regs *regs) > > #endif > > } > > =20 > > +/* prototype is a placeholder to suppress the missing prototype wornin= g */ > > +long do_SYSENTER_32(struct pt_regs *regs); > > This feels wrong, sorry, and you have a spelling error in your comment. Yeah it is, in fact this do not make sense because we are in a c file. However, looks like it is the only option to suppress the warnings in this case? Do you know some magic __attribute__ that can suppress it for a not static function like the one in this PATCH? > > > + > > /* Returns 0 to return using IRET or 1 to return using SYSEXIT/SYSRETL= . */ > > __visible noinstr long do_SYSENTER_32(struct pt_regs *regs) > > It's wrong because look, you define it right here so why do you need a > prototype? Here the problem is the macros __visible that force the function to be=20 not static because need to be visible outside, and in C as far I know a=20 procedure without a prototype need to be static, for this reason I made the= =20 previous trick to suppress the warning. I thought also to modify the macros in some way but I did not have a good idea. P.S: Thanks to catch the typo, I will provide a v2 when we converge in a common solution. Cheers! Vincent.