Linux CXL
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Andy Gospodarek <andrew.gospodarek@broadcom.com>,
	Aron Silverton <aron.silverton@oracle.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	David Ahern <dsahern@kernel.org>,
	Andy Gospodarek <gospo@broadcom.com>,
	Christoph Hellwig <hch@infradead.org>,
	Itay Avraham <itayavr@nvidia.com>, Jiri Pirko <jiri@nvidia.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Leonid Bloch <lbloch@nvidia.com>,
	Leon Romanovsky <leonro@nvidia.com>,
	linux-cxl@vger.kernel.org, linux-rdma@vger.kernel.org,
	netdev@vger.kernel.org, Saeed Mahameed <saeedm@nvidia.com>,
	"Nelson, Shannon" <shannon.nelson@amd.com>
Subject: Re: [PATCH v4 04/10] taint: Add TAINT_FWCTL
Date: Fri, 7 Feb 2025 17:24:24 -0700	[thread overview]
Message-ID: <1dbc68d4-355f-4baa-bbef-1e023959032d@intel.com> (raw)
In-Reply-To: <4-v4-0cf4ec3b8143+4995-fwctl_jgg@nvidia.com>



On 2/6/25 5:13 PM, Jason Gunthorpe wrote:
> Requesting a fwctl scope of access that includes mutating device debug
> data will cause the kernel to be tainted. Changing the device operation
> through things in the debug scope may cause the device to malfunction in
> undefined ways. This should be reflected in the TAINT flags to help any
> debuggers understand that something has been done.
> 
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>  Documentation/admin-guide/tainted-kernels.rst | 5 +++++
>  include/linux/panic.h                         | 3 ++-
>  kernel/panic.c                                | 1 +
>  tools/debugging/kernel-chktaint               | 8 ++++++++
>  4 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/admin-guide/tainted-kernels.rst b/Documentation/admin-guide/tainted-kernels.rst
> index 700aa72eecb169..a0cc017e44246f 100644
> --- a/Documentation/admin-guide/tainted-kernels.rst
> +++ b/Documentation/admin-guide/tainted-kernels.rst
> @@ -101,6 +101,7 @@ Bit  Log  Number  Reason that got the kernel tainted
>   16  _/X   65536  auxiliary taint, defined for and used by distros
>   17  _/T  131072  kernel was built with the struct randomization plugin
>   18  _/N  262144  an in-kernel test has been run
> + 19  _/J  524288  userspace used a mutating debug operation in fwctl
>  ===  ===  ======  ========================================================
>  
>  Note: The character ``_`` is representing a blank in this table to make reading
> @@ -184,3 +185,7 @@ More detailed explanation for tainting
>       build time.
>  
>   18) ``N`` if an in-kernel test, such as a KUnit test, has been run.
> +
> + 19) ``J`` if userpace opened /dev/fwctl/* and performed a FWTCL_RPC_DEBUG_WRITE
> +     to use the devices debugging features. Device debugging features could
> +     cause the device to malfunction in undefined ways.
> diff --git a/include/linux/panic.h b/include/linux/panic.h
> index 54d90b6c5f47bd..2494d51707ef42 100644
> --- a/include/linux/panic.h
> +++ b/include/linux/panic.h
> @@ -74,7 +74,8 @@ static inline void set_arch_panic_timeout(int timeout, int arch_default_timeout)
>  #define TAINT_AUX			16
>  #define TAINT_RANDSTRUCT		17
>  #define TAINT_TEST			18
> -#define TAINT_FLAGS_COUNT		19
> +#define TAINT_FWCTL			19
> +#define TAINT_FLAGS_COUNT		20
>  #define TAINT_FLAGS_MAX			((1UL << TAINT_FLAGS_COUNT) - 1)
>  
>  struct taint_flag {
> diff --git a/kernel/panic.c b/kernel/panic.c
> index d8635d5cecb250..0c55eec9e8744a 100644
> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -511,6 +511,7 @@ const struct taint_flag taint_flags[TAINT_FLAGS_COUNT] = {
>  	TAINT_FLAG(AUX,				'X', ' ', true),
>  	TAINT_FLAG(RANDSTRUCT,			'T', ' ', true),
>  	TAINT_FLAG(TEST,			'N', ' ', true),
> +	TAINT_FLAG(FWCTL,			'J', ' ', true),
>  };
>  
>  #undef TAINT_FLAG
> diff --git a/tools/debugging/kernel-chktaint b/tools/debugging/kernel-chktaint
> index 279be06332be99..e7da0909d09707 100755
> --- a/tools/debugging/kernel-chktaint
> +++ b/tools/debugging/kernel-chktaint
> @@ -204,6 +204,14 @@ else
>  	echo " * an in-kernel test (such as a KUnit test) has been run (#18)"
>  fi
>  
> +T=`expr $T / 2`
> +if [ `expr $T % 2` -eq 0 ]; then
> +	addout " "
> +else
> +	addout "J"
> +	echo " * fwctl's mutating debug interface was used (#19)"
> +fi
> +
>  echo "For a more detailed explanation of the various taint flags see"
>  echo " Documentation/admin-guide/tainted-kernels.rst in the Linux kernel sources"
>  echo " or https://kernel.org/doc/html/latest/admin-guide/tainted-kernels.html"


  parent reply	other threads:[~2025-02-08  0:24 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-07  0:13 [PATCH v4 00/10] Introduce fwctl subystem Jason Gunthorpe
2025-02-07  0:13 ` [PATCH v4 01/10] fwctl: Add basic structure for a class subsystem with a cdev Jason Gunthorpe
2025-02-07 23:32   ` Dan Williams
2025-02-07 23:55     ` Jason Gunthorpe
2025-02-08  0:08   ` Dave Jiang
2025-02-07  0:13 ` [PATCH v4 02/10] fwctl: Basic ioctl dispatch for the character device Jason Gunthorpe
2025-02-07 12:59   ` Jonathan Cameron
2025-02-07 13:52     ` Jason Gunthorpe
2025-02-08  0:16   ` Dave Jiang
2025-02-10 15:24     ` Jason Gunthorpe
2025-02-13 12:42   ` Przemek Kitszel
2025-02-13 18:52     ` Jason Gunthorpe
2025-02-07  0:13 ` [PATCH v4 03/10] fwctl: FWCTL_INFO to return basic information about the device Jason Gunthorpe
2025-02-07 13:06   ` Jonathan Cameron
2025-02-07 14:23     ` Jason Gunthorpe
2025-02-08  0:21   ` Dave Jiang
2025-02-07  0:13 ` [PATCH v4 04/10] taint: Add TAINT_FWCTL Jason Gunthorpe
2025-02-07 13:09   ` Jonathan Cameron
2025-02-08  0:24   ` Dave Jiang [this message]
2025-02-07  0:13 ` [PATCH v4 05/10] fwctl: FWCTL_RPC to execute a Remote Procedure Call to device firmware Jason Gunthorpe
2025-02-08  0:28   ` Dave Jiang
2025-02-07  0:13 ` [PATCH v4 06/10] fwctl: Add documentation Jason Gunthorpe
2025-02-07 14:42   ` Jonathan Cameron
2025-02-10 15:17     ` Jason Gunthorpe
2025-02-08  0:40   ` Dave Jiang
2025-02-07  0:13 ` [PATCH v4 07/10] fwctl/mlx5: Support for communicating with mlx5 fw Jason Gunthorpe
2025-02-13 13:19   ` Przemek Kitszel
2025-02-13 14:25     ` Leon Romanovsky
2025-02-13 19:18     ` Jason Gunthorpe
2025-02-07  0:13 ` [PATCH v4 08/10] mlx5: Create an auxiliary device for fwctl_mlx5 Jason Gunthorpe
2025-02-07  0:13 ` [PATCH v4 09/10] fwctl/bnxt: Support communicating with bnxt fw Jason Gunthorpe
2025-02-07 14:59   ` Jonathan Cameron
2025-02-07 15:03     ` Jason Gunthorpe
2025-02-07  0:13 ` [PATCH v4 10/10] bnxt: Create an auxiliary device for fwctl_bnxt Jason Gunthorpe
2025-02-07  0:44   ` Jakub Kicinski
2025-02-07  3:17     ` Andy Gospodarek
2025-02-07 12:46       ` Jason Gunthorpe
2025-02-07 15:36       ` Jakub Kicinski
2025-02-07 20:25         ` Saeed Mahameed
2025-02-07 21:51           ` Jakub Kicinski
2025-02-08  1:10             ` Saeed Mahameed
2025-02-08  1:16             ` Jason Gunthorpe
2025-02-08  3:24               ` Andy Gospodarek
2025-02-11  1:04               ` Jakub Kicinski
2025-02-11  7:55                 ` Leon Romanovsky
2025-02-11 14:27                   ` Andy Gospodarek
2025-02-12 14:20                     ` Leon Romanovsky
2025-02-11 18:36                   ` Nelson, Shannon
2025-02-12 13:22                     ` Leon Romanovsky
2025-02-14  1:03                       ` Saeed Mahameed
2025-02-17 12:49                         ` Jiri Pirko
2025-02-17 19:02                           ` Leon Romanovsky
2025-02-11 16:24                 ` David Ahern
2025-02-18 20:05                   ` Jason Gunthorpe
2025-02-18 21:42                     ` David Ahern
2025-02-18 23:31                       ` Jakub Kicinski
2025-02-24 22:34                         ` Saeed Mahameed
2025-02-07 23:29         ` Andy Gospodarek
2025-02-08  0:08           ` Jakub Kicinski
2025-02-07 21:41 ` [PATCH v4 00/10] Introduce fwctl subystem Dan Williams
2025-02-07 21:58 ` Dave Jiang
2025-02-11  9:33   ` Jonathan Cameron
2025-02-13 17:55     ` Jason Gunthorpe
2025-02-13 17:52   ` Jason Gunthorpe
2025-02-12 22:21 ` Zhu Yanjun
2025-02-13  2:30 ` Nelson, Shannon
2025-02-13 18:02   ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1dbc68d4-355f-4baa-bbef-1e023959032d@intel.com \
    --to=dave.jiang@intel.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=aron.silverton@oracle.com \
    --cc=dan.j.williams@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dsahern@kernel.org \
    --cc=gospo@broadcom.com \
    --cc=hch@infradead.org \
    --cc=itayavr@nvidia.com \
    --cc=jgg@nvidia.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=lbloch@nvidia.com \
    --cc=leonro@nvidia.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=shannon.nelson@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox