[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <190540378.14355.1576873926104.JavaMail.zimbra@efficios.com>
Date: Fri, 20 Dec 2019 15:32:06 -0500 (EST)
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Shuah Khan <skhan@...uxfoundation.org>
Cc: Thomas Gleixner <tglx@...utronix.de>,
linux-kernel <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
paulmck <paulmck@...ux.ibm.com>,
Boqun Feng <boqun.feng@...il.com>,
"H. Peter Anvin" <hpa@...or.com>, Paul Turner <pjt@...gle.com>,
linux-api <linux-api@...r.kernel.org>,
stable <stable@...r.kernel.org>,
Florian Weimer <fw@...eb.enyo.de>,
Dmitry Vyukov <dvyukov@...gle.com>
Subject: Re: [PATCH for 5.5 2/2] rseq/selftests: Clarify
rseq_prepare_unload() helper requirements
----- On Dec 20, 2019, at 3:27 PM, Shuah Khan skhan@...uxfoundation.org wrote:
> Hi Mathieu,
>
> On 12/20/19 1:12 PM, Mathieu Desnoyers wrote:
>> The rseq.h UAPI now documents that the rseq_cs field must be cleared
>> before reclaiming memory that contains the targeted struct rseq_cs, but
>> also that the rseq_cs field must be cleared before reclaiming memory of
>> the code pointed to by the rseq_cs start_ip and post_commit_offset
>> fields.
>>
>> While we can expect that use of dlclose(3) will typically unmap
>> both struct rseq_cs and its associated code at once, nothing would
>> theoretically prevent a JIT from reclaiming the code without
>> reclaiming the struct rseq_cs, which would erroneously allow the
>> kernel to consider new code which is not a rseq critical section
>> as a rseq critical section following a code reclaim.
>>
>> Suggested-by: Florian Weimer <fw@...eb.enyo.de>
>> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
>> Cc: Shuah Khan <skhan@...uxfoundation.org>
>> Cc: Florian Weimer <fw@...eb.enyo.de>
>> Cc: Thomas Gleixner <tglx@...utronix.de>
>> Cc: Peter Zijlstra (Intel) <peterz@...radead.org>
>> Cc: "Paul E. McKenney" <paulmck@...ux.ibm.com>
>> Cc: Boqun Feng <boqun.feng@...il.com>
>> Cc: "H . Peter Anvin" <hpa@...or.com>
>> Cc: Paul Turner <pjt@...gle.com>
>> Cc: Dmitry Vyukov <dvyukov@...gle.com>
>> ---
>> tools/testing/selftests/rseq/rseq.h | 12 +++++++-----
>> 1 file changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/tools/testing/selftests/rseq/rseq.h
>> b/tools/testing/selftests/rseq/rseq.h
>> index d40d60e7499e..15cbd51d0818 100644
>> --- a/tools/testing/selftests/rseq/rseq.h
>> +++ b/tools/testing/selftests/rseq/rseq.h
>> @@ -149,11 +149,13 @@ static inline void rseq_clear_rseq_cs(void)
>> /*
>> * 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.
>> + * library unload of the library defining the rseq critical section (struct
>> + * rseq_cs) or the code refered to by the struct rseq_cs start_ip and
>
> Nit: referred instead of refered
Good catch. I've done the same error in patch 1/2. I'll update both and
resend.
Thanks!
Mathieu
>
>> + * post_commit_offset fields. 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 or reclaim of the code pointed to by struct
>> + * rseq_cs start_ip and post_commit_offset fields.
>> */
>> static inline void rseq_prepare_unload(void)
>> {
>>
>
> thanks,
> -- Shuah
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Powered by blists - more mailing lists