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
This commit is contained in:
Linus Torvalds
2018-07-13 12:50:42 -07:00
4 changed files with 100 additions and 117 deletions

View File

@@ -133,17 +133,27 @@ static inline uint32_t rseq_current_cpu(void)
return cpu;
}
static inline void rseq_clear_rseq_cs(void)
{
#ifdef __LP64__
__rseq_abi.rseq_cs.ptr = 0;
#else
__rseq_abi.rseq_cs.ptr.ptr32 = 0;
#endif
}
/*
* rseq_prepare_unload() should be invoked by each thread using rseq_finish*()
* at least once between their last rseq_finish*() and library unload of the
* library defining the rseq critical section (struct rseq_cs). This also
* applies to use of rseq in code generated by JIT: rseq_prepare_unload()
* should be invoked at least once by each thread using rseq_finish*() before
* reclaim of the memory holding the struct rseq_cs.
* rseq_prepare_unload() should be invoked by each thread executing a rseq
* critical section at least once between their last critical section and
* library unload of the library defining the rseq critical section
* (struct rseq_cs). This also applies to use of rseq in code generated by
* JIT: rseq_prepare_unload() should be invoked at least once by each
* thread executing a rseq critical section before reclaim of the memory
* holding the struct rseq_cs.
*/
static inline void rseq_prepare_unload(void)
{
__rseq_abi.rseq_cs = 0;
rseq_clear_rseq_cs();
}
#endif /* RSEQ_H_ */