Skip to content

Commit

Permalink
signal: Guard against negative signal numbers in copy_siginfo_from_us…
Browse files Browse the repository at this point in the history
…er32

While fixing an out of bounds array access in known_siginfo_layout
reported by the kernel test robot it became apparent that the same bug
exists in siginfo_layout and affects copy_siginfo_from_user32.

The straight forward fix that makes guards against making this mistake
in the future and should keep the code size small is to just take an
unsigned signal number instead of a signed signal number, as I did to
fix known_siginfo_layout.

Cc: [email protected]
Fixes: cc73152 ("signal: Remove kernel interal si_code magic")
Signed-off-by: "Eric W. Biederman" <[email protected]>
  • Loading branch information
ebiederm committed Oct 11, 2018
1 parent b2a2ab5 commit a367005
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/linux/signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enum siginfo_layout {
SIL_SYS,
};

enum siginfo_layout siginfo_layout(int sig, int si_code);
enum siginfo_layout siginfo_layout(unsigned sig, int si_code);

/*
* Define some primitives to manipulate sigset_t.
Expand Down
2 changes: 1 addition & 1 deletion kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -2879,7 +2879,7 @@ static bool known_siginfo_layout(unsigned sig, int si_code)
return false;
}

enum siginfo_layout siginfo_layout(int sig, int si_code)
enum siginfo_layout siginfo_layout(unsigned sig, int si_code)
{
enum siginfo_layout layout = SIL_KILL;
if ((si_code > SI_USER) && (si_code < SI_KERNEL)) {
Expand Down

0 comments on commit a367005

Please sign in to comment.