Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6551790rdb; Fri, 15 Dec 2023 01:35:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IG26krPMuSKM74pO4KaJ6Y/AY2mowWkBZ7tX489uu4cZf6MXU0cecTwYMAe5SS32ZTRmvau X-Received: by 2002:ac8:5a87:0:b0:425:9e75:3c77 with SMTP id c7-20020ac85a87000000b004259e753c77mr17381775qtc.55.1702632921133; Fri, 15 Dec 2023 01:35:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702632921; cv=none; d=google.com; s=arc-20160816; b=r+LE4gOr6YgXJ0pytOi5QRKCkVuSok2pDKShsJUcdhjobRaMYwaCXCem0N3XKTGoHV 9wRW/OV5bMXHbgkrL3ymIAn7yuPDefc/91AFSu6sKPIdofRAtePRstICmJCWHuUPR0M6 RfI7oVQqS4Mr34CDAMCtK68J0ni6Fbm2o3wAJZzAEdKHCizUozTvd+wEW8g8ikAXqKY4 D4ACm5SgR+QiqA3h4hOxCc+PKSh6TjmaZzdTEpKdU/5tIBFbZvP5NxfGJL8HAGq9MaJX +TBYmbzrhaPmhrjVTUVCGdRKEfRRiBWgOgXFOMzd5UFWpMVjv82ZgJkf9C1UdIbBtu0I WXLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:subject:cc:to:from:date:user-agent:message-id :dkim-signature; bh=b4R8oBfA9zqLdMspEmf7BM9tcAtmYn2SA6ZbJ+T1P5c=; fh=vd912/km9qZuP2V7TBjqUWoA7VSy9ThzbPxJdH/Qh1E=; b=ZlGxpDwBRTqv3q7kFGgxIGv/KzNaC0bkYI2nQijwTTah+YIo1NgTd/COBTIVwOgQwb 4L42cfttAeRwgd4vG6MuXpk0bYlVVZsVF6K+NdGun0FloRNVYTp8MH+CBqdjWm9B9JTI ouyyHjnHpBbpRzzvNS9y6ROs9fd09BHEopkkabsEYF6nz6/bEOCgq6OZ/NizmaQm8hw2 +4NQRrILWdXGegmBef+MDXV20nGIkjwB+hXfETinFtu6Mpc6b2833J/dmEVUyny/MDTr 7NShJLdUsxgK7IwZFX3sPOOYbZDr5jFtdLD+6cTIDztOqn9Vovetep6xGSh//uqwXyjj qR1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Lq2PgWht; spf=pass (google.com: domain of linux-kernel+bounces-688-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-688-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id dq15-20020a05622a520f00b00417aec1fb7bsi15846698qtb.353.2023.12.15.01.35.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 01:35:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-688-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=Lq2PgWht; spf=pass (google.com: domain of linux-kernel+bounces-688-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-688-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id DDD211C20FBC for ; Fri, 15 Dec 2023 09:35:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46A622033B; Fri, 15 Dec 2023 09:33:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Lq2PgWht" X-Original-To: linux-kernel@vger.kernel.org Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 061F5179A2; Fri, 15 Dec 2023 09:33:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-Id:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=b4R8oBfA9zqLdMspEmf7BM9tcAtmYn2SA6ZbJ+T1P5c=; b=Lq2PgWhtX3V8toHwd4gXthsfPV 51X7SJQC7Nru1W8AxzAo9FgQf8X7B//HhiVa4Wni0K2G+n5NSLp0J6KuWaVPHCg5LqaWnnTct6an7 VSn/94veX/IqLryss/BBYEDgrH3uHxiAng0tbAwUZR/2wWcS1xNJe4HBpFsWFWk2lHDRHwf+hSYIV jW3O6OYVrI2YIUtYDEzNZCpeDl/mhsRZv8X+fwN3HuvgHv0Zv4s2ZWXFlNfony2rirfUxjBaebt0e 2AMaCofhDa/dAdzVSTw7hG62RjkawKG+01OP4YeCDE2L2mGeW2/sgrNjJVf24DXfwrfjR9XaYP+Bk aMms2tmQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rE4ZF-009rG1-0w; Fri, 15 Dec 2023 09:33:14 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 0) id D6BA730098F; Fri, 15 Dec 2023 10:33:11 +0100 (CET) Message-Id: <20231215092707.669401084@infradead.org> User-Agent: quilt/0.65 Date: Fri, 15 Dec 2023 10:12:21 +0100 From: Peter Zijlstra To: Alexei Starovoitov Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, davem@davemloft.net, dsahern@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, Arnd Bergmann , samitolvanen@google.com, keescook@chromium.org, nathan@kernel.org, ndesaulniers@google.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-arch@vger.kernel.org, llvm@lists.linux.dev, jpoimboe@kernel.org, joao@overdrivepizza.com, mark.rutland@arm.com, peterz@infradead.org Subject: [PATCH v3 5/7] cfi: Add CFI_NOSEAL() References: <20231215091216.135791411@infradead.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=UTF-8 Add a CFI_NOSEAL() helper to mark functions that need to retain their CFI information, despite not otherwise leaking their address. Signed-off-by: Peter Zijlstra (Intel) --- arch/x86/include/asm/cfi.h | 5 +++++ include/linux/cfi.h | 4 ++++ 2 files changed, 9 insertions(+) --- a/arch/x86/include/asm/cfi.h +++ b/arch/x86/include/asm/cfi.h @@ -8,6 +8,7 @@ * Copyright (C) 2022 Google LLC */ #include +#include /* * An overview of the various calling conventions... @@ -138,4 +139,8 @@ static inline u32 cfi_get_func_hash(void } #endif /* CONFIG_CFI_CLANG */ +#if HAS_KERNEL_IBT == 1 +#define CFI_NOSEAL(x) asm(IBT_NOSEAL(__stringify(x))) +#endif + #endif /* _ASM_X86_CFI_H */ --- a/include/linux/cfi.h +++ b/include/linux/cfi.h @@ -46,4 +46,8 @@ static inline void module_cfi_finalize(c #endif /* CONFIG_ARCH_USES_CFI_TRAPS */ #endif /* CONFIG_MODULES */ +#ifndef CFI_NOSEAL +#define CFI_NOSEAL(x) +#endif + #endif /* _LINUX_CFI_H */