Почему dmesg будет получать сообщения из пространства пользователя?

1499
dspjm

Вы можете использовать dmesg -u, чтобы увидеть журнал из пространства пользователя. В моем случае у меня есть лог от systemd и lvm. Почему это происходит, почему пользовательская программа может печатать в буферное кольцо ядра?

3

2 ответа на вопрос

2
David Schwartz

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
MariusMatutiae

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.

Похожие вопросы