Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 673004 - app-admin/rsyslog: omusrmsg module fails to log to user's tty
Summary: app-admin/rsyslog: omusrmsg module fails to log to user's tty
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Thomas Deutschmann (RETIRED)
URL: https://github.com/rsyslog/rsyslog/is...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-12 14:18 UTC by Gil Kloepfer
Modified: 2018-12-13 13:19 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gil Kloepfer 2018-12-12 14:18:22 UTC
As of rsyslog 8.38.0-r1, rsyslog fails to log to designated users' ttys using builtin omusrmsg module.

Examined differences in code between 8.35.0-r1 (working) and 8.38.0-r1 (not working) and discovered that a strncat() was replaced with a memcpy() function when placing the tty name from the user's utmp (ut_line) entry into a buffer, causing the ttyname to now be missing the _PATH_DEV (/dev/) prefix.

The difference in question is the following:

@@ -254,7 +261,7 @@
 
                /* compute the device name */
                strcpy(p, _PATH_DEV);
-               strncat(p, ut.ut_line, UNAMESZ);
+               memcpy(p, ut.ut_line, UNAMESZ);

memcpy() is not a suitable substitute for strncat() in this context.

Reverting back to 8.35.0-r1 consistently fixes the issue.  Note that this bug also exists in rsyslog 8.39.0 as well.

This almost certainly needs to be forwarded to upstream.

The rsyslog configuration where I am using this is the following:

if (($programname == "alarmd" or $programname == "mqtt-alarmd") and $syslogfacil
ity-text == "auth" and
                $syslogpriority-text == "crit") then {
        action(
                type="omusrmsg"
                users="root,gil"
                template="AlarmdTimestampUserMsgs"
        )
}
Comment 1 Gil Kloepfer 2018-12-12 14:19:15 UTC
The following is my emerge --info:

$ emerge --info
Portage 2.3.51 (python 3.6.5-final-0, default/linux/amd64/17.0, gcc-7.3.0, glibc-2.27-r6, 4.9.122-gentoo x86_64)
=================================================================
System uname: Linux-4.9.122-gentoo-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q9550_@_2.83GHz-with-gentoo-2.6
KiB Mem:     4047428 total,   2528884 free
KiB Swap:    8000364 total,   7822804 free
Timestamp of repository gentoo: Thu, 15 Nov 2018 15:45:01 +0000
Head commit of repository gentoo: 204c925dd4c65fb1c3485df1269cbfb78d7639f2
Timestamp of repository kloepfer: Sun, 25 Nov 2018 04:21:51 +0000
sh bash 4.4_p12
ld GNU ld (Gentoo 2.30 p5) 2.30.0
distcc 3.2rc1 x86_64-pc-linux-gnu [disabled]
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.24.3-r1::gentoo
dev-lang/python:          2.7.15::gentoo, 3.6.5::gentoo
dev-util/cmake:           3.9.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.38.3::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.15.1-r2::gentoo
sys-devel/binutils:       2.30-r4::gentoo
sys-devel/gcc:            7.3.0-r3::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers)
sys-libs/glibc:           2.27-r6::gentoo
Repositories:

gentoo
    location: /cspace/sysbuild/portage
    sync-type: rsync
    sync-uri: rsync://rsync.namerica.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24
    sync-rsync-extra-opts: 

crossdev
    location: /cspace/sysbuild/crossdev-overlay
    masters: gentoo
    priority: 0

kloepfer
    location: /cspace/sysbuild/kloepfer-overlay
    masters: gentoo

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=core2 -pipe -fomit-frame-pointer -fno-ident"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/easy-rsa /usr/share/gnupg/qualified.txt /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/init.d/ /etc/php/apache2-php7.2/ext-active/ /etc/php/cgi-php7.2/ext-active/ /etc/php/cli-php7.2/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=core2 -pipe -fomit-frame-pointer -fno-ident"
DISTDIR="/sysbuild/distfiles"
EMERGE_DEFAULT_OPTS="--jobs=4 --load-average=3"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="/usr/lib/systemd /etc/systemd /lib/systemd"
LANG="C"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en_US"
MAKEOPTS="-j5"
PKGDIR="/sysbuild/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X acl amd64 berkdb bzip2 cli crypt cxx dri gdbm iconv ipv6 libtirpc mmx mmxext multilib ncurses nls nptl openmp pam pcre readline seccomp sse sse2 ssl tcpd unicode xattr zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="access_compat authn_core authz_core authz_host mime unixd socache_shmcb proxy proxy_ajp proxy_connect proxy_ftp proxy_http" CALLIGRA_FEATURES="karbon plan sheets stage words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 sse4_1 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LIRC_DEVICES="udp" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" QEMU_SOFTMMU_TARGETS="arm" QEMU_USER_TARGETS="arm" RUBY_TARGETS="ruby23" SANE_BACKENDS="genesys net" USERLAND="GNU" VIDEO_CARDS="nv nvidia vesa vga fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 2 Gil Kloepfer 2018-12-12 14:22:29 UTC
I failed to indicate which file was being referenced with my diff above...it is tools/omusrmsg.c - apologies for not including this in my original report.
Comment 3 Thomas Deutschmann (RETIRED) gentoo-dev 2018-12-12 19:24:29 UTC
Thank you for the report.
Comment 4 Larry the Git Cow gentoo-dev 2018-12-13 13:19:51 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cee2b656924f8f4b581ebfdfc2b4d2626c9be3ba

commit cee2b656924f8f4b581ebfdfc2b4d2626c9be3ba
Author:     Thomas Deutschmann <whissi@gentoo.org>
AuthorDate: 2018-12-13 13:19:27 +0000
Commit:     Thomas Deutschmann <whissi@gentoo.org>
CommitDate: 2018-12-13 13:19:42 +0000

    app-admin/rsyslog: fix omusrmsg
    
    Closes: https://bugs.gentoo.org/673004
    Package-Manager: Portage-2.3.52, Repoman-2.3.12
    Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>

 app-admin/rsyslog/files/rsyslog-8.40.0-fix-omusrmsg.patch   | 13 +++++++++++++
 .../{rsyslog-8.38.0-r1.ebuild => rsyslog-8.38.0-r2.ebuild}  |  5 ++++-
 .../{rsyslog-8.39.0.ebuild => rsyslog-8.39.0-r1.ebuild}     |  5 ++++-
 .../{rsyslog-8.40.0.ebuild => rsyslog-8.40.0-r1.ebuild}     |  2 ++
 4 files changed, 23 insertions(+), 2 deletions(-)