All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Davidlohr Bueso <dave@stgolabs.net>,
	Huacai Chen <chenhuacai@loongson.cn>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Darren Hart <dvhart@infradead.org>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	Xuefeng Li <lixuefeng@loongson.cn>,
	Huacai Chen <chenhuacai@gmail.com>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Hongchen Zhang <zhanghongchen@loongson.cn>
Subject: Re: [PATCH] futex: Fix fault_in_user_writeable()
Date: Mon, 16 Aug 2021 21:03:18 +0200	[thread overview]
Message-ID: <874kbpp5zd.ffs@tglx> (raw)
In-Reply-To: <20210816182750.26i535ilc6nef5k6@offworld>

On Mon, Aug 16 2021 at 11:27, Davidlohr Bueso wrote:
> On Mon, 16 Aug 2021, Huacai Chen wrote:
>
>>fault_in_user_writeable() should verify R/W access but only verify W. In
>>most archs W implies R, but not true in MIPS and LoongArch, so fix it.
>
> Yuck for a find_vma() in futex.c. If this is a problem in MIPS, shouldn't
> the fix be there? Furthermore it's stated that fault_in_user_writeable():
>
> "Fault in user address and verify RW access"

That seems to be wishful thinking given the fact that some architectures
do not imply R for FLAG_FAULT_WRITE.

> And you guys seem to have proposed it already:
>
> https://lore.kernel.org/linux-mips/20200630005845.1239974-1-liulichao@loongson.cn/

That's surely one way to fix that. If that does not work for whatever
reason, then we really don't want this find_vma() hack there, but rather
something like:

    if (IS_ENABLED(CONFIG_ARCH_USER_FAULT_VOODOO) && get_user(&tmp, uaddr))
	return -EFAULT;

Thanks,

        tglx

  reply	other threads:[~2021-08-16 19:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16  6:54 [PATCH] futex: Fix fault_in_user_writeable() Huacai Chen
2021-08-16 18:27 ` Davidlohr Bueso
2021-08-16 19:03   ` Thomas Gleixner [this message]
2021-08-17  1:53     ` Huacai Chen
2021-08-17  7:07       ` Thomas Gleixner
2021-08-17  7:38         ` Huacai Chen
2021-08-17  9:05           ` Thomas Gleixner
2021-08-17  9:45             ` Peter Zijlstra
2021-08-17 12:27               ` Huacai Chen
2021-08-17  9:22       ` Peter Zijlstra

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=874kbpp5zd.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=chenhuacai@gmail.com \
    --cc=chenhuacai@loongson.cn \
    --cc=dave@stgolabs.net \
    --cc=dvhart@infradead.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=lixuefeng@loongson.cn \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=zhanghongchen@loongson.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.