Skip to content

Commit f08cae2

Browse files
milk163wildea01
authored andcommitted
arm64: mmap: Ensure file offset is treated as unsigned
The file offset argument to the arm64 sys_mmap() implementation is scaled from bytes to pages by shifting right by PAGE_SHIFT. Unfortunately, the offset is passed in as a signed 'off_t' type and therefore large offsets (i.e. with the top bit set) are incorrectly sign-extended by the shift. This has been observed to cause false mmap() failures when mapping GPU doorbells on an arm64 server part. Change the type of the file offset argument to sys_mmap() from 'off_t' to 'unsigned long' so that the shifting scales the value as expected. Cc: <stable@vger.kernel.org> Signed-off-by: Boyang Zhou <zhouby_cn@126.com> [will: rewrote commit message] Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent bc15cf7 commit f08cae2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎arch/arm64/kernel/sys.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
3333
unsigned long, prot, unsigned long, flags,
34-
unsigned long, fd, off_t, off)
34+
unsigned long, fd, unsigned long, off)
3535
{
3636
if (offset_in_page(off) != 0)
3737
return -EINVAL;

0 commit comments

Comments
 (0)