3

you can use dmesg -u to see log from userspace. In my case, I have log from systemd and lvm. Why is this happening, why userspace program can print to kernel buffer ring?

dspjm
  • 468

2 Answers2

2

A root process can write to /dev/kmsg. This is used for logging that occurs very early, before regular logging systems are ready to do any logging.

0

Some userspace processes can write to the dmesg because they execute actions which used to belong to kernel-space processes, but which have been moved to user-space to allow easier control by users.

A classic example is udev, which, according to Wikipedia:

it handles ... all user space actions when adding/removing devices, including firmware load.

Another well-know example is FUSE, which is:

Filesystem in Userspace (FUSE) is an operating system mechanism for Unix-like computer operating systems that lets non-privileged users create their own file systems without editing kernel code.

Together with LVM, init, and so on, these tools perform kernel operations in user space; for this reason, and possibly also for continuity with the instruments they replaced (devfs, hotplug, ...), their output clearly belongs in the kernel ring buffer.

MariusMatutiae
  • 48,517
  • 12
  • 86
  • 136