All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: "V, Narasimhan" <Narasimhan.V@amd.com>
To: Feng Tang <feng.tang@intel.com>
Cc: "linux-next@vger.kernel.org" <linux-next@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"Aithal, Srikanth" <Srikanth.Aithal@amd.com>,
	"Petkov, Borislav" <Borislav.Petkov@amd.com>
Subject: Re: Boot failure with kernel BUG at mm/usercopy.c on next-20240325
Date: Mon, 25 Mar 2024 17:48:48 +0000	[thread overview]
Message-ID: <DM4PR12MB5086B9BDBF32D53DF226CBF489362@DM4PR12MB5086.namprd12.prod.outlook.com> (raw)
In-Reply-To: <ZgGYFRuzuaawyGPm@feng-clx.sh.intel.com>

[AMD Official Use Only - General]

________________________________________
From: Feng Tang <feng.tang@intel.com>
Sent: Monday, March 25, 2024 08:58 PM
To: V, Narasimhan
Cc: linux-next@vger.kernel.org; linux-mm@kvack.org; Aithal, Srikanth; Petkov, Borislav
Subject: Re: Boot failure with kernel BUG at mm/usercopy.c on next-20240325

On Mon, Mar 25, 2024 at 08:40:20PM +0800, V, Narasimhan wrote:
> [AMD Official Use Only - General]
>
> Hi,
> There is a boot failure as below.
> On bisecting, the bad commit is found to be 328c801335d5f7edf2a3c9c331ddf8978f21e2a7.
> Boots fine if we revert the above bad commit.
>
>
> kernel BUG at mm/usercopy.c:102!
> invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
> CPU: 15 PID: 567 Comm: systemd-udevd Not tainted 6.9.0-rc1-next-20240325-1711333827684 #1
> Hardware name: AMD Corporation Shale96/Shale96, BIOS RSH100BD 12/11/2023
> RIP: 0010:usercopy_abort+0x72/0x90
>  __check_heap_object+0xd6/0x110
>  __check_object_size+0x28a/0x2f0
>  ? srso_alias_return_thunk+0x5/0xfbef5
>  __x64_sys_sched_getaffinity+0xda/0x120
>  do_syscall_64+0x76/0x120

> I met similar issue with QEMU boot test, and seems the root cause is
> the 'cpumask' slub object could be copied to user space, and fail
> the usercopy check. With below patch, the panic is gone in my test.

> Could you give it a try?

Hi Feng, tested this patch and works fine for me as well.


> Thanks,
> Feng

---
diff --git a/lib/cpumask.c b/lib/cpumask.c
index f3f68c45caba..dcadcf7adc7c 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -62,8 +62,8 @@ static struct kmem_cache *cpumask_cache __ro_after_init;

 int __init cpumask_cache_init(void)
 {
-       cpumask_cache = kmem_cache_create("cpumask", cpumask_size(), sizeof(long),
-                                         SLAB_HWCACHE_ALIGN, NULL);
+       cpumask_cache = kmem_cache_create_usercopy("cpumask", cpumask_size(), sizeof(long),
+                                         SLAB_HWCACHE_ALIGN, 0, cpumask_size(), NULL);

        return cpumask_cache ? 0 : -ENOMEM;
 }


  reply	other threads:[~2024-03-25 17:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-25 12:40 Boot failure with kernel BUG at mm/usercopy.c on next-20240325 V, Narasimhan
2024-03-25 12:50 ` Borislav Petkov
2024-03-25 18:34   ` Andrew Morton
2024-03-25 20:37     ` Borislav Petkov
2024-03-26  2:30       ` Feng Tang
2024-03-26 19:56         ` Andrew Morton
2024-03-25 15:28 ` Feng Tang
2024-03-25 17:48   ` V, Narasimhan [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-03-25 12:36 V, Narasimhan

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=DM4PR12MB5086B9BDBF32D53DF226CBF489362@DM4PR12MB5086.namprd12.prod.outlook.com \
    --to=narasimhan.v@amd.com \
    --cc=Borislav.Petkov@amd.com \
    --cc=Srikanth.Aithal@amd.com \
    --cc=feng.tang@intel.com \
    --cc=linux-mm@kvack.org \
    --cc=linux-next@vger.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 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.