diff mbox series

[03/15] mips: fix compat_sys_lseek syscall

Message ID 20240620162316.3674955-4-arnd@kernel.org (mailing list archive)
State Accepted
Commit 0d5679a0aae2d8cda72169452c32e5cb88a7ab33
Headers show
Series linux system call fixes | expand

Commit Message

Arnd Bergmann June 20, 2024, 4:23 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

This is almost compatible, but passing a negative offset should result
in a EINVAL error, but on mips o32 compat mode would seek to a large
32-bit byte offset.

Use compat_sys_lseek() to correctly sign-extend the argument.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/mips/kernel/syscalls/syscall_o32.tbl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Bogendoerfer June 21, 2024, 8:25 a.m. UTC | #1
On Thu, Jun 20, 2024 at 06:23:04PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> This is almost compatible, but passing a negative offset should result
> in a EINVAL error, but on mips o32 compat mode would seek to a large
> 32-bit byte offset.
> 
> Use compat_sys_lseek() to correctly sign-extend the argument.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  arch/mips/kernel/syscalls/syscall_o32.tbl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl
> index 85751c9b9cdb..2439a2491cff 100644
> --- a/arch/mips/kernel/syscalls/syscall_o32.tbl
> +++ b/arch/mips/kernel/syscalls/syscall_o32.tbl
> @@ -27,7 +27,7 @@
>  17	o32	break				sys_ni_syscall
>  # 18 was sys_stat
>  18	o32	unused18			sys_ni_syscall
> -19	o32	lseek				sys_lseek
> +19	o32	lseek				sys_lseek			compat_sys_lseek
>  20	o32	getpid				sys_getpid
>  21	o32	mount				sys_mount
>  22	o32	umount				sys_oldumount
> -- 
> 2.39.2

applied to mips-fixes.

Thomas.
diff mbox series

Patch

diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl
index 85751c9b9cdb..2439a2491cff 100644
--- a/arch/mips/kernel/syscalls/syscall_o32.tbl
+++ b/arch/mips/kernel/syscalls/syscall_o32.tbl
@@ -27,7 +27,7 @@ 
 17	o32	break				sys_ni_syscall
 # 18 was sys_stat
 18	o32	unused18			sys_ni_syscall
-19	o32	lseek				sys_lseek
+19	o32	lseek				sys_lseek			compat_sys_lseek
 20	o32	getpid				sys_getpid
 21	o32	mount				sys_mount
 22	o32	umount				sys_oldumount