Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1592398
| From | Hoeun Ryu <hoeun.ryu@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC] arm64: support HAVE_ARCH_RARE_WRITE |
| Date | 2017-03-04 07:10 +0100 |
| Message-ID | <thb3b-4zi-5@gated-at.bofh.it> (permalink) |
| References | <tgAwG-3Yt-29@gated-at.bofh.it> <th2sV-6Bq-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
> On Mar 4, 2017, at 5:50 AM, Andy Lutomirski <luto@amacapital.net> wrote:
>
>> On Thu, Mar 2, 2017 at 7:00 AM, Hoeun Ryu <hoeun.ryu@gmail.com> wrote:
>> +unsigned long __rare_write_rw_alias_start = TASK_SIZE_64 / 4;
>> +
>> +__always_inline unsigned long __arch_rare_write_map(void)
>> +{
>> + struct mm_struct *mm = &rare_write_mm;
>> +
>> + preempt_disable();
>> +
>> + __switch_mm(mm);
>
> ...
>
>> +__always_inline unsigned long __arch_rare_write_unmap(void)
>> +{
>> + struct mm_struct *mm = current->active_mm;
>> +
>> + __switch_mm(mm);
>> +
>
> This reminds me: this code imposes constraints on the context in which
> it's called. I'd advise making it very explicit, asserting
> correctness, and putting the onus on the caller to set things up. For
> example:
>
> DEBUG_LOCKS_WARN_ON(preemptible() || in_interrupt() || in_nmi());
>
OK. I will add some onus in the next version.
> in both the map and unmap functions, along with getting rid of the
> preempt_disable(). I don't think we want the preempt-disabledness to
> depend on the arch. The generic non-arch rare_write helpers can do
> the preempt_disable().
>
I think I can fix this in the next version when Kees send the next version of RFC.
> This code also won't work if the mm is wacky when called. On x86, we could do:
>
> DEBUG_LOCKS_WARN_ON(read_cr3() != current->active_mm->pgd);
>
> or similar (since that surely doesn't compile as is).
>
> --Andy
Thank you for the review.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[RFC] arm64: support HAVE_ARCH_RARE_WRITE Hoeun Ryu <hoeun.ryu@gmail.com> - 2017-03-02 16:10 +0100
Re: [RFC] arm64: support HAVE_ARCH_RARE_WRITE Kees Cook <keescook@chromium.org> - 2017-03-03 07:00 +0100
Re: [RFC] arm64: support HAVE_ARCH_RARE_WRITE Hoeun Ryu <hoeun.ryu@gmail.com> - 2017-03-04 07:00 +0100
Re: [RFC] arm64: support HAVE_ARCH_RARE_WRITE Andy Lutomirski <luto@amacapital.net> - 2017-03-03 22:00 +0100
Re: [RFC] arm64: support HAVE_ARCH_RARE_WRITE Hoeun Ryu <hoeun.ryu@gmail.com> - 2017-03-04 07:10 +0100
csiph-web