• Alexander Kartashov's avatar
    sys_mmap: fixed the error detection logic. · 3f12d688
    Alexander Kartashov authored
    The current sys_mmap error analysis code doesn't work on 32-bit architectures
    with 3G/1G userspace/kernel virtual address space split since the syscall
    allocates anonymous memory above the first 2G of the address space ---
    such an address is a negative integer so it's interpreted as a error code.
    The problem isn't encountered on x86-64 becauase it doesn't use negative
    virtual addresses in the userspace.
    
    The 3G/1G split is used because memory allocation is currently broken for other
    values of the split on ARM: the value of TASK_UNMAPPED_BASE (arch/arm/include/asm/memory.h)
    isn't page-aligned if other split value is used so the value of the field
    mm_struct::mmap_base is initialized with a page-unaligned value by
    the function arch_pick_mmap_layout() (arch/arm/mm/mmap.c) in some circumstances
    that breaks page-alignment checks in the kernel memory management code.
    
    This patch modifies sys_mmap return value analysis code replacing tests
    for negativeness of the signed return value with tests that checks that
    the return value isn't greater than TASK_SIZE.
    Signed-off-by: 's avatarAlexander Kartashov <alekskartashov@parallels.com>
    Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
    3f12d688
Name
Last commit
Last update
Documentation Loading commit data...
arch/x86 Loading commit data...
include Loading commit data...
pie Loading commit data...
protobuf Loading commit data...
test Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Makefile Loading commit data...
README Loading commit data...
cpu.c Loading commit data...
cr-check.c Loading commit data...
cr-dump.c Loading commit data...
cr-exec.c Loading commit data...
cr-restore.c Loading commit data...
cr-show.c Loading commit data...
crtools.c Loading commit data...
eventfd.c Loading commit data...
eventpoll.c Loading commit data...
fifo.c Loading commit data...
file-ids.c Loading commit data...
files-reg.c Loading commit data...
files.c Loading commit data...
image.c Loading commit data...
inotify.c Loading commit data...
ipc_ns.c Loading commit data...
kcmp-ids.c Loading commit data...
libnetlink.c Loading commit data...
log.c Loading commit data...
mount.c Loading commit data...
namespaces.c Loading commit data...
net.c Loading commit data...
netfilter.c Loading commit data...
parasite-syscall.c Loading commit data...
pipes.c Loading commit data...
proc_parse.c Loading commit data...
protobuf.c Loading commit data...
pstree.c Loading commit data...
ptrace.c Loading commit data...
rbtree.c Loading commit data...
shmem.c Loading commit data...
signalfd.c Loading commit data...
sk-inet.c Loading commit data...
sk-packet.c Loading commit data...
sk-queue.c Loading commit data...
sk-tcp.c Loading commit data...
sk-unix.c Loading commit data...
sockets.c Loading commit data...
sysctl.c Loading commit data...
tty.c Loading commit data...
util-net.c Loading commit data...
util.c Loading commit data...
uts_ns.c Loading commit data...