On Thursday 17 March 2011 00:12, Bernhard Reutner-Fischer wrote: > On Wed, Mar 16, 2011 at 05:25:49PM +0300, Sergey Naumov wrote: > >Hello. > > > >I have noticed that in uclibc-0.9.31 facility of kernel messages are > >"user" in busybox syslogd applet. > >There was a fix (maybe from Denys Vlasenko - busybox maintaier) to > >openlog() function for 0.9.31 and now KERN facility (=0) is > >interpreted correctly in this function. However vsyslog() function > >also interprets =0 value as "not set" and sets LOG_USER facility > >instead of LOG_KERN. After applying attached patch I see appropriate > >facility for kernel messages in /var/log/messages. > > > >As far as I know this issue is not fixed in uclibc-0.9.32-rc2. > > According to the manpage userspace should not be able to generate > kern logfac.
I believe it's a glibc invention. (And pointless invention at that, because malicious userspace can easily work around by connecting to /dev/log directly, and writing "<0>LOG_KERN+LOG_EMERG message"). The standard says this: http://pubs.opengroup.org/onlinepubs/9699919799/functions/syslog.html ======================================================== ... The syslog() function shall send a message to an implementation-defined logging facility... Values of the priority argument are formed by OR'ing together a severity-level value and an optional facility value. If no facility value is specified, the current default facility value is used. Possible values of severity level include: ... The facility indicates the application or system component generating the message. Possible facility values include: LOG_USER Messages generated by arbitrary processes. This is the default facility identifier if none is specified. *** Note that it says that LOG_USER is the default for _syslog()_, *** *** because this whole section is about syslog(), not openlog(). *** LOG_LOCAL0 ... ... The openlog() function shall set process attributes that affect subsequent calls to syslog()... *** openlog() description started. This means that text above it *** *** (including the "LOG_USER is the default", doesn't belong *** *** to openlog(), but to syslog(). ... =========================================================== There are other considerations for making openlog(LOG_KERN) use LOG_KERN, not LOG_USER. For example, how would you implement klogd without that? It _does_ need to create LOG_KERN messages! -- vda _______________________________________________ uClibc mailing list [email protected] http://lists.busybox.net/mailman/listinfo/uclibc
