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

TOMOYO Linux Cross Reference
Linux/include/asm-generic/bitops/instrumented-non-atomic.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/asm-generic/bitops/instrumented-non-atomic.h (Version linux-6.11-rc3) and /include/asm-ppc/bitops/instrumented-non-atomic.h (Version linux-4.18.20)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 
  2                                                   
  3 /*                                                
  4  * This file provides wrappers with sanitizer     
  5  * bit operations.                                
  6  *                                                
  7  * To use this functionality, an arch's bitops    
  8  * the below bit operations with an arch_ pref    
  9  * arch___set_bit(), etc.).                       
 10  */                                               
 11 #ifndef _ASM_GENERIC_BITOPS_INSTRUMENTED_NON_A    
 12 #define _ASM_GENERIC_BITOPS_INSTRUMENTED_NON_A    
 13                                                   
 14 #include <linux/instrumented.h>                   
 15                                                   
 16 /**                                               
 17  * ___set_bit - Set a bit in memory               
 18  * @nr: the bit to set                            
 19  * @addr: the address to start counting from      
 20  *                                                
 21  * Unlike set_bit(), this function is non-atom    
 22  * region of memory concurrently, the effect m    
 23  * succeeds.                                      
 24  */                                               
 25 static __always_inline void                       
 26 ___set_bit(unsigned long nr, volatile unsigned    
 27 {                                                 
 28         instrument_write(addr + BIT_WORD(nr),     
 29         arch___set_bit(nr, addr);                 
 30 }                                                 
 31                                                   
 32 /**                                               
 33  * ___clear_bit - Clears a bit in memory          
 34  * @nr: the bit to clear                          
 35  * @addr: the address to start counting from      
 36  *                                                
 37  * Unlike clear_bit(), this function is non-at    
 38  * region of memory concurrently, the effect m    
 39  * succeeds.                                      
 40  */                                               
 41 static __always_inline void                       
 42 ___clear_bit(unsigned long nr, volatile unsign    
 43 {                                                 
 44         instrument_write(addr + BIT_WORD(nr),     
 45         arch___clear_bit(nr, addr);               
 46 }                                                 
 47                                                   
 48 /**                                               
 49  * ___change_bit - Toggle a bit in memory         
 50  * @nr: the bit to change                         
 51  * @addr: the address to start counting from      
 52  *                                                
 53  * Unlike change_bit(), this function is non-a    
 54  * region of memory concurrently, the effect m    
 55  * succeeds.                                      
 56  */                                               
 57 static __always_inline void                       
 58 ___change_bit(unsigned long nr, volatile unsig    
 59 {                                                 
 60         instrument_write(addr + BIT_WORD(nr),     
 61         arch___change_bit(nr, addr);              
 62 }                                                 
 63                                                   
 64 static __always_inline void __instrument_read_    
 65 {                                                 
 66         if (IS_ENABLED(CONFIG_KCSAN_ASSUME_PLA    
 67                 /*                                
 68                  * We treat non-atomic read-wr    
 69                  * Given the operations here o    
 70                  * non-atomicity of the writer    
 71                  * for certain usage (and foll    
 72                  * assume-plain-writes-atomic     
 73                  * 1. report read-modify-write    
 74                  * 2. do not report races with    
 75                  *    races with unmarked read    
 76                  */                               
 77                 kcsan_check_read(addr + BIT_WO    
 78                 /*                                
 79                  * Use generic write instrumen    
 80                  * or tools are enabled alongs    
 81                  */                               
 82                 instrument_write(addr + BIT_WO    
 83         } else {                                  
 84                 instrument_read_write(addr + B    
 85         }                                         
 86 }                                                 
 87                                                   
 88 /**                                               
 89  * ___test_and_set_bit - Set a bit and return     
 90  * @nr: Bit to set                                
 91  * @addr: Address to count from                   
 92  *                                                
 93  * This operation is non-atomic. If two instan    
 94  * can appear to succeed but actually fail.       
 95  */                                               
 96 static __always_inline bool                       
 97 ___test_and_set_bit(unsigned long nr, volatile    
 98 {                                                 
 99         __instrument_read_write_bitop(nr, addr    
100         return arch___test_and_set_bit(nr, add    
101 }                                                 
102                                                   
103 /**                                               
104  * ___test_and_clear_bit - Clear a bit and ret    
105  * @nr: Bit to clear                              
106  * @addr: Address to count from                   
107  *                                                
108  * This operation is non-atomic. If two instan    
109  * can appear to succeed but actually fail.       
110  */                                               
111 static __always_inline bool                       
112 ___test_and_clear_bit(unsigned long nr, volati    
113 {                                                 
114         __instrument_read_write_bitop(nr, addr    
115         return arch___test_and_clear_bit(nr, a    
116 }                                                 
117                                                   
118 /**                                               
119  * ___test_and_change_bit - Change a bit and r    
120  * @nr: Bit to change                             
121  * @addr: Address to count from                   
122  *                                                
123  * This operation is non-atomic. If two instan    
124  * can appear to succeed but actually fail.       
125  */                                               
126 static __always_inline bool                       
127 ___test_and_change_bit(unsigned long nr, volat    
128 {                                                 
129         __instrument_read_write_bitop(nr, addr    
130         return arch___test_and_change_bit(nr,     
131 }                                                 
132                                                   
133 /**                                               
134  * _test_bit - Determine whether a bit is set     
135  * @nr: bit number to test                        
136  * @addr: Address to start counting from          
137  */                                               
138 static __always_inline bool                       
139 _test_bit(unsigned long nr, const volatile uns    
140 {                                                 
141         instrument_atomic_read(addr + BIT_WORD    
142         return arch_test_bit(nr, addr);           
143 }                                                 
144                                                   
145 /**                                               
146  * _test_bit_acquire - Determine, with acquire    
147  * @nr: bit number to test                        
148  * @addr: Address to start counting from          
149  */                                               
150 static __always_inline bool                       
151 _test_bit_acquire(unsigned long nr, const vola    
152 {                                                 
153         instrument_atomic_read(addr + BIT_WORD    
154         return arch_test_bit_acquire(nr, addr)    
155 }                                                 
156                                                   
157 #endif /* _ASM_GENERIC_BITOPS_INSTRUMENTED_NON    
158                                                   

~ [ 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