LOG_KERN treated as LOG_USER?

From: Eric Tucker <et_at_tallmaple.com>
Date: Mon, 27 Nov 2006 19:04:46 -0800

Hi,

I think I have noticed a bug where messages intended for the
LOG_KERN facility go to LOG_USER instead. If true, this would
probably be a glibc bug, but I thought I'd ask here too to see
if anyone else agrees with it. The bug seems so basic that I
can't believe no one else has noticed it, leading me to think
that I have missed something.

It's easy to reproduce (at least for me): just put a line in
syslog.conf like:

kern.* /var/log/kern.log

(like in so many example files), and then try logging to the
kernel facility like:

logger -p kern.crit hi

The messages don't show up there, but they do show up in
/var/log/messages, assuming you have a *.(something) line pointing
there. Messages from the kernel itself don't either, unsurprising
since klogd just seems to call openlog("kernel", 0, LOG_KERN) like
anyone else would.

I think I see why, from looking at the code for openlog() in glibc,
where it treats a facility of 0 as not specified, and uses its
default of LOG_USER instead. But LOG_KERN *is* 0, hence the bug.

All I can think is that they wanted to prevent userland processes
from spoofing messages from the kernel, but in that case klogd
would have to have some different method of logging (or at least
use a different facility level in cahoots with syslogd). Are there
other versions of klogd that do this, or do they all work with the
standard syslog API?

Is this a real bug, or what am I missing here?

thanks,
Eric Tucker
et_at_tallmaple.com
Received on Tue Nov 28 2006 - 04:04:46 CET

This archive was generated by hypermail 2.2.0 : Tue Nov 28 2006 - 04:04:50 CET