~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/loongarch/kernel/uprobes.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/loongarch/kernel/uprobes.c (Version linux-6.12-rc7) and /arch/m68k/kernel/uprobes.c (Version linux-4.14.336)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 
  2 #include <linux/highmem.h>                        
  3 #include <linux/ptrace.h>                         
  4 #include <linux/sched.h>                          
  5 #include <linux/uprobes.h>                        
  6 #include <asm/cacheflush.h>                       
  7                                                   
  8 #define UPROBE_TRAP_NR  UINT_MAX                  
  9                                                   
 10 int arch_uprobe_analyze_insn(struct arch_uprob    
 11                              struct mm_struct     
 12 {                                                 
 13         int idx;                                  
 14         union loongarch_instruction insn;         
 15                                                   
 16         if (addr & 0x3)                           
 17                 return -EILSEQ;                   
 18                                                   
 19         for (idx = ARRAY_SIZE(auprobe->insn) -    
 20                 insn.word = auprobe->insn[idx]    
 21                 if (insns_not_supported(insn))    
 22                         return -EINVAL;           
 23         }                                         
 24                                                   
 25         if (insns_need_simulation(insn)) {        
 26                 auprobe->ixol[0] = larch_insn_    
 27                 auprobe->simulate = true;         
 28         } else {                                  
 29                 auprobe->ixol[0] = auprobe->in    
 30                 auprobe->simulate = false;        
 31         }                                         
 32                                                   
 33         auprobe->ixol[1] = UPROBE_XOLBP_INSN;     
 34                                                   
 35         return 0;                                 
 36 }                                                 
 37                                                   
 38 int arch_uprobe_pre_xol(struct arch_uprobe *au    
 39 {                                                 
 40         struct uprobe_task *utask = current->u    
 41                                                   
 42         utask->autask.saved_trap_nr = current-    
 43         current->thread.trap_nr = UPROBE_TRAP_    
 44         instruction_pointer_set(regs, utask->x    
 45         user_enable_single_step(current);         
 46                                                   
 47         return 0;                                 
 48 }                                                 
 49                                                   
 50 int arch_uprobe_post_xol(struct arch_uprobe *a    
 51 {                                                 
 52         struct uprobe_task *utask = current->u    
 53                                                   
 54         WARN_ON_ONCE(current->thread.trap_nr !    
 55         current->thread.trap_nr = utask->autas    
 56                                                   
 57         if (auprobe->simulate)                    
 58                 instruction_pointer_set(regs,     
 59         else                                      
 60                 instruction_pointer_set(regs,     
 61                                                   
 62         user_disable_single_step(current);        
 63                                                   
 64         return 0;                                 
 65 }                                                 
 66                                                   
 67 void arch_uprobe_abort_xol(struct arch_uprobe     
 68 {                                                 
 69         struct uprobe_task *utask = current->u    
 70                                                   
 71         current->thread.trap_nr = utask->autas    
 72         instruction_pointer_set(regs, utask->v    
 73         user_disable_single_step(current);        
 74 }                                                 
 75                                                   
 76 bool arch_uprobe_xol_was_trapped(struct task_s    
 77 {                                                 
 78         if (t->thread.trap_nr != UPROBE_TRAP_N    
 79                 return true;                      
 80                                                   
 81         return false;                             
 82 }                                                 
 83                                                   
 84 bool arch_uprobe_skip_sstep(struct arch_uprobe    
 85 {                                                 
 86         union loongarch_instruction insn;         
 87                                                   
 88         if (!auprobe->simulate)                   
 89                 return false;                     
 90                                                   
 91         insn.word = auprobe->insn[0];             
 92         arch_simulate_insn(insn, regs);           
 93         auprobe->resume_era = regs->csr_era;      
 94                                                   
 95         return true;                              
 96 }                                                 
 97                                                   
 98 unsigned long arch_uretprobe_hijack_return_add    
 99                                                   
100 {                                                 
101         unsigned long ra = regs->regs[1];         
102                                                   
103         regs->regs[1] = trampoline_vaddr;         
104                                                   
105         return ra;                                
106 }                                                 
107                                                   
108 bool arch_uretprobe_is_alive(struct return_ins    
109                              enum rp_check ctx    
110 {                                                 
111         if (ctx == RP_CHECK_CHAIN_CALL)           
112                 return regs->regs[3] <= ret->s    
113         else                                      
114                 return regs->regs[3] < ret->st    
115 }                                                 
116                                                   
117 int arch_uprobe_exception_notify(struct notifi    
118                                  unsigned long    
119 {                                                 
120         return NOTIFY_DONE;                       
121 }                                                 
122                                                   
123 bool uprobe_breakpoint_handler(struct pt_regs     
124 {                                                 
125         if (uprobe_pre_sstep_notifier(regs))      
126                 return true;                      
127                                                   
128         return false;                             
129 }                                                 
130                                                   
131 bool uprobe_singlestep_handler(struct pt_regs     
132 {                                                 
133         if (uprobe_post_sstep_notifier(regs))     
134                 return true;                      
135                                                   
136         return false;                             
137 }                                                 
138                                                   
139 unsigned long uprobe_get_swbp_addr(struct pt_r    
140 {                                                 
141         return instruction_pointer(regs);         
142 }                                                 
143                                                   
144 void arch_uprobe_copy_ixol(struct page *page,     
145                            void *src, unsigned    
146 {                                                 
147         void *kaddr = kmap_local_page(page);      
148         void *dst = kaddr + (vaddr & ~PAGE_MAS    
149                                                   
150         memcpy(dst, src, len);                    
151         flush_icache_range((unsigned long)dst,    
152         kunmap_local(kaddr);                      
153 }                                                 
154                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php