summaryrefslogtreecommitdiffstats
path: root/security/apparmor/ipc.c
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2018-02-01 12:32:02 +0100
committerJohn Johansen <john.johansen@canonical.com>2018-02-09 20:30:01 +0100
commit3acfd5f54ca16c15c36ac2f218357f2707b7edb8 (patch)
treed64067798fbe0d4ff3fa839e48ce6fae3bfe84c3 /security/apparmor/ipc.c
parentapparmor: make signal label match work when matching stacked labels (diff)
downloadlinux-3acfd5f54ca16c15c36ac2f218357f2707b7edb8.tar.xz
linux-3acfd5f54ca16c15c36ac2f218357f2707b7edb8.zip
apparmor: audit unknown signal numbers
Allow apparmor to audit the number of a signal that it does not provide a mapping for and is currently being reported only as unknown. Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor/ipc.c')
-rw-r--r--security/apparmor/ipc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/security/apparmor/ipc.c b/security/apparmor/ipc.c
index 754f2ff8d355..d7b137d4eb74 100644
--- a/security/apparmor/ipc.c
+++ b/security/apparmor/ipc.c
@@ -138,7 +138,7 @@ static inline int map_signal_num(int sig)
if (sig > SIGRTMAX)
return SIGUNKNOWN;
else if (sig >= SIGRTMIN)
- return sig - SIGRTMIN + 128; /* rt sigs mapped to 128 */
+ return sig - SIGRTMIN + SIGRT_BASE;
else if (sig < MAXMAPPED_SIG)
return sig_map[sig];
return SIGUNKNOWN;
@@ -174,11 +174,14 @@ static void audit_signal_cb(struct audit_buffer *ab, void *va)
audit_signal_mask(ab, aad(sa)->denied);
}
}
- if (aad(sa)->signal < MAXMAPPED_SIGNAME)
+ if (aad(sa)->signal == SIGUNKNOWN)
+ audit_log_format(ab, "signal=unknown(%d)",
+ aad(sa)->unmappedsig);
+ else if (aad(sa)->signal < MAXMAPPED_SIGNAME)
audit_log_format(ab, " signal=%s", sig_names[aad(sa)->signal]);
else
audit_log_format(ab, " signal=rtmin+%d",
- aad(sa)->signal - 128);
+ aad(sa)->signal - SIGRT_BASE);
audit_log_format(ab, " peer=");
aa_label_xaudit(ab, labels_ns(aad(sa)->label), aad(sa)->peer,
FLAGS_NONE, GFP_ATOMIC);
@@ -211,6 +214,7 @@ int aa_may_signal(struct aa_label *sender, struct aa_label *target, int sig)
DEFINE_AUDIT_DATA(sa, LSM_AUDIT_DATA_NONE, OP_SIGNAL);
aad(&sa)->signal = map_signal_num(sig);
+ aad(&sa)->unmappedsig = sig;
return xcheck_labels(sender, target, profile,
profile_signal_perm(profile, target, MAY_WRITE, &sa),
profile_signal_perm(profile, sender, MAY_READ, &sa));