[v2,3/3] objtool: make objtool RETPOLINE validation fatal when building with CONFIG_RETPOLINE=y
Message ID | 20231213134303.2302285-4-dimitri.ledkov@canonical.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp7782973dys; Wed, 13 Dec 2023 05:43:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IHdRS/GEH1Rk3ziNRJAXs4Nop1FTRKid2xHfn0nzIGJO8nvYj2udFteNIoyzypWEk6Fe+WY X-Received: by 2002:a05:6a20:244f:b0:18f:f040:86df with SMTP id t15-20020a056a20244f00b0018ff04086dfmr8662770pzc.82.1702475016441; Wed, 13 Dec 2023 05:43:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702475016; cv=none; d=google.com; s=arc-20160816; b=i1n4S0Yoa3xXqZof/IxpyLqW6ClTT6d5zwEI8LGmtskAcoFargtME6ywvuTKgMKy1p /wbrQtyH2TNZ7phvZ924YKamgnZ8/yquAL46zzQI29Moe+ieo3Sf6H3MLYklcNpw1pDO gdQIcgVh2nSSzBU/1oQoE39f0rj86Toi6kYdGGTjuoxW+W3E0YqLv+n85/Y0pl/j6f/w /qzdcZbRiQbTJdb0OCz0442bLZ3pP0vdPHVvKiHO3FGSNC5MtgvWEz/pn+yQsBHmsTzX cSTPqX9JnhBLVFGNQoq6wNi18HRPBou588ojkGfhkt2uzJl4w+7VpKi2RGUgkZnbISLv 1Ocg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uM/Cfv1vwzgbhYkByR9B4hJJ+cVjQnEklsojPpuPdXQ=; fh=6ApmiAOj5llZz/5mpFBkruPgBxrXH89XL4qsmxPd28M=; b=u6S0w7uFl1g4v72UU3q18e49mdbebHbOxtXjOeqIRTeZDoC22zM0jUmQwoJGc3z9gG DKSm6D1h5HJs+0taWHBznq78FpUmtrA4ZjXtG+pfRn6kdUOB2FgFPbp9o8gBQllRBcsG gt6S25nK50k6H0oonx+EgFzciVwg2PtNl3dPmG7R7zgm/EZK/RIdXcRKjVHtFRmTpqgP GXCwJt/sWTkCvWOl/kZCzjm8bznxHN3UBlQce39jj182+ZjQFMbgdd1BOIc1Iuy6aCMb 1g2g4sazLqtNGiKK8LYkiauNa0wGUAa7L7s3SpHKbdr3O39PNNxAgMNYcojeHlYxfU+V txEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=VsHIRli2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id 6-20020a630f46000000b00578b487825asi9481950pgp.208.2023.12.13.05.43.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 05:43:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=VsHIRli2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id B560E822A489; Wed, 13 Dec 2023 05:43:33 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233465AbjLMNnR (ORCPT <rfc822;dexuan.linux@gmail.com> + 99 others); Wed, 13 Dec 2023 08:43:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378905AbjLMNnQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 13 Dec 2023 08:43:16 -0500 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98017AB for <linux-kernel@vger.kernel.org>; Wed, 13 Dec 2023 05:43:22 -0800 (PST) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 740EA3F285 for <linux-kernel@vger.kernel.org>; Wed, 13 Dec 2023 13:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1702475001; bh=uM/Cfv1vwzgbhYkByR9B4hJJ+cVjQnEklsojPpuPdXQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VsHIRli2pTZ6iIHCW3eYbOklT6g0gh2Lmd/wP9FUSZ2MDM34SoQUaLr61X4oBJtE7 TNj47ViVyI+OnRpNH4JSHiel6hRUn+hnZ1zA7ZAKKtMC4GF+RChKii5yuJRmX5WyVx 7mNz0u+YYOTEVqPbV8SEwiNGEs9Uq1rpWbNwQFqA0gHQL2BV+7l/QGXV9a8hFZ+Yyo vXFOFxH8USjsIlUxq+B9/dDwyByPVgs2qGCDGMRRwlItjxnNaQkws+V5trYU8W2+k+ 6VfXGidyVkjQtoc5rBm9/kCKT9FAqow20BXDTunvP1UZm2ihM6bFIU2UtK96oIdsSO pWTG7pbdv3CZw== Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-40c3826d6feso30999575e9.0 for <linux-kernel@vger.kernel.org>; Wed, 13 Dec 2023 05:43:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702475000; x=1703079800; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uM/Cfv1vwzgbhYkByR9B4hJJ+cVjQnEklsojPpuPdXQ=; b=Q57JX2mhQtHhG9965TqbQOZMVUaYUBXboUn25l2IpBfNKjQhdxmcvgKIIVCY/4i3Bt xA2BX+TVq1zHAal6pvzemrjtJPfWslx3NDRmuuf0n35+Zq88/A4woz54fgo34rtkob4Q 6F3k3iLTLhjq9DdaWJNjXm6e0ZzqrjeGwKSqsxNwy722lscuGs+54St07+cipcG5pAtS T/Z4sqophiqBi8HgNOVmhFT5ZT3v1xPSb9OZu/AzC1zVeOvsP8Zh3/u2/6uyB4f1zogt 5MbU0fkzwvVb1RnIKzTpmFqKWpjZPN1/CKgJmII5dhKbcYXkEu220hpmR+2E8JXdBacT bl4Q== X-Gm-Message-State: AOJu0YxIAa/Z9dbNX/420LPZ7IsXJJBjg21oiXFHee93AgjHCqDGgEYb bJkuFeeoStMo3tYry4sC7iOBsxisJw0/W8i8Lg60jYtN9jqKCp5pry9YjF8Yls/tkVhCfOCsuCp ckBrbSIhlROUFsh3dyCYGUVzJJhHJ1aRXzswyGc3O5EOg3P5HfQ== X-Received: by 2002:a05:600c:ac8:b0:40b:5e1b:549e with SMTP id c8-20020a05600c0ac800b0040b5e1b549emr4130203wmr.42.1702475000494; Wed, 13 Dec 2023 05:43:20 -0800 (PST) X-Received: by 2002:a05:600c:ac8:b0:40b:5e1b:549e with SMTP id c8-20020a05600c0ac800b0040b5e1b549emr4130191wmr.42.1702475000108; Wed, 13 Dec 2023 05:43:20 -0800 (PST) Received: from localhost ([2001:67c:1560:8007::aac:c15c]) by smtp.gmail.com with ESMTPSA id h12-20020a05600c314c00b0040c45cabc34sm12197042wmo.17.2023.12.13.05.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 05:43:19 -0800 (PST) From: Dimitri John Ledkov <dimitri.ledkov@canonical.com> To: jpoimboe@kernel.org, peterz@infradead.org Cc: x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] objtool: make objtool RETPOLINE validation fatal when building with CONFIG_RETPOLINE=y Date: Wed, 13 Dec 2023 13:43:02 +0000 Message-Id: <20231213134303.2302285-4-dimitri.ledkov@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231213134303.2302285-1-dimitri.ledkov@canonical.com> References: <20231213134303.2302285-1-dimitri.ledkov@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 13 Dec 2023 05:43:33 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785174442759542578 X-GMAIL-MSGID: 1785174442759542578 |
Series |
[v2,1/3] objtool: Make objtool check actually fatal upon fatal errors
|
|
Commit Message
Dimitri John Ledkov
Dec. 13, 2023, 1:43 p.m. UTC
Make objtool RETPOLINE validation fatal when building with
CONFIG_RETPOLINE=y, currently it is a build.log warning only.
This is a standalone patch, such that if regressions are identified
(with any config or toolchain configuration) it can be reverted until
relevant identified code is fixed up or otherwise
ignored/silecned/marked as safe.
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
---
tools/objtool/check.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 9709f037f1..c21258e109 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -3991,7 +3991,10 @@ static int validate_retpoline(struct objtool_file *file) warnings++; } - return warnings; + /* RETPOLINE is an optional security safety feature, make it + * fatal to ensure no new code is introduced that fails + * RETPOLINE */ + return -warnings; } static bool is_kasan_insn(struct instruction *insn)