lkml.org 
[lkml]   [2023]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v2] kasan: fix deadlock in start_report()
    On Sat, Mar 11, 2023 at 12:42:20AM +0100, Andrey Konovalov wrote:
    > On Wed, Mar 1, 2023 at 6:00 PM Catalin Marinas <catalin.marinas@arm.com> wrote:
    > > Yes. I'm including Vincenzo's patch below (part of fixing some potential
    > > strscpy() faults with its unaligned accesses eager reading; we'll get to
    > > posting that eventually). You can add some arch_kasan_enable/disable()
    > > macros on top and feel free to include the patch below.
    >
    > Ah, perfect! I'll send a patchset soon. Thanks!
    >
    > > Now, I wonder whether we should link those into kasan_disable_current().
    > > These functions only deal with the depth for KASAN_SW_TAGS but it would
    > > make sense for KASAN_HW_TAGS to enable tag-check-override so that we
    > > don't need to bother with a match-all tags on pointer dereferencing.
    >
    > Using these TCO routines requires having (at least) migration disabled, right?

    Not necessarily. The TCO is set per CPU and disabling preemption (I
    don't think migration is sufficient) would work but these routines are
    also called on a uaccess fault path, so it needs to be preemptible. We
    used to clear TCO on exception entry prior to commit 38ddf7dafaea
    ("arm64: mte: avoid clearing PSTATE.TCO on entry unless necessary") but
    we restore it anyway on exception return.

    I think the only problem is if between these routines, we invoke
    cond_resched() directly. Not sure what the kasan code does but disabling
    preemption should avoid a reschedule. Another option is for
    mte_thread_switch() to context switch the TCO state.

    --
    Catalin

    \
     
     \ /
      Last update: 2023-03-27 01:01    [W:5.148 / U:0.076 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site