X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=cirros-testvm%2Fsrc-cirros%2Fbuildroot-2015.05%2Fpackage%2Fuclibc%2F0.9.33.2%2F0031-mmap-sys_mmap2-do-unsigned-shift-of-offset.patch;fp=cirros-testvm%2Fsrc-cirros%2Fbuildroot-2015.05%2Fpackage%2Fuclibc%2F0.9.33.2%2F0031-mmap-sys_mmap2-do-unsigned-shift-of-offset.patch;h=475dcfdea75687e7dbee2e6bbd06cbdd6a4c6ba9;hb=b0a0f15dfaa205161a7fcb20cf1b8cd4948c2ef3;hp=0000000000000000000000000000000000000000;hpb=c6ac3cd55ee2da956195eee393b0882105dfad4e;p=packages%2Ftrusty%2Fcirros-testvm.git diff --git a/cirros-testvm/src-cirros/buildroot-2015.05/package/uclibc/0.9.33.2/0031-mmap-sys_mmap2-do-unsigned-shift-of-offset.patch b/cirros-testvm/src-cirros/buildroot-2015.05/package/uclibc/0.9.33.2/0031-mmap-sys_mmap2-do-unsigned-shift-of-offset.patch new file mode 100644 index 0000000..475dcfd --- /dev/null +++ b/cirros-testvm/src-cirros/buildroot-2015.05/package/uclibc/0.9.33.2/0031-mmap-sys_mmap2-do-unsigned-shift-of-offset.patch @@ -0,0 +1,35 @@ +From 569d1423ac2b585b5cb38bee545b5e0ae2bd7f67 Mon Sep 17 00:00:00 2001 +From: James Hogan +Date: Thu, 17 May 2012 12:42:54 +0100 +Subject: [PATCH] mmap()->sys_mmap2: do unsigned shift of offset + +Fix the implementation of mmap based on the mmap2 system call, to +construct pgoffset from offset with an unsigned shift rather than a +signed (off_t) shift. The mmap2 test in the testsuite catches this case +by mmap'ing with a large offset (with the sign bit set). The signed +shift repeats the sign bit making the page shift way out of range. This +is already fixed similarly in mmap64(). + +Signed-off-by: James Hogan +Signed-off-by: Mike Frysinger +--- + libc/sysdeps/linux/common/mmap.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/libc/sysdeps/linux/common/mmap.c b/libc/sysdeps/linux/common/mmap.c +index 8995898..d53eabb 100644 +--- a/libc/sysdeps/linux/common/mmap.c ++++ b/libc/sysdeps/linux/common/mmap.c +@@ -63,7 +63,8 @@ __ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offs + __set_errno(EINVAL); + return MAP_FAILED; + } +- return __syscall_mmap2(addr, len, prot, flags, fd, offset >> MMAP2_PAGE_SHIFT); ++ return __syscall_mmap2(addr, len, prot, flags, ++ fd, ((__u_long) offset >> MMAP2_PAGE_SHIFT)); + } + + libc_hidden_def(mmap) +-- +1.7.10.4 +