Re: Error running socklog Klog service

Thomas Schwinge <[email protected]>
Newsgroups gmane.comp.misc.pape.general
Message-ID <[email protected]>
On Sun, Apr 04, 2004 at 12:19:07PM +0200, [email protected] wrote:
> Hello Everyone,
> 
> I cannot get socklogs klog service to work (socklog unix runs fine):
> 
> # cd /etc/minit/service/
> # klog/run
> socklog: fatal: read(): permission denied
> 
> # uname -sr
> Linux 2.6.4-gentoo-r1

Quoting Gerrit Pape:
#v+
It's the proc filesystem implementation in linux 2.6.x.

> I got an offline response from the [email protected] list that said
> removing "setuidgid log" from my run script would make the error go
> away, is that the _only_ fix?

Yes, running the socklog program as root to process kernel message under
linux 2.6.x kernels is the only workaround I'm currently aware of.

The socklog-klog run script first opens a file descriptor as root, then
drops permissions to an unprivileged user, and starts reading kernel
messages from the filedescriptor.  This technique works fine with normal
filesystems.

Unfortunately the implementation of the proc filesystem in the 2.6.x
linux kernels makes open() a noop, and checks permissions in read().  So
the newer linux kernels force the application reading from /proc/kmsg to
run under root privileges.

See linux-2.6.1/fs/proc/kmsg.c and linux-2.6.1/kernel/printk.c, function
do_syslog().
#v-

Regards,
 Thomas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.