Skip to content

Commit f7dc4c9

Browse files
jrjohansentorvalds
authored andcommitted
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: cd1dbf7 ("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>
1 parent fbc3edf commit f7dc4c9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

security/apparmor/ipc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static inline int map_signal_num(int sig)
128128
return SIGUNKNOWN;
129129
else if (sig >= SIGRTMIN)
130130
return sig - SIGRTMIN + 128; /* rt sigs mapped to 128 */
131-
else if (sig <= MAXMAPPED_SIG)
131+
else if (sig < MAXMAPPED_SIG)
132132
return sig_map[sig];
133133
return SIGUNKNOWN;
134134
}
@@ -163,7 +163,7 @@ static void audit_signal_cb(struct audit_buffer *ab, void *va)
163163
audit_signal_mask(ab, aad(sa)->denied);
164164
}
165165
}
166-
if (aad(sa)->signal <= MAXMAPPED_SIG)
166+
if (aad(sa)->signal < MAXMAPPED_SIG)
167167
audit_log_format(ab, " signal=%s", sig_names[aad(sa)->signal]);
168168
else
169169
audit_log_format(ab, " signal=rtmin+%d",

0 commit comments

Comments
 (0)