apparmor/libraries/libapparmor/src
Patrick Steinhardt 778176b9d8
libapparmor: do not honor $LIBAPPARMOR_DEBUG when secure_getenv is undefined
The `secure_getenv` function is a non-POSIX compliant extension of
glibc. In contrast to the POSIX `getenv`, `secure_getenv` will return
`NULL` for all environment variables when the program is run with
escalated privileges due to an SUID or SGID bit. Some strictly
POSIX-compliant libc libraries, most notably musl libc, do not have this
function and do not wish to implement it. Thus, AppArmor cannot be
compiled on such systems.

In libapparmor, `secure_getenv` is only used to determine whether the
environment variable DEBUG_ENV_VAR has been set to enable debugging. In
case an unprivileged user runs a SUID/SGID executable linked against
libapparmor, we do not want that user to be able to get additional
information via debug output.

The fix here is to produce an error only in case where debug output is
enabled by defining ENABLE_DEBUG_OUTPUT. Otherwise, we simply define
`secure_getenv` to `NULL` to completely disable the debug output.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
2018-05-09 13:15:42 -07:00
..
features.c libapparmor: convert multicache from using djb2 hashing to murmur3 hash 2018-04-14 15:51:23 -07:00
grammar.y libapparmor: Fix -Wunused-but-set-variable GCC warning 2016-02-01 09:40:25 -06:00
kernel.c libapparmor: Implement aa_stack_profile and aa_stack_onexec 2016-03-18 17:28:50 -05:00
kernel_interface.c libapparmor: Preserve errno across aa_*_unref() functions 2017-11-03 15:34:26 +00:00
libaalogparse.c libaalogparse: support missing mount keywords 2014-09-04 10:10:56 -07:00
libapparmor.map libapparmor: make aa_policy_cache_add_ro_dir function visible 2018-05-09 13:14:21 -07:00
libapparmor.pc.in Given that we want to do more apparmor things in user space (dbus 2012-11-14 11:00:06 -08:00
Makefile.am libapparmor: do not purge PMurHash.h on maintainerclean 2018-05-03 14:09:17 -07:00
parser.h libraries/libapparmor/: more license cleanups, adjust my email address 2011-02-23 14:02:45 -08:00
PMurHash.c libapparmor: convert multicache from using djb2 hashing to murmur3 hash 2018-04-14 15:51:23 -07:00
PMurHash.h libapparmor: convert multicache from using djb2 hashing to murmur3 hash 2018-04-14 15:51:23 -07:00
policy_cache.c libapparmor: fix failure to create missing cache dir 2018-04-25 20:09:05 -07:00
private.c libapparmor: do not honor $LIBAPPARMOR_DEBUG when secure_getenv is undefined 2018-05-09 13:15:42 -07:00
private.h libapparmor: handle feature hash collision by falling back to next dir 2018-04-14 15:51:23 -07:00
scanner.l accept hostname with dots 2016-05-05 11:57:57 +02:00
tst_aalogmisc.c libapparmor: fix memory leaks in aalogmisc unit tests. 2015-08-27 13:47:52 -07:00
tst_features.c libapparmor: Move the aa_features API 2015-03-25 17:09:27 -05:00
tst_kernel.c libapparmor: Strip a trailing newline character in aa_splitcon(3) 2015-05-19 21:31:53 -05:00