aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-07-13 15:50:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-07-13 15:50:42 -0400
commitae4ea3975d97ab61a274718dc3642a8b2b459811 (patch)
tree3204e4062c65cd81bf248028a1fbd162c1b8e3c0 /tools
parent4659fc8484b707c161b14324df0e3a2f5d03f050 (diff)
parent8a46580128a02bdc18d7dcc0cba19d3cea4fb9c4 (diff)
Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull rseq fixes from Ingo Molnar: "Various rseq ABI fixes and cleanups: use get_user()/put_user(), validate parameters and use proper uapi types, etc" * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: rseq/selftests: cleanup: Update comment above rseq_prepare_unload rseq: Remove unused types_32_64.h uapi header rseq: uapi: Declare rseq_cs field as union, update includes rseq: uapi: Update uapi comments rseq: Use get_user/put_user rather than __get_user/__put_user rseq: Use __u64 for rseq_cs fields, validate user inputs
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/rseq/rseq.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/tools/testing/selftests/rseq/rseq.h b/tools/testing/selftests/rseq/rseq.h
index a4684112676c..86ce22417e0d 100644
--- a/tools/testing/selftests/rseq/rseq.h
+++ b/tools/testing/selftests/rseq/rseq.h
@@ -133,17 +133,27 @@ static inline uint32_t rseq_current_cpu(void)
133 return cpu; 133 return cpu;
134} 134}
135 135
136static inline void rseq_clear_rseq_cs(void)
137{
138#ifdef __LP64__
139 __rseq_abi.rseq_cs.ptr = 0;
140#else
141 __rseq_abi.rseq_cs.ptr.ptr32 = 0;
142#endif
143}
144
136/* 145/*
137 * rseq_prepare_unload() should be invoked by each thread using rseq_finish*() 146 * rseq_prepare_unload() should be invoked by each thread executing a rseq
138 * at least once between their last rseq_finish*() and library unload of the 147 * critical section at least once between their last critical section and
139 * library defining the rseq critical section (struct rseq_cs). This also 148 * library unload of the library defining the rseq critical section
140 * applies to use of rseq in code generated by JIT: rseq_prepare_unload() 149 * (struct rseq_cs). This also applies to use of rseq in code generated by
141 * should be invoked at least once by each thread using rseq_finish*() before 150 * JIT: rseq_prepare_unload() should be invoked at least once by each
142 * reclaim of the memory holding the struct rseq_cs. 151 * thread executing a rseq critical section before reclaim of the memory
152 * holding the struct rseq_cs.
143 */ 153 */
144static inline void rseq_prepare_unload(void) 154static inline void rseq_prepare_unload(void)
145{ 155{
146 __rseq_abi.rseq_cs = 0; 156 rseq_clear_rseq_cs();
147} 157}
148 158
149#endif /* RSEQ_H_ */ 159#endif /* RSEQ_H_ */