Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp662369pxb; Fri, 16 Apr 2021 15:11:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaYDTW0LdxoVlL6fvt4f7p1YrpkOicKz3jOaew1MaBBSctpoXyuvgvAX0cklKHIvrxe+x5 X-Received: by 2002:a17:90a:fa98:: with SMTP id cu24mr12025051pjb.202.1618611063765; Fri, 16 Apr 2021 15:11:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618611063; cv=none; d=google.com; s=arc-20160816; b=va3eaCqjEQd5BBq6qQtrvExTR0ius54KGZcy6YhY5g4Nqp4Y/AmLpkSrXYhMTyf+IY UgOtEtDX3aGekb5TLSPMBjPyvCL7JybhS6oMntnvWiWNGhzgREj0f+04AbmPNfNjPmAi fTGjN7u3TSh0VA5vBLxrjwslWJ3Q0ksaO6VakRbAC9cvIr1sL+Y5X2tdcm8DhQ6z2B8E pB3Nsrx1XUeePukqoBRaT2WiQtwm4JqEpXz2fXWgXUeTJdqNqW7jdyKjxt5W8XxaPmg8 4f51GGjNQx/TbJx9Vt4RL1pgGWoRD3kmXo4maNmTDhzayGO5kgdwJR8jSH4Due5Ai0nw J7Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=Nv03/zLxr2oHatYYOW2cTappG/aWUT1vHWklwSM1ZYI=; b=E/CEx2TCF3oDMdzctUblbEs0WGvqGjRTNrIbeNardLgQ1PyO/N7Xd/thl76/MxUeGc TZ3c29NHGwgO1dFE+375HDsW2PEbEqkAi81Rjl0XnCri9Dfmkoqb5ZYYi0++Qyk6JmWr TDYmr9MpNKrXH4dKslKMm/Ie8fWo94WcmGwzbJnn2pIx/oaWZSJfJ2srzjD9Ny7ERplT 25aglYpoyBU8/YTM/niIamvNklVTmYTlugA22IGtjZepLOaZ/jaTELLal39LxPsS3Lvh MmoOUN7n+fdmzViUBun1lyShKHY8i0YYz0pWeSDsIja6EUWap9ag0b2znBInAR214pYd joyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=qPprLSkW; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p3si8227958plo.211.2021.04.16.15.10.51; Fri, 16 Apr 2021 15:11:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=qPprLSkW; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344464AbhDPVhu (ORCPT + 99 others); Fri, 16 Apr 2021 17:37:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235540AbhDPVhu (ORCPT ); Fri, 16 Apr 2021 17:37:50 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41813C061574; Fri, 16 Apr 2021 14:37:25 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1618609037; h=from:from:reply-to:subject:subject: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=Nv03/zLxr2oHatYYOW2cTappG/aWUT1vHWklwSM1ZYI=; b=qPprLSkW0kIBFmfAx0B3I7XdAZ51tGDJMCeDxt27wl7oCpvuISeVCcWiT+71nO9L7QGUP+ ULPQ9Sjd9alF4/zYbkTAR5xAq0utktI7JriDncQZYr3l1Oea9P7Rfcshh5SwL7bDJ2wcfS CzaeqCzPUOsOm+rgc/xowSdF9Kp3Oekv2yTMhl8r5yu+V9J+A5wr2d3uaw6fR0eZltwWK2 iW4D7ZgcBVKfUcWlT3Rnv0GiwtycAyBK677+XpcC+ji3pvtzbygqMaBt2XN5FykbHOrlQa whp17GStBdRh+UJM/8OaP9TBho4OU0eFpyx5TV3IDwGWt0fq/5aXFDbgEw4M5Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1618609037; h=from:from:reply-to:subject:subject: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=Nv03/zLxr2oHatYYOW2cTappG/aWUT1vHWklwSM1ZYI=; b=KhvVLh+3hJEGNrNN2QXKpQOaJ2k3XuR4bgYj1oH/lMK6TlkrZ/Kx8y0SzhCP+BtMaD+2ZU BUNjVhasXJU2m9DQ== To: Sami Tolvanen , x86@kernel.org Cc: Kees Cook , Josh Poimboeuf , Peter Zijlstra , Nathan Chancellor , Nick Desaulniers , Sedat Dilek , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Sami Tolvanen Subject: Re: [PATCH 04/15] static_call: Use global functions for the self-test In-Reply-To: <20210416203844.3803177-5-samitolvanen@google.com> References: <20210416203844.3803177-1-samitolvanen@google.com> <20210416203844.3803177-5-samitolvanen@google.com> Date: Fri, 16 Apr 2021 23:37:16 +0200 Message-ID: <87v98lud0z.ffs@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 16 2021 at 13:38, Sami Tolvanen wrote: > With CONFIG_CFI_CLANG, the compiler renames static functions. This > breaks static_call users using static functions, because the current > implementation assumes functions have stable names by hardcoding them > in inline assembly. Make the self-test functions global to prevent the > compiler from renaming them. Sorry, no. > Signed-off-by: Sami Tolvanen > --- > kernel/static_call.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/static_call.c b/kernel/static_call.c > index 723fcc9d20db..d09f500c2d2a 100644 > --- a/kernel/static_call.c > +++ b/kernel/static_call.c > @@ -503,12 +503,12 @@ long __static_call_return0(void) > > #ifdef CONFIG_STATIC_CALL_SELFTEST > > -static int func_a(int x) > +int func_a(int x) > { > return x+1; > } > > -static int func_b(int x) > +int func_b(int x) > { > return x+2; > } Did you even compile that? Global functions without a prototype are generating warnings, but we can ignore them just because of sekurity, right? Aside of that polluting the global namespace with func_a/b just to work around a tool shortcoming is beyond hillarious. Fix the tool not the perfectly correct code. Thanks, tglx