pop-os / linux

Pop!_OS fork of https://launchpad.net/ubuntu/+source/linux
Other
111 stars 13 forks source link

Sleep/Suspend leads to an array-index-out-of-bounds in dswexec.c #161

Open skryvets opened 2 years ago

skryvets commented 2 years ago

Description

On my laptop Dell XPS 15 7590, (Pop!_OS 22.04 LTS) when I close the lid and open it again I have the error that is displayed on the black screen. There is no way for me to skip it and the only solution is to "force shut down" by holding on "on/off" button and start machine again. It started to happen when I updated to the latest Pop!_OS 22.04 LTS version.

The error says:

"array-index-out-of-bounds in /build/linux-9jwrn2/linux-5.17.5/drivers/acpi/acpica/dswexec.c:401:12"

Please see the photo here on imgur.

References

Exact same issue was reported in ACPI repo: https://github.com/acpica/acpica/issues/725. This is where the solution comes from. Please see below.

Solution

https://github.com/acpica/acpica/pull/745/files

Environment info

$ uname -a
Linux pop-os 5.17.15-76051715-generic #202206141358~1655919116~22.04~1db9e34 SMP PREEMPT Wed Jun 22 19 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/os-release
NAME="Pop!_OS"
VERSION="22.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 22.04 LTS"
VERSION_ID="22.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
LOGO=distributor-logo-pop-os

Stacktrace

Jun 20 12:16:11 pop-os kernel: [12389.874545] UBSAN: array-index-out-of-bounds in /build/linux-9jwrn2/linux-5.17.5/drivers/acpi/acpica/dswexec.c:401:12
Jun 20 12:16:11 pop-os kernel: [12389.874550] index -1 is out of range for type 'acpi_operand_object *[9]'
Jun 20 12:16:11 pop-os kernel: [12389.874553] CPU: 0 PID: 6 Comm: kworker/0:0 Tainted: P           OE     5.17.5-76051705-generic #202204271406~1653440576~22.
04~6277a18
Jun 20 12:16:11 pop-os kernel: [12389.874559] Hardware name: Dell Inc. XPS 15 7590/0VYV0G, BIOS 1.15.0 12/09/2021
Jun 20 12:16:11 pop-os kernel: [12389.874561] Workqueue: kacpid acpi_os_execute_deferred
Jun 20 12:16:11 pop-os kernel: [12389.874574] Call Trace:
Jun 20 12:16:11 pop-os kernel: [12389.874576]  <TASK>
Jun 20 12:16:11 pop-os kernel: [12389.874581]  show_stack+0x52/0x59
Jun 20 12:16:11 pop-os kernel: [12389.874591]  dump_stack_lvl+0x4c/0x64
Jun 20 12:16:11 pop-os kernel: [12389.874596]  dump_stack+0x10/0x13
Jun 20 12:16:11 pop-os kernel: [12389.874599]  ubsan_epilogue+0x9/0x46
Jun 20 12:16:11 pop-os kernel: [12389.874603]  __ubsan_handle_out_of_bounds.cold+0x44/0x49
Jun 20 12:16:11 pop-os kernel: [12389.874607]  acpi_ds_exec_end_op+0x1a1/0x799
Jun 20 12:16:11 pop-os kernel: [12389.874614]  acpi_ps_parse_loop+0x58a/0x661
Jun 20 12:16:11 pop-os kernel: [12389.874620]  acpi_ps_parse_aml+0x1af/0x553
Jun 20 12:16:11 pop-os kernel: [12389.874624]  acpi_ps_execute_method+0x208/0x2cb
Jun 20 12:16:11 pop-os kernel: [12389.874629]  acpi_ns_evaluate+0x34e/0x4f1
Jun 20 12:16:11 pop-os kernel: [12389.874636]  acpi_ev_asynch_execute_gpe_method+0xc0/0x15f
Jun 20 12:16:11 pop-os kernel: [12389.874642]  acpi_os_execute_deferred+0x1a/0x30
Jun 20 12:16:11 pop-os kernel: [12389.874649]  process_one_work+0x21f/0x3f0
Jun 20 12:16:11 pop-os kernel: [12389.874657]  worker_thread+0x50/0x3e0
Jun 20 12:16:11 pop-os kernel: [12389.874663]  ? rescuer_thread+0x390/0x390
Jun 20 12:16:11 pop-os kernel: [12389.874669]  kthread+0xee/0x120
Jun 20 12:16:11 pop-os kernel: [12389.874675]  ? kthread_complete_and_exit+0x20/0x20
Jun 20 12:16:11 pop-os kernel: [12389.874680]  ret_from_fork+0x22/0x30
Jun 20 12:16:11 pop-os kernel: [12389.874690]  </TASK>

More info

I'm trying to test this on my machine, since building a kernel is new for me. If it's going to work and would be approved I would submit a fix. Since I'm first timer here, please let me know if any additional steps required to submit a PR besides regular git flow.

rlaanemets commented 2 years ago

I have the same laptop, same OS, same symptoms.

RafalSkolasinski commented 2 years ago

Exactly the same happening to me. Same laptop. Running in nvidia compute mode. Suspending via menu. Does not happen regularly but it is quite annoying...

I noticed I am able to ssh into the machine but not sure what could fix it. The only thing that works so far is either reboot or "kill -9 -1"...

RafalSkolasinski commented 2 years ago

Latest comment from https://github.com/acpica/acpica/issues/725#issuecomment-1180568082 may suggest that issue is independent from acpica and rather lies within i915 driver.

What graphic mode are you running @skryvets @rlaanemets?

rlaanemets commented 2 years ago

I'm running Nvidia only.

RafalSkolasinski commented 2 years ago

If this is the kernel, do we know which was the one that was working fine?

skryvets commented 2 years ago

Latest comment from acpica/acpica#725 (comment) may suggest that issue is independent from acpica and rather lies within i915 driver.

What graphic mode are you running @skryvets @rlaanemets?

I'm running Hybrid.

If this is kernel, do we know which was the one that was working fine?

Not sure.

P.s.
I was able to fix the issue applying the patch from here. I tested it and it does fix the issue indeed.

However, since building kernel is new for me, some of my periphery stopped working with this newly kernel I built from source (some usb devices and wired network, they're now showing up as they connected). I assume I've done something wrong here. I wanted to find 5.17.15-76051715-generic sources, but I had no luck so I used this repo at this commit as a kernel source.

This is what I've done:

RafalSkolasinski commented 2 years ago

If this is indeed a fix, I would really love landing it in default kernel in pop repos.

LookedPath commented 1 year ago

It has been merged into mainline, is there any possibility of seeing it merged in here too?

https://github.com/torvalds/linux/commit/7dfb216eda99bbfc2a8c3b03d2eec63314f52b3c