mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Gow <david@davidgow.net>
To: "Thomas Weißschuh" <linux@weissschuh.net>,
	"Michal Simek" <monstr@monstr.eu>,
	"Brendan Higgins" <brendan.higgins@linux.dev>,
	"Rae Moar" <raemoar63@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	kunit-dev@googlegroups.com
Subject: Re: [PATCH 1/4] microblaze: uaccess: Zero out destination on failed get_user()
Date: Wed, 5 Aug 2026 21:59:00 +0800	[thread overview]
Message-ID: <2eb03d7c-08ee-4e59-a8ea-58bd448012a5@davidgow.net> (raw)
In-Reply-To: <20260804-kunit-microblaze-v1-1-6dcdfe12eb40@weissschuh.net>

Le 04/08/2026 à 13:32, Thomas Weißschuh a écrit :
> On failure get_user() is supposed to zero out the destination variable.
> This is documented in the kdoc of the microblaze get_user()
> implementation and validated in lib/tests/usercopy_kunit.c.
> 
> Currently that zeroing is missing.
> 
> Add it.
> 
> Fixes: 0d6de9532663 ("microblaze_mmu_v2: uaccess MMU update")
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---

This test seems to be the gift which keeps on giving. Every architecture 
seems to have had a buggy get_user() at some point.

Reviewed-by: David Gow <david@davidgow.net>

Cheers,
-- David

>   arch/microblaze/include/asm/uaccess.h | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h
> index afa0dd8d013f..77203af255e5 100644
> --- a/arch/microblaze/include/asm/uaccess.h
> +++ b/arch/microblaze/include/asm/uaccess.h
> @@ -95,7 +95,8 @@ extern long __user_bad(void);
>   #define get_user(x, ptr) ({				\
>   	const typeof(*(ptr)) __user *__gu_ptr = (ptr);	\
>   	access_ok(__gu_ptr, sizeof(*__gu_ptr)) ?	\
> -		__get_user(x, __gu_ptr) : -EFAULT;	\
> +		__get_user(x, __gu_ptr) :		\
> +		((x) = 0, -EFAULT);			\
>   })
>   
>   #define __get_user(x, ptr)						\
> 


  reply	other threads:[~2026-08-05 13:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-04  5:32 [PATCH 0/4] microblaze: KUnit support Thomas Weißschuh
2026-08-04  5:32 ` [PATCH 1/4] microblaze: uaccess: Zero out destination on failed get_user() Thomas Weißschuh
2026-08-05 13:59   ` David Gow [this message]
2026-08-04  5:32 ` [PATCH 2/4] microblaze: reset: Call POWER_OFF handlers Thomas Weißschuh
2026-08-05 13:59   ` David Gow
2026-08-04  5:32 ` [PATCH 3/4] microblaze: reset: Provide a power off handler through an unaligned PC Thomas Weißschuh
2026-08-05 13:59   ` David Gow
2026-08-04  5:32 ` [PATCH 4/4] kunit: qemu_configs: Add microblaze configuration Thomas Weißschuh
2026-08-05 13:59   ` David Gow
2026-08-05 19:18     ` Thomas Weißschuh

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=2eb03d7c-08ee-4e59-a8ea-58bd448012a5@davidgow.net \
    --to=david@davidgow.net \
    --cc=brendan.higgins@linux.dev \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=monstr@monstr.eu \
    --cc=raemoar63@gmail.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®