mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ben Dooks <ben.dooks@codethink.co.uk>
To: Charlie Jenkins <charlie@rivosinc.com>,
	Cyril Bur <cyrilbur@tenstorrent.com>
Cc: palmer@dabbelt.com, aou@eecs.berkeley.edu,
	paul.walmsley@sifive.com, linux-riscv@lists.infradead.org,
	linux-kernel@vger.kernel.org, Jisheng Zhang <jszhang@kernel.org>
Subject: Re: [PATCH v2 1/4] riscv: implement user_access_begin and families
Date: Wed, 5 Feb 2025 15:08:45 +0000	[thread overview]
Message-ID: <b45aab1e-6d37-4027-9a15-4fa917d806b9@codethink.co.uk> (raw)
In-Reply-To: <Z4rl8BgoV8tygCn9@ghost>

On 17/01/2025 23:21, Charlie Jenkins wrote:
> On Mon, Nov 18, 2024 at 11:01:09PM +0000, Cyril Bur wrote:
>> From: Jisheng Zhang <jszhang@kernel.org>
>>
>> Currently, when a function like strncpy_from_user() is called,
>> the userspace access protection is disabled and enabled
>> for every word read.
>>
>> By implementing user_access_begin and families, the protection
>> is disabled at the beginning of the copy and enabled at the end.
>>
>> The __inttype macro is borrowed from x86 implementation.
>>
>> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
>> Signed-off-by: Cyril Bur <cyrilbur@tenstorrent.com>

If we're doing this, then saving the STATUS.SUM flag is going to
be more important than before. We had this discussion when the
initial user-access with syzbot stress testing turned up.

We partially fixed this by rewriting the ordering in the __put_user
function to stop the 'x' argument being evaluated inside the area
where SUM is enabled, but this is going to make the window of
opportunity of a thread switch much bigger and the bug will just
come back and bite harder.

If you want I can look at re-doing my original patch and resubmitting.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

  reply	other threads:[~2025-02-05 15:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-18 23:01 [PATCH v2 0/4] riscv: uaccess: optimizations Cyril Bur
2024-11-18 23:01 ` [PATCH v2 1/4] riscv: implement user_access_begin and families Cyril Bur
2025-01-17 23:21   ` Charlie Jenkins
2025-02-05 15:08     ` Ben Dooks [this message]
2025-02-13 17:07       ` Cyril Bur
2025-02-13 17:16         ` Ben Dooks
2025-02-18 19:21           ` Cyril Bur
2024-11-18 23:01 ` [PATCH v2 2/4] riscv: uaccess: use input constraints for ptr of __put_user Cyril Bur
2025-01-17 23:23   ` Charlie Jenkins
2025-01-17 23:34   ` Jessica Clarke
2025-01-31  1:31     ` Cyril Bur
2025-01-31  6:00       ` Charlie Jenkins
2024-11-18 23:01 ` [PATCH v2 3/4] riscv: uaccess: use 'asm goto' for put_user() Cyril Bur
2025-01-17 23:24   ` Charlie Jenkins
2024-11-18 23:01 ` [PATCH v2 4/4] riscv: uaccess: use 'asm goto output' for get_user Cyril Bur
2025-01-17 23:24   ` Charlie Jenkins

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=b45aab1e-6d37-4027-9a15-4fa917d806b9@codethink.co.uk \
    --to=ben.dooks@codethink.co.uk \
    --cc=aou@eecs.berkeley.edu \
    --cc=charlie@rivosinc.com \
    --cc=cyrilbur@tenstorrent.com \
    --cc=jszhang@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.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

all inboxes | Powered by JetHome®