Message ID | 4-v2-940e479ceba9+3821-fwctl_jgg@nvidia.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | Introduce fwctl subystem | expand |
On 6/24/24 3:47 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> Please also update tools/debugging/kernel-chktaint. > --- > Documentation/admin-guide/tainted-kernels.rst | 5 +++++ > include/linux/panic.h | 3 ++- > kernel/panic.c | 1 + > 3 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/Documentation/admin-guide/tainted-kernels.rst b/Documentation/admin-guide/tainted-kernels.rst > index f92551539e8a66..f91a54966a9719 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 > @@ -182,3 +183,7 @@ More detailed explanation for tainting > produce extremely unusual kernel structure layouts (even performance > pathological ones), which is important to know when debugging. Set at > build time. > + > + 18) ``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 6717b15e798c38..5dfd5295effd40 100644 > --- a/include/linux/panic.h > +++ b/include/linux/panic.h > @@ -73,7 +73,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 8bff183d6180e7..b71f573ec7c5fc 100644 > --- a/kernel/panic.c > +++ b/kernel/panic.c > @@ -494,6 +494,7 @@ const struct taint_flag taint_flags[TAINT_FLAGS_COUNT] = { > [ TAINT_AUX ] = { 'X', ' ', true }, > [ TAINT_RANDSTRUCT ] = { 'T', ' ', true }, > [ TAINT_TEST ] = { 'N', ' ', true }, > + [ TAINT_FWCTL ] = { 'J', ' ', true }, > }; > > /**
On Tue, Jun 25, 2024 at 12:03:35PM -0700, Randy Dunlap wrote: > > > On 6/24/24 3:47 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> > > Please also update tools/debugging/kernel-chktaint. Got it, thanks Jason
diff --git a/Documentation/admin-guide/tainted-kernels.rst b/Documentation/admin-guide/tainted-kernels.rst index f92551539e8a66..f91a54966a9719 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 @@ -182,3 +183,7 @@ More detailed explanation for tainting produce extremely unusual kernel structure layouts (even performance pathological ones), which is important to know when debugging. Set at build time. + + 18) ``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 6717b15e798c38..5dfd5295effd40 100644 --- a/include/linux/panic.h +++ b/include/linux/panic.h @@ -73,7 +73,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 8bff183d6180e7..b71f573ec7c5fc 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -494,6 +494,7 @@ const struct taint_flag taint_flags[TAINT_FLAGS_COUNT] = { [ TAINT_AUX ] = { 'X', ' ', true }, [ TAINT_RANDSTRUCT ] = { 'T', ' ', true }, [ TAINT_TEST ] = { 'N', ' ', true }, + [ TAINT_FWCTL ] = { 'J', ' ', true }, }; /**
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> --- Documentation/admin-guide/tainted-kernels.rst | 5 +++++ include/linux/panic.h | 3 ++- kernel/panic.c | 1 + 3 files changed, 8 insertions(+), 1 deletion(-)