vma.c (002c6ca75289a4ac4f6738213dd2d258704886e4) | vma.c (8032bf1233a74627ce69b803608e650f3f35971c) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Set up the VMAs to tell the VM about the vDSO. 4 * Copyright 2007 Andi Kleen, SUSE Labs. 5 */ 6 7/* 8 * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved. --- 340 unchanged lines hidden (view full) --- 349struct linux_binprm; 350 351/* Shuffle the vdso up a bit, randomly. */ 352static unsigned long vdso_addr(unsigned long start, unsigned int len) 353{ 354 unsigned int offset; 355 356 /* This loses some more bits than a modulo, but is cheaper */ | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Set up the VMAs to tell the VM about the vDSO. 4 * Copyright 2007 Andi Kleen, SUSE Labs. 5 */ 6 7/* 8 * Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved. --- 340 unchanged lines hidden (view full) --- 349struct linux_binprm; 350 351/* Shuffle the vdso up a bit, randomly. */ 352static unsigned long vdso_addr(unsigned long start, unsigned int len) 353{ 354 unsigned int offset; 355 356 /* This loses some more bits than a modulo, but is cheaper */ |
357 offset = prandom_u32_max(PTRS_PER_PTE); | 357 offset = get_random_u32_below(PTRS_PER_PTE); |
358 return start + (offset << PAGE_SHIFT); 359} 360 361static int map_vdso(const struct vdso_image *image, 362 struct vm_special_mapping *vdso_mapping) 363{ 364 struct mm_struct *mm = current->mm; 365 struct vm_area_struct *vma; --- 92 unchanged lines hidden --- | 358 return start + (offset << PAGE_SHIFT); 359} 360 361static int map_vdso(const struct vdso_image *image, 362 struct vm_special_mapping *vdso_mapping) 363{ 364 struct mm_struct *mm = current->mm; 365 struct vm_area_struct *vma; --- 92 unchanged lines hidden --- |