lkml.org 
[lkml]   [2019]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v3 3/4] uaccess: Check no rescheduling function is called in unsafe region
    On Wed, Feb 13, 2019 at 02:00:26PM +0000, Will Deacon wrote:
    > > This; how is getting preempted fundamentally different from scheduling
    > > ourselves?
    >
    > The difference is because getting preempted in the sequence above is
    > triggered off the back of an interrupt. On arm64, and I think also on x86,
    > the user access state (SMAP or PAN) is saved and restored across exceptions
    > but not across context switch. Consequently, taking an irq in a
    > user_access_{begin,end} section and then scheduling is fine, but calling
    > schedule directly within such a section is not.

    So how's this then:

    if (user_access_begin()) {

    preempt_disable();

    <IRQ>
    set_need_resched();
    </IRQ no preempt>

    preempt_enable()
    __schedule();

    user_access_end();
    }

    That _should_ work just fine but explodes with the proposed nonsense.

    \
     
     \ /
      Last update: 2019-02-13 15:19    [W:5.422 / U:0.024 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site