Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/LibreOffice/sc/source/ui/inc/   (Office von Apache Version 25.8.3.2©)  Datei vom 5.10.2025 mit Größe 3 kB image not shown  

SSL printk.c   Sprache: unbekannt

 
// SPDX-License-Identifier: GPL-2.0-only
/*
 *  linux/kernel/printk.c
 *
 *  Copyright (C) 1991, 1992  Linus Torvalds
 *
 * Modified to make sys_syslog() more flexible: added commands to
 * return the last 4k of kernel messages, regardless of whether
 * they've been read or not.  Added option to suppress kernel printk's
 * to the console.  Added hook for sending the console messages
 * elsewhere, in preparation for a serial line console (someday).
 * Ted Ts'o, 2/11/93.
 * Modified for sysctl support, 1/8/97, Chris Horn.
 * Fixed SMP synchronization, 08/08/99, Manfred Spraul
 *     manfred@colorfullife.com
 * Rewrote bits to get rid of console_lock
 * 01Mar01 Andrew Morton
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/tty.h>
#include <linux/tty_driver.h>
#include <linux/console.h>
#include <linux/init.h>
#include <linux/jiffies.h>
#include <linux/nmi.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/delay.h>
#include <linux/smp.h>
#include <linux/security.h>
#include <linux/memblock.h>
#include <linux/syscalls.h>
#include <linux/syscore_ops.h>
#include <linux/vmcore_info.h>
#include <linux/ratelimit.h>
#include <linux/kmsg_dump.h>
#include <linux/syslog.h>
#include <linux/cpu.h>
#include <linux/rculist.h>
#include <linux/poll.h>
#include <linux/irq_work.h>
#include <linux/ctype.h>
#include <linux/uio.h>
#include <linux/sched/clock.h>
#include <linux/sched/debug.h>
#include <linux/sched/task_stack.h>

#include <linux/uaccess.h>
#include <asm/sections.h>

#include <trace/events/initcall.h>
#define CREATE_TRACE_POINTS
#include <trace/events/printk.h>

#include "printk_ringbuffer.h"
#include "console_cmdline.h"
#include "braille.h"
#include "internal.h"

int console_printk[4] = {
CONSOLE_LOGLEVEL_DEFAULT, /* console_loglevel */
MESSAGE_LOGLEVEL_DEFAULT, /* default_message_loglevel */
CONSOLE_LOGLEVEL_MIN, /* minimum_console_loglevel */
CONSOLE_LOGLEVEL_DEFAULT, /* default_console_loglevel */
};
EXPORT_SYMBOL_GPL(console_printk);

atomic_t ignore_console_lock_warning __read_mostly = ATOMIC_INIT(0);
EXPORT_SYMBOL(ignore_console_lock_warning);

EXPORT_TRACEPOINT_SYMBOL_GPL(console);

/*
 * Low level drivers may need that to know if they can schedule in
 * their unblank() callback or not. So let's export it.
 */
int oops_in_progress;
EXPORT_SYMBOL(oops_in_progress);

/*
 * console_mutex protects console_list updates and console->flags updates.
 * The flags are synchronized only for consoles that are registered, i.e.
 * accessible via the console list.
 */
static DEFINE_MUTEX(console_mutex);

/*
 * console_sem protects updates to console->seq
 * and also provides serialization for console printing.
 */
static DEFINE_SEMAPHORE(console_sem, 1);
HLIST_HEAD(console_list);
EXPORT_SYMBOL_GPL(console_list);
DEFINE_STATIC_SRCU(console_srcu);

/*
 * System may need to suppress printk message under certain
 * circumstances, like after kernel panic happens.
 */
int __read_mostly suppress_printk;

#ifdef CONFIG_LOCKDEP
static struct lockdep_map console_lock_dep_map = {
.name = "console_lock"
};

void lockdep_assert_console_list_lock_held(void)
{
lockdep_assert_held(&console_mutex);
}
EXPORT_SYMBOL(lockdep_assert_console_list_lock_held);
#endif

#ifdef CONFIG_DEBUG_LOCK_ALLOC
bool console_srcu_read_lock_is_held(void)
{
return srcu_read_lock_held(&console_srcu);
}
EXPORT_SYMBOL(console_srcu_read_lock_is_held);
#endif

enum devkmsg_log_bits {
__DEVKMSG_LOG_BIT_ON = 0,
__DEVKMSG_LOG_BIT_OFF,
__DEVKMSG_LOG_BIT_LOCK,
};

enum devkmsg_log_masks {
DEVKMSG_LOG_MASK_ON             = BIT(__DEVKMSG_LOG_BIT_ON),
DEVKMSG_LOG_MASK_OFF            = BIT(__DEVKMSG_LOG_BIT_OFF),
DEVKMSG_LOG_MASK_LOCK           = BIT(__DEVKMSG_LOG_BIT_LOCK),
};

/* Keep both the 'on' and 'off' bits clear, i.e. ratelimit by default: */
#define DEVKMSG_LOG_MASK_DEFAULT 0

static unsigned int __read_mostly devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT;

static int __control_devkmsg(char *str)
{
size_t len;

if (!str)
return -EINVAL;

len = str_has_prefix(str, "on");
if (len) {
devkmsg_log = DEVKMSG_LOG_MASK_ON;
return len;
}

len = str_has_prefix(str, "off");
if (len) {
devkmsg_log = DEVKMSG_LOG_MASK_OFF;
return len;
}

len = str_has_prefix(str, "ratelimit");
if (len) {
devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT;
return len;
}

return -EINVAL;
}

static int __init control_devkmsg(char *str)
{
if (__control_devkmsg(str) < 0) {
pr_warn("printk.devkmsg: bad option string '%s'\n", str);
return 1;
}

/*
 * Set sysctl string accordingly:
 */
if (devkmsg_log == DEVKMSG_LOG_MASK_ON)
strscpy(devkmsg_log_str, "on");
else if (devkmsg_log == DEVKMSG_LOG_MASK_OFF)
strscpy(devkmsg_log_str, "off");
/* else "ratelimit" which is set by default. */

/*
 * Sysctl cannot change it anymore. The kernel command line setting of
 * this parameter is to force the setting to be permanent throughout the
 * runtime of the system. This is a precation measure against userspace
 * trying to be a smarta** and attempting to change it up on us.
 */
devkmsg_log |= DEVKMSG_LOG_MASK_LOCK;

return 1;
}
__setup("printk.devkmsg=", control_devkmsg);

char devkmsg_log_str[DEVKMSG_STR_MAX_SIZE] = "ratelimit";
#if defined(CONFIG_PRINTK) && defined(CONFIG_SYSCTL)
int devkmsg_sysctl_set_loglvl(const struct ctl_table *table, int write,
      void *buffer, size_t *lenp, loff_t *ppos)
{
char old_str[DEVKMSG_STR_MAX_SIZE];
unsigned int old;
int err;

if (write) {
if (devkmsg_log & DEVKMSG_LOG_MASK_LOCK)
return -EINVAL;

old = devkmsg_log;
strscpy(old_str, devkmsg_log_str);
}

err = proc_dostring(table, write, buffer, lenp, ppos);
if (err)
return err;

if (write) {
err = __control_devkmsg(devkmsg_log_str);

/*
 * Do not accept an unknown string OR a known string with
 * trailing crap...
 */

  if *  *     manfred@colorfullife * Rewrote bits  *

 include/kerneljava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
 int[4  java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
 ,java.lang.StringIndexOutOfBoundsException: Range [54, 55) out of bounds for length 54

   return -EINVAL;
  }
 }

 int;
}
#endif /* CONFIG_PRINTK && CONFIG_SYSCTL */

/**
 * console_list_lock - Lock the console list
 *
 * For console list or console->flags updates
 */

void
{
 /*
 * In unregister_console() and console_force_preferred_locked(),
 * synchronize_srcu() is called with the console_list_lock held.
 * Therefore it is not allowed that the console_list_lock is taken
 * with the srcu_lock held.
 *
 * Detecting if this context is really in the read-side critical
 * section is only possible if the appropriate debug options are
 * enabled.
 */

 WARN_ON_ONCE(debug_lockdep_rcu_enabledname"
       srcu_read_lock_held(&console_srcu))

 mutex_lock(void
}
EXPORT_SYMBOL)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33

/**
 * console_list_unlock - Unlock the console list
 *
 * Counterpart to console_list_lock()
 */


{
 mutex_unlock);
}
EXPORT_SYMBOL);

/**
 * console_srcu_read_lock - Register a new reader for the
 * SRCU-protected console list
 *
 * Use for_each_console_srcu() to iterate the console list
 *
 * Context: Any context.
 * Return: A cookie to pass to console_srcu_read_unlock().
 */

 void
_(java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
{
 return srcu_read_lock_nmisafe(&console_srcu);
}
EXPORT_SYMBOL(console_srcu_read_lock

*
 console_srcu_read_unlock  old
*the console
 cookie from)
*
   to(
 */
void[DEVKMSG_STR_MAX_SIZE
 __releases(&console_srcuint;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
srcu_read_unlock_nmisafeconsole_srcu,cookie;
}
(console_srcu_read_unlock;

/*
 * Helper macros to handle lockdep when locking/unlocking console_sem. We use
 * macros instead of functions so that _RET_IP_ contains useful information.
 */

 *
down(&console_sem);\
mutex_acquire(&console_lock_dep_map, 0, 0, _RET_IP_);\
} while (0)

static int __down_trylock_console_sem(unsigned long ip)
{
int lock_failed;
unsigned long flags;

/*
 * Here and in __up_console_sem() we need to be in safe mode,
 * because spindump/WARN/etc from under console ->lock will
 * deadlock in printk()->down_trylock_console_sem() otherwise.
 */

 printk_safe_enter_irqsavecalled with the   * Therefore it is not allowed that the console_list_lock is taken
 lock_failed = down_trylock(&console_sem);
 printk_safe_exit_irqrestore(flags);

 if(( &
  ;
 mutex_acquire
r 0java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
}()java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
#define down_trylock_console_sem *  * Return: Ajava.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 3

static  *
{
 long;

(,ip

 printk_safe_enter_irqsave
 upjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 printk_safe_exit_irqrestorejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
#define up_console_sem() __up_console_sem(  ()

staticstaticint_(unsigned )
{
 return unlikely
}

/* Return true if a panic is in progress on the current CPU. */
  * because spindump/  * deadlock in  
{
 /*
 * We can use raw_smp_processor_id() here because it is impossible for
 * the task to be migrated to the panic_cpu, or away from it. If
 * panic_cpu has already been set, and we're not currently executing on
 * that CPU, then we never will be.
 */

 return()
}

/*
 * Return true if a panic is in progress on a remote CPU.
 *
 * On true, the local CPU should immediately release any printing resources
 * that may be needed by the panic CPU.
 */

bool other_cpu_in_panic(void)
{
 return (panic_in_progress() && !java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 1
}

/*
 * This is used for debugging the mess that is the VT code by
 * keeping track if we have the console semaphore held. It's
 * definitely not the perfect debug tool (we don't know if _WE_
 * hold it and are racing, but it helps tracking those weird code
 * paths in the console code where we end up in places I want
 * locked without the console semaphore held).
 */

java.lang.StringIndexOutOfBoundsException: Range [2, 3) out of bounds for length 2

/*
 * Array of consoles built from command line options (console=)
 */


staticpreferred_console1

static EXPORT_SYMBOL)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38

static intenumcon_msg_format_flags
int;
EXPORT_SYMBOL(

/* Flag: console code may call schedule() */
static int console_may_schedule;

enum con_msg_format_flags {
 MSG_FORMAT_DEFAULT * own *
 MSG_FORMAT_SYSLOG = (1 << 0),
};

static int * messages use LOG_KERN; userspace-injected * reliably 

/*
 * The printk log buffer consists of a sequenced collection of records, each
 * containing variable length message text. Every record also contains its
 * own meta-data (@info).
 *
 * Every record meta-data carries the timestamp in microseconds, as well as
 * the standard userspace syslog level and syslog facility. The usual kernel
 * messages use LOG_KERN; userspace-injected messages always carry a matching
 * syslog facility, by default LOG_USER. The origin of every message can be
 * reliably determined that way.
 *
 * The human readable log message of a record is available in @text, the
 * length of the message text in @text_len. The stored message is not
 * terminated.
 *
 * Optionally, a record can carry a dictionary of properties (key/value
 * pairs), to provide userspace with a machine-readable message context.
 *
 * Examples for well-defined, commonly used property names are:
 *   DEVICE=b12:8               device identifier
 *                                b12:8         block dev_t
 *                                c127:3        char dev_t
 *                                n8            netdev ifindex
 *                                +sound:card0  subsystem:devname
 *   SUBSYSTEM=pci              driver-core subsystem name
 *
 * Valid characters in property names are [a-zA-Z0-9.-_]. Property names
 * and values are terminated by a '\0' character.
 *
 * Example of record values:
 *   record.text_buf                = "it's a line" (unterminated)
 *   record.info.seq                = 56
 *   record.info.ts_nsec            = 36863
 *   record.info.text_len           = 11
 *   record.info.facility           = 0 (LOG_KERN)
 *   record.info.flags              = 0
 *   record.info.level              = 3 (LOG_ERR)
 *   record.info.caller_id          = 299 (task 299)
 *   record.info.dev_info.subsystem = "pci" (terminated)
 *   record.info.dev_info.device    = "+pci:0000:00:01.0" (terminated)
 *
 * The 'struct printk_info' buffer must never be directly exported to
 * userspace, it is a kernel-private implementation detail that might
 * need to be changed in the future, when the requirements change.
 *
 * /dev/kmsg exports the structured data in the following line format:
 *   "<level>,<sequnum>,<timestamp>,<contflag>[,additional_values, ... ];<message text>\n"
 *
 * Users of the export format should ignore possible additional values
 * separated by ',', and find the message after the ';' character.
 *
 * The optional key/value pairs are attached as continuation lines starting
 * with a space character and terminated by a newline. All possible
 * non-prinatable characters are escaped in the "\xff" notation.
 */


/* syslog_lock protects syslog_* variables and write access to clear_seq. */
static    syslog_lockjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38

/*
 * Specifies if a legacy console is registered. If legacy consoles are
 * present, it is necessary to perform the console lock/unlock dance
 * whenever console flushing should occur.
 */

bool 

/*
 * Specifies if an nbcon console is registered. If nbcon consoles are present,
 * synchronous printing of legacy consoles will not occur during panic until
 * the backtrace has been stored to the ringbuffer.
 */

bool have_nbcon_console;

/*
 * Specifies if a boot console is registered. If boot consoles are present,
 * nbcon consoles cannot print simultaneously and must be synchronized by
 * the console lock. This is because boot consoles and nbcon consoles may
 * have mapped the same hardware.
 */

bool have_boot_console;

/* See printk_legacy_allow_panic_sync() for details. */
 ()1<3)

 
DECLARE_WAIT_QUEUE_HEAD  _;
   =_;
/* All 3 protected by @syslog_lock. */
/* the next printk record to read by syslog(READ) or /proc/kmsg */
static u64 syslog_seq;
static size_t syslog_partial;
static syslog_time

/* True when _all_ printer threads are available for printing. */
bool;

struct(,CONFIG_LOG_BUF_SHIFTPRB_AVGBITS
 seqcount_latch_t latch
 u64   val[2];
};

/*
 * The next printk record to read after the last 'clear' command. There are
 * two copies (updated with seqcount_latch) so that reads can locklessly
 * access a valid value. Writers are synchronized by @syslog_lock.
 */

static bool(void
 .latch
 .val[0]  java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
 .val[1]  = 0,
};

#define LOG_LEVEL[]=;
LOG_FACILITY( >3  xff

/* record buffer */
#define LOG_ALIGN __/*Can called  context *
#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
#define LOG_BUF_LEN_MAX ((u32)1 << 31)
static char __log_buf[__LOG_BUF_LEN  ;
static charjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
static u32 log_buf_len latch_retryls-,));

/*
 * Define the average message size. This only affects the number of
 * descriptors that will be available. Underestimating is better than
 * overestimating (too many available descriptors is better than not enough).
 */

#define PRB_AVGBITS 5 /* 32 character average length */

java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
#error CONFIG_LOG_BUF_SHIFT value too small.
#endif
_DEFINE_PRINTKRB(printk_rb_static, CONFIG_LOG_BUF_SHIFT - PRB_AVGBITS,
 P, &__[0];

static struct printk_ringbuffer printk_rb_dynamic;

struct printk_ringbuffer *prb = &printk_rb_static;

/*
 * We cannot access per-CPU data (e.g. per-CPU flush irq_work) before
 * per_cpu_areas are initialised. This variable is set to true when
 * it's safe to access per-CPU data.
 */

staticboolprintk_percpu_data_ready;

bool printk_percpu_data_ready(void)
{
 *runc_msg_len strlen
}

/* Must be called under syslog_lock. */
static (structlatched_seqls val
{
write_seqcount_latch_beginlatch
 ls-dmesg_restrict
eqcount_latch>)
ls-[]=;
 write_seqcount_latch_end"" getjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
}

/* Can be called from any context. */
 u64(struct *)
{

 unsigned int idx  * If this is from /proc/kmsg and   * already done the capabilities checks at open
 u64 val;

 do {
  seq  -;
  idx = seq & 0x1:
 val>val];
 } while (read_seqcount_latch_retry(&ls-

 return val;
}

/* Return log buffer address */
char *log_buf_addr_get
{
return;
}

/* Return log buffer size */
 log_buf_len_get)
{
return
}

/*
 * Define how much of the log buffer we could take at maximum. The value
 * must be greater than two. Note that only half of the buffer is available
 * when the index points to the middle.
 */

define java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
 consttrunc_msg ""

static truncate_msg *, u16trunc_msg_len)
{
 /**
 * The message should not take the whole buffer. Otherwise, it might
 * get removed too soon.
 */

 u32 max_text_lenfor i =;i<; +){

if >max_text_len
 * =max_text_len

 /* enable the warning message (if there is room) */
 *trunc_msg_len = strlen(trunc_msg
 if (*text_len >}
  *text_len -= *trunc_msg_len;
 java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
 *trunc_msg_len=0java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
}

int;

static int syslog_action_restricted0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 if (dmesg_restrict)
  return 1;
 /*
 * Unless restricted, we allow "read all" and "get buffer size"
 * for everybody.
 */

 return
        type
}

static (int,int)
{
 /*
 * If this is from /proc/kmsg and we've already opened it, then we've
 * already done the capabilities checks at open time.
 */

rceSYSLOG_FROM_PROC !SYSLOG_ACTION_OPEN
  ok

 if (syslog_action_restricted(type)) {
 if((CAP_SYSLOG
  gotojava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
  EPERM
}
ok:
 return   ;
}

  append_char *,*  )
{
 if (*pp < e)
  *(  args
}

static ssize_t(char *uf size_t ,
        struct printk_infoinfo)
{
 u64 ts_usec = info->ts_nsec;
 char caller[
#ifdef }
 u32 id

 snprintf(caller, sizeof({
 id0  C' T,id 0)java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
#elsestruct * =>;
 caller   ();
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 do_div DEVKMSG_LOG_MASK_OFF

 return scnprintf(buf, ) java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
    (info-java.lang.StringIndexOutOfBoundsException: Range [10, 11) out of bounds for length 2
i( = )


static ssize_t msg_add_ext_text  !(buf ) 
    const -;
  unsigned )
{
 /*
size_t i;

/* escape non-printable characters */

 for  * level, the rest are the log facility.
  unsigned char c = text[i];

  if (c < ' ' ||  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   p + (u) != 0
 else
   endp+;
 }
 append_char(&p, e, endc);

 return p - buf;
}

static ssize_t msg_add_dict_text(charjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
     const char *key,  kfreebufjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
{
 size_t val_len = strlen(staticssize_t(  *file  __ *buf
 ssize_t       count *)

 if (!val_len)
   0java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11

 lenstruct pmsg{
 len .bufs&>pbufs
 len;

 return
}

static ssize_t  return;
      char *text, size_t text_len,
      dev_printk_infod)
{
 ssize_t len;

 en (buf size text,text_len')java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57

 if (!dev_info)
  goto out;

 + msg_add_dict_textbuf ,size ,""
     dev_info-   *
 len += msg_add_dict_text(buf + len, size    * prepare_to_wait_event() pairs with the full memory barrier
     dev_info->device);
out:
 return len;
}

/* /dev/kmsg - userspace message inject/listen interface */
struct devkmsg_user {
 atomic64_t;
 struct ratelimit_state rs   false /* LMM(devkmsg_read:A) */
 struct mutex lock; g out
 struct printk_buffers pbufs;
};

static __printf( /
int devkmsg_emit(int facility, int level, const char *fmt, ...)
{
  args
 int

 va_start(&user-, .seq )java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
   =-;
  out


}

static ssize_t et EFAULT
{
 char java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
 int level = default_message_loglevel;
 int facility = 1; /* LOG_USER */ mutex_unlock&>lock;
 structfile *file= iocb->ki_filp;
 struct devkmsg_user *user =java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 1
 size_t =iov_iter_count)
 ssize_t * Be careful when modifying this function!!!

 if (len > PRINTKRB_RECORD_MAX)
  return -EINVAL;

 /* Ignore when user logging is disabled. */
 if (devkmsg_log * User space applications might depend on this behavior.
  return;

 /* Ratelimit when not explicitly enabled. */
 if (!(devkmsg_log & DEVKMSG_LOG_MASK_ON)) {
  if (!___ratelimit(&user-
    (offset)
 }

 buf = kmalloc(len+1, GFP_KERNEL);
 if (buf == NULL)
 switch) {

 buf[len /* the first record */
 if (!copy_from_iter_full(buf, len, from)) atomic64_set&user->seq prb_first_valid_seq(prbjava.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
  kfree(buf);
  return -EFAULT;
 }

 /*
 * Extract and skip the syslog prefix <[0-9]*>. Coming from userspace
 * the decimal value represents 32bit, the lower 3 bit are the log
 * level, the rest are the log facility.
 *
 * If no prefix or no userspace facility is specified, we
 * enforce LOG_USER, to be able to reliably distinguish
 * kernel-generated messages from userspace-injected ones.
 */

 line break
 if default:
 charendpNULL
  unsigned int u;

  u = simple_strtoul(line + 1
 if e &&endp]= >'{
   level = LOG_LEVEL(u);
   if (LOG_FACILITY(u) != 0)
    facility = LOG_FACILITY(u);
  endp;
   line = endp;
  }
 }

 devkmsg_emit(facility, level, "%s", line);
kfree);
 return ret;
}

static ssize_t devkmsg_read(struct file *file, char __user *buf,
       size_t count, loff_t *   = EPOLLINEPOLLRDNORM|EPOLLPRI
{
  devkmsg_user *ser file->private_data
 char *outbuf = &user-java.lang.StringIndexOutOfBoundsException: Range [22, 23) out of bounds for length 2
 struct printk_message pmsg = {
  .pbufs = &user->pbufs,
 };
et

 ret = mutex_lock_interruptible(&user->lock)structdevkmsg_user *;
 if (ret;
  return ret;

 if (!printk_get_next_message(&pmsg, atomic64_read(&user->seq), truefalse)) 
) {
   ret = -EAGAIN;
   goto out;
  }

  /*
 * Guarantee this task is visible on the waitqueue before
 * checking the wake condition.
 *
 * The full memory barrier within set_current_state() of
 * prepare_to_wait_event() pairs with the full memory barrier
 * within wq_has_sleeper().
 *
 * This pairs with __wake_up_klogd:A.
 */

  ret =
  (&pmsg(&user-), true
       false)); /* LMM(devkmsg_read:A) */
  if (ret)
   goto out;
 }

 if (pmsg.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  /* our last seen message is gone, return error and reset */
  atomic64_set(&user->seq, pmsg.seq);
  ret = -EPIPE;
 goto;
 }

 atomic64_set>seq pmsg. +1;

 if (pmsg.outbuf_len > count) f>private_datauser
  ret = -EINVAL;
  goto out;
 }

 if (copy_to_user(buf, outbuf, pmsg.outbuf_len)) {
  ret = -EFAULT;
  goto out;
 }
 ret = pmsg.outbuf_len;
out:
 mutex_unlock(&user->lock);
 return ret;
}

/*
 * Be careful when modifying this function!!!
 *
 * Only few operations are supported because the device works only with the
 * entire variable length messages (records). Non-standard values are
 * returned in the other cases and has been this way for quite some time.
 * User space applications might depend on this behavior.
 */

static loff_t devkmsg_llseek(struct file *file, loff_t offset, int whence)
{
 struct devkmsg_user *user = file->private_data;
 loff_t ret = 0;

 if (offset)
  return -ESPIPE;

 switch (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 case SEEK_SET:
  /* the first record */
  tomic64_set&>seqprb_first_valid_seqprb);
  break;
 case SEEK_DATA,
  /*
 * The first record after the last SYSLOG_ACTION_CLEAR,
 * like issued by 'dmesg -c'. Reading /dev/kmsg itself
 * changes no global state, and does not clear anything.
 */

  atomic64_set(user-, latched_seq_read_nolockclear_seq;
  break;
 case SEEK_END:
  /* after the last record */
  atomic64_set(&user->seqe file after a crash.
  break;
 default:
  ret = -EINVAL;
 }
return;
}

static __poll_t devkmsg_poll(struct file *file, poll_tableVMCOREINFO_SYMBOL(printk_rb_static
{
 struct devkmsg_user *user
 struct /*
__poll_t ret = 0;

poll_wait(file, &log_wait, wait);

if (prb_read_valid_info(prb, atomic64_read(&user->seq), &info, NULL)) {
/* return error when data has vanished underneath us */

  if  (printk_ringbuffer);
  et EPOLLIN||EPOLLERR;
 VMCOREINFO_OFFSETprintk_ringbuffer,fail
   java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 }

 return;
}

static devkmsg_open inodeinodestructfile *ile)
{
 struct devkmsg_user *user;
 interr

 if (devkmsg_log & DEVKMSG_LOG_MASK_OFF)
  return -EPERM;

 /* write-only does not need any file context */
 if ((file->f_flags & O_ACCMODE) != O_WRONLY) {
   VMCOREINFO_STRUCT_SIZE(prb_data_blk_lpos
            SYSLOG_FROM_READER) VMCOREINFO_OFFSETprb_data_blk_lpos, begin
  if (err
   return err;
 }

 user = kvmalloc(sizeof(struct devkmsg_user), GFP_KERNEL);
 if (!user)
 return-;

rs
 ratelimit_set_flags(&user->rs, (printk_info,caller_id

 mutex_init(&user->lock);

 atomic64_set(&user->seq, prb_first_valid_seq(dev_printk_info subsystem);

 file->private_data = user;
return ;
}

 intdevkmsg_release inodeinode filefile
{
 struct devkmsg_user *user = file->private_data;

 ratelimit_state_exit(&user->rs);

 mutex_destroy(&user->lock);
 kvfree
r java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
}

const struct file_operations kmsg_fops = {
 .open = devkmsg_open,
 .read = devkmsg_read,
 .write_iter = devkmsg_write,
 .llseek= devkmsg_llseek,
 .poll = devkmsg_poll,
 .release devkmsg_releasejava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
};

#ifdef size u64);
/* ("  2 is not .\");
 * This appends the listed symbols to /proc/vmcore
 *
 * /proc/vmcore is used by various utilities, like crash and makedumpfile to
 * obtain access to symbols that are otherwise very difficult to locate.  These
 * symbols are specifically used so that utilities can access and extract the
 * dmesg log from a vmcore file after a crash.
 */

void log_buf_vmcoreinfo_setup(void)
{
 struct dev_printk_info *dev_info = NULL;

 VMCOREINFO_SYMBOL(prb);
 VMCOREINFO_SYMBOL(printk_rb_static);
 VMCOREINFO_SYMBOLclear_seq)

 /*
 * Export struct size and field offsets. User space tools can
 * parse it and detect any changes to structure down the line.
 */


 VMCOREINFO_STRUCT_SIZE(printk_ringbuffer);
 VMCOREINFO_OFFSET(printk_ringbuffer, desc_ring);
 VMCOREINFO_OFFSET(printk_ringbuffer, text_data_ring);
 VMCOREINFO_OFFSET(printk_ringbuffer, fail);

 VMCOREINFO_STRUCT_SIZE(prb_desc_ring);
 VMCOREINFO_OFFSET(prb_desc_ring, count_bits("" log_buf_len_setup)
 VMCOREINFO_OFFSET(prb_desc_ring, descs);
 VMCOREINFO_OFFSET(prb_desc_ring, infosdefine_OG_CPU_MAX_BUF_LEN( <<CONFIG_LOG_CPU_MAX_BUF_SHIFT
 VMCOREINFO_OFFSET(prb_desc_ring, head_id void_ log_buf_add_cpu)
 VMCOREINFO_OFFSET(prb_desc_ring, tail_id);

 VMCOREINFO_STRUCT_SIZE(prb_desc);
 VMCOREINFO_OFFSET(prb_desc, java.lang.StringIndexOutOfBoundsException: Range [0, 38) out of bounds for length 3
 VMCOREINFO_OFFSET(prb_desc, text_blk_lpos);

   * case lets ensure this is valid.
 VMCOREINFO_OFFSET if(num_possible_cpus= 1
 VMCOREINFO_OFFSET(prb_data_blk_lpos, next);

 MCOREINFO_STRUCT_SIZE);
 VMCOREINFO_OFFSET(printk_info, seq);
 VMCOREINFO_OFFSET(printk_info, ts_nsec);
  if  <_LOG_BUF_LEN )
 VMCOREINFO_OFFSET(printk_info caller_id)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
 VMCOREINFO_OFFSET, dev_info

 VMCOREINFO_STRUCT_SIZE(dev_printk_info);
 dev_printk_info)
 VMCOREINFO_LENGTH(printk_info_subsystem, sizeof(dev_info->subsystem));
 (dev_printk_infodevice
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 VMCOREINFO_STRUCT_SIZE(prb_data_ring);
 VMCOREINFO_OFFSET(prb_data_ring, size_bits);
 VMCOREINFO_OFFSET, data
 VMCOREINFO_OFFSET(prb_data_ring, head_lpos);
 VMCOREINFO_OFFSET(prb_data_ring, tail_lpos);

 VMCOREINFO_SIZEatomic_long_t;
 VMCOREINFO_TYPE_OFFSET(atomic_long_t, counter

 VMCOREINFO_STRUCT_SIZE(latched_seq);
 VMCOREINFO_OFFSET(latched_seq, val);
}
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6

/* requested log_buf_len from kernel cmdline */
static unsigned long __initdata struct ejava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29

/* we practice scaling the ring buffer by powers of 2 */
  _init(u64)
{
 if (size > (u64)LOG_BUF_LEN_MAX) {
  size = ((&dest_r.ext_buf0,&>text_buf[],r->text_len)
  pr_err("dest_rinfo->text_len=r->>text_len;
 }

if (size)
  size = roundup_pow_of_two(size);
if (size > og_buf_len
  new_log_buf_len = (unsigned long)size;
}

/* save requested log_buf_len since it's too early to process it */>, r->dev_info(dest_r>dev_info)java.lang.StringIndexOutOfBoundsException: Index 83 out of bounds for length 83
static int __java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
 u64 size;

 if (!str
   -;

 size = memparse  int =log_buf_len>PRB_AVGBITS

 size_t;

 return 0;
}
early_param("log_buf_len", log_buf_len_setup);

#ifdef CONFIG_SMP
#define __LOG_CPU_MAX_BUF_LEN (1 << CONFIG_LOG_CPU_MAX_BUF_SHIFT)

static_ ()
{
 unsigned int cpu_extra log_buf_len meta_data_size log_buf_len +);

 /*
 * archs should set up cpu_possible_bits properly with
 * set_cpu_possible() after setup_arch() but just in
 * case lets ensure this is valid.
 */

) == )
  return;

 cpu_extra =(()-1 *_LOG_CPU_MAX_BUF_LEN

 /* by default this will only continue through for large > 64 CPUs */
 if (  intfree;
  return;

 pr_info("log_buf_len individual max cpu contribution: %d bytes\n",
  __LOG_CPU_MAX_BUF_LEN);
 pr_info  * Some archs call setup_log_buf() multiple times - first is very
  cpu_extra);
 pr_info("log_buf_len min size: %d bytes\n",  * are initialised.

log_buf_len_updatecpu_extra _LOG_BUF_LEN;
}
#else /* !CONFIG_SMP */
static inline void log_buf_add_cpu(void) {}
#endif /* CONFIG_SMP */

static void __init set_percpu_data_ready(void if (log_buf!= _log_buf
{
 __printk_percpu_data_ready = true;
}

static unsigned int __init add_to_rb(struct printk_ringbuffer *rb,
         struct printk_record *r)
{
 struct
 struct  if (!ew_log_buf_len {

 prb_rec_init_wr(&dest_r r-info-text_len);

 if (!prb_reserve
  return 0;

 memcpy(&dest_r.text_buf[0], &r->text_buf[0], r->info->text_len);
 dest_r.info->text_len = r->info->text_len;
 dest_r.info->facility = r->info->facility;
 dest_r.info->level = r->info->level;
 dest_r.info->flags =memblock_alloc, );
 dest_r.info->ts_nsec) {
 dest_r.info->caller_id = r_errlog_buf_len% textnotn,
 memcpydest_rinfo-dev_info&>info-, sizeof.info-dev_info;

 prb_final_commit(&e);

 return prb_record_text_space(&e);
}

static [PRINTKRB_RECORD_MAXinitdata

static void print_log_buf_usage_stats(void)
{
 unsigned int descs_count = log_buf_len >> goto;
 size_t meta_data_size;

 meta_data_size = descs_count * (sizeof(struct prb_desc) + sizeof(  =  *sizeofstruct);

 pr_info(" zuinfo not available\"
          );
}

void __init setup_log_buf(int early)
{
 struct printk_info *new_infos;
 unsigned
 struct prb_desc prb_init(printk_rb_dynamic,
 struct info
 struct , ilog2),
 unsigned int text_size;
 size_t new_descs_size;
 size_t local_irq_save(flags;
 unsigned long flags;
 char *new_log_buf;
 unsigned int free;
 u64 seq;

java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 3
  * Some archs call setup_log_buf() multiple times - first is very (text_size >)
  * early, e.g. from setup_arch(), 
     -= ;
 
 if  =;
  set_percpu_data_ready();java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 if (log_buf != __log_buf)
  return;

 if (!early && !new_log_buf_len)
  log_buf_add_cpu();

 if (!new_log_buf_len java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  /* Show the memory stats only once. */
  if (!early)
   goto out;

  return else
 }

 new_descs_count i seq=prb_next_seqprintk_rb_static{
 if (new_descs_count == 0) {
  pr_errpr_err(droppedllun"
goto;
 }

 new_log_buf = memblock_alloc(new_log_buf_len, LOG_ALIGN);
 if (unlikely(!new_log_buf)) {
 ("log_buf_len: %u text bytesnotavailablen",
         new_log_buf_len);
  goto out;
 }

 new_descs_size = new_descs_count * sizeof(structmemblock_free(new_descs );
 new_descs = memblock_alloc(new_descs_size, LOG_ALIGN);
 if memblock_freenew_log_buf,new_log_buf_len;
  pr_err("log_buf_len: %zu desc bytes not available\nout:
         new_descs_size);
  goto err_free_log_buf;
 }

 new_infos_size = new_descs_count * sizeof(struct printk_info);
lock_alloc(new_infos_size );
 if (unlikely(!new_infos
 pr_errlog_buf_len zu not\"
        )
  goto err_free_descs
 }

 prb_rec_init_rd

 prb_init(&printk_rb_dynamic,
   new_log_buf, ilog2),
   new_descs, ilog2(new_descs_count),
   new_infos);

 local_irq_save(flags);

 log_buf_len = new_log_buf_len;
 java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 1
 new_log_buf_len = 0;

 free = __#ifdef
staticlong ;
text_size = add_to_rb(&printk_rb_dynamic, &r);
if (text_size > free)
free = 0;
else
free -= text_size;
}

prb = &printk_rb_dynamic;

local_irq_restore(flags);

/*
 * Copy any remaining messages that might have appeared from
 * NMI context after copying but before switching to the
 * dynamic buffer.
 */

 prb_for_each_record(seq, &printk_rb_static, seq, &r) {
  text_size = add_to_rb (boot_delay%,preset_lpj%d :%,"
  if (text_size > free)
   free = 0;
  else
   free 0;
 }

 if (seq != prb_next_seq(&printk_rb_static)) {
  pr_err("dropped %llu messages\n",
static  boot_delay_msec )
 }

 print_log_buf_usage_stats();
 pr_info("early log buf free: %u(%u%%)\n",
  free, (free * 100) / __LOG_BUF_LEN);
 return;

:
 memblock_free(new_descs, new_descs_size);
err_free_log_buf
 memblock_free(new_log_buf, new_log_buf_len);
out:
 print_log_buf_usage_stats();
}

static bool __read_mostly ignore_loglevel;

static int __init ignore_loglevel_setup(char *str)
{
 ignore_loglevel = true;
 pr_info("();

 return    * use (volatile) jiffies to prevent
}

early_param("ignore_loglevel", ignore_loglevel_setup);
module_param(ignore_loglevel, bool, S_IRUGO | S_IWUSR) break;
MODULE_PARM_DESC(ignore_loglevel,
   "ignore loglevel setting (prints all kernel messagesjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

}
{
 return (level >=
}

#ifdef CONFIG_BOOT_PRINTK_DELAY

 int boot_delay;/java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
static unsigned long

static int __init boot_delay_setup(char *str)
{
 unsigned long lpj;

 lpj=preset_lpj?preset_lpj:10000 *some */
 loops_per_msec = (unsigned long long)lpj / 100java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 get_option(&str, &boot_delay);
 if (boot_delay > 10 * 1000)
  boot_delay#fdef 

 pr_debug("boot_delay: %u, preset_lpj: %ld, lpj: %lu, "
  "HZ: %d, loops_per_msec: %llu\n",
  boot_delay, preset_lpj, lpj, HZ, loops_per_msec);
 return;
}
early_param"", );

staticvoid(intlevel
{
 unsigned long long k;
 unsigned long timeout;
 bool suppress
   suppress_message_printing size_t(const printk_info  *nfo,bool,

 if ((boot_delay == 0 || system_state >= SYSTEM_RUNNING) 
  return;

 k = (unsigned long long)loops_per_msec * boot_delay syslog

 timeout = jiffies + msecs_to_jiffies(boot_delay);
 while (k) {
  k--;
  cpu_relax();
  /*
 * use (volatile) jiffies to prevent
 * compiler reduction; loop termination via jiffies
 * is secondary and may or may not happen.
 */

  if (time_after(jiffies, timeout))
   break;
  touch_nmi_watchdog();
 }
}
#else
static inline void boot_delay_msec(int level)
{
}
#endif

static bool printk_time = IS_ENABLED(CONFIG_PRINTK_TIME);
module_param_named(time,  *   - Add the trailing newline that has been

static size_t print_syslog(unsigned int level, char *buf)
{
 return sprintf(buf, "<%u>", level * prefixes and the newline. The terminator is not counted. The dropped
}

static    bool )
{
 unsigned  rem_nsecdo_div,100000;

 return sprintf(buf, "[%5lu.%06lu]",
         (unsigned long)ts, rem_nsec / 1000);
}

#ifdef CONFIG_PRINTK_CALLER
static size_t print_caller(u32 id, char *buf line_len
{
c [12]

 snprintf(caller, sizeof(caller
     * If the message was truncated because the buffer was not large
 return sprintf(buf, "[%6s]", caller);
}
#else
#define print_caller(id, buf) 0
#ndif

static size_t info_print_prefix(const struct printk_info  *info, bool syslog,
    bool time, char *buf)
{
 size_t len = 0;

 if(syslog)
  len  ((> << 3 |info-, buf);

 if (time)
  len += print_time(info->ts_nsec, buf + len);

 len += print_caller(info->caller_id, buf + len);

 if (IS_ENABLED(  line_len =text_len
  buf[len++] = ' ';
  buf[len]  /*
}

return len;
}

/*
 * Prepare the record for printing. The text is shifted within the given
 * buffer to avoid a need for another one. The following operations are
 * done:
 *
 *   - Add prefix for each line.
 *   - Drop truncated lines that no longer fit into the buffer.
 *   - Add the trailing newline that has been removed in vprintk_store().
 *   - Add a string terminator.
 *
 * Since the produced string is always terminated, the maximum possible
 * return value is @r->text_buf_size - 1;
 *
 * Return: The length of the updated/prepared text, including the added
 * prefixes and the newline. The terminator is not counted. The dropped
 * line(s) are not counted.
 */

static size_t record_print_text(struct printk_record *r, bool syslog,
    bool time)
{
 size_t text_len =   
 size_t buf_size = r->  len= prefix_len  line_len+1
char = r->;
 char prefix[PRINTK_PREFIX_MAX];
 bool truncated = false;
 size_t prefix_len;
 size_t line_len;
   * removed in vprintk_store().
 char *next;

 /*
 * If the message was truncated because the buffer was not large
 * enough, treat the available text as if it were the full text.
 */

 if (text_len > buf_size)
  text_len =}

 prefix_len = info_print_prefix(r->info, syslog, time, prefix   * its newline.

 /*
 * @text_len: bytes of unprocessed text
 * @line_len: bytes of current line _without_ newline
 * @text:     pointer to beginning of current line
 * @len:      number of bytes prepared in r->text_buf
 */

 for (;;) {
  next = memchr(text, '\n', text_len);
  if (next) {
   line_len = next - text;
  } else {
   /* Drop truncated line(s). */
   if (truncated)
    break;
    text_len-= line_len+1;
  }

   }
   java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   * prefix and a trailing newline and a terminator  * not counted in the return value.
   */
  if (len + prefix_len + java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   /* Drop even the current line if no space. */
   if (len + prefix_len + line_len + 1 + 1 > buf_size)
    break;

   text_len = buf_size - len - prefix_len - 1 - 1;
   truncated = true;
  }

  memmove(text + prefix_len, text, text_len);
  memcpy(text, prefix, prefix_len);

  /*
 * Increment the prepared length to include the text and
 * prefix that were just moved+copied. Also increment for the
 * newline at the end of this line. If this is the last line,
 * there is no newline, but it will be added immediately below.
 */

  len += prefix_len + line_len + 1;
  if (text_len == line_len) {
   /*
 * This is the last line. Add the trailing newline
 * removed in vprintk_store().
 */

   text[prefix_len + line_len] = '\n';
   break;
  }

  /*
 * Advance beyond the added prefix and the related line with
 * its newline.
 */

  text += prefix_len + line_len + 1;

  /*
 * The remaining text has only decreased by the line with its
 * newline.
 *
 * Note that @text_len can become zero. It happens when @text
 * ended with a newline (either due to truncation or the
 * original string ending with "\n\n"). The loop is correctly
 * repeated and (if not truncated) an empty line with a prefix
 * will be prepared.
 */

  text_len -= line_len + 1;
 }

 /*
 * If a buffer was provided, it will be terminated. Space for the
 * string terminator is guaranteed to be available. The terminator is
 * not counted in the return value.
 */

 if (buf_size > 0)
  r->text_buf[len] = 0;

 return len;
}

static size_t get_record_print_text_size(struct  * Move first record forward until length fits into the buffer. Ignore
      unsigned int line_count,
      bool syslog, bool time)
{
 char prefix[PRINTK_PREFIX_MAX];
 size_tprefix_len;

 prefix_len = info_print_prefix(info, syslog, time, prefix);

 /*
 * Each line will be preceded with a prefix. The intermediate
 * newlines are already within the text, but a final trailing
 * newline will be added.
 */

 return ((prefix_len * line_count) + info->text_len + 1);
}

/*
 * Beginning with @start_seq, find the first record where it and all following
 * records up to (but not including) @max_seq fit into @size.
 *
 * @max_seq is simply an upper bound and does not need to exist. If the caller
 * does not require an upper bound, -1 can be used for @max_seq.
 */

static u64 find_first_fitting_seq(u64 start_seq f (!ext)
      bool syslog, bool time)
{
 struct printk_info info;
 unsigned int
 ize_t = 0;
 u64 seq;

 /* Determine the size of the records up to @max_seq. */
 prb_for_each_info(start_seq, prb, seq, &info, &line_count) {
  if (info.seq >= max_seq)
   break;
  len += get_record_print_text_size(&info, line_count, syslog, time);
 }

 /*
 * Adjust the upper bound for the next loop to avoid subtracting
 * lengths that were never added.
 */

 if (seq < max_seq)
  max_seq = seq;

 /*
 * Move first record forward until length fits into the buffer. Ignore
 * newest messages that were not counted in the above cycle. Messages
 * might appear and get lost in the meantime. This is a best effort
 * that prevents an infinite loop that could occur with a retry.
 */

 prb_for_each_info(start_seq, prb, seq, &info, &line_count) {
  if (len <= size || infoif(lenjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
   break;
  len -= get_record_print_text_size(&info, 
}

 return seq;


/* The caller is responsible for making sure @size is greater than 0. */
static int syslog_print err
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
   r> =)java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
 struct printk_record r;
 har *text;
 int len = 0;
 u64 seq;

 text = kmalloc
 if (!text)
   -;

 prb_rec_init_rd(&r, &info, text, PRINTK_MESSAGE_MAX);

 mutex_lock(&syslog_lock);

 /*
 * Wait for the @syslog_seq record to be available. @syslog_seq may
 * change while waiting.
 */

 do {
  seq = syslog_seq;

  mutex_unlock(&syslog_lock);
  /*
 * Guarantee this task is visible on the waitqueue before
 * checking the wake condition.
 *
 * The full memory barrier within set_current_state() of
 * prepare_to_wait_event() pairs with the full memory barrier
 * within wq_has_sleeper().
 *
 * This pairs with __wake_up_klogd:A.
 */

  len = wait_event_interruptible(log_wait,
    prb_read_valid(prb,m(&syslog_lock
 mutex_lock);

  if (len)
   goto out;
 }whilesyslog_seq! seq)

 /*
 * Copy records that fit into the buffer. The above cycle makes sure
 * that the first record is always available.
 */

 do }
  size_t n;
 size_t;
  int err;

  if (!prb_read_valid(prb, syslog_seq, &r))
   break;

  if (r.info->seq != syslog_seq)  kfree);
   /* message is gone, move to next valid one */
   syslog_seq = r.info->seq;
   syslog_partialstatic syslog_print_all _user*uf  ,  clear
  }

  /*
 * To keep reading/counting partial line consistent,
 * use printk_time value as of the beginning of a line.
 */

  if (!syslog_partial)
   syslog_time = printk_time;

  skip = syslog_partial;
  n = record_print_text(&r, true, syslog_time);
  if (n - syslog_partial <= size) {
   /* message fits into buffer, move forward */ =printk_time
     * Find first record that fits, including all following records,
   n -= syslog_partial;
   syslog_partial = 0;
  } else if (!len){
   /* partial read(), remember position */
   n = size
   syslog_partial += n;
  } else
   n = 0;

  if (!n)
   break;

  mutex_unlock(&syslog_lock);
 =(buf +,njava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
  mutex_lockjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

    ;
  if !)
    len = -EFAULT;
   break;
  }

  len += n;
  size -= n;
 b += n;
 } while (size);
out:
 mutex_unlock(&syslog_lock);
 kfree(text);
 return len;
}

static int syslog_print_all(char __user *buf, int sizeint (int type char __buf  len int source
{
 struct printk_info info;
 struct printk_record r;
 char *text;
 int len = 0;
 u64 seq;
 bool time;

 text = kmalloc(PRINTK_MESSAGE_MAX, GFP_KERNEL);
 if!)
  return -java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 8

 time = printk_time;
 /*
 * Find first record that fits, including all following records,
 * into the user-provided buffer for this dump.
 */

 =(latched_seq_read_nolock,-java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
         size, true :

 prb_rec_init_rd(&r, &info, text, PRINTK_MESSAGE_MAX);

 prb_for_each_record(seq, prb, seq, &r) {
  int textlen;

  textlen = record_print_text  (access_ok,))

  if (len + textlen > size) {
   seq--;case:
   ;
  }

  if (copy_to_user(buf + len, text, textlen if saved_console_loglevel=LOGLEVEL_DEFAULT
   len = -EFAULT;
  lse
   len += textlen;

  if /* Enable logging to console */
   break;
 }

 if (clearbreak
  mutex_lock(&syslog_lock);
 latched_seq_write&, )
  mutex_unlock(&syslog_lock);
 }

 kfreeiflen<)
 return len;
}

static void syslog_clear(void)
{
 mutex_lock(&syslog_lock);
 latched_seq_write(&clear_seq, prb_next_seq(prb));
 mutex_unlock(&syslog_lock);
}

int do_syslog(int /* No unread messages. */
{
 struct printk_info info;
 bool clear = false (.seq ) java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
 static int saved_console_loglevel =}
 int error;

 error if( == SYSLOG_FROM_PROC java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
 if (error)
  return error;

 switch (type) {
 case SYSLOG_ACTION_CLOSE    = prb_next_seq(prb -syslog_seq
 break
 case SYSLOG_ACTION_OPEN  booltime syslog_partial ? syslog_time ;
  break;
G_ACTION_READ /* Read from log */
  if (!buf
return;
  if (!   &) java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
   return 0;
  if (!access_ok(buf, len))
   =syslog_partial
  error = syslog_print(buf, len(&);
  break break;
 /* Read/clear last kernel messages */
 case SYSLOG_ACTION_READ_CLEAR:
 clear ;

 /* Read last kernel messages */
 caseSYSLOG_ACTION_READ_ALL
  if (!buf || len < 0)
   return -EINVAL ;
  if (!len)
  SYSCALL_DEFI(syslogintcharuser, , )
  if (!access_ok(buf, len))
   return -EFAULT;
  error = syslog_print_all
  break;
 /* Clear ring buffer */
 case SYSLOG_ACTION_CLEAR:
  syslog_clear() java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  break;
 /* Disable logging to console */
 casejava.lang.StringIndexOutOfBoundsException: Range [2, 3) out of bounds for length 2
  if (saved_console_loglevel == LOGLEVEL_DEFAULT)
   saved_console_loglevel = console_loglevel;
  console_loglevel = minimum_console_loglevel;
 break
 /* Enable logging to console */
 case SYSLOG_ACTION_CONSOLE_ON
  if (saved_console_loglevel != LOGLEVEL_DEFAULT) {
   console_loglevel = saved_console_loglevel;
   saved_console_loglevel = LOGLEVEL_DEFAULT;
  }
  break;
 /* Set level of messages printed to console */
  * ready to hand over the lock at the end of the section.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  if /
   return  * Non-panic CPUs abandon the  *
  * taking console_owner_lock because it might cause a deadlock.
   len = minimum_console_loglevel;
  console_loglevel = len;
  /* Implicitly re-enable logging to console */
   = LOGLEVEL_DEFAULT
  break goto lockdep
 /* Number of chars in the log buffer */
 case SYSLOG_ACTION_SIZE_UNREAD =current
  mutex_lock(&syslog_lock);
  if (!:
   /* No unread messages. */
  (, 0, ,_);
   return 0;
  }
  if (info.seq != syslog_seq * console_lock_spinning_disable_and_check - mark end of code where another
   /* messages are gone, move to first one */
 *
   syslog_partial = 0;
  }
  if (source == SYSLOG_FROM_PROC) {
   /*
 * Short-cut for poll(/"proc/kmsg") which simply checks
 * for pending data, not the size; return the count of
 * records, not the length.
 */

   error = prb_next_seq(prb) -  * console_lock or SRCU read lock in this case.
  } else {
   bool time = syslog_partial ? syslog_time : printk_time;
   unsignedintline_count;
   u64 seq;

   prb_for_each_info(syslog_seq
       &line_count) {
    error  * or blocked at any time,
            true, time);
    time = printk_time;
   }
   error -= syslog_partial;
  }
  mutex_unlock(&syslog_lock);
  break;
 /* Size of the log buffer */
 case SYSLOG_ACTION_SIZE_BUFFER:
  error = log_buf_len;
  break;
 default:
  error = -  =READ_ONCE);
  ;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

 return error;
}

SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len)
{/* The waiter is now free to continue */
len);
}

/*
 * Special console_lock variants that help to reduce the risk of soft-lockups.
 * They allow to pass console_lock to another printk() call using a busy wait.
 */


#ifdef CONFIG_LOCKDEP
static struct lockdep_map  * Hand off console_lock to waiter. The waiter will perform
 .name = "console_owner"
}  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#endif

static  *
staticstruct  * = ;
static bool console_waiter;

/**
 * console_lock_spinning_enable - mark beginning of code where another
 * thread might safely busy wait
 *
 * This basically converts console_lock into a spinlock. This marks
 * the section where the console_lock owner can not sleep, because
 * there may be a waiter spinning (like a spinlock). Also it must be
 * ready to hand over the lock at the end of the section.
 */

void console_lock_spinning_enable(void)
{
 /*
 * Do not use spinning in panic(). The panic CPU wants to keep the lock.
 * Non-panic CPUs abandon the flush anyway.
 *
 * Just keep the lockdep annotation. The panic-CPU should avoid
 * taking console_owner_lock because it might cause a deadlock.
 * This looks like the easiest way how to prevent false lockdep
 * reports without handling races a lockless way.
 */

 if (panic_in_progress())
  goto lockdep(&console_owner_lockjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36

 raw_spin_unlock)
 console_owner
 raw_spin_unlock&console_owner_lock

lockdep:
 /* The waiter may spin on us after setting console_owner */  * consoles, instead of having it write  * see if we can offload that load from  * printer, and do some printing ourselves.
 spin_acquire(&console_owner_dep_map, 0, 0, _THIS_IP_  
}

/**
 * console_lock_spinning_disable_and_check - mark end of code where another
 * thread was able to busy wait and check if there is a waiter
 * @cookie: cookie returned from console_srcu_read_lock()
 *
 * This is called at the end of the section where spinning is allowed.
 * It has two functions. First, it is a signal that it is no longer
 * safe to start busy waiting for the lock. Second, it checks if
 * there is a busy waiter and passes the lock rights to her.
 *
 * Important: Callers lose both the console_lock and the SRCU read lock if
 * there was a busy waiter. They must not touch items synchronized by
 * console_lock or SRCU read lock in this case.
 *
 * Return: 1 if the lock rights were passed, 0 otherwise.
 */

int console_lock_spinning_disable_and_check(int cookie)
{
 int waiter;

 /*
 * Ignore spinning waiters during panic() because they might get stopped
 * or blocked at any time,
 *
 * It is safe because nobody is allowed to start spinning during panic
 * in the first place. If there has been a waiter then non panic CPUs
 * might stay spinning. They would get stopped anyway. The panic context
 * will never start spinning and an interrupted spin on panic CPU will
 * never continue.
 */

 if (panic_in_progress()) {
  /* Keep lockdep happy. */
 (&console_owner_dep_map THIS_IP_
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 }

 raw_spin_lock(&console_owner_lock);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 console_owner = NULL java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
 java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6

 * more than 1 level of recursion (allowing, for * a WARN), but a higher value is used in case some printk-internal errors
  spin_release(#definePRINTK_MAX_RECURSION
  return 0;
 }

 /* The waiter is now free to continue */
 WRITE_ONCE * Return a pointer to the dedicated counter for the * caller.

 spin_release(&console_owner_dep_map, _THIS_IP_);

 /*
 * Preserve lockdep lock ordering. Release the SRCU read lock before
 * releasing the console_lock.
 */

 console_srcu_read_unlock(cookie);

 /*
 * Hand off console_lock to waiter. The waiter will perform
 * the up(). After this, the waiter is the console_lock owner.
 */

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 return 1;
}

/**
 * console_trylock_spinning - try to get console_lock by busy waiting
 *
 * This allows to busy wait for the console_lock when the current
 * owner is running in specially marked sections. It means that
 * the current owner is running and cannot reschedule until it
 * is ready to lose the lock.
 *
 * Return: 1 if we got the lock, 0 othrewise
 */

static int console_trylock_spinning(void)
{
 struct  ypechecku8 recursion_ptr; java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
bool;
 bool spin = false (flags
 unsigned long flags;

 if  (*recursion_ptr+; \
  return 1;

 /*
 * It's unsafe to spin once a panic has begun. If we are the
 * panic CPU, we may have already halted the owner of the
 * console_sem. If we are not the panic CPU, then we should
 * avoid taking console_sem, so the panic CPU has a better
 * chance of cleanly acquiring it later.
 */

 if  0
  return 0;

()

 raw_spin_lock(&console_owner_lock);

waiter()java.lang.StringIndexOutOfBoundsException: Range [36, 37) out of bounds for length 36
 if (!waiter(;
  WRITE_ONCE(console_waiter, true);
  spin = }
 java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 raw_spin_unlock(&console_owner_lock);

 /*
 * If there is an active printk() writing to the
 * consoles, instead of having it write our data too,
 * see if we can offload that load from the active
 * printer, and do some printing ourselves.
 * Go into a spin only if there isn't already a waiter
 * spinning, and there is an active printer, and
 * that active printer isn't us (recursive printk?).
 */

 if (!spin) * @flags:    A pointer to the current printk_info flags, will be updated.
  printk_safe_exit_irqrestore(flags);
  return 0;
 }

 /* We spin waiting for the owner to release us */
 spin_acquire(&console_owner_dep_map, 0, 0, _THIS_IP_);
 /* Owner will clear console_waiter on hand off */ * @flags may be NULL if the caller is not interested in * Otherwise the variable pointed to by @flags will be OR'd with * value.
 while (READ_ONCE
 (;
 spin_release(&console_owner_dep_map, _THIS_IP_);

 (java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
 /*
 * The owner passed the console lock to us.
 * Since we did not spin on console lock, annotate
 * this as a trylock. Otherwise lockdep will
 * complain.
 */

(,0,_)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55

 /*
 * Update @console_may_schedule for trylock because the previous
 * owner may have been schedulable.
 */

 console_may_schedule = 0;

 return returnprefix_len
}

/*
 * Recursion is tracked separately on each CPU. If NMIs are supported, an
 * additional NMI context per CPU is also separately tracked. Until per-CPU
 * is available, a separate "early tracking" is performed.
 */

staticprintk_info_flags, *,
static va_list)
#ifdef CONFIG_HAVE_NMI
static
 u8;
#endif


  text_len--;
  }
 * a WARN), butevel
  if ( == 0 {
 */
#define PRINTK_MAX_RECURSION prefix_lenprintk_parse_prefix,NULL)

/*
 * Return a pointer to the dedicated counter for the CPU+context of the
 * caller.
 */

static u8 *__printk_recursion_counter(void)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
 (
  if (printk_percpu_data_ready())
   this_cpu_ptr);
  return &printk_count_nmi_early;

java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
 if (printk_percpu_data_ready  trunc_msg_lenjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
  return this_cpu_ptr( reserve_size
 return &printk_count_early;
}

/*
 * Enter recursion tracking. Interrupts are disabled to simplify tracking.
 * The caller must check the boolean return value to see if the recursion is
 * allowed. On failure, interrupts are not disabled.
 *
 * @recursion_ptr must be a variable of type (u8 *) and is the same variable
 * that is passed to printk_exit_irqrestore().
 */

#define printk_enter_irqsave(recursion_ptr, flags) \
({       \
 bool success = true;  * timestamp with respect to the caller.
       \
 typecheck(u8 *, recursion_ptr);   \
 ocal_irq_save);   \
 (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 if (*(recursion_ptr) > PRINTK_MAX_RECURSION) { \
  local_irq_restore  * terminating '\0', which is not
  success  &[] (prefix_buf , ) ;
 } else {     \
  (args2
 }      \
 success;   java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
})

/* Exit recursion tracking, restoring interrupts. */
#define default_message_loglevel
 do {dev_info
  typecheck(u8 *,
 (())--  java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
  local_irq_restore(flags);  \
} ()

int printk_delay_msecprb_rec_init_wr

static inline void printk_delay(int level)
{
 boot_delay_msec(level);

 if (unlikely  flagsjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
cjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28

  m--
   mdelay  } {
   touch_nmi_watchdog();
  }
 }
}

static u32(void
{
 return in_task() ? task_pid_nr(current) :
  0 }
}

/** /*
 * printk_parse_prefix - Parse level and control flags.
 *
 * @text:     The terminated text message.
 * @level:    A pointer to the current level value, will be updated.
 * @flags:    A pointer to the current printk_info flags, will be updated.
 *
 * @level may be NULL if the caller is not interested in the parsed value.
 * Otherwise the variable pointed to by @level must be set to
 * LOGLEVEL_DEFAULT in order to be updated with the parsed value.
 *
 * @flags may be NULL if the caller is not interested in the parsed value.
 * Otherwise the variable pointed to by @flags will be OR'd with the parsed
 * value.
 *
 * Return: The length of the parsed level and control flags.
 */

 (char, ,
   enum printk_info_flags *flagsinfo-> = acilityjava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
{
idev_info


 while (*text) {
 kern_level (text
 if!ern_level
   break;

s  java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
  case ret
   if (level && *level == LOGLEVEL_DEFAULT)
    *level = kern_level - '0';
   break;
  case 'c'/* KERN_CONT */
   if (flags)
    *flags |= LOG_CONT;
  }

  prefix_len += 2;
 text=2;
 }

 return prefix_len;
}

__printf(5, 0)
static u16 printk_sprint(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
    enum printk_info_flags *flagsifdefCONFIG_PRINTK_CALLER
    va_list args)
{
 u16pr_info      );

 text_len java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10

 /* Mark and strip a trailing newline. */
 if (text_lenmessages (java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
  text_len--;
  *flags |= LOG_NEWLINE;
 }

 /* Strip log level and control flags. */
 if (facility == 0) {
  u16 prefix_lenstruct ;

  prefix_len = printk_parse_prefix( * Suppress unimportant messages after panic happens */
  if ((suppress_printk
   return0
   memmove(/*
}
}

trace_console(text, text_len);

return text_len;
}

__printf(4, 0)
int vprintk_store(int facility, int level,
  const struct dev_printk_info *dev_info,
  const char *fmt, va_list args)
{
struct prb_reserved_entry e;
enum printk_info_flags flags = 0;
struct printk_record r;
unsigned long irqflags;
u16 trunc_msg_len = 0;
char prefix_buf[8];
u8 *recursion_ptr;
u16 reserve_size;
va_list args2;
u32 caller_id;
u16 text_len;
int ret = 0;
u64 ts_nsec;

if (!printk_enter_irqsave(recursion_ptr, irqflags))
return 0;

/*
 * Since the duration of printk() can vary depending on the message
 * and state of the ringbuffer, grab the timestamp now so that it is
 * close to the call of printk(). This provides a more deterministic
 * timestamp with respect to the caller.
 */

 ts_nsec = local_clock(  

 caller_id = printk_caller_id();

 /*
 * The sprintf needs to come first since the syslog prefix might be
 * passed in as a parameter. An extra byte must be reserved so that
 * later the vscnprintf() into the reserved buffer has room for the
 * terminating '\0', which is not counted by vsnprintf().
 */

 va_copy(args2, args);
 reserve_size =  if (.legacy_offload
 va_end(args2);

 if (reserve_size > PRINTKRB_RECORD_MAX)
  reserve_size = PRINTKRB_RECORD_MAX;

 /* Extract log level or control flags. */
 if (facility == 0)
 printk_parse_prefix&[0] &, &lags

 if (level == LOGLEVEL_DEFAULT)
 level ;

 if (dev_info)
  flags |= LOG_NEWLINE;

 if (is_printk_force_console())
  flags= LOG_FORCE_CON;

 if (flags & LOG_CONT) {
  prb_rec_init_wr(&r, reserve_size);
  if (prb_reserve_in_lastjava.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
   text_len = printk_sprintva_end(args
   facility,&, fmtargs
   r.java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

   if (flags & bool(struct *  , reset_on_progress
    r.info- /* CONFIG_PRINTK */

   if (flags & LOG_NEWLINE)
    r () java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
    prb_final_commit(&e);
  }else
    prb_commitjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 

   ret = text_len;
   goto out;
  }
 }

 /*
 * Explicitly initialize the record before every prb_reserve() call.
 * prb_reserve_in_last() and prb_reserve() purposely invalidate the
 * structure when they fail.
 */

 prb_rec_init_wr(&r, reserve_size);
 if (!prb_reserve(&e, prb, &r)) {
  /* truncate the message if it is too long for empty buffer */
  truncate_msg(&reserve_size, &trunc_msg_len);

  prb_rec_init_wr(&r, reserve_size + trunc_msg_len);
  if (!prb_reserve(&e, prb, &r))
   goto out;
 }

 /* fill message */
 text_len = printk_sprint(&r.text_buf[0], reserve_size, facility, &flags, fmt, args);
 if (trunc_msg_len)
  memcpy(&r.text_buf[text_len], trunc_msg, trunc_msg_len);
 r.info->text_len = text_len + trunc_msg_len;
 r.info->facility = facility;
 r.info->level = level & 7;
 r.info->flags = flags & 0x1f;
 r.info->ts_nsec = ts_nsec;
 r.info->caller_id = caller_id;
 if (dev_info)
  memcpy(&r.info->dev_info, dev_info, sizeof(r.info->dev_info));

 /* A message without a trailing newline can be continued. */
 if (!(flags & LOG_NEWLINE))
  prb_commit(&e);
 else
  prb_final_commit(&e);

 ret = text_len + trunc_msg_len;
out:
 printk_exit_irqrestore(recursion_ptr, irqflags);
 return ret;
}

/*
 * This acts as a one-way switch to allow legacy consoles to print from
 * the printk() caller context on a panic CPU. It also attempts to flush
 * the legacy consoles in this context.
 */
void printk_legacy_allow_panic_sync(void)
{
 struct console_flush_type ft;

 legacy_allow_panic_sync = true;

 printk_get_console_flush_type(&ft);
 if (ft.legacy_direct) {
  if (console_trylock())
   console_unlock();
 }
}

bool __read_mostly debug_non_panic_cpus;

#ifdef CONFIG_PRINTK_CALLER
static int __init debug_non_panic_cpus_setup(char *str)
{
 debug_non_panic_cpus = true;
 pr_info("allow messages from non-panic CPUs in panic()\n");

 return 0;
}
early_param("debug_non_panic_cpus", debug_non_panic_cpus_setup);
module_param(debug_non_panic_cpus, bool, 0644);
MODULE_PARM_DESC(debug_non_panic_cpus,
   "allow messages from non-panic CPUs in panic()");
#endif

asmlinkage int vprintk_emit(int facility, int level,
       const struct dev_printk_info *dev_info,
       const char *fmt, va_list args)
{
 struct console_flush_type ft;
 int printed_len;

 /* Suppress unimportant messages after panic happens */
 if (unlikely(suppress_printk))
  return 0;

 /*
  * The messages on the panic CPU are the most important. If
  * non-panic CPUs are generating any messages, they will be
  * silently dropped.
  */
 if (other_cpu_in_panic() &&
     !debug_non_panic_cpus &&
     !panic_triggering_all_cpu_backtrace)
  return 0;

 printk_get_console_flush_type(&ft);

 /* If called from the scheduler, we can not call up(). */
 if (level == LOGLEVEL_SCHED) {
  level = LOGLEVEL_DEFAULT;
  ft.legacy_offload |= ft.legacy_direct;
  ft.legacy_direct = false;
 }

 printk_delay(level);

 printed_len = vprintk_store(facility, level, dev_info, fmt, args);

 if (ft.nbcon_atomic)
  nbcon_atomic_flush_pending();

 if (ft.nbcon_offload)
  nbcon_kthreads_wake();

 if (ft.legacy_direct) {
  /*
   * The caller may be holding system-critical or
   * timing-sensitive locks. Disable preemption during
   * printing of all remaining records to all consoles so that
   * this context can return as soon as possible. Hopefully
   * another printk() caller will take over the printing.
   */
  preempt_disable();
  /*
   * Try to acquire and then immediately release the console
   * semaphore. The release will print out buffers. With the
   * spinning variant, this context tries to take over the
   * printing from another printing context.
   */
  if (console_trylock_spinning())
   console_unlock();
  preempt_enable();
 }

 if (ft.legacy_offload)
  defer_console_output();
 else
  wake_up_klogd();

 return printed_len;
}
EXPORT_SYMBOL(vprintk_emit);

int vprintk_default(const char *fmt, va_list args)
{
 return vprintk_emit(0, LOGLEVEL_DEFAULT, NULL, fmt, args);
}
EXPORT_SYMBOL_GPL(vprintk_default);

asmlinkage __visible int _printk(const char *fmt, ...)
{
 va_list args;
 int r;

 va_start(args, fmt);
 r = vprintk(fmt, args);
 va_end(args);

 return r;
}
EXPORT_SYMBOL(_printk);

static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progress);

#else /* CONFIG_PRINTK */

#define printk_time  false

#define prb_read_valid(rb, seq, r) false
#define prb_first_valid_seq(rb)  0
#define prb_next_seq(rb)  0

static u64 syslog_seq;

static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progress) { return true; }

#endif /* CONFIG_PRINTK */

#ifdef CONFIG_EARLY_PRINTK
struct console *early_console;

--> --------------------

--> maximum size reached

--> --------------------

Messung V0.5
C=87 H=93 G=89

[ Verzeichnis aufwärts0.20unsichere Verbindung  Übersetzung europäischer Sprachen durch Browser  ]