[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <9A7F15AA-836C-457B-BFD9-B37497B16A27@linux.dev>
Date: Mon, 22 Sep 2025 15:18:32 +0200
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: kernel test robot <oliver.sang@...el.com>
Cc: oe-lkp@...ts.linux.dev,
lkp@...el.com,
linux-sgx@...r.kernel.org,
Jarkko Sakkinen <jarkko@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/sgx: Replace kmalloc() + copy_from_user() with
memdup_user()
On 21. Sep 2025, at 11:59, kernel test robot wrote:
>
> kernel test robot noticed "kernel-selftests.sgx.test_sgx.enclave.tcs_entry.fail" on:
>
> commit: c407010c166bcf30f9400bf0a4a4ec81c0149b81 ("[PATCH] x86/sgx: Replace kmalloc() + copy_from_user() with memdup_user()")
> url: https://github.com/intel-lab-lkp/linux/commits/Thorsten-Blum/x86-sgx-Replace-kmalloc-copy_from_user-with-memdup_user/20250909-041627
> base: https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git ed16618c380c32c68c06186d0ccbb0d5e0586e59
> patch link: https://lore.kernel.org/all/20250908201229.440105-2-thorsten.blum@linux.dev/
> patch subject: [PATCH] x86/sgx: Replace kmalloc() + copy_from_user() with memdup_user()
>
> in testcase: kernel-selftests
> version: kernel-selftests-x86_64-79e8447ec662-1_20250914
> with following parameters:
>
> group: sgx
>
>
>
> config: x86_64-rhel-9.4-kselftests
> compiler: gcc-14
> test machine: 16 threads 1 sockets Intel(R) Xeon(R) E-2278G CPU @ 3.40GHz (Coffee Lake-E) with 32G memory
>
> (please refer to attached dmesg/kmsg for entire log/backtrace)
>
>
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <oliver.sang@...el.com>
> | Closes: https://lore.kernel.org/oe-lkp/202509211747.1edb60f-lkp@intel.com
>
>
> besides, we also observed below tests failed on this commit while passing
> without this patch.
>
> =========================================================================================
> tbox_group/testcase/rootfs/kconfig/compiler/group:
> lkp-cfl-e1/kernel-selftests/debian-13-x86_64-20250902.cgz/x86_64-rhel-9.4-kselftests/gcc-14/sgx
>
> ed16618c380c32c6 c407010c166bcf30f9400bf0a4a
> ---------------- ---------------------------
> fail:runs %reproduction fail:runs
> | | |
> :6 100% 6:6 kernel-selftests.sgx.test_sgx.enclave.clobbered_vdso.fail
> :6 100% 6:6 kernel-selftests.sgx.test_sgx.enclave.clobbered_vdso_and_user_function.fail
> :6 100% 6:6 kernel-selftests.sgx.test_sgx.enclave.pte_permissions.fail
> :6 100% 6:6 kernel-selftests.sgx.test_sgx.enclave.tcs_entry.fail
> :6 100% 6:6 kernel-selftests.sgx.test_sgx.enclave.unclobbered_vdso.fail
> :6 100% 6:6 kernel-selftests.sgx.test_sgx.enclave.unclobbered_vdso_oversubscribed.fail
> :6 100% 6:6 kernel-selftests.sgx.test_sgx.fail
>
>
>
> # # RUN enclave.tcs_entry ...
> # SGX_IOC_ENCLAVE_CREATE failed: Input/output error
> # # main.c:231:tcs_entry:0x0000000000000000 0x0000000000002000 0x03
> # # main.c:231:tcs_entry:0x0000000000002000 0x0000000000002000 0x05
> # # main.c:231:tcs_entry:0x0000000000004000 0x0000000000007000 0x03
> # # main.c:231:tcs_entry:0x000000000000b000 0x0000000000001000 0x03
> # # main.c:246:tcs_entry:Failed to initialize the test enclave.
> # # main.c:578:tcs_entry:Expected 0 (0) != setup_test_encl(ENCL_HEAP_SIZE_DEFAULT, &self->encl, _metadata) (0)
> # # tcs_entry: Test terminated by assertion
> # # FAIL enclave.tcs_entry
> # not ok 6 enclave.tcs_entry
>
>
>
> 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?
Thanks,
Thorsten
Powered by blists - more mailing lists