TAINT_WARN is explained in kernel/panic.c as ‘Taint on warning’.

static const struct tnt tnts[] = {
  { TAINT_WARN,     'W', ' ' },
 *  'W' - Taint on warning.

This flag is turned on from “__WARN()” to confirm that the system had ‘WARNING’ messages once or more time.

#define __WARN()    __WARN_TAINT(TAINT_WARN)

#ifndef WARN_ON
#define WARN_ON(condition) ({           
  int __ret_warn_on = !!(condition);        
  if (unlikely(__ret_warn_on))          

#define WARN_TAINT(condition, taint, format...) ({         
    int __ret_warn_on = !!(condition);              
    if (unlikely(__ret_warn_on))                    
        __WARN_printf_taint(taint, format);         

#define __WARN_printf_taint(taint, arg...)        
  warn_slowpath_fmt_taint(__FILE__, __LINE__, taint, arg)

void warn_slowpath_fmt_taint(const char *file, int line,
           unsigned taint, const char *fmt, ...)
  struct slowpath_args args;

  args.fmt = fmt;
  va_start(args.args, fmt);
  warn_slowpath_common(file, line, __builtin_return_address(0),
           taint, &args);

static void warn_slowpath_common(const char *file, int line, void *caller,
         unsigned taint, struct slowpath_args *args)
  const char *board;

  printk(KERN_WARNING "------------[ cut here ]------------n");
  printk(KERN_WARNING "WARNING: at %s:%d %pS() (%s)n",
    file, line, caller, print_tainted());
  board = dmi_get_system_info(DMI_PRODUCT_NAME);
  if (board)
    printk(KERN_WARNING "Hardware name: %sn", board);

  if (args)
    vprintk(args->fmt, args->args);

  if (panic_on_warn) {
     * This thread may hit another WARN() in the panic path.
     * Resetting this prevents additional WARN() from panicking the
     * system on this thread.  Other threads are blocked by the
     * panic_mutex in panic().
    panic_on_warn = 0;
    panic("panic_on_warn set ...n");


void add_taint(unsigned flag)
   * Can't trust the integrity of the kernel anymore.
   * We don't call directly debug_locks_off() because the issue
   * is not necessarily serious enough to set oops_in_progress to 1
   * Also we want to keep up lockdep for staging development and
   * post-warning case.
  if (flag != TAINT_CRAP &&
      flag != TAINT_WARN &&
      flag != TAINT_TECH_PREVIEW &&
      flag != TAINT_TECH_PREVIEW &&
    printk(KERN_WARNING "Disabling lock debugging due to kernel taintn");

  set_bit(flag, &tainted_mask);

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: