Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp7857058rwn; Wed, 14 Sep 2022 05:40:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR7ByTZ8O41UeFBqN51WKjZzm1MbcvtiANLCFMJ632vMgBo1q9aJA4/VAmQE21naAq+/iFcQ X-Received: by 2002:a17:902:ccd1:b0:172:5c49:34be with SMTP id z17-20020a170902ccd100b001725c4934bemr36039199ple.23.1663159203350; Wed, 14 Sep 2022 05:40:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663159203; cv=none; d=google.com; s=arc-20160816; b=x83mai4Z9Li67qlG9j3wNCRbxY4RLkjlOL/1or7sb8u71coAvn1alG6ZAKBO6RreRM JQWCstTOr58bN1mE1GxGuiABUTO300bh4FeD4i8WV46WPX/IOZBv+N6cBiqv8NgtP8gN 2BOseivCTybsjowdhjaxMecaU4mVIS6PB1ECmqTZPWv82AaRIWD+6IXsxdvNdkwv7tTR xrQD0Ewb2YjRmXqX0qqHWv9e2eJZkAvwcKknprFFMd0y9C/2KbYM7eeVHMTXWNZVmGth FERFKPY/BJayURa5LHT0ZIYKIXkweZoMX/U4H9dYS5llkQ2QIa+OhC9NY1oTkNPpxRrX ttNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature:dkim-signature; bh=EROMvm9onlQ1pv6K+o0p8csnLRDwiei6BOviFGwrA7g=; b=SApY9DdXL7oG1CgJp10LvPzEJk2MhuriLgL0bbsCn/+ufS3T3jl7+0435PAWVlMSf+ finA6HbhHc02hUGEpdh6apq90Sk65kZziogqQpqoU32ggjDkzM+DLrI1u/HcXCxvVkV5 NT7g6sbaFGEfoT5Q0yesjTbRB+09apQgZyrTSAsAAhhelUE+VLfFVZx06x2WJX8pK/DK dfLquT8pYFW6FGQCqshPCavyKRe2POJnROVbnrT4uc5sNAESKPLMTMgJC0qxPh2Eabk5 O94CS2Qb5UPiyCti8DJZiNrOPslNhBcZD8NVltpfn2PdRxzxgT2RSmVy8fnXfwVdmd6d mFKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=N6rGNIhN; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=vzhve7Qq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt18-20020a17090afa5200b002006b213af9si14497217pjb.32.2022.09.14.05.39.51; Wed, 14 Sep 2022 05:40:03 -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=@suse.de header.s=susede2_rsa header.b=N6rGNIhN; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=vzhve7Qq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229989AbiINMIp (ORCPT + 99 others); Wed, 14 Sep 2022 08:08:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229607AbiINMIl (ORCPT ); Wed, 14 Sep 2022 08:08:41 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F23FA7F272; Wed, 14 Sep 2022 05:08:39 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 98EE41F88E; Wed, 14 Sep 2022 12:08:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1663157318; h=from:from:reply-to: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=EROMvm9onlQ1pv6K+o0p8csnLRDwiei6BOviFGwrA7g=; b=N6rGNIhNKxdXp806QI0zAk4xPAhf+SEyit3RuVKUnJWTuttnyMc/XWf4ndMQI1e25mB6Xy w3n2Udc44IREotKfsObWytw9LP2JWoTa4JrdA/fpK10/bGM/9SF10Ddg58EgDLKASTNZpE j0pdgUmJ6VEPjp3jycWUfmlpohhWukw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1663157318; h=from:from:reply-to: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=EROMvm9onlQ1pv6K+o0p8csnLRDwiei6BOviFGwrA7g=; b=vzhve7Qqk2E+FT99nQbYNPPECnhq+NbJpp9DLURo5qsFj7GVE1Y4WsygcjY8gIQs5BDi35 c3wm4mBhowD40ADw== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id E0D6F2C141; Wed, 14 Sep 2022 12:08:37 +0000 (UTC) Received: by wotan.suse.de (Postfix, from userid 10510) id B964D62AF; Wed, 14 Sep 2022 12:08:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by wotan.suse.de (Postfix) with ESMTP id B7682628B; Wed, 14 Sep 2022 12:08:37 +0000 (UTC) Date: Wed, 14 Sep 2022 12:08:37 +0000 (UTC) From: Michael Matz To: Josh Poimboeuf cc: Segher Boessenkool , Mark Rutland , Peter Zijlstra , linuxppc-dev@lists.ozlabs.org, Chen Zhongjin , x86@kernel.org, Nick Desaulniers , linux-kernel@vger.kernel.org, Mark Brown , Sathvika Vasireddy , linux-toolchains@vger.kernel.org, Indu Bhagat , live-patching@vger.kernel.org, Miroslav Benes , Will Deacon , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org, "Jose E. Marchesi" Subject: Re: [RFC] Objtool toolchain proposal: -fannotate-{jump-table,noreturn} In-Reply-To: <20220914102100.thl5ad35plvazark@treble> Message-ID: References: <20220909180704.jwwed4zhwvin7uyi@treble> <20220912113114.GV25951@gate.crashing.org> <20220914102100.thl5ad35plvazark@treble> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, 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 Hello, On Wed, 14 Sep 2022, Josh Poimboeuf wrote: > > > This information is needed because the > > > code after the call to such a function is optimized out as > > > unreachable and objtool has no way of knowing that. > > > > Since June we (GCC) have -funreachable-traps. This creates a trap insn > > wherever control flow would otherwise go into limbo. > > Ah, that's interesting, though I'm not sure if we'd be able to > distinguish between "call doesn't return" traps and other traps or > reasons for UD2. There are two reasons (which will turn out to be the same) for a trap (say 'UD2' on x86-64) directly after a call insn: 1) "the call shall not have returned" 2) something else jumps to that trap because it was __builtin_unreachable (or equivalent), and the compiler happened to put that ud2 directly after the call. It could have done that only when the call itself was noreturn: cmp $foo, %rax jne do_trap call noret do_trap: ud2 So, it's all the same. If there's an ud2 (or whatever the trap maker is) after a call then it was because it's noreturn. (But, of course this costs (little) code size, unlike the non-alloc checker sections) Ciao, Michael.