linux/Documentation
Borislav Petkov 750afe7bab printk: add kernel parameter to control writes to /dev/kmsg
Add a "printk.devkmsg" kernel command line parameter which controls how
userspace writes into /dev/kmsg.  It has three options:

 * ratelimit - ratelimit logging from userspace.
 * on  - unlimited logging from userspace
 * off - logging from userspace gets ignored

The default setting is to ratelimit the messages written to it.

This changes the kernel default setting of "on" to "ratelimit" and we do
that because we want to keep userspace spamming /dev/kmsg to sane
levels.  This is especially moot when a small kernel log buffer wraps
around and messages get lost.  So the ratelimiting setting should be a
sane setting where kernel messages should have a bit higher chance of
survival from all the spamming.

It additionally does not limit logging to /dev/kmsg while the system is
booting if we haven't disabled it on the command line.

Furthermore, we can control the logging from a lower priority sysctl
interface - kernel.printk_devkmsg.

That interface will succeed only if printk.devkmsg *hasn't* been
supplied on the command line.  If it has, then printk.devkmsg is a
one-time setting which remains for the duration of the system lifetime.
This "locking" of the setting is to prevent userspace from changing the
logging on us through sysctl(2).

This patch is based on previous patches from Linus and Steven.

[bp@suse.de: fixes]
  Link: http://lkml.kernel.org/r/20160719072344.GC25563@nazgul.tnic
Link: http://lkml.kernel.org/r/20160716061745.15795-3-bp@alien8.de
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Dave Young <dyoung@redhat.com>
Cc: Franck Bui <fbui@suse.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-08-02 19:35:06 -04:00
..
ABI Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2016-07-27 12:03:20 -07:00
DocBook Merge tag 'drm-for-v4.8' of git://people.freedesktop.org/~airlied/linux 2016-08-01 21:44:08 -04:00
EDID
PCI
RCU Documentation: Fix spelling mistake 2016-06-14 16:01:00 -07:00
accounting
acpi Merge branches 'acpi-bus', 'acpi-pci', 'acpica' and 'acpi-doc' 2016-07-25 13:41:25 +02:00
aoe
arm ARM: at91: Documentation: update the sama5d2 entry 2016-06-21 17:09:34 +02:00
arm64 ARM64: ACPI: Update documentation for latest specification version 2016-06-21 16:26:09 +01:00
auxdisplay
backlight
blackfin
block Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-07-28 12:59:05 -07:00
blockdev zram: cosmetic: cleanup documentation 2016-07-26 16:19:19 -07:00
bus-devices
cdrom
cgroup-v1 mm, vmscan: move lru_lock to the node 2016-07-28 16:07:41 -07:00
cma
connector
console
cpu-freq Revert "cpufreq: pcc-cpufreq: update default value of cpuinfo_transition_latency" 2016-07-22 23:51:06 +02:00
cpuidle
cris
crypto crypto: doc - Fix typo 2016-05-31 16:41:55 +08:00
development-process docs: deprecate kernel-doc-nano-HOWTO.txt 2016-07-20 16:45:37 -06:00
device-mapper dm raid: update Documentation about reshaping/takeover/additonal RAID types 2016-06-14 18:52:12 -04:00
devicetree Merge tag 'drm-for-v4.8' of git://people.freedesktop.org/~airlied/linux 2016-08-01 21:44:08 -04:00
dmaengine Documentation: dmaengine: fix typo for device_resume 2016-06-03 14:00:21 -06:00
driver-model ARM: SoC driver updates for v4.8 2016-08-01 18:36:01 -04:00
early-userspace
extcon
fault-injection
fb Documentation: fb: fix spelling mistakes 2016-05-10 12:05:27 +03:00
features powerpc: Add HAVE_PERF_USER_STACK_DUMP support 2016-05-11 21:54:05 +10:00
filesystems libnvdimm for 4.8 2016-07-28 17:38:16 -07:00
firmware_class
fmc
fpga
frv
gpio gpio: Fix paths to GPIO driver source files 2016-06-13 09:30:31 +02:00
gpu drm/doc: Spinx leftovers 2016-07-19 14:12:00 +02:00
hid HID: add Alps I2C HID Touchpad-Stick support 2016-06-17 23:12:04 +02:00
hwmon hwmon: Add driver for FTS BMC chip "Teutates" 2016-07-20 06:29:54 -07:00
i2c Documentation: i2c: slave: give proper example for pm usage 2016-07-23 22:04:20 +02:00
ia64
ide
iio
infiniband Round two of 4.7 merge window patches 2016-05-28 11:04:16 -07:00
input
ioctl Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2016-07-29 17:38:46 -07:00
isdn
ja_JP
kbuild kbuild, x86: Track generated headers with generated-y 2016-07-07 15:58:44 +02:00
kdump kdump: fix dmesg gdbmacro to work with record based printk 2016-06-03 15:06:22 -07:00
ko_KR
laptops leds: documentation: 'ide-disk' to 'disk-activity' 2016-06-27 08:58:35 +02:00
leds leds: documentation: 'ide-disk' to 'disk-activity' 2016-06-27 08:58:35 +02:00
livepatch Merge branches 'for-4.7/core', 'for-4.7/livepatching-doc' and 'for-4.7/livepatching-ppc64' into for-linus 2016-05-17 12:06:35 +02:00
locking
m68k
media [media] cx23885-cardlist.rst: add a new card 2016-07-23 08:14:48 -03:00
memory-devices
metag
mic mpssd: fix buffer overflow warning 2016-06-03 13:31:37 -06:00
mips
misc-devices
mmc mmc: core: Extend sysfs with DSR register 2016-07-25 10:34:51 +02:00
mn10300
mtd
namespaces
netlabel
networking Documentation: RDS: Document Multipath RDS (mprds) 2016-07-15 11:36:58 -07:00
nfc
nios2
nvdimm libnvdimm, btt: update the usage section in Documentation 2016-06-17 16:23:23 -07:00
nvmem
parisc
pcmcia
phy
platform
power
powerpc
pps
prctl
pti
ptp
rapidio
s390 s390/Documentation: improve sort command for trace buffer 2016-06-13 15:58:23 +02:00
scheduler
scsi Merge remote-tracking branch 'mkp-scsi/4.7/scsi-fixes' into fixes 2016-06-18 11:59:01 -07:00
security Some big changes this month, headlined by the addition of a new formatted 2016-07-26 13:05:11 -07:00
serial TTY and Serial driver update for 4.7-rc1 2016-05-20 20:57:27 -07:00
sh
sound ASoC: Updates for v4.8 2016-07-26 10:35:31 +02:00
sphinx Merge branch 'docs-next' of git://git.lwn.net/linux into topic/docs-next 2016-07-23 07:55:59 -03:00
sphinx-static [media] doc-rst: backward compatibility with older Sphinx versions 2016-07-19 12:35:08 -03:00
spi
sysctl printk: add kernel parameter to control writes to /dev/kmsg 2016-08-02 19:35:06 -04:00
target target: make close_session optional 2016-05-10 01:19:26 -07:00
thermal Doc: PM: Fix a typo in intel_powerclamp.txt 2016-06-30 13:05:40 -06:00
timers
tpm tpm: Add documentation for the tpm_vtpm_proxy device driver 2016-06-25 17:26:35 +03:00
trace tracing: expose current->comm to [ku]probe events 2016-06-20 09:54:19 -04:00
usb Documentation: tiny typo fix in usb/gadget_multi.txt 2016-06-23 08:09:10 -06:00
vDSO
virtual kvm: introduce KVM_MAX_VCPU_ID 2016-05-11 22:37:54 +02:00
vm mm: fix build warnings in <linux/compaction.h> 2016-07-26 16:19:19 -07:00
w1
watchdog Documentation/watchdog: check return value for magic close 2016-07-25 11:02:17 +02:00
wimax
x86 Merge branch 'linus' into x86/microcode, to pick up merge window changes 2016-07-27 12:35:35 +02:00
xtensa
zh_CN docs: deprecate kernel-doc-nano-HOWTO.txt 2016-07-20 16:45:37 -06:00
.gitignore Add .pyc files to .gitignore 2016-06-30 13:07:33 -06:00
00-INDEX docs: deprecate kernel-doc-nano-HOWTO.txt 2016-07-20 16:45:37 -06:00
BUG-HUNTING
Changes
CodeOfConflict
CodingStyle docs: deprecate kernel-doc-nano-HOWTO.txt 2016-07-20 16:45:37 -06:00
DMA-API-HOWTO.txt
DMA-API.txt
DMA-ISA-LPC.txt
DMA-attributes.txt
HOWTO
IPMI.txt
IRQ-affinity.txt
IRQ-domain.txt
IRQ.txt
Intel-IOMMU.txt
Makefile [media] samples: v4l: from Documentation to samples directory 2016-05-09 18:34:37 -03:00
Makefile.sphinx Merge branch 'docs-next' of git://git.lwn.net/linux into devel/docs-next 2016-07-15 07:33:47 -03:00
ManagementStyle
SAK.txt
SM501.txt
SecurityBugs
SubmitChecklist
SubmittingDrivers
SubmittingPatches
VGA-softcursor.txt
adding-syscalls.txt
applying-patches.txt
assoc_array.txt
atomic_ops.txt
bad_memory.txt
basic_profiling.txt
bcache.txt bcache: documentation formatting, edited for clarity, stripe alignment notes 2016-06-23 07:58:38 -06:00
binfmt_misc.txt
braille-console.txt
bt8xxgpio.txt
btmrvl.txt
bus-virt-phys-mapping.txt
cachetlb.txt
cec.txt [media] cec.txt: add CEC framework documentation 2016-06-22 08:36:50 -03:00
cgroup-v2.txt
circular-buffers.txt
clk.txt
coccinelle.txt
conf.py Revert "doc/sphinx: Enable keep_warnings" 2016-07-20 16:56:21 -06:00
cpu-hotplug.txt
cpu-load.txt
cputopology.txt topology/sysfs: provide drawer id and siblings attributes 2016-06-13 15:58:27 +02:00
crc32.txt
dcdbas.txt
debugging-modules.txt
debugging-via-ohci1394.txt
dell_rbu.txt
devices.txt
digsig.txt
dma-buf-sharing.txt
dontdiff
dynamic-debug-howto.txt
edac.txt
efi-stub.txt
eisa.txt
email-clients.txt
flexible-arrays.txt
futex-requeue-pi.txt
gcov.txt
gdb-kernel-debugging.txt Revert "scripts/gdb: add documentation example for radix tree" 2016-07-15 14:54:27 +09:00
highuid.txt
hsi.txt
hw_random.txt
hwspinlock.txt
index.rst Merge tag 'drm-for-v4.8' of git://people.freedesktop.org/~airlied/linux 2016-08-01 21:44:08 -04:00
init.txt
initrd.txt
intel_txt.txt
io-mapping.txt
io_ordering.txt
iostats.txt
irqflags-tracing.txt
isa.txt
isapnp.txt
java.txt
kasan.txt
kcov.txt
kernel-doc-nano-HOWTO.txt docs: deprecate kernel-doc-nano-HOWTO.txt 2016-07-20 16:45:37 -06:00
kernel-docs.txt
kernel-documentation.rst docs: Get rid of some kernel-documentation warnings 2016-07-17 19:24:02 -06:00
kernel-parameters.txt printk: add kernel parameter to control writes to /dev/kmsg 2016-08-02 19:35:06 -04:00
kernel-per-CPU-kthreads.txt
kmemcheck.txt
kmemleak.txt
kobject.txt
kprobes.txt
kref.txt
kselftest.txt
ldm.txt
local_ops.txt
lockup-watchdogs.txt
logo.gif
logo.txt
lzo.txt
magic-number.txt
mailbox.txt
md-cluster.txt md-cluster: change array_sectors and update size are not supported 2016-05-04 12:39:35 -07:00
md.txt Documentation: fix wrong value in md.txt 2016-06-23 08:08:36 -06:00
memory-barriers.txt locking/Documentation: Clarify limited control-dependency scope 2016-06-17 09:54:45 +02:00
memory-hotplug.txt memory_hotplug: introduce CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE 2016-05-19 19:12:14 -07:00
men-chameleon-bus.txt
module-signing.txt
mono.txt
nommu-mmap.txt
ntb.txt
numastat.txt
oops-tracing.txt
padata.txt
parport-lowlevel.txt
parport.txt
percpu-rw-semaphore.txt
phy.txt
pi-futex.txt
pinctrl.txt pinctrl: Flag strict is a field in struct pinmux_ops 2016-06-23 10:50:10 +02:00
pnp.txt
preempt-locking.txt
printk-formats.txt
pwm.txt pwm: Update documentation 2016-05-17 14:48:04 +02:00
ramoops.txt pstore/ram: add Device Tree bindings 2016-06-14 11:34:39 -07:00
rbtree.txt
remoteproc.txt
rfkill.txt
robust-futex-ABI.txt
robust-futexes.txt
rpmsg.txt rpmsg: use module_rpmsg_driver in existing drivers and examples 2016-05-06 11:09:01 -07:00
rtc.txt
serial-console.txt
sgi-ioc4.txt
smsc_ece1099.txt
sparse.txt
stable_api_nonsense.txt
stable_kernel_rules.txt
static-keys.txt
svga.txt
sync_file.txt Documentation: Fix some grammar mistakes in sync_file.txt 2016-06-03 13:24:16 -06:00
sysfs-rules.txt
sysrq.txt
this_cpu_ops.txt
ubsan.txt
unaligned-memory-access.txt
unicode.txt
unshare.txt
vfio.txt
vgaarbiter.txt
video-output.txt
vme_api.txt
volatile-considered-harmful.txt
workqueue.txt workqueue: Fix a typo in workqueue.txt 2016-07-06 02:37:38 -06:00
xillybus.txt
xz.txt
zorro.txt