public inbox for linux-sgx@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Thorsten Blum <thorsten.blum@linux.dev>,
	kernel test robot <oliver.sang@intel.com>
Cc: oe-lkp@lists.linux.dev, lkp@intel.com, linux-sgx@vger.kernel.org,
	Jarkko Sakkinen <jarkko@kernel.org>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/sgx: Replace kmalloc() + copy_from_user() with memdup_user()
Date: Thu, 25 Sep 2025 08:37:22 -0700	[thread overview]
Message-ID: <ee907cef-684b-49a3-84c3-ba2efead9caa@intel.com> (raw)
In-Reply-To: <9A7F15AA-836C-457B-BFD9-B37497B16A27@linux.dev>

On 9/22/25 06:18, Thorsten Blum wrote:
>> The kernel config and materials to reproduce are available at:
>> https://download.01.org/0day-ci/archive/20250921/202509211747.1edb60f-
>> lkp@intel.com
> Can someone explain why this test is failing?
> 
> After some digging into SGX, I think it's the different allocators
> kmalloc() vs. kmem_buckets_alloc_track_caller(), but I'm not exactly
> sure why it fails.
> 
> Perhaps we should add a comment for anyone else trying to replace this?

I can't fathom that this is an SGX problem. The SGX code is as dirt
simple as it gets:

	secs = kmalloc(PAGE_SIZE, GFP_KERNEL);

There are literally thousands of those in the kernel.

memdup_user() look suspicious to me, though:

        p = kmem_buckets_alloc_track_caller(...GFP_USER | __GFP_NOWARN);

That GFP_USER looks wrong. It shouldn't matter _much_ in practice, but
it's allocating kernel memory with GFP_USER.

      reply	other threads:[~2025-09-25 15:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-08 20:12 [PATCH] x86/sgx: Replace kmalloc() + copy_from_user() with memdup_user() Thorsten Blum
2025-09-10 17:12 ` Jarkko Sakkinen
2025-09-21  9:59 ` kernel test robot
2025-09-22 13:18   ` Thorsten Blum
2025-09-25 15:37     ` Dave Hansen [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=ee907cef-684b-49a3-84c3-ba2efead9caa@intel.com \
    --to=dave.hansen@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jarkko@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mingo@redhat.com \
    --cc=oe-lkp@lists.linux.dev \
    --cc=oliver.sang@intel.com \
    --cc=tglx@linutronix.de \
    --cc=thorsten.blum@linux.dev \
    --cc=x86@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