linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Andrey Konovalov <andreyknvl@gmail.com>
Cc: "Peter Collingbourne" <pcc@google.com>,
	"袁帅(Shuai Yuan)" <yuanshuai@zeku.com>,
	"Dmitry Vyukov" <dvyukov@google.com>,
	"欧阳炜钊(Weizhao Ouyang)" <ouyangweizhao@zeku.com>,
	"Andrey Ryabinin" <ryabinin.a.a@gmail.com>,
	"Alexander Potapenko" <glider@google.com>,
	"Vincenzo Frascino" <vincenzo.frascino@arm.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"kasan-dev@googlegroups.com" <kasan-dev@googlegroups.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Weizhao Ouyang" <o451686892@gmail.com>,
	"任立鹏(Peng Ren)" <renlipeng@zeku.com>
Subject: Re: [PATCH v2] kasan: fix deadlock in start_report()
Date: Wed, 15 Mar 2023 16:14:08 +0000	[thread overview]
Message-ID: <ZBHu0Jk/erSOhD7e@arm.com> (raw)
In-Reply-To: <CA+fCnZdFZ0w33GcUWRfWhNmYkhszQ0gwVKGeY0uSOzBEJJe27A@mail.gmail.com>

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


      reply	other threads:[~2023-03-15 16:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230209031159.2337445-1-ouyangweizhao@zeku.com>
2023-02-09  8:55 ` Dmitry Vyukov
     [not found]   ` <93b94f59016145adbb1e01311a1103f8@zeku.com>
2023-02-09 10:44     ` Dmitry Vyukov
2023-02-09 22:54       ` Andrey Konovalov
     [not found]         ` <b058a424e46d4f94a1f2fdc61292606b@zeku.com>
2023-02-15 13:22           ` 袁帅(Shuai Yuan)
2023-02-27  2:13             ` Andrey Konovalov
2023-02-28 16:09               ` Catalin Marinas
2023-02-28 21:50                 ` Andrey Konovalov
2023-03-01 16:59                   ` Catalin Marinas
2023-03-10 23:42                     ` Andrey Konovalov
2023-03-15 16:14                       ` Catalin Marinas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZBHu0Jk/erSOhD7e@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=o451686892@gmail.com \
    --cc=ouyangweizhao@zeku.com \
    --cc=pcc@google.com \
    --cc=renlipeng@zeku.com \
    --cc=ryabinin.a.a@gmail.com \
    --cc=vincenzo.frascino@arm.com \
    --cc=yuanshuai@zeku.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox