uaccess.h (52fe8d125c9afecc6fff6afd9950a388488df2ce) | uaccess.h (12700c17fc286149324f92d6d380bc48e43f253d) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Based on arch/arm/include/asm/uaccess.h 4 * 5 * Copyright (C) 2012 ARM Ltd. 6 */ 7#ifndef __ASM_UACCESS_H 8#define __ASM_UACCESS_H --- 12 unchanged lines hidden (view full) --- 21#include <asm/asm-extable.h> 22#include <asm/cpufeature.h> 23#include <asm/mmu.h> 24#include <asm/mte.h> 25#include <asm/ptrace.h> 26#include <asm/memory.h> 27#include <asm/extable.h> 28 | 1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Based on arch/arm/include/asm/uaccess.h 4 * 5 * Copyright (C) 2012 ARM Ltd. 6 */ 7#ifndef __ASM_UACCESS_H 8#define __ASM_UACCESS_H --- 12 unchanged lines hidden (view full) --- 21#include <asm/asm-extable.h> 22#include <asm/cpufeature.h> 23#include <asm/mmu.h> 24#include <asm/mte.h> 25#include <asm/ptrace.h> 26#include <asm/memory.h> 27#include <asm/extable.h> 28 |
29static inline int __access_ok(const void __user *ptr, unsigned long size) 30{ 31 unsigned long limit = TASK_SIZE_MAX; 32 unsigned long addr = (unsigned long)ptr; | 29static inline int __access_ok(const void __user *ptr, unsigned long size); |
33 | 30 |
34 return (size <= limit) && (addr <= (limit - size)); 35} 36 | |
37/* 38 * Test whether a block of memory is a valid user space address. 39 * Returns 1 if the range is valid, 0 otherwise. 40 * 41 * This is equivalent to the following test: 42 * (u65)addr + (u65)size <= (u65)TASK_SIZE_MAX 43 */ 44static inline int access_ok(const void __user *addr, unsigned long size) --- 4 unchanged lines hidden (view full) --- 49 * the user address before checking. 50 */ 51 if (IS_ENABLED(CONFIG_ARM64_TAGGED_ADDR_ABI) && 52 (current->flags & PF_KTHREAD || test_thread_flag(TIF_TAGGED_ADDR))) 53 addr = untagged_addr(addr); 54 55 return likely(__access_ok(addr, size)); 56} | 31/* 32 * Test whether a block of memory is a valid user space address. 33 * Returns 1 if the range is valid, 0 otherwise. 34 * 35 * This is equivalent to the following test: 36 * (u65)addr + (u65)size <= (u65)TASK_SIZE_MAX 37 */ 38static inline int access_ok(const void __user *addr, unsigned long size) --- 4 unchanged lines hidden (view full) --- 43 * the user address before checking. 44 */ 45 if (IS_ENABLED(CONFIG_ARM64_TAGGED_ADDR_ABI) && 46 (current->flags & PF_KTHREAD || test_thread_flag(TIF_TAGGED_ADDR))) 47 addr = untagged_addr(addr); 48 49 return likely(__access_ok(addr, size)); 50} |
51#define access_ok access_ok |
|
57 | 52 |
53#include <asm-generic/access_ok.h> 54 |
|
58/* 59 * User access enabling/disabling. 60 */ 61#ifdef CONFIG_ARM64_SW_TTBR0_PAN 62static inline void __uaccess_ttbr0_disable(void) 63{ 64 unsigned long flags, ttbr; 65 --- 401 unchanged lines hidden --- | 55/* 56 * User access enabling/disabling. 57 */ 58#ifdef CONFIG_ARM64_SW_TTBR0_PAN 59static inline void __uaccess_ttbr0_disable(void) 60{ 61 unsigned long flags, ttbr; 62 --- 401 unchanged lines hidden --- |