public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Jann Horn <jannh@google.com>
Cc: Andrei Vagin <avagin@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] time/namespace: Forbid timens page faults under kthread_use_mm()
Date: Tue, 29 Nov 2022 22:18:28 +0100	[thread overview]
Message-ID: <87fse1v4rf.ffs@tglx> (raw)
In-Reply-To: <20221129191839.2471308-2-jannh@google.com>

On Tue, Nov 29 2022 at 20:18, Jann Horn wrote:

> find_timens_vvar_page() doesn't work when current's timens does not match
> the timens associated with current->mm.
> v6 of the series adding this code [1] had some complicated code to deal
> with this case, but v7 [2] removed that.
>
> Since the vvar region is designed to only be accessed by vDSO code, and
> vDSO code can't run in kthread context, it should be fine to error out in
> this case.

Should? Either it is correct or not.

But the way more interesting question is:
  
>  struct page *find_timens_vvar_page(struct vm_area_struct *vma)
>  {
> +	/*
> +	 * We can't handle faults where current's timens does not match the
> +	 * timens associated with the mm_struct. This can happen if a page fault
> +	 * occurs in a kthread that is using kthread_use_mm().
> +	 */

How does a kthread, which obvioulsy did kthread_use_mm(), end up trying to
fault in the time namespace vvar page?

It's probably something nasty, but the changelog has a big information
void.

It neither answers the obvious question why this is a problem of the
time namespace vvar page and not a general issue versus a kthread, which
borrowed a user mm, ending up in vdso_fault() in the first place?

None of those VDSO (user space) addresses are subject to be faulted in
by anything else than the associated user space task(s).

Thanks,

        tglx

  reply	other threads:[~2022-11-29 21:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29 19:18 [PATCH 1/2] time/namespace: Refactor copy-pasted helper into one copy Jann Horn
2022-11-29 19:18 ` [PATCH 2/2] time/namespace: Forbid timens page faults under kthread_use_mm() Jann Horn
2022-11-29 21:18   ` Thomas Gleixner [this message]
2022-11-29 22:28     ` Jann Horn
2022-11-29 22:34       ` Jann Horn
2022-11-30  0:09         ` Thomas Gleixner
2022-11-30  0:07       ` Thomas Gleixner
2022-11-30 22:48         ` David Laight
2022-12-01  9:31           ` Jann Horn
2022-11-30 10:15 ` [PATCH 1/2] time/namespace: Refactor copy-pasted helper into one copy Jann Horn
2022-11-30 10:57   ` Thomas Gleixner

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=87fse1v4rf.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=avagin@gmail.com \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    /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