processor.h (20b8547277a6e8ee1d928792c1b2782c9a2a6cf5) | processor.h (65896545b69ffaac947c12e11d3dcc57fd1fb772) |
---|---|
1/* 2 * Based on arch/arm/include/asm/processor.h 3 * 4 * Copyright (C) 1995-1999 Russell King 5 * Copyright (C) 2012 ARM Ltd. 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 20 unchanged lines hidden (view full) --- 29/* 30 * Default implementation of macro that returns current 31 * instruction pointer ("program counter"). 32 */ 33#define current_text_addr() ({ __label__ _l; _l: &&_l;}) 34 35#ifdef __KERNEL__ 36 | 1/* 2 * Based on arch/arm/include/asm/processor.h 3 * 4 * Copyright (C) 1995-1999 Russell King 5 * Copyright (C) 2012 ARM Ltd. 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 20 unchanged lines hidden (view full) --- 29/* 30 * Default implementation of macro that returns current 31 * instruction pointer ("program counter"). 32 */ 33#define current_text_addr() ({ __label__ _l; _l: &&_l;}) 34 35#ifdef __KERNEL__ 36 |
37#include <linux/build_bug.h> 38#include <linux/stddef.h> |
|
37#include <linux/string.h> 38 39#include <asm/alternative.h> 40#include <asm/cpufeature.h> 41#include <asm/hw_breakpoint.h> 42#include <asm/lse.h> 43#include <asm/pgtable-hwdef.h> 44#include <asm/ptrace.h> --- 53 unchanged lines hidden (view full) --- 98 unsigned long x28; 99 unsigned long fp; 100 unsigned long sp; 101 unsigned long pc; 102}; 103 104struct thread_struct { 105 struct cpu_context cpu_context; /* cpu context */ | 39#include <linux/string.h> 40 41#include <asm/alternative.h> 42#include <asm/cpufeature.h> 43#include <asm/hw_breakpoint.h> 44#include <asm/lse.h> 45#include <asm/pgtable-hwdef.h> 46#include <asm/ptrace.h> --- 53 unchanged lines hidden (view full) --- 100 unsigned long x28; 101 unsigned long fp; 102 unsigned long sp; 103 unsigned long pc; 104}; 105 106struct thread_struct { 107 struct cpu_context cpu_context; /* cpu context */ |
106 unsigned long tp_value; /* TLS register */ 107#ifdef CONFIG_COMPAT 108 unsigned long tp2_value; 109#endif 110 struct user_fpsimd_state fpsimd_state; | 108 109 /* 110 * Whitelisted fields for hardened usercopy: 111 * Maintainers must ensure manually that this contains no 112 * implicit padding. 113 */ 114 struct { 115 unsigned long tp_value; /* TLS register */ 116 unsigned long tp2_value; 117 struct user_fpsimd_state fpsimd_state; 118 } uw; 119 |
111 unsigned int fpsimd_cpu; 112 void *sve_state; /* SVE registers, if any */ 113 unsigned int sve_vl; /* SVE vector length */ 114 unsigned int sve_vl_onexec; /* SVE vl after next exec */ 115 unsigned long fault_address; /* fault info */ 116 unsigned long fault_code; /* ESR_EL1 value */ 117 struct debug_info debug; /* debugging */ 118}; 119 | 120 unsigned int fpsimd_cpu; 121 void *sve_state; /* SVE registers, if any */ 122 unsigned int sve_vl; /* SVE vector length */ 123 unsigned int sve_vl_onexec; /* SVE vl after next exec */ 124 unsigned long fault_address; /* fault info */ 125 unsigned long fault_code; /* ESR_EL1 value */ 126 struct debug_info debug; /* debugging */ 127}; 128 |
120/* 121 * Everything usercopied to/from thread_struct is statically-sized, so 122 * no hardened usercopy whitelist is needed. 123 */ | |
124static inline void arch_thread_struct_whitelist(unsigned long *offset, 125 unsigned long *size) 126{ | 129static inline void arch_thread_struct_whitelist(unsigned long *offset, 130 unsigned long *size) 131{ |
127 *offset = *size = 0; | 132 /* Verify that there is no padding among the whitelisted fields: */ 133 BUILD_BUG_ON(sizeof_field(struct thread_struct, uw) != 134 sizeof_field(struct thread_struct, uw.tp_value) + 135 sizeof_field(struct thread_struct, uw.tp2_value) + 136 sizeof_field(struct thread_struct, uw.fpsimd_state)); 137 138 *offset = offsetof(struct thread_struct, uw); 139 *size = sizeof_field(struct thread_struct, uw); |
128} 129 130#ifdef CONFIG_COMPAT 131#define task_user_tls(t) \ 132({ \ 133 unsigned long *__tls; \ 134 if (is_compat_thread(task_thread_info(t))) \ | 140} 141 142#ifdef CONFIG_COMPAT 143#define task_user_tls(t) \ 144({ \ 145 unsigned long *__tls; \ 146 if (is_compat_thread(task_thread_info(t))) \ |
135 __tls = &(t)->thread.tp2_value; \ | 147 __tls = &(t)->thread.uw.tp2_value; \ |
136 else \ | 148 else \ |
137 __tls = &(t)->thread.tp_value; \ | 149 __tls = &(t)->thread.uw.tp_value; \ |
138 __tls; \ 139 }) 140#else | 150 __tls; \ 151 }) 152#else |
141#define task_user_tls(t) (&(t)->thread.tp_value) | 153#define task_user_tls(t) (&(t)->thread.uw.tp_value) |
142#endif 143 144/* Sync TPIDR_EL0 back to thread_struct for current */ 145void tls_preserve_current_state(void); 146 147#define INIT_THREAD { } 148 149static inline void start_thread_common(struct pt_regs *regs, unsigned long pc) --- 91 unchanged lines hidden --- | 154#endif 155 156/* Sync TPIDR_EL0 back to thread_struct for current */ 157void tls_preserve_current_state(void); 158 159#define INIT_THREAD { } 160 161static inline void start_thread_common(struct pt_regs *regs, unsigned long pc) --- 91 unchanged lines hidden --- |