From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="VEu5tKE3" 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-Google-Smtp-Source: AGHT+IEPSGoV+PaXRY7JI9uSPnapXCs52p1ILPTe+H1wv+UxrhqJWz+AChv6CTzYH5Lp5odgHWXRGQ== 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