Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3410388pxp; Mon, 14 Mar 2022 19:22:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyu29sRprRhJBE5QO+QmwsEJSuldXwd7leWIf40SQJX+bls9MUEpAoOsNI8+fBLxavxea9 X-Received: by 2002:a17:906:2a92:b0:6cd:4349:dc1a with SMTP id l18-20020a1709062a9200b006cd4349dc1amr20534945eje.648.1647310972922; Mon, 14 Mar 2022 19:22:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647310972; cv=none; d=google.com; s=arc-20160816; b=nR8RdnPsEktwTXS5ESXSOaed1jb1W+dwZjnuiA6K0j6s0aexHBeVMfxXzFRRFhr4zY McLAS55FR6fDoWIpzqKe/UytA0KcX1RMuiGgf+6VMT/6y6fN+nW7iNP9qJsdr91WOWOC WYKXK1WnSsyAFWqDEY9tAf/7Lr8Ccvg5M6OmmaTPZ8O4oBjgwef59LG08RC3Kk9c6CXc bjxHQNh54ziZ15l0CkhcroFmHKyNrLxsuCuyhf1aR8C12BLJT1Wjo5KiR1CNHRqlPo+k WN08sw5r33gWzaYPLQMrWCxFaeQMUfY3s1WfRZQOFyMl1QTvU9KhyTHPQwzmB3/OHOZn Kwaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Xs4X/y59tj7HCyhkvEPkeSgLjnXIhqNwdO4FVnEL+Lk=; b=r+NsNSO09EV85ovXgrEnzT/5hcFkCCcGUMQDZu08YEpFK28/KcBfr2mKYMibx7qZDd 7NZXdMnz5PgwyUk0t3n6JB5yqv2CNMsTPzZ26Rl1jfuBSrLeLBQaZ1irIO0Jo84LZCLu qMlDF4yIVId2tqVDz6LUq2lq3fNkPIz3Kpi3tfKEKui3fK7b42+NpBNJXKbS4GsdYdrv C20yPZC9kWkVftgzNyheCcS/ERtMV9O+M6Tjb2pHxtIoXr2qGxBqxSc0o6fo0dlR+bl9 Br0SJ0cgPjhwDHk0BEUwg0YLjH1F86PvpHEVYYZyiasNbAzvymZYkldm8z9Q0aNOYflM zAGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=RlpyCy17; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne32-20020a1709077ba000b006da6dd46484si10814480ejc.155.2022.03.14.19.22.27; Mon, 14 Mar 2022 19:22:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=RlpyCy17; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242526AbiCNPe4 (ORCPT + 99 others); Mon, 14 Mar 2022 11:34:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230187AbiCNPey (ORCPT ); Mon, 14 Mar 2022 11:34:54 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 546166572; Mon, 14 Mar 2022 08:33:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Xs4X/y59tj7HCyhkvEPkeSgLjnXIhqNwdO4FVnEL+Lk=; b=RlpyCy17AC9KU1bMeyX9gDjqxL hhCYrshZ+ckxB66p0f2s35xypYHgvQDc2EhLIK7PdoZPSo2wQp0/uqOQbAADx6So/uuxagyHHv5P6 XdYiargvDKJqFlXE8nk3voaoMbmn+MzDqvbdwT4+Erf64fMsfg1FQiDWako7LIN6Cl5xkMx6MEG/B ND17scnQT5kPv+cGQV8cUG/gQgJMtgSZyAm2Lb4v2QwdJfZeOYRMNuh6AEj/Ub5p6jhhIaBJN5liD FSUETzkzk0feqLsiTGeB47ZK26DoSp30lXMAECxM8B/LXEymhokHpV/R6syZjxTYQhqnquNeFEloW SRHIhZLQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nTmh9-000svL-FV; Mon, 14 Mar 2022 15:33:15 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 9109C3003BC; Mon, 14 Mar 2022 16:33:13 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 50B833041324E; Mon, 14 Mar 2022 16:33:13 +0100 (CET) Date: Mon, 14 Mar 2022 16:33:13 +0100 From: Peter Zijlstra To: Alexei Starovoitov Cc: Kumar Kartikeya Dwivedi , X86 ML , joao@overdrivepizza.com, hjl.tools@gmail.com, Josh Poimboeuf , Andrew Cooper , LKML , Nick Desaulniers , Kees Cook , Sami Tolvanen , Mark Rutland , alyssa.milburn@intel.com, Miroslav Benes , Steven Rostedt , Masami Hiramatsu , Daniel Borkmann , Andrii Nakryiko , bpf Subject: Re: [PATCH v4 00/45] x86: Kernel IBT Message-ID: References: <20220309190917.w3tq72alughslanq@ast-mbp.dhcp.thefacebook.com> <20220312154407.GF28057@worktop.programming.kicks-ass.net> <20220313085214.GK28057@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220313085214.GK28057@worktop.programming.kicks-ass.net> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 13, 2022 at 09:52:14AM +0100, Peter Zijlstra wrote: > > and: > > vmlinux.o: warning: objtool: ksys_unshare()+0x626: unreachable instruction > > which stays even after make clean. > > Humm, I shall have to dig out gcc-8.5 then. Ha!, I could reproduce using the bpf-selftest .config for x86_64. Fixing that (the __noreturn on __invalid_creds) immediately yields another one on that .config in asm_exc_double_fault. And a missing ENDBR if you don't build 32bit compat. I'll go clean up ... --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -551,6 +551,14 @@ SYM_CODE_START(\asmsym) movq $-1, ORIG_RAX(%rsp) /* no syscall to restart */ call \cfunc + /* + * For some configurations exc_double_fault() is a noreturn + */ +1: + .pushsection .discard.reachable + .long 1b - . + .popsection + jmp paranoid_exit _ASM_NOKPROBE(\asmsym) @@ -1440,6 +1448,7 @@ SYM_CODE_END(asm_exc_nmi) */ SYM_CODE_START(ignore_sysret) UNWIND_HINT_EMPTY + ENDBR mov $-ENOSYS, %eax sysretl SYM_CODE_END(ignore_sysret) diff --git a/include/linux/cred.h b/include/linux/cred.h index fcbc6885cc09..9ed9232af934 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h @@ -176,7 +176,7 @@ extern int set_cred_ucounts(struct cred *); * check for validity of credentials */ #ifdef CONFIG_DEBUG_CREDENTIALS -extern void __invalid_creds(const struct cred *, const char *, unsigned); +extern void __noreturn __invalid_creds(const struct cred *, const char *, unsigned); extern void __validate_process_creds(struct task_struct *, const char *, unsigned); diff --git a/kernel/cred.c b/kernel/cred.c index 933155c96922..e10c15f51c1f 100644 --- a/kernel/cred.c +++ b/kernel/cred.c @@ -870,7 +870,7 @@ static void dump_invalid_creds(const struct cred *cred, const char *label, /* * report use of invalid credentials */ -void __invalid_creds(const struct cred *cred, const char *file, unsigned line) +void __noreturn __invalid_creds(const struct cred *cred, const char *file, unsigned line) { printk(KERN_ERR "CRED: Invalid credentials\n"); printk(KERN_ERR "CRED: At %s:%u\n", file, line);