Skip to content

Commit 98cf5bb

Browse files
committed
apparmor: fix logging of the existence test for signals
The existence test is not being properly logged as the signal mapping maps it to the last entry in the named signal table. This is done to help catch bugs by making the 0 mapped signal value invalid so that we can catch the signal value not being filled in. When fixing the off-by-one comparision logic the reporting of the existence test was broken, because the logic behind the mapped named table was hidden. Fix this by adding a define for the name lookup and using it. Cc: Stable <stable@vger.kernel.org> Fixes: f7dc4c9 ("apparmor: fix off-by-one comparison on MAXMAPPED_SIG") Signed-off-by: John Johansen <john.johansen@canonical.com>
1 parent b5beb07 commit 98cf5bb

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎security/apparmor/include/sig_names.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#define SIGUNKNOWN 0
44
#define MAXMAPPED_SIG 35
5+
#define MAXMAPPED_SIGNAME (MAXMAPPED_SIG + 1)
6+
57
/* provide a mapping of arch signal to internal signal # for mediation
68
* those that are always an alias SIGCLD for SIGCLHD and SIGPOLL for SIGIO
79
* map to the same entry those that may/or may not get a separate entry
@@ -56,7 +58,7 @@ static const int sig_map[MAXMAPPED_SIG] = {
5658
};
5759

5860
/* this table is ordered post sig_map[sig] mapping */
59-
static const char *const sig_names[MAXMAPPED_SIG + 1] = {
61+
static const char *const sig_names[MAXMAPPED_SIGNAME] = {
6062
"unknown",
6163
"hup",
6264
"int",

‎security/apparmor/ipc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ static void audit_signal_cb(struct audit_buffer *ab, void *va)
174174
audit_signal_mask(ab, aad(sa)->denied);
175175
}
176176
}
177-
if (aad(sa)->signal < MAXMAPPED_SIG)
177+
if (aad(sa)->signal < MAXMAPPED_SIGNAME)
178178
audit_log_format(ab, " signal=%s", sig_names[aad(sa)->signal]);
179179
else
180180
audit_log_format(ab, " signal=rtmin+%d",

0 commit comments

Comments
 (0)