]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ARC: entry: fix off-by-one error in syscall number validation
authorVineet Gupta <vgupta@synopsys.com>
Fri, 23 Apr 2021 19:16:25 +0000 (12:16 -0700)
committerVineet Gupta <vgupta@synopsys.com>
Fri, 23 Apr 2021 20:32:36 +0000 (13:32 -0700)
commit1582f08d83d7899410fb111eba560c26ace249a1
tree7a8bf92f1cbedfc1f615578be503a5add3bf6475
parent1cb7eefda7ed1f39be84fa97ac38d0cbecc669cf
ARC: entry: fix off-by-one error in syscall number validation

We have NR_syscall syscalls from [0 .. NR_syscall-1].
However the check for invalid syscall number is "> NR_syscall".
This off-by-one error erronesously allows "NR_syscall" itself as valid
and when passed causes out-of-bounds syscall-call table access leading
to crash.

This problem showed up when testing glibc 2.33 (v5.10 kernel capable,
includng faccessat2 syscall (439) against a v5.6 kernel with
NR_syscalls=439 (0 to 438). Due to the bug, 439 was not returned with
-ENOSYS but processed leading to a crash.

Link: https://github.com/foss-for-synopsys-dwc-arc-processors/linux/issues/48
Reported-by: Shahab Vahedi <shahab@synopsys.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
arch/arc/kernel/entry.S