Message ID | 20240126072852.1.Ib065e528a8620474a72f15baa2feead1f3d89865@changeid |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-40279-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:106:343:edcb with SMTP id ju23csp9692dyc; Fri, 26 Jan 2024 07:29:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IFdIFMGkx7csC7PebB0Qj64zTEr4ZcB/3saAkJ+Xk3DxOcIY45pcaBM4yw2KG/KhPl0mJcQ X-Received: by 2002:a2e:b1d3:0:b0:2cf:1696:4ecc with SMTP id e19-20020a2eb1d3000000b002cf16964eccmr926932lja.18.1706282960069; Fri, 26 Jan 2024 07:29:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706282960; cv=pass; d=google.com; s=arc-20160816; b=E/VPFLXRs/PJf71JkVMhZnSshBbd4U/yHXRII+GRkpGxVIgogOtjUVAaaKWn4AySjh vw4OxQLdmwkridHGo4w00PINQisMgGTwVfOAPYQNDU7fmR5oPvFOBpKgHI2G0h9ofr/C 9gpbPCkbH2Dm0PRuLavBIyAgF6K/qtsLzDvSu4b5dvj58FXnE0sMXmHXHclmZRTk2l2C vwQae2mg1Ea+vgNXE2sbuCbPCgCWs/ChneLhRECcR7RWfXA2764ORxZTq8soRwuFaez9 cp67f8AtMa3DtV70uUb1jjYzfn1MP6UlMF5NeoNm96sVxINQPLAMigN04U7maUq6LWil 9nCA== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=KDpycj0twAw6yoH+p28gix4mRkksTB474idsqfyTR5s=; fh=AlVnYWQ8a6bE65S2OcpYlU8vD9D5USt95Es1mdAXGHg=; b=XGG6TtEazSxxTVlCD7LeGC8u3q/jCKLmNVwpEiX5yw6IRuvWKfbDTQnyTuGcS485cb nwoP0kJF0qH37bbFfchGoCGQYNE7WiOIvnM83HwfForo1JtdsV94wSP8RD+joas4ThOA yt6AYt4uqw7FTGBBNhhJ/IldGzs0IN2zVf5t1mgxIUvqWT01s1yA3N43YtOiNuvg3D+x cnfY72yGNHkqSqa4MiehiP385nIKbz3ONDw5D0QTqSYBs/bEp+CtGiSh9d60rNuyre9h jo1WwdX84p0xbtTVy7wBfnWJuQfL48tHyP7b8QBeEwzPOv4eqSl0y0Jv6QpVpi0ByCmX t5Rw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AkwGDV6p; 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-40279-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40279-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 6-20020a508e46000000b0055a1e7baedbsi707599edx.579.2024.01.26.07.29.19 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 07:29:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40279-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AkwGDV6p; 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-40279-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40279-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id A67AA1F21359 for <ouuuleilei@gmail.com>; Fri, 26 Jan 2024 15:29:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 686721D522; Fri, 26 Jan 2024 15:29:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="AkwGDV6p" Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 3406D1C68A for <linux-kernel@vger.kernel.org>; Fri, 26 Jan 2024 15:29:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706282945; cv=none; b=Go1PmVGkBJOxYzfmydHvfazfxzKXiK7tKDvOcn9pVZxk4CXqXE3cYIQjGnCfT//M+A0Ft/9qdpvN3YH+AJaf7YPHZiM76P2K2uFZ5qnWOSuly3vNcjzKXcZu7G9TRWpPSdJfZQqTQGt8wZeQTh5LRJeDdNJkD2/Fet0HMvKRKuQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706282945; c=relaxed/simple; bh=IDmnKs4KXoXn6lftKlwke8vXRewjXDmMhjWvV+QJ43s=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=iZOyh/ubmQQEHibK/FZjks0XGpjI/6Uo3ZSUhxM0fTLqJjpEOPHDpI8H+TYAEr04UMJDYJNQPMi/OP/+TTMc/0tfDrqI3Lg8DTgL5RksimCUP1/MVkf2Y8/x2X/3ZMMy4QkmoCxpETzFPpaPPwMae9D73pFXY9EECy935vJEuwA= 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=AkwGDV6p; arc=none smtp.client-ip=209.85.210.182 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-pf1-f182.google.com with SMTP id d2e1a72fcca58-6d9b37f4804so1288148b3a.1 for <linux-kernel@vger.kernel.org>; Fri, 26 Jan 2024 07:29:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1706282943; x=1706887743; 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=KDpycj0twAw6yoH+p28gix4mRkksTB474idsqfyTR5s=; b=AkwGDV6pCk1LRoKnWrfbYT0iKc34uG2d66T19JFCa55N9TVRuNf1Ty3lrhPY/jfAm2 ZaWYpzzJ3+AKEYQ2CLVAGoffiTogA4EXH68Yd/+Ut0NTh4TWSiiGKlRL3VyX6/jPzS0C Xsr9ERns2ucePSn1vIDOIUP1nEHRRDd769kSI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706282943; x=1706887743; 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=KDpycj0twAw6yoH+p28gix4mRkksTB474idsqfyTR5s=; b=TZS6ARlRUR/L/BST+xFLyNDFaXJIcnFiph36PIVda8VT+wSIKsvAdi1IX/ph3bMozZ hX2KJw4R1xguzQCkxt3gdXs9Ela7/Gu3yo5CVgd6LT4dcSwwDao5sGz0yIC61hJdBRMc TezDgfviz4uAGRAkJ3qRdAcEPs84Knbqcgfo2j4x0YmL7bbXPAVJlUvXAEwOjfVfn6bK ywwYGEwQOnt3fJBR0yrKSB2vGOioTbCNE1Mrw9FlCxqJT1rDA5ZLyK1glKrbJSus8gLP e+W06qf9VkE2ol78mLChnBcmUa/2uGQZda+GCF1IkPKGZno2XO+JxmsXogT4cOOOfhD8 bmNQ== X-Gm-Message-State: AOJu0YzdgkIGsFO2XnpXewyDgbBzQY7u+0T8xdmyDEA2NBeqREno6FId 7SA4L814v/sdpOgs0j0pPxheoeFN/zonhjnHakHm8Syn5oUj+BeqjEVLA+oeBg== X-Received: by 2002:a05:6a00:c92:b0:6dd:c0a5:3f2e with SMTP id a18-20020a056a000c9200b006ddc0a53f2emr1456979pfv.25.1706282943253; Fri, 26 Jan 2024 07:29:03 -0800 (PST) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:8218:45d8:d8fe:f7f2]) by smtp.gmail.com with ESMTPSA id a22-20020a62d416000000b006d9be279432sm1267169pfh.2.2024.01.26.07.29.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 07:29:02 -0800 (PST) From: Douglas Anderson <dianders@chromium.org> To: Kees Cook <keescook@chromium.org> Cc: Douglas Anderson <dianders@chromium.org>, Arnd Bergmann <arnd@arndb.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-kernel@vger.kernel.org Subject: [PATCH] lkdtm/bugs: In lkdtm_HUNG_TASK() use BUG(), not BUG_ON(1) Date: Fri, 26 Jan 2024 07:28:53 -0800 Message-ID: <20240126072852.1.Ib065e528a8620474a72f15baa2feead1f3d89865@changeid> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789167361128167959 X-GMAIL-MSGID: 1789167361128167959 |
Series |
lkdtm/bugs: In lkdtm_HUNG_TASK() use BUG(), not BUG_ON(1)
|
|
Commit Message
Doug Anderson
Jan. 26, 2024, 3:28 p.m. UTC
In commit edb6538da3df ("lkdtm/bugs: Adjust lkdtm_HUNG_TASK() to avoid
tail call optimization") we marked lkdtm_HUNG_TASK() as
__noreturn. The compiler gets unhappy if it thinks a __noreturn
function might return, so there's a BUG_ON(1) at the end. Any human
can see that the function won't return and the compiler can figure
that out too. Except when it can't.
The MIPS architecture defines HAVE_ARCH_BUG_ON and defines its own
version of BUG_ON(). The MIPS version of BUG_ON() is not a macro but
is instead an inline function. Apparently this prevents the compiler
from realizing that the condition to BUG_ON() is constant and that the
function will never return.
Let's change the BUG_ON(1) to just BUG(), which it should have been to
begin with. The only reason I used BUG_ON(1) to begin with was because
I was used to using WARN_ON(1) when writing test code and WARN() and
BUG() are oddly inconsistent in this manner. :-/
Fixes: edb6538da3df ("lkdtm/bugs: Adjust lkdtm_HUNG_TASK() to avoid tail call optimization")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
---
drivers/misc/lkdtm/bugs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/lkdtm/bugs.c b/drivers/misc/lkdtm/bugs.c index d1222d3eda2f..b92767d6bdd2 100644 --- a/drivers/misc/lkdtm/bugs.c +++ b/drivers/misc/lkdtm/bugs.c @@ -298,7 +298,7 @@ static void __noreturn lkdtm_HUNG_TASK(void) { set_current_state(TASK_UNINTERRUPTIBLE); schedule(); - BUG_ON(1); + BUG(); } static volatile unsigned int huge = INT_MAX - 2;