From nobody Wed Dec 17 05:47:41 2025 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC36F23DEB4 for ; Mon, 13 Jan 2025 14:05:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736777125; cv=none; b=lXUozyjl2Gv4ZxvueP+PodpJwqRsZRBfe73mCPE849yTCoHYWgqe0o2QmaYXyzZ/yuj6H4iL825vwX9tNwuU29GPCoJzcs7PweEfLZNnCSC74jFOFQ23GHLUj+8mPDTiasqVG/BT4pzaJmuqacvECW5xrtAbZgcOJoUaohsoNYs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736777125; c=relaxed/simple; bh=3LnAsMhP1pZpm6rI95kHTS+/gw5w1gOhLmu4sHb5rac=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=LtJCDAx3ui8mkPQm5bnOHwprAp3D3cWgau8qGC5hTvsSvtQ+ejEgaK6oB+pJBxYfup0YSug505vQXmL0VbrxZXywIgKwralRuxzF7TXnBT1jfIIpWShdBJ+6/kSSRk74+RX//XBP+XNYPOkoTSAUVdICCTRRBYmomJ6Jqse8+6U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=2x/WFUad; arc=none smtp.client-ip=209.85.221.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="2x/WFUad" Received: by mail-wr1-f73.google.com with SMTP id ffacd0b85a97d-385e49efd59so1579719f8f.0 for ; Mon, 13 Jan 2025 06:05:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736777122; x=1737381922; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=+ZPe1bNvuiIIATFBKvXi5cf5G8IqMVRN5Iv2+H/k4HE=; b=2x/WFUadoEo7uUqSwCj0yJbk8qbVaSXaDYcY619iuq4MZHQSxuwbRFo9/Zu8sf5vOI PmnmSQHC7sSoDi7GeiXWfSx4GT5Efe1x8gFpRfqWpDkBE9UaJbYhze6uAJepM4e1EBsP eJcEh4YDZaoj7puwz/UHSkD3IQDR2JbkFpsqU8AooZ1L2Tu2xgNnMcnPUN6wxcrkQndN DelVT0a8+dBbWO8PDv/xBEGPOyMVp/ItDr+JwA12nIbU2d2Ug1ApJzR7GTIJk1AezVcK gRv7tv9V5l3WxA7NXNHpBIi8vuGL+ZHcUjZFr7vySd/Z1CqRZ82ScX9tuOvb05SnYOIf vC3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736777122; x=1737381922; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+ZPe1bNvuiIIATFBKvXi5cf5G8IqMVRN5Iv2+H/k4HE=; b=SejPfms6HTPPiJvu7PfD7DA9+KJDvqLsQIwOVfWew6EOuMARKj8Yp0zkHi5iB+lKJr qp9Q3QwR1tCIxT8fgiJhqwBqNkhFb14BxhudAH4JrPex2EG5Gq8EBkWDvJQ7smrNnRSY MIf2ODWmMRIbkOq0A1xuR8fJZtnP4E/GWb0BUVKN634+TpjvRUs6At71cou0dvcrmdNk QgWO96hogKhGXENW+uLgb+BvcDRcn3C17LMHvYi5IK/gzi4vTkIYezP6ZhLcucCeTD2j 8OlBXRPN9nV7Ap0qrTL0sEJi1hNXC/XlBYc5uoYEq8/hK8MagI34/4WUOw/cSKzy1GoJ N6Vw== X-Gm-Message-State: AOJu0YwVjN0TXAXJjJ/1I2KcesF5yo0oJauW/T5x59Fi6r11aO2Z2UBs 5aq3MTlMLnnZELi0RcOffQxZL7Jhu35P6/4/f2aZaU8jY6nCuMarQa29/inMnIUiLBPdPh12KlY rwxwwj/d65A== X-Google-Smtp-Source: AGHT+IFCImalmFtqftfgPV7fXo5SPWkGINMDlx+uQu0uulLu5xXIGdZVMHnmcWHtKguwAmvevmLaJ75QWCDdYA== X-Received: from wmbjg22.prod.google.com ([2002:a05:600c:a016:b0:436:a247:a0e6]) (user=jackmanb job=prod-delivery.src-stubby-dispatcher) by 2002:adf:a108:0:b0:38a:88ac:ed10 with SMTP id ffacd0b85a97d-38a88acedf9mr15222851f8f.25.1736777122192; Mon, 13 Jan 2025 06:05:22 -0800 (PST) Date: Mon, 13 Jan 2025 14:05:16 +0000 In-Reply-To: <20250113-objtool-strict-v3-0-8b51f94957fb@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250113-objtool-strict-v3-0-8b51f94957fb@google.com> X-Mailer: b4 0.15-dev Message-ID: <20250113-objtool-strict-v3-2-8b51f94957fb@google.com> Subject: [PATCH v3 2/2] kbuild: Add option to fail build on vmlinux objtool issues From: Brendan Jackman To: Josh Poimboeuf , Peter Zijlstra , Andrew Morton , Masahiro Yamada , Nathan Chancellor , Nicolas Schier Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Brendan Jackman Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable NOINSTR_VALIDATION is pretty helpful for detecting bugs, it would be helpful for the build to fail when those bugs arise. If necessary it would be possible to enable this for individual warnings, it seems unlikely there's a use-case for that though. So for now just add a global setting. When the this new option, OBJTOOL_WERROR, is set, also add --verbose: if the build is failing then it's better to spit out any information that might help diagnose the failure, even if that risks a very verbose output. Checkpatch-args: --ignore=3DCONFIG_DESCRIPTION Signed-off-by: Brendan Jackman --- lib/Kconfig.debug | 10 ++++++++++ scripts/Makefile.lib | 1 + 2 files changed, 11 insertions(+) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index f3d72370587936fa373129cc9b246f15dac907be..3ee92da4733a3a504991d5dbb4d= 0cee84f519d64 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -545,6 +545,16 @@ config FRAME_POINTER config OBJTOOL bool =20 +config OBJTOOL_WERROR + bool "Run objtool with warnings as errors" + default n + depends on OBJTOOL + help + Fail the build when objtool produces warnings. + + By default, objtool just prints warnings to the terminal without + causing a build failure. This config changes that. + config STACK_VALIDATION bool "Compile-time stack metadata validation" depends on HAVE_STACK_VALIDATION && UNWINDER_FRAME_POINTER diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 7395200538da89a2f6e6d21f8959f3f60d291d79..a1b264e532920dd649122968d57= 82ca8eff34ad9 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -277,6 +277,7 @@ objtool-args-$(CONFIG_HAVE_STATIC_CALL_INLINE) +=3D --= static-call objtool-args-$(CONFIG_HAVE_UACCESS_VALIDATION) +=3D --uaccess objtool-args-$(CONFIG_GCOV_KERNEL) +=3D --no-unreachable objtool-args-$(CONFIG_PREFIX_SYMBOLS) +=3D --prefix=3D$(CONFIG_FUNCTION_= PADDING_BYTES) +objtool-args-$(CONFIG_OBJTOOL_WERROR) +=3D --Werror --verbose =20 objtool-args =3D $(objtool-args-y) \ $(if $(delay-objtool), --link) \ --=20 2.47.1.613.gc27f4b7a9f-goog