cregit-Linux how code gets into the kernel

Release 4.8 arch/sh/kernel/vsyscall/vsyscall.c

/*
 * arch/sh/kernel/vsyscall/vsyscall.c
 *
 *  Copyright (C) 2006 Paul Mundt
 *
 * vDSO randomization
 * Copyright(C) 2005-2006, Red Hat, Inc., Ingo Molnar
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 */
#include <linux/mm.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/gfp.h>
#include <linux/module.h>
#include <linux/elf.h>
#include <linux/sched.h>
#include <linux/err.h>

/*
 * Should the kernel map a VDSO page into processes and pass its
 * address down to glibc upon exec()?
 */

unsigned int __read_mostly vdso_enabled = 1;

EXPORT_SYMBOL_GPL(vdso_enabled);


static int __init vdso_setup(char *s) { vdso_enabled = simple_strtoul(s, NULL, 0); return 1; }

Contributors

PersonTokensPropCommitsCommitProp
paul mundtpaul mundt25100.00%1100.00%
Total25100.00%1100.00%

__setup("vdso=", vdso_setup); /* * These symbols are defined by vsyscall.o to mark the bounds * of the ELF DSO images included therein. */ extern const char vsyscall_trapa_start, vsyscall_trapa_end; static struct page *syscall_pages[1];
int __init vsyscall_init(void) { void *syscall_page = (void *)get_zeroed_page(GFP_ATOMIC); syscall_pages[0] = virt_to_page(syscall_page); /* * XXX: Map this page to a fixmap entry if we get around * to adding the page to ELF core dumps */ memcpy(syscall_page, &vsyscall_trapa_start, &vsyscall_trapa_end - &vsyscall_trapa_start); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
paul mundtpaul mundt49100.00%2100.00%
Total49100.00%2100.00%

/* Setup a VMA at program startup for the vsyscall page */
int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) { struct mm_struct *mm = current->mm; unsigned long addr; int ret; if (down_write_killable(&mm->mmap_sem)) return -EINTR; addr = get_unmapped_area(NULL, 0, PAGE_SIZE, 0, 0); if (IS_ERR_VALUE(addr)) { ret = addr; goto up_fail; } ret = install_special_mapping(mm, addr, PAGE_SIZE, VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC, syscall_pages); if (unlikely(ret)) goto up_fail; current->mm->context.vdso = (void *)addr; up_fail: up_write(&mm->mmap_sem); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
paul mundtpaul mundt12593.28%250.00%
michal hockomichal hocko85.97%125.00%
martin schwidefskymartin schwidefsky10.75%125.00%
Total134100.00%4100.00%


const char *arch_vma_name(struct vm_area_struct *vma) { if (vma->vm_mm && vma->vm_start == (long)vma->vm_mm->context.vdso) return "[vdso]"; return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
paul mundtpaul mundt39100.00%1100.00%
Total39100.00%1100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
paul mundtpaul mundt29795.81%342.86%
michal hockomichal hocko82.58%114.29%
manuel laussmanuel lauss30.97%114.29%
martin schwidefskymartin schwidefsky10.32%114.29%
uwe kleine-koeniguwe kleine-koenig10.32%114.29%
Total310100.00%7100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.