Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp659634lqs; Tue, 5 Mar 2024 12:24:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVDGnYQ8JwLSjw2TE8NseAwv4KfIAFVlGbqSViNOEcSTbfItGZT9WJjoYQzz9ZT2S7kLLF1iSdubryjNpVcT3mwVZySEB3iNgErzKQs9Q== X-Google-Smtp-Source: AGHT+IFP0kx+qP/NEPaaCnHPgV1ReO4RaRUN1L71OD0aoV4uFXF9IM4ZP2rWPG9ihH+v8kCdedKp X-Received: by 2002:a17:902:d2c8:b0:1dc:c8b8:3cb7 with SMTP id n8-20020a170902d2c800b001dcc8b83cb7mr3128398plc.13.1709670263188; Tue, 05 Mar 2024 12:24:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709670263; cv=pass; d=google.com; s=arc-20160816; b=LpWlIl4+cvrr2HPLDG6yFH9FuIuKFlWWOAydu8rZyv8K1QYr9RRIqD0yi6l+856Mqu VQTtUaFRVLZpPTmWSOf1HZBAeltIm3tjF2LjNwc890KEKMIUiKOoSff5x49hlr18QWHQ Yo73Ds705zG6mCxtyROY2ZGsMdcmIedvpiUWlCiTO2tNFT5dgLdNNgOJNwkLoclZVMgU Sk8yxlT5cDzSGzpSCnRU+b0DPQPqvYOIbV61fLr1uT5XdNzO6Mk0YF1RGb5zAr40HES4 WGHjbctzirnRFL868UE3Krp/qoGFdNRheHxV5Q5UmXpnr8TgOZ4VfUDpwfSEe7o4fE5H zHVQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8OJiIuppva2X62G3XuKOpZ18Of2oWMu+/RVVvODtp4M=; fh=HVz6Iu48NrR89u+hrEeKTjqCF3JmI4Rp9iuRyH5ZU9o=; b=N50kZC97IaTVGTfEX3Q68W6sd74Lpw6zBSVtrstscxOU9PsY1DylfDYyPMr4XZXt91 Gc/RrP03f56Bi2NqVJNt4OUFYqNHuVBMmstyavkAk1a56N4bmWnZAGyoRkvK1QrsClF+ w9UI1n4SLNlD90GBmRxWHHQ420bBsozVX3xiRTNaWwrikwwZw3IWQFRVeYpnrM+9IwrW ObyVhgMdTpywRJSsKnfFckj2HC9HKhCK8G/AaSTGmxA44ZWw4VKhSHQhMubhaNs4Llc+ Mt1te15lhOe76tmKdBcOaiAsEeNXZsiO5scq6DsfcvolutxDQfuo80cYyTeV3LZGOJAp bEPw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VEu5tKE3; 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-92910-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92910-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id i13-20020a170902cf0d00b001dcbb569d36si10812661plg.129.2024.03.05.12.24.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 12:24:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92910-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=VEu5tKE3; 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-92910-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92910-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 33DE6B2302D for ; Tue, 5 Mar 2024 19:54:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA21D5C612; Tue, 5 Mar 2024 19:54:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="VEu5tKE3" Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (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 AD1015C601 for ; Tue, 5 Mar 2024 19:54:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709668450; cv=none; b=Xgapf0K/zl1MK1NIVpnIObg+sCAEIUk6NrDaf4BTKxbRd7Bh6EXweBFIcSaLGjDJct2PqcCt77HnFSxmgH9Hflfhb/BHbq9Z7o4jCPUaP865B3kQ8AS+bzpOud8DlFIodohecv/dy+VLte3+X1vpxpQuYY18G7oJIUs4PfDDI4I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709668450; c=relaxed/simple; bh=Thh+og9vWfifMZ7QUJajbgXYm3QoY+CJHcawNAefhMM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VWTeVDWQ5l9l5bdqyu+THooocOb2MigVqbysPUu3HBUFJRyxGpq8iChSjKhfEP/Jy8DhEPyIXbGdzt0Q5cf0GIgMmIzeP3vnsS3xD+7Ny8i5j4q7ITZhKHwKFMp2yc6tyafq3+EgXWSWwNo57VRRhmmjZVXcv2Vr7ybfELrxdTg= 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=VEu5tKE3; arc=none smtp.client-ip=209.85.210.176 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-f176.google.com with SMTP id d2e1a72fcca58-6e5a232fe80so100439b3a.0 for ; Tue, 05 Mar 2024 11:54:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1709668448; x=1710273248; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=8OJiIuppva2X62G3XuKOpZ18Of2oWMu+/RVVvODtp4M=; b=VEu5tKE3ZGEMGDvffumPkT0uy9dQ8tGrLGc5mS3ynHiKSCM4jxVM5Mk1gHagvtd+va 4Iwg26a4/Jq7rwllJwhLNbUP9PnQmbrV8ntmuSzHQaslvio2ZDd3/Xg2cJSCUEe9CPxH Qc2vmlAQcaToA8ldYp9nPwe1NLKlztG9Emee4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709668448; x=1710273248; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8OJiIuppva2X62G3XuKOpZ18Of2oWMu+/RVVvODtp4M=; b=duNri6UGNgZc1u239TzXnOTEkgC92Y1SBsLA7B5wolJcctzFjxbklmtgb6giA3btAp OZpiwqOGkWS34RPdD2F4hdZT4xzKjwVdw+IzW4kFeSMPpai9gwugQ81IQQGEI0Dwivua Zd4oaVXVvvzdisGATYdKKV4Eir7oH4B9MC+ER1olt7yf4diSQnWqK1frtP3YzZerI4XL AxpEniiNchHTqGp1h87jtvd5ymwyveZVhaGsC1cARRXJWquWaMcnkOZBGVoqhudwYBdf ZLM1/ekfk8LYPq/X43FjfGwPZw1j/F0WMJ1//b21SZjb3JNpp2W2nZnGs2qg36b6Dypo whHQ== X-Forwarded-Encrypted: i=1; AJvYcCVjmrcKXsaLWdGZw38K3JITuLydaTSomhlM0xPibd+/s+kgv5KYY5JdGjQShbZSGdJeccycm3TVz4T7pIP4qVaZBtRN0md47HO5H7nv X-Gm-Message-State: AOJu0YxaCR6HmDk37aqHjk2QW1B4bKI9CEZ3oiveq9btOOIHpqGX0+Zl QbEhzicA1wQZJIF/tkku/udE7o261SUKxoFCRyZfTgZQr9WwEV6dXkDCNJ9jUA== X-Received: by 2002:a05:6a00:8cc:b0:6e6:1df9:af92 with SMTP id s12-20020a056a0008cc00b006e61df9af92mr4909513pfu.14.1709668447845; Tue, 05 Mar 2024 11:54:07 -0800 (PST) Received: from www.outflux.net ([198.0.35.241]) by smtp.gmail.com with ESMTPSA id h5-20020aa786c5000000b006e52ce4ee2fsm9391340pfo.20.2024.03.05.11.54.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 11:54:07 -0800 (PST) Date: Tue, 5 Mar 2024 11:54:06 -0800 From: Kees Cook To: Guenter Roeck Cc: linux-kselftest@vger.kernel.org, David Airlie , Arnd Bergmann , =?iso-8859-1?Q?Ma=EDra?= Canal , Dan Carpenter , Daniel Diaz , David Gow , Arthur Grillo , Brendan Higgins , Naresh Kamboju , Maarten Lankhorst , Andrew Morton , Maxime Ripard , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Daniel Vetter , Thomas Zimmermann , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kunit-dev@googlegroups.com, linux-arch@vger.kernel.org Subject: Re: [RFC PATCH 1/5] bug: Core support for suppressing warning backtraces Message-ID: <202403051149.547235C794@keescook> References: <20240305184033.425294-1-linux@roeck-us.net> <20240305184033.425294-2-linux@roeck-us.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240305184033.425294-2-linux@roeck-us.net> On Tue, Mar 05, 2024 at 10:40:29AM -0800, Guenter Roeck wrote: > [...] > warning = (bug->flags & BUGFLAG_WARNING) != 0; > once = (bug->flags & BUGFLAG_ONCE) != 0; > done = (bug->flags & BUGFLAG_DONE) != 0; > > + if (warning && IS_SUPPRESSED_WARNING(function)) > + return BUG_TRAP_TYPE_WARN; > + I had to re-read __report_bug() more carefully, but yes, this works -- it's basically leaving early, like "once" does. This looks like a reasonable approach! Something very similar to this is checking that a warning happens. i.e. you talk about drm selftests checking function return values, but I've got a bunch of tests (LKDTM) that live outside of KUnit because I haven't had a clean way to check for specific warnings/bugs. I feel like future changes built on top of this series could add counters or something that KUnit could examine. E.g. I did this manually for some fortify tests: https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git/commit/?h=for-next/hardening&id=4ce615e798a752d4431fcc52960478906dec2f0e -Kees -- Kees Cook