public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <oliver.sang@intel.com>
To: <kingdix10@qq.com>
Cc: <oe-lkp@lists.linux.dev>, <lkp@intel.com>,
	<linux-kernel@vger.kernel.org>, <akpm@linux-foundation.org>,
	<andriy.shevchenko@linux.intel.com>,
	<ilpo.jarvinen@linux.intel.com>, <bhelgaas@google.com>,
	<mika.westerberg@linux.intel.com>, <huang.ying.caritas@gmail.com>,
	<jhubbard@nvidia.com>, <peterz@infradead.org>,
	King Dix <kingdix10@qq.com>, <oliver.sang@intel.com>
Subject: Re: [PATCH] resource: use kstrdup_const to prevent wild pointer issues
Date: Fri, 3 Jan 2025 16:38:42 +0800	[thread overview]
Message-ID: <202501031658.51df654c-lkp@intel.com> (raw)
In-Reply-To: <tencent_3BD5C192A0E62121DE44D1A05A9C9ECB7C06@qq.com>



Hello,

kernel test robot noticed "BUG:sleeping_function_called_from_invalid_context_at_include/linux/sched/mm.h" on:

commit: 85f3f9e1bca4488dcf0032c11c2d0b59352971a0 ("[PATCH] resource: use kstrdup_const to prevent wild pointer issues")
url: https://github.com/intel-lab-lkp/linux/commits/kingdix10-qq-com/resource-use-kstrdup_const-to-prevent-wild-pointer-issues/20250101-215639
base: https://git.kernel.org/cgit/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/all/tencent_3BD5C192A0E62121DE44D1A05A9C9ECB7C06@qq.com/
patch subject: [PATCH] resource: use kstrdup_const to prevent wild pointer issues

in testcase: boot

config: x86_64-randconfig-161-20250102
compiler: gcc-12
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G

(please refer to attached dmesg/kmsg for entire log/backtrace)


+-------------------------------------------------------------------------------+------------+------------+
|                                                                               | d77847ea04 | 85f3f9e1bc |
+-------------------------------------------------------------------------------+------------+------------+
| BUG:sleeping_function_called_from_invalid_context_at_include/linux/sched/mm.h | 0          | 18         |
+-------------------------------------------------------------------------------+------------+------------+


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@intel.com>
| Closes: https://lore.kernel.org/oe-lkp/202501031658.51df654c-lkp@intel.com


[   24.398603][    T1] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:321
[   24.399830][    T1] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1, name: swapper/0
[   24.400487][    T1] preempt_count: 1, expected: 0
[   24.400919][    T1] RCU nest depth: 0, expected: 0
[   24.401295][    T1] 2 locks held by swapper/0/1:
[ 24.401659][ T1] #0: ffff8881003600f0 (&dev->mutex){....}-{4:4}, at: __driver_attach (drivers/base/dd.c:1216 drivers/base/dd.c:1156)
[ 24.402502][ T1] #1: ffffffff95689c58 (resource_lock){++++}-{3:3}, at: __request_region (kernel/resource.c:1264 kernel/resource.c:1330)
[   24.403255][    T1] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Tainted: G        W       T  6.13.0-rc4-00416-g85f3f9e1bca4 #2
[   24.404161][    T1] Tainted: [W]=WARN, [T]=RANDSTRUCT
[   24.404599][    T1] Call Trace:
[   24.404862][    T1]  <TASK>
[ 24.404862][ T1] dump_stack_lvl (lib/dump_stack.c:123)
[ 24.404862][ T1] dump_stack (lib/dump_stack.c:130)
[ 24.404862][ T1] __might_resched (kernel/sched/core.c:8767)
[ 24.404862][ T1] slab_alloc_node+0x12d/0x1b0
[ 24.404862][ T1] ? kstrdup_const (mm/util.c:101)
[ 24.404862][ T1] __kmalloc_node_track_caller_noprof (mm/slub.c:4293 mm/slub.c:4313)
[ 24.404862][ T1] kstrdup (mm/util.c:61 mm/util.c:81)
[ 24.404862][ T1] kstrdup_const (mm/util.c:101)
[ 24.404862][ T1] __request_region (kernel/resource.c:1266 kernel/resource.c:1330)
[ 24.404862][ T1] ? device_register (drivers/base/core.c:3748)
[ 24.404862][ T1] ? wake_up_q (kernel/sched/core.c:7088)
[ 24.404862][ T1] __parport_pc_probe_port (drivers/parport/parport_pc.c:2073)
[ 24.404862][ T1] ? __dev_printk (drivers/base/core.c:4962)
[ 24.404862][ T1] ? _dev_info (drivers/base/core.c:5004)
[ 24.404862][ T1] ? pnp_device_probe (drivers/pnp/driver.c:95)
[ 24.404862][ T1] parport_pc_pnp_probe (drivers/parport/parport_pc.c:2917)
[ 24.404862][ T1] parport_pc_pnp_probe (drivers/parport/parport_pc.c:3039)
[ 24.404862][ T1] pnp_device_probe (drivers/pnp/driver.c:111)
[ 24.404862][ T1] really_probe (drivers/base/dd.c:579 drivers/base/dd.c:658)
[ 24.404862][ T1] __driver_probe_device (drivers/base/dd.c:800)
[ 24.404862][ T1] driver_probe_device (drivers/base/dd.c:830)
[ 24.404862][ T1] __driver_attach (drivers/base/dd.c:1217 drivers/base/dd.c:1156)
[ 24.404862][ T1] ? __device_attach_driver (drivers/base/dd.c:1157)
[ 24.404862][ T1] bus_for_each_dev (drivers/base/bus.c:369)
[ 24.404862][ T1] driver_attach (drivers/base/dd.c:1235)
[ 24.404862][ T1] bus_add_driver (drivers/base/bus.c:675)
[ 24.404862][ T1] driver_register (drivers/base/driver.c:246)
[ 24.404862][ T1] pnp_register_driver (drivers/pnp/driver.c:281)
[ 24.404862][ T1] parport_pc_find_ports (drivers/parport/parport_pc.c:3118)
[ 24.404862][ T1] ? driver_register (drivers/base/driver.c:258)
[ 24.404862][ T1] parport_pc_init (drivers/parport/parport_pc.c:3380)
[ 24.404862][ T1] ? parport_pc_find_ports (drivers/parport/parport_pc.c:3354)
[ 24.404862][ T1] do_one_initcall (init/main.c:1266)
[ 24.404862][ T1] ? rcu_is_watching (arch/x86/include/asm/atomic.h:23 include/linux/atomic/atomic-arch-fallback.h:457 include/linux/context_tracking.h:128 kernel/rcu/tree.c:737)
[ 24.404862][ T1] do_initcalls (init/main.c:1327 init/main.c:1344)
[ 24.404862][ T1] ? rdinit_setup (init/main.c:1314)
[ 24.404862][ T1] ? rest_init (init/main.c:1458)
[ 24.404862][ T1] kernel_init_freeable (init/main.c:1581)
[ 24.404862][ T1] kernel_init (init/main.c:1468)
[ 24.404862][ T1] ret_from_fork (arch/x86/kernel/process.c:153)
[ 24.404862][ T1] ? rest_init (init/main.c:1458)
[ 24.404862][ T1] ret_from_fork_asm (arch/x86/entry/entry_64.S:254)
[   24.404862][    T1]  </TASK>


The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20250103/202501031658.51df654c-lkp@intel.com



-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


      parent reply	other threads:[~2025-01-03  8:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-01 13:49 [PATCH] resource: use kstrdup_const to prevent wild pointer issues kingdix10
2025-01-02  1:59 ` Huang, Ying
2025-01-02 23:33   ` Andrew Morton
2025-01-03  8:38 ` kernel test robot [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=202501031658.51df654c-lkp@intel.com \
    --to=oliver.sang@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=huang.ying.caritas@gmail.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jhubbard@nvidia.com \
    --cc=kingdix10@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=oe-lkp@lists.linux.dev \
    --cc=peterz@infradead.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