[Crash-utility] [PATCH 0/3] Show that the kernel is tainted at init-time

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Mon Nov 15 08:58:56 UTC 2021


Hi Aaron,

sorry for the delay.

-----Original Message-----
> The goal of this patchset is to explicitly indicate to the
> user that the Linux kernel is "tainted" at init-time or
> when the 'sys' command is used. In additional to the above
> show_kernel_taints() has been consolidated to avoid
> duplication and hopefully improve readability.

That would be usuful and looks more readable, thanks.

To stop the compilation warning below, with initializing the variables,
Acked-by: Kazuhito Hagio <k-hagio-ab at nec.com>


cc -c -g -DX86_64 -DLZO -DSNAPPY -DZSTD -DGDB_10_2  kernel.c -Wall -O2 -Wstrict-prototypes -Wmissing-prototypes -fstack-protector -Wformat-security
kernel.c: In function ‘show_kernel_taints’:
kernel.c:11268:12: warning: ‘sp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  tnts_addr = sp->value;
  ~~~~~~~~~~^~~~~~~~~~~
kernel.c:11222:6: warning: ‘tnts_len’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  int tnts_len;
      ^~~~~~~~

--- a/kernel.c
+++ b/kernel.c
@@ -11219,11 +11219,11 @@ show_kernel_taints(char *buf, int verbose)
        int i, bx;
        uint8_t tnt_bit;
        char tnt_true, tnt_false;
-       int tnts_len;
+       int tnts_len = 0;
        ulong tnts_addr;
        ulong tainted_mask, *tainted_mask_ptr;
        int tainted;
-       struct syment *sp;
+       struct syment *sp = NULL;
 
        if (kernel_symbol_exists("tainted")) {
                get_symbol_data("tainted", sizeof(int), &tainted);


> 
> 
> Aaron Tomlin (3):
>   kernel: consolidate show_kernel_taints()
>   kernel: Introduce is_kernel_tainted()
>   kernel: show that the kernel is tainted at init-time
> 
>  kernel.c | 210 ++++++++++++++++++++++++++-----------------------------
>  1 file changed, 98 insertions(+), 112 deletions(-)
> 
> --
> 2.31.1
> 
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://listman.redhat.com/mailman/listinfo/crash-utility





More information about the Crash-utility mailing list