From patchwork Wed Mar 13 18:12:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13591784 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 87AF7605C2 for ; Wed, 13 Mar 2024 18:12:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710353545; cv=none; b=mvI9h20ItUDIXmOBXANOBKukFDIl3B2OpN478PfLy5oD66WC2hmBT9MO3yMjLENCSsDoj9AhS6nsnVRxqz0TDcpFyAJI4QZN5jQhU15r4TNpyevD7P/in1MjYoAkm4GpO/m1zoEJ6JgIoN+pBJhytskiCtFMCNNr5UthgppWh2E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710353545; c=relaxed/simple; bh=Juz30sNn9Vm/o0qmgqL6ej/+Db1FXC/0PH8XbJPugnI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=mT0QvRPsadeQ13TfveLFmG2H/YMegXsoWUjJ57jiMXJDgQIC3OrNBPWRKQBlZK7OpNGds0fMyzBa9lgE2XOulpWowAMQrUeG3nLQqw6g8g25bVBASqIOceSWdkreCZ/wrT/ZEsIwhs4BjEYrLf+lOK7rgmizOPqxlF5m7mG488A= 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=TjODz66q; arc=none smtp.client-ip=209.85.214.178 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="TjODz66q" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1dd10ae77d8so902415ad.0 for ; Wed, 13 Mar 2024 11:12:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1710353543; x=1710958343; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=zH16D+dx0oQl5CujF1HkbTVT0zJku0/wsGqqINARPF0=; b=TjODz66qwSw9FCbT7aXlAYxoSRj85qdomQp2Nzrvnuxhu4DKNXcKTBbQ8MoR0d5VcO N99SZPeUYeRI4Ihpt2ZKj/Ks2NnI9szyD/xgXbyMF1bzBB9JB/0l5kN3P4qlYC6MrxNX qU4spN/SOHu1FlLyY3pm5HLgrBI7kaIplfJ6Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710353543; x=1710958343; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zH16D+dx0oQl5CujF1HkbTVT0zJku0/wsGqqINARPF0=; b=V/vvdbMbvXBy/Yj+dNtcNUjxLnD/v14t9WKT+BkxbdVnKy5bfdRRc4+sx8ZOCDBxZv NV6jDCj/vEIaEjeYWM2trEg4U/3Yxzqtw3woMYNajOXK4833QymWdhaGGKp1kvFwFULz I2k0P++kK4/p6tIxIKzu19WnydqJxC9p1s7IRSghZFdQfUa2MMtlwb/xmWrU08Cymo8t CiN7syiaD5i84Y8VHUGG1ANY32P91t1NPIml7/iHZB3jHaMD2Iovw8sJmiWEn6W0+W0b 4yh0KIp2QoF09RceLphRcjm5tUUGOwBnZbYbfxv3vTNOMCSHSLQQMMvlWNfM+lm84epU qgBw== X-Forwarded-Encrypted: i=1; AJvYcCV4c87KKHXYgKHKk4lglsPfHGOL/GSE5zFYlfvHSaFWpyYMe9m8fkQL13X40Bv5UeqEaYAfiEhg6ajFnsfDzXlmttjPD4ezYrGc+JvnxvsA X-Gm-Message-State: AOJu0YzlYuVDW94OzFX6A1F5AGcSUWdezyWOjNkwnIvtHabdVFbprwKj aF94L28jjyNLQK8FQmNtLpKXuE7zmRoiObtR3db5Hr0eFCGiyqUdYdEb1UnsNQ== X-Google-Smtp-Source: AGHT+IF4D9+0QB6a94Q1UTugK4FIN2Jw3/2SUxLiLcnoVm4wN+52lZO/YIzJAWgk6SC0iB7flOhkNw== X-Received: by 2002:a17:902:e849:b0:1dd:5ba0:e0ee with SMTP id t9-20020a170902e84900b001dd5ba0e0eemr6961805plg.9.1710353542738; Wed, 13 Mar 2024 11:12:22 -0700 (PDT) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id p10-20020a170902e74a00b001dda1e9f510sm6006486plf.92.2024.03.13.11.12.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 11:12:22 -0700 (PDT) From: Kees Cook To: Marco Elver Cc: Kees Cook , kernel test robot , Andrey Konovalov , Andrey Ryabinin , kasan-dev@googlegroups.com, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ubsan: Disable signed integer overflow sanitizer on GCC < 8 Date: Wed, 13 Mar 2024 11:12:20 -0700 Message-Id: <20240313181217.work.263-kees@kernel.org> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1242; i=keescook@chromium.org; h=from:subject:message-id; bh=Juz30sNn9Vm/o0qmgqL6ej/+Db1FXC/0PH8XbJPugnI=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBl8eyE9J4yYHWBRmDSdvgZpqfXhVx4eTZnYonIO C2r7NDdWBeJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZfHshAAKCRCJcvTf3G3A JrdUD/9PrK3mREHrrRuyLF4jhJgBAkp5b4PysQdaAjPjzZYkJbyTnujbjqdj8HsfbcKdySR+sQ5 onBvzW2mCRKGIevgEPgGaRJC+9qZWmUP/EBSa0kkQJAhA/WkPe297pALLimV0ipGDra9dQnJaR9 AvQE/QiFBgiUxzrnIEwLqsVsdHIjudciaLu4aWyg+CwfuW06MV82wAfjptQQiKIr95CuFOJ4ykm lF7cpXA5NH/v5B+wjfh4iJ4r2/zjaDi8TpGU4HQ+oqYCTNH6A3+x6qEXwuOdzPSO4kcJ3AvfOis UW7pd7rW8+O25WJaEyMo0Npxvs+3gKMwDx6G/DgM+PcE5swxdcPHZAqIX1UnL+T0KeQdIBEdgKt KqopeblJVpbLxic2Okx2HQDLQQXTec0V3igxfc5msTovLOhTkdlprYSH1pwYC7/Mriht7U+TTUj cDewZRRncSAgwMs/EMALchw3L1ZtdIYMifMrnHMMpQ8PwPsptTatZ+WxpQ9T7fAezSb5jgNJCgy edDaC8i9zMq3eQHCZcP8W9ej8H3sJ4ywMbbnRUTqD0VF9hE5yBQrwo818Rh3+sU3VvaueK3fVV7 +j/OFiy6wrf5XSH/dPltWckYZlHgYO1pxaoskP/k/XZiTJUOpJY+DN7ISRH6KiOOBmk8gXBvTgg 88J3E9H MDnG3kmA== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 For opting functions out of sanitizer coverage, the "no_sanitize" attribute is used, but in GCC this wasn't introduced until GCC 8. Disable the sanitizer unless we're not using GCC, or it is GCC version 8 or higher. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202403110643.27JXEVCI-lkp@intel.com/ Signed-off-by: Kees Cook Reviewed-by: Marco Elver --- Cc: Marco Elver Cc: Andrey Konovalov Cc: Andrey Ryabinin Cc: kasan-dev@googlegroups.com Cc: linux-hardening@vger.kernel.org --- lib/Kconfig.ubsan | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan index 48a67058f84e..e81e1ac4a919 100644 --- a/lib/Kconfig.ubsan +++ b/lib/Kconfig.ubsan @@ -119,6 +119,8 @@ config UBSAN_SIGNED_WRAP bool "Perform checking for signed arithmetic wrap-around" default UBSAN depends on !COMPILE_TEST + # The no_sanitize attribute was introduced in GCC with version 8. + depends on !CC_IS_GCC || GCC_VERSION >= 80000 depends on $(cc-option,-fsanitize=signed-integer-overflow) help This option enables -fsanitize=signed-integer-overflow which checks