Skip to contentSkip to conversation

INFO: BUG: kobject: integrity does not have a release function

DISCUSSION Mirsad Goran Todorovac 1 participant 1 message Mar 9, 2023 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 65 lines · Hillf Danton

On 8 Mar 2023 15:08:21 +0100 Mirsad Todorovac <[email protected]>

Quoted 9 lines

Please see the bug reports from the kernel log:

https://domac.alu.hr/~mtodorov/linux/bugreports/integrity/20230308_123748.jpg

https://domac.alu.hr/~mtodorov/linux/bugreports/integrity/20230308_123752.jpg

The kernel is Linux 6.2.0-mg-andy-devres-12485-gf3a2439f20d9-dirty x86_64 on a LENOVO_MT_10TX_BU_Lenovo_FM_V530S-07ICB running AlmaLinux 8.7.

Only in case no support from your linux vendor, take a look at the debug/fix diffs below.

Quoted 9 lines

I was unable to reproduce on the other Lenovo laptop box, for the kernel refused to boot, unable to find root drive on NVMe (other kernels w/o CONFIG_DEBUG_KOBJECT=y run smoothly).

Config used is:

https://domac.alu.hr/~mtodorov/linux/bugreports/integrity/config-6.2.0-mg-andy-devres-12485-gf3a2439f20d9-dirty

Quoted 18 lines

As I already said to Andy, this might not be a critical bug, for it happens only at shutdown AFAICS. However, it can be a sign of some more serious problem in the code. :-/

Hope this helps.

Regards,
Mirsad

Signature · 8 lines
Mirsad Goran Todorovac
Sistem inženjer
Grafički fakultet | Akademija likovnih umjetnosti
Sveučilište u Zagrebu

System engineer
Faculty of Graphic Arts | Academy of Fine Arts
University of Zagreb, Republic of Croatia

Add a dummy release callback to the integrity ktype in order to quiesce kobj warning.

block/blk-integrity.c +4 -1
@@ -356,7 +356,11 @@ static const struct sysfs_ops integrity_
  	.store	= &integrity_attr_store,
  };
 
+static void blk_integrity_kobj_release(struct kobject *kobj)
+{
+}
  static const struct kobj_type integrity_ktype = {
+	.release = blk_integrity_kobj_release,
  	.default_groups = integrity_groups,
  	.sysfs_ops	= &integrity_ops,
  };
--

Add debug info to catch invalid kobj type.

lib/kobject.c int kobject_init_and_add(struct kobject

Quoted 9 lines
lib/kobject.c +2 -1
@@ -443,6 +443,8 @@ int kobject_init_and_add(struct kobject
  	va_list args;
  	int retval;
 
+	if (WARN_ON(!ktype || !ktype->release))
+		return -EINVAL;
  	kobject_init(kobj, ktype);
 
  	va_start(args, fmt);
--

Hi, Hillf, thank you very much for the patch.

However, I have seen another inconsistency here:

security/integrity/iint.c:
175 static int __init integrity_iintcache_init(void) 176 {
177 iint_cache =
178 kmem_cache_create("iint_cache", sizeof(struct integrity_iint_cache),
179 0, SLAB_PANIC, init_once);
180 return 0;
181 }
182 DEFINE_LSM(integrity) = {
183 .name = "integrity",
184 .init = integrity_iintcache_init,
185 };

There is no call to kmem_cache_destroy(iint_cache) in entire security/integrity subtree?

Is that intentional?

I know there is little logic in releasing resources at shutdown, but it seems like the right thing to do ... :-/

Thank you very much, again.

Regards,
Mirsad

Signature · 9 lines
Mirsad Todorovac
System engineer
Faculty of Graphic Arts | Academy of Fine Arts
University of Zagreb
Republic of Croatia, the European Union

Sistem inženjer
Grafički fakultet | Akademija likovnih umjetnosti
Sveučilište u Zagrebu