diff options
author | John Johansen <john.johansen@canonical.com> | 2017-11-08 11:09:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-11-08 13:56:22 -0500 |
commit | f7dc4c9a855a13dbb33294c9fc94f17af03f6291 (patch) | |
tree | 9ce322841e592dae220139d91d5e48e555987a70 | |
parent | fbc3edf7d7731d7a22c483c679700589bab936a3 (diff) |
apparmor: fix off-by-one comparison on MAXMAPPED_SIG
This came in yesterday, and I have verified our regression tests
were missing this and it can cause an oops. Please apply.
There is a an off-by-one comparision on sig against MAXMAPPED_SIG
that can lead to a read outside the sig_map array if sig
is MAXMAPPED_SIG. Fix this.
Verified that the check is an out of bounds case that can cause an oops.
Revised: add comparison fix to second case
Fixes: cd1dbf76b23d ("apparmor: add the ability to mediate signals")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | security/apparmor/ipc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/security/apparmor/ipc.c b/security/apparmor/ipc.c index 66fb9ede9447..7ca0032e7ba9 100644 --- a/security/apparmor/ipc.c +++ b/security/apparmor/ipc.c | |||
@@ -128,7 +128,7 @@ static inline int map_signal_num(int sig) | |||
128 | return SIGUNKNOWN; | 128 | return SIGUNKNOWN; |
129 | else if (sig >= SIGRTMIN) | 129 | else if (sig >= SIGRTMIN) |
130 | return sig - SIGRTMIN + 128; /* rt sigs mapped to 128 */ | 130 | return sig - SIGRTMIN + 128; /* rt sigs mapped to 128 */ |
131 | else if (sig <= MAXMAPPED_SIG) | 131 | else if (sig < MAXMAPPED_SIG) |
132 | return sig_map[sig]; | 132 | return sig_map[sig]; |
133 | return SIGUNKNOWN; | 133 | return SIGUNKNOWN; |
134 | } | 134 | } |
@@ -163,7 +163,7 @@ static void audit_signal_cb(struct audit_buffer *ab, void *va) | |||
163 | audit_signal_mask(ab, aad(sa)->denied); | 163 | audit_signal_mask(ab, aad(sa)->denied); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | if (aad(sa)->signal <= MAXMAPPED_SIG) | 166 | if (aad(sa)->signal < MAXMAPPED_SIG) |
167 | audit_log_format(ab, " signal=%s", sig_names[aad(sa)->signal]); | 167 | audit_log_format(ab, " signal=%s", sig_names[aad(sa)->signal]); |
168 | else | 168 | else |
169 | audit_log_format(ab, " signal=rtmin+%d", | 169 | audit_log_format(ab, " signal=rtmin+%d", |