Linux kernel 6.8.0-62 generic null pointer
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Jan - please don't email me in private about bug reports, these things should go to the proper mailing lists.
I've added more people and more lists to the participant list. The decoded oops code is
0: e8 50 09 9c e1 call 0xffffffffe19c0955
5: 85 c0 test %eax,%eax 7: 75 d5 jne 0xffffffffffffffde 9: 45 85 ff test %r15d,%r15d c: 78 45 js 0x53 e: 48 c7 c6 30 40 00 c1 mov $0xffffffffc1004030,%rsi 15: 44 89 ff mov %r15d,%edi 18: e8 e8 f7 ff ff call 0xfffffffffffff805 1d: 49 89 c4 mov %rax,%r12 20: 48 85 c0 test %rax,%rax 23: 74 4c je 0x71 25: 48 8b 40 08 mov 0x8(%rax),%rax 29:* 83 78 60 02 cmpl $0x2,0x60(%rax) <-- trapping instruction 2d: 75 4b jne 0x7a 2f: 48 8b 7d d0 mov -0x30(%rbp),%rdi 33: 48 8b 48 68 mov 0x68(%rax),%rcx
37: be 00 10 00 00 mov $0x1000,%esi
and while this driver is doing some annoying things (it has three different functions all called "current_value_show()" for different cases), it seems to be the either the enum-attributes.c or string-attributes.c one, and that "cmpl $2" instruction that oopses looks to be this code:
if (obj->package.elements[CURRENT_VAL].type != ACPI_TYPE_STRING) {
kfree(obj);
return -EINVAL;
}on line 26 in
drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c
or line 28 in
drivers/platform/x86/dell/dell-wmi-sysman/string-attributes.c
which has pretty much the exact same code. Annoying stupid "same function name, pretty much same function, hard to tell which of them was triggered".
Both copies of that code have checked that 'obj' is not NULL earlier:
if (!obj)
return -EIO;which is that
20: 48 85 c0 test %rax,%rax
23: 74 4c je 0x71
sequence, but it neither checks that the 'obj->package.elements' pointer isn't NULL., and just dereferences that array directly:
25: 48 8b 40 08 mov 0x8(%rax),%rax
29:* 83 78 60 02 cmpl $0x2,0x60(%rax) <-- trapping instruction
and the value of %rax clearly is NULL:
RSP: 0018:ffffae84611f7aa0 EFLAGS: 00010282
RAX: 0000000000000000 RBX: 000000000000002d RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffffae84611f7ad0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff979dcdf65e40
which is why it oopses with that
BUG: kernel NULL pointer dereference, address: 0000000000000060 RIP: 0010:current_value_show+0x84/0xf0 [dell_wmi_sysman]
The band-aid fix looks fairly obvious:
- if (!obj)
+ if (!obj || !obj->package.elements)
return -EIO;
in both places, but I wonder if there's something more fundamentally wrong there that the elements array doesn't exist.
I suspect the registration code should be more careful, and not even create that sysfs file when the ACPI object doesn't exist, or the package.elements pointer is NULL.
So I will leave the proper fix for the Dell sysman driver people to work out.
NOTE! While I think this particular oops is for that enum-attributes.c or string-attributes.c cases, the exact same issue exists in the int-attributes.c copy (that checks for ACPI_TYPE_INTEGER instead - the difference is just a "cmpl $1" instead of "$2").
Linus
---------- Forwarded message ---------
From: Jan Graczyk <[email protected]>
Date: Sun, 29 Jun 2025 at 04:16
Subject: Linux kernel 6.8.0-62 generic null pointer
To: [email protected] <[email protected]>
Hello Linus,
Yesterday I have experienced sudden crash on my laptop running Ubuntu 24.04.2 LTS. I have attached the part of dmesg. So far I was not involved in contribution to Linux open source code foundation. However I would be very happy to start contributing. Looking forward to hearing from you soon.
Best Regards,
Jan Graczyk
Mobile: +48 535 045 515
Quoted 9 lines · Linus Torvalds
The band-aid fix looks fairly obvious:
- if (!obj)
+ if (!obj || !obj->package.elements)return -EIO;in both places, but I wonder if there's something more fundamentally wrong there that the elements array doesn't exist.
Bah. That band-aid may fix the oops. but I think the problem is deeper.
It should probably also check that
(a) obj->type == ACPI_TYPE_PACKAGE
(b) obj->package.count is actually large enough for the dereference
because maybe some broken ACPI bios ends up having a non-package object there and then checking "is obj->package.elements NULL" pointless, because that "package.elements" may be something entirely different than a pointer in the first place, because "package.elements" is only valid for a ACPI_TYPE_PACKAGE.
Maybe that wmi_query_block() is always *supposed* to return a ACPI_TYPE_PACKAGE, but I don't see any such guarantees, and it obviously happily is returning an ACPI object with a NULL package.elements.
Some other drivers do seem to check this all, eg drivers/hwmon/hp-wmi-sensors.c has check_wobj() to verify the thing it uses, and it does do things like this:
if (type != ACPI_TYPE_PACKAGE)
return -EINVAL;
elem_count = wobj->package.count;
if (elem_count != last_prop + 1)
return -EINVAL;at the very top of the function. So clearly people have either hit this kind of issue before, or some people have just been more careful.
Linus
Hi Linus,
Quoted 12 lines · Linus Torvalds
Quoted 9 lines · Linus Torvalds
The band-aid fix looks fairly obvious:
- if (!obj)
+ if (!obj || !obj->package.elements)return -EIO;in both places, but I wonder if there's something more fundamentally wrong there that the elements array doesn't exist.
Quoted 7 lines
Bah. That band-aid may fix the oops. but I think the problem is deeper.
It should probably also check that
(a)
obj->type==ACPI_TYPE_PACKAGE(b)
obj->package.countis actually large enough for the dereference
As you mentioned, the driver does check this when creating the sysfs attributes here [1]. But I believe it should definitely check every time to catch spurious errors.
I'll submit this fix.
Quoted 11 lines
because maybe some broken ACPI bios ends up having a non-package object there and then checking "is
obj->package.elementsNULL" pointless, because that "package.elements" may be something entirely different than a pointer in the first place, because "package.elements" is only valid for aACPI_TYPE_PACKAGE.Maybe that
wmi_query_block()is always *supposed* to return aACPI_TYPE_PACKAGE, but I don't see any such guarantees, and it obviously happily is returning an ACPI object with a NULL package.elements.
Not necessarily, AFAIK data blocks could be of any type.
Quoted 12 lines
Some other drivers do seem to check this all, eg
drivers/hwmon/hp-wmi-sensors.chascheck_wobj()to verify the thing it uses, and it does do things like this:if (type != ACPI_TYPE_PACKAGE) return -EINVAL; elem_count = wobj->package.count; if (elem_count != last_prop + 1) return -EINVAL;
Quoted 2 lines
at the very top of the function. So clearly people have either hit this kind of issue before, or some people have just been more careful.
I think in this case this bug is not common at all, because the driver already retrieved this data block successfully once (at init).
I also believe this has something to do with WMI method enablement. There might be a race condition at play here. I'll Cc this to Armin Wolf so he can take a look.
Quoted 2 lines
Linus
@Jan:
What is the reproduction rate of the OOPS?
Your crash log suggest this was triggered by fwupd, maybe a call to fwupdmgr get-bios-settings?
Also, please attach your full dmesg output and acpidump.
Signature · 1 line
~ Kurt
Hello Kurt,
I have attached both full dmesg dump and acpi dump. Best Regards,
Jan
On Sunday, June 29, 2025 at 07:45:13 p.m. GMT+2, Kurt Borja <[email protected]> wrote:
Hi Linus,
Quoted 12 lines · Linus Torvalds
Quoted 9 lines · Linus Torvalds
The band-aid fix looks fairly obvious:
- if (!obj)
+ if (!obj || !obj->package.elements)
return-EIO;in both places, but I wonder if there's something more fundamentally wrong there that the elements array doesn't exist.
Quoted 7 lines
Bah. That band-aid may fix the oops. but I think the problem is deeper.
It should probably also check that
(a)
obj->type==ACPI_TYPE_PACKAGE(b)
obj->package.countis actually large enough for the dereference
As you mentioned, the driver does check this when creating the sysfs attributes here [1]. But I believe it should definitely check every time to catch spurious errors.
I'll submit this fix.
Quoted 11 lines
because maybe some broken ACPI bios ends up having a non-package object there and then checking "is
obj->package.elementsNULL" pointless, because that "package.elements" may be something entirely different than a pointer in the first place, because "package.elements" is only valid for aACPI_TYPE_PACKAGE.Maybe that
wmi_query_block()is always *supposed* to return aACPI_TYPE_PACKAGE, but I don't see any such guarantees, and it obviously happily is returning an ACPI object with a NULL package.elements.
Not necessarily, AFAIK data blocks could be of any type.
Quoted 8 lines
Some other drivers do seem to check this all, eg
drivers/hwmon/hp-wmi-sensors.chascheck_wobj()to verify the thing it uses, and it does do things like this:if (type !=
ACPI_TYPE_PACKAGE)
return-EINVAL;
Quoted 6 lines
elem_count=wobj->package.count;
if (elem_count!=last_prop+ 1)
return-EINVAL;at the very top of the function. So clearly people have either hit this kind of issue before, or some people have just been more careful.
I think in this case this bug is not common at all, because the driver already retrieved this data block successfully once (at init).
I also believe this has something to do with WMI method enablement. There might be a race condition at play here. I'll Cc this to Armin Wolf so he can take a look.
Quoted 2 lines
Linus
@Jan:
What is the reproduction rate of the OOPS?
Your crash log suggest this was triggered by fwupd, maybe a call to fwupdmgr get-bios-settings?
Also, please attach your full dmesg output and acpidump.
Signature · 1 line
~ Kurt
Am 29.06.25 um 20:02 schrieb Jan Graczyk:
Quoted 8 lines
Hello Kurt,
I have attached both full dmesg dump and acpi dump.
Best Regards,
Jan
No top posting please.
Quoted 61 lines · Kurt Borja
Hi Linus,
Quoted 12 lines · Linus Torvalds
Quoted 9 lines · Linus Torvalds
The band-aid fix looks fairly obvious:
- if (!obj)
+ if (!obj || !obj->package.elements)
return-EIO;in both places, but I wonder if there's something more fundamentally wrong there that the elements array doesn't exist.
Quoted 7 lines
Bah. That band-aid may fix the oops. but I think the problem is deeper.
It should probably also check that
(a)
obj->type==ACPI_TYPE_PACKAGE(b)
obj->package.countis actually large enough for the dereferenceAs you mentioned, the driver does check this when creating the sysfs attributes here [1]. But I believe it should definitely check every time to catch spurious errors.
I'll submit this fix.
Quoted 11 lines
because maybe some broken ACPI bios ends up having a non-package object there and then checking "is
obj->package.elementsNULL" pointless, because that "package.elements" may be something entirely different than a pointer in the first place, because "package.elements" is only valid for aACPI_TYPE_PACKAGE.Maybe that
wmi_query_block()is always *supposed* to return aACPI_TYPE_PACKAGE, but I don't see any such guarantees, and it obviously happily is returning an ACPI object with a NULL package.elements.Not necessarily, AFAIK data blocks could be of any type.
Quoted 8 lines
Some other drivers do seem to check this all, eg
drivers/hwmon/hp-wmi-sensors.chascheck_wobj()to verify the thing it uses, and it does do things like this:if (type !=
ACPI_TYPE_PACKAGE)
return-EINVAL;Quoted 6 lines
elem_count=wobj->package.count;
if (elem_count!=last_prop+ 1)
return-EINVAL;at the very top of the function. So clearly people have either hit this kind of issue before, or some people have just been more careful.
Quoted 6 lines
I think in this case this bug is not common at all, because the driver already retrieved this data block successfully once (at init).
I also believe this has something to do with WMI method enablement. There might be a race condition at play here. I'll Cc this to Armin Wolf so he can take a look.
I do not think so, from my point of view querying the DELL_WMI_BIOS_ENUMERATION_ATTRIBUTE_GUID using ACPI control method WQBL causes the error. The reason for this seems that this control method can return an integer when encountering an error.
Under windows the WMI request would thus fail as the integer would be marshaled as a 32-bit buffer, being too small to fulfill the request. So i think improving the ACPI object validation inside the driver is indeed the best way to go.
Thanks,
Armin Wolf
Quoted 22 lines
Quoted 3 lines
Linus
@Jan:
What is the reproduction rate of the OOPS?
Your crash log suggest this was triggered by fwupd, maybe a call to
fwupdmgr get-bios-settings?Also, please attach your full
dmesgoutput andacpidump.Signature · 1 line
~ Kurt