Skip to contentSkip to conversation

lkdtm: Add lockdep related crash tests

PATCH Superseded Tzung-Bi Shih 2 participants 2 messages Nov 14, 2025 – Nov 15, 2025

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lkdtm: Add lockdep related crash tests

Introduce various lockdep related crash tests.

---
 drivers/misc/lkdtm/Makefile  |  1 +
 drivers/misc/lkdtm/core.c    |  1 +
 drivers/misc/lkdtm/lkdtm.h   |  1 +
 drivers/misc/lkdtm/lockdep.c | 98 ++++++++++++++++++++++++++++++++++++
 4 files changed, 101 insertions(+)
 create mode 100644 drivers/misc/lkdtm/lockdep.c
drivers/misc/lkdtm/Makefile +1 -0
index 03ebe33185f9..830b71c8e6a0 100644
@@ -11,6 +11,7 @@ lkdtm-$(CONFIG_LKDTM)		+= usercopy.o
 lkdtm-$(CONFIG_LKDTM)		+= kstack_erase.o
 lkdtm-$(CONFIG_LKDTM)		+= cfi.o
 lkdtm-$(CONFIG_LKDTM)		+= fortify.o
+lkdtm-$(CONFIG_LKDTM)		+= lockdep.o
 lkdtm-$(CONFIG_PPC_64S_HASH_MMU)	+= powerpc.o
 
 KASAN_SANITIZE_stackleak.o	:= n
drivers/misc/lkdtm/core.c +1 -0
index 5732fd59a227..43e91388940f 100644
@@ -96,6 +96,7 @@ static const struct crashtype_category *crashtype_categories[] = {
 	&stackleak_crashtypes,
 	&cfi_crashtypes,
 	&fortify_crashtypes,
+	&lockdep_crashtypes,
 #ifdef CONFIG_PPC_64S_HASH_MMU
 	&powerpc_crashtypes,
 #endif
drivers/misc/lkdtm/lkdtm.h +1 -0
index 015e0484026b..d2d97e6f323e 100644
@@ -84,6 +84,7 @@ extern struct crashtype_category usercopy_crashtypes;
 extern struct crashtype_category stackleak_crashtypes;
 extern struct crashtype_category cfi_crashtypes;
 extern struct crashtype_category fortify_crashtypes;
+extern struct crashtype_category lockdep_crashtypes;
 extern struct crashtype_category powerpc_crashtypes;
 
 /* Each category's init/exit routines. */
drivers/misc/lkdtm/lockdep.c new file +98 -0

98 lines not on this page · raw message

Signature · 1 line
2.52.0.rc1.455.g30608eb744-goog
#1 lore raw
kernel test robot noticed the following build warnings:

Hi Tzung-Bi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on char-misc/char-misc-next char-misc/char-misc-linus kees/for-next/pstore kees/for-next/kspp soc/for-next linus/master v6.18-rc5 next-20251114] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Tzung-Bi-Shih/lkdtm-Add-lockdep-related-crash-tests/20251114-142702
base:   char-misc/char-misc-testing
patch link:    https://lore.kernel.org/r/20251114062535.1827309-1-tzungbi%40kernel.org
patch subject: [PATCH] lkdtm: Add lockdep related crash tests
config: parisc-defconfig (https://download.01.org/0day-ci/archive/20251115/[email protected]/config)
compiler: hppa-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251115/[email protected]/reproduce)

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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/misc/lkdtm/lockdep.c: In function 'lkdtm_LOCKDEP_CIRCULAR_LOCK':

>> drivers/misc/lkdtm/lockdep.c:21:48: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
      21 |                 scoped_guard(spinlock, &lock_B);
         |                                                ^
   drivers/misc/lkdtm/lockdep.c:23:48: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
      23 |                 scoped_guard(spinlock, &lock_A);
         |                                                ^
   drivers/misc/lkdtm/lockdep.c: In function 'lkdtm_LOCKDEP_INCONSISTENT_LOCK':
   drivers/misc/lkdtm/lockdep.c:37:40: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
      37 |         scoped_guard(spinlock, &lock_A);
         |                                        ^
   drivers/misc/lkdtm/lockdep.c:40:40: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
      40 |         scoped_guard(spinlock, &lock_A);
         |                                        ^

vim +/else +21 drivers/misc/lkdtm/lockdep.c

    16	
    17	/* For "WARNING: possible circular locking dependency detected". */
    18	static void lkdtm_LOCKDEP_CIRCULAR_LOCK(void)
    19	{
    20		scoped_guard(spinlock, &lock_A)
  > 21			scoped_guard(spinlock, &lock_B);
    22		scoped_guard(spinlock, &lock_B)
    23			scoped_guard(spinlock, &lock_A);
    24	}
    25	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki