Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp547740rdb; Mon, 29 Jan 2024 10:01:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IGte+fqfgX3xMen/5Fh8a9/qpm4yYSVaYtASQCyW/i0ffJ+U3VYbnSG51Pu7QlamuDjXdla X-Received: by 2002:a05:6358:7f05:b0:178:7c7b:77bd with SMTP id p5-20020a0563587f0500b001787c7b77bdmr1198119rwn.27.1706551318345; Mon, 29 Jan 2024 10:01:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706551318; cv=pass; d=google.com; s=arc-20160816; b=XN+U6dziQC8fPwzRTWhaX7J3FLNHzhcFD+zB62lpxWh/BSJUc2o+pEpHLQdDVCJcxG GV5Z/QTH7kyloYKmyG0kIw7w2cWuUhrsx4hUH3MZv1bAHSyKNdfUna2swv2d0Y3PSKmi LvgwusgkYE5f1/0gNqItBRcZdgR/Ivy/takxhYPPwSZKg1fATRGaHYeEyFQQawm/spOZ FBuRM8PnBnuMsmFDkLR9UheiGTOCcr/xLpLH+GwJZl722mPT+XO9kNjcPcaP9mYo0si8 jBe6mZM9Bqr+fJ1qMemF1nT1GfYjYb8BPkxhHGqAYezaIUPKZ72/ISzr2a9EsyMKsNiJ htbQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=O9sYK7z3WbbgkknvMvwfZX35RqRNyf5Py+2kBlCGv4k=; fh=w66fDkgWyq6eUHTBip3RYxoRZD/xeQliwzQs0Ymcq9E=; b=H3stuiCu3pXKFgHPKz9RHtiKqDie2+VTMqnt62efHdBa4J/J4zxC3/0jtxmNa3xSUe f89wPfgPLoKaWKIs0oOT6JYqtMoDc+FSHxoBe5ckc1fr0YGKGDLaLLxipQ5bdfZYxIOB AKxRIWmgw1BZTJcsuaTHp6YnLi1dZKldkdykJVX3vENuWwIBGVPtInStUwkolRAnxnk/ 3tC7mWAAvvBkZfwYsgeU9gkMBaZZdjPlMJSHJRRVtZRFCfGCxHECMVGXnK6hXaL9kHcn P0oFQVsCTk4ZggoOieXyv+eDxCBbzZ6l5zF2QTVqf4KP+zdc6OKijgt+zKSwVJTKVRX7 FC7A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=D+W3vtj3; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-43260-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43260-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y73-20020a638a4c000000b005cf588780c7si5899087pgd.242.2024.01.29.10.01.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 10:01:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43260-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=D+W3vtj3; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-43260-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43260-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 00D7A28EE70 for ; Mon, 29 Jan 2024 18:01:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D10E715705A; Mon, 29 Jan 2024 18:00:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="D+W3vtj3" Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 CDBF17602E for ; Mon, 29 Jan 2024 18:00:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706551252; cv=none; b=EugsEjCjfLz2ewyjQoJFB4L7Qz34kEcj4QPuBcDRiGONlJmQ9gbpYEhdlRtiaBfjIT3bvZU1ydohaMisUsja+8BatdWQdTsUtDXUWY/li7o820DXSGmvb+EwUTB2FpspFP1MTkaEV8CmEWC+PALX6hhLHsM2PiMQ6XS3BObXFYI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706551252; c=relaxed/simple; bh=yH6x7koGVyqkzXPlS5DuuMQ7rErHxIAyUsPCshZXJqo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KVU/aKsYgbesJFNUA+vNLAv6ZdtFJdkiS44UZh7gMH5cUmJUs06IZVA6azXRC8QHMefMzqnRvMa1vmN4PiatmsU2TKu3OKxYfYprC4Gz6dOrGaKSytopDyl6rYxjJ5k3s9saADqspp2ig711eoiwyTfoCdS957xcPPyCK9YZ0ko= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=D+W3vtj3; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1d8e7ebbbadso6206835ad.3 for ; Mon, 29 Jan 2024 10:00:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1706551248; x=1707156048; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=O9sYK7z3WbbgkknvMvwfZX35RqRNyf5Py+2kBlCGv4k=; b=D+W3vtj3vZFcI9oGz6V5ju8PYQQVA8nM1WxSfb12wHEPiXaNwqm3wjfaCMKw0Pe6Wt 2ej8iznLFlfqsKj0FUEH8eXfs4q5zqIstMEocbQsy76IO3onrdBqk8O8pnFM/u4uTTl+ GBCDYJeQi+SP7w0qVfjTlWAs+st5aqYvtBP/c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706551248; x=1707156048; 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=O9sYK7z3WbbgkknvMvwfZX35RqRNyf5Py+2kBlCGv4k=; b=tj/kEommJBVwriQu9jm/fxxWXWAIhkCz7DO4rKfBixGcqJIgMlLWZd/5Ul0E07BNqz /O6TLc//bMzbBnExauLqDMZUB/YJKLsrP3mAIFVLxxZyj+ULAl+QY96bLI+ttID2rXOT hvCzbJTd5waPlzXb7hDe91l7Pakdve3ZhCpKgLyY9sJ87zxUCWVp7IlMxq8aJNJTGbvR yQlpbKRvR/YaeCyX+nnMKBfXExG9CM/tZgYniNR7W9YiD+bHnwFcPkI2O6TLlJwgAqXR YkFZCDgXjtTvOx6IfNJS6zpX40Qw9SONEm3x+8VKTvUcH2Ny+yi7Odk8PtIsdFdMdeiv zPiQ== X-Gm-Message-State: AOJu0YzyM3ysWnQUySeSUMmKu6qpoJPtLmQK2GSN/ZPyN+iEhX6ZSnyQ SQvmoOewyn3ambarwLzisjgw+nn6W66x6wZIS6LJy5jRBST6ezHL3PVtj8NLiQ== X-Received: by 2002:a17:903:451:b0:1d9:1e1:76b3 with SMTP id iw17-20020a170903045100b001d901e176b3mr199139plb.107.1706551247632; Mon, 29 Jan 2024 10:00:47 -0800 (PST) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id l4-20020a170902d04400b001d8dd45b9b1sm2374739pll.134.2024.01.29.10.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 10:00:47 -0800 (PST) From: Kees Cook To: Marco Elver Cc: Kees Cook , Fangrui Song , Nathan Chancellor , Masahiro Yamada , Nicolas Schier , Nick Desaulniers , Bill Wendling , Justin Stitt , linux-kbuild@vger.kernel.org, llvm@lists.linux.dev, Andrey Konovalov , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH 1/6] ubsan: Use Clang's -fsanitize-trap=undefined option Date: Mon, 29 Jan 2024 10:00:38 -0800 Message-Id: <20240129180046.3774731-1-keescook@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240129175033.work.813-kees@kernel.org> References: <20240129175033.work.813-kees@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1398; i=keescook@chromium.org; h=from:subject; bh=yH6x7koGVyqkzXPlS5DuuMQ7rErHxIAyUsPCshZXJqo=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBlt+fKRyYbL1VJp1m0ZRn8657+TY/Q9I2OhsIfr Nhr+eEyD8qJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZbfnygAKCRCJcvTf3G3A JvvwD/4oBxFkh5fzUJffPCV7wy9Y6k2huiVfHjonoBRkDeyjaKqfQYTecCk/CL+c+TO65fhCT+q xqSs2LGuFyyj7eOZGVYhpL+fAeyXp00kJeJ9NO48Zit8cDCVOojomAjG68UBgx7SMDH9RrcGsCW zKM1fWgaWgs6y6q25ikHsKAQ7cGyV/ccKJlhd1//ttzhOufRHmHl1LFtqGGHwgaNA3VNKoFSbJ9 Oj0pG0RrZWSc1cUZWHhw6X12fopRpJKdMPethlAGh8DSRUCH+Qp8S+c4Uvx5Kbflb28/q/w+1P/ zUabY1h1VH0yC8NAe8xOBilIj5KXfjjkMAMF02LmZMDFPbVbAfTarNEBT3anpykg4TB6OjJUpeG JnnqzvSGbO9iveLeJWaN+9nR2qFV59NSmvyvLnIMvYf3heAJYgWyf1Ac10HNTUVuyPrvlLDm7f+ rfpkI7Xd3lzR/l64/lRkqWcSDg+ZtSkQW+h1T6/5rzYkoxhC9BeJ5hl3PCuFtAgF1VmSVbnqkCE HVawUkwEyNpURWxmfTF7cmTDPpYe2V7SoUU+viFzi+mDZoSumju/sQWzFqG5usxniFDaa3H0Gse h84FxDEHMfFv3vs75+fQ00Ra4GKbQta90pHtfeZtrlf9zymnXZw60aQCN1CQRLFQL4eGd8FHP4d U4aVwGwI1l81C6w== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Content-Transfer-Encoding: 8bit Clang changed the way it enables UBSan trapping mode. Update the Makefile logic to discover it. Suggested-by: Fangrui Song Link: https://lore.kernel.org/lkml/CAFP8O3JivZh+AAV7N90Nk7U2BHRNST6MRP0zHtfQ-Vj0m4+pDA@mail.gmail.com/ Cc: Nathan Chancellor Cc: Masahiro Yamada Cc: Nicolas Schier Cc: Nick Desaulniers Cc: Bill Wendling Cc: Justin Stitt Cc: linux-kbuild@vger.kernel.org Cc: llvm@lists.linux.dev Signed-off-by: Kees Cook --- scripts/Makefile.ubsan | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Makefile.ubsan b/scripts/Makefile.ubsan index 4749865c1b2c..7cf42231042b 100644 --- a/scripts/Makefile.ubsan +++ b/scripts/Makefile.ubsan @@ -10,6 +10,6 @@ ubsan-cflags-$(CONFIG_UBSAN_DIV_ZERO) += -fsanitize=integer-divide-by-zero ubsan-cflags-$(CONFIG_UBSAN_UNREACHABLE) += -fsanitize=unreachable ubsan-cflags-$(CONFIG_UBSAN_BOOL) += -fsanitize=bool ubsan-cflags-$(CONFIG_UBSAN_ENUM) += -fsanitize=enum -ubsan-cflags-$(CONFIG_UBSAN_TRAP) += -fsanitize-undefined-trap-on-error +ubsan-cflags-$(CONFIG_UBSAN_TRAP) += $(call cc-option,-fsanitize-trap=undefined,-fsanitize-undefined-trap-on-error) export CFLAGS_UBSAN := $(ubsan-cflags-y) -- 2.34.1