The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / uclibc / 0.9.33.2 / 0031-mmap-sys_mmap2-do-unsigned-shift-of-offset.patch
1 From 569d1423ac2b585b5cb38bee545b5e0ae2bd7f67 Mon Sep 17 00:00:00 2001
2 From: James Hogan <james.hogan@imgtec.com>
3 Date: Thu, 17 May 2012 12:42:54 +0100
4 Subject: [PATCH] mmap()->sys_mmap2: do unsigned shift of offset
5
6 Fix the implementation of mmap based on the mmap2 system call, to
7 construct pgoffset from offset with an unsigned shift rather than a
8 signed (off_t) shift. The mmap2 test in the testsuite catches this case
9 by mmap'ing with a large offset (with the sign bit set). The signed
10 shift repeats the sign bit making the page shift way out of range. This
11 is already fixed similarly in mmap64().
12
13 Signed-off-by: James Hogan <james.hogan@imgtec.com>
14 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
15 ---
16  libc/sysdeps/linux/common/mmap.c |    3 ++-
17  1 file changed, 2 insertions(+), 1 deletion(-)
18
19 diff --git a/libc/sysdeps/linux/common/mmap.c b/libc/sysdeps/linux/common/mmap.c
20 index 8995898..d53eabb 100644
21 --- a/libc/sysdeps/linux/common/mmap.c
22 +++ b/libc/sysdeps/linux/common/mmap.c
23 @@ -63,7 +63,8 @@ __ptr_t mmap(__ptr_t addr, size_t len, int prot, int flags, int fd, __off_t offs
24                 __set_errno(EINVAL);
25                 return MAP_FAILED;
26         }
27 -       return __syscall_mmap2(addr, len, prot, flags, fd, offset >> MMAP2_PAGE_SHIFT);
28 +       return __syscall_mmap2(addr, len, prot, flags,
29 +                              fd, ((__u_long) offset >> MMAP2_PAGE_SHIFT));
30  }
31  
32  libc_hidden_def(mmap)
33 -- 
34 1.7.10.4
35