Reading values from SPS30 sensor leads to Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: sps30_read_raw

Open
#5,706 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c, linux

Research direction

Start with the SPS30 driver's sps30_read_raw and sps30_trigger_handler paths, reproducing the failure by reading in_massconcentration_pm4_input on the Raspberry Pi setup described. Compare that path with the working PM1 and PM2.5 reads; done means the requested sensor values can be read without a kernel stack-corruption panic.

Written by the indexing model from the issue text.

Description

Describe the bug

Trying to read specific values from sps30 (https://sensirion.com/products/catalog/SPS30/) sensor leads to kernel panic:

[ 105.317088] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: sps30_read_raw+0x1c0/0x1c0 [sps30]

Reading from in_massconcentration_pm1_input and in_massconcentration_pm2p5_input works fine,
panic on in_massconcentration_pm4_input

Steps to reproduce the behaviour

Configure Sensirion sps30 sensor on i2c, try to read sensor values.

Device (s)

Raspberry Pi 4 Mod. B

System

Raspberry Pi reference 2023-10-10
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 962bf483c8f326405794827cce8c0313fd5880a8, stage2
Oct 17 2023 15:39:16
Copyright (c) 2012 Broadcom
version 30f0c5e4d076da3ab4f341d88e7d505760b93ad7 (clean) (release) (start)
Linux raspberrypi 6.1.0-rpi6-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.58-1+rpt2 (2023-10-27) aarch64 GNU/Linux

Logs

[ 1340.212930] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: sps30_read_raw+0x1c0/0x1c0 [sps30]
[ 1340.224134] CPU: 1 PID: 920 Comm: cat Tainted: G C 6.1.0-rpi6-rpi-v8 #1 Debian 1:6.1.58-1+rpt2
[ 1340.234433] Hardware name: Raspberry Pi 4 Model B Rev 1.5 (DT)
[ 1340.240383] Call trace:
[ 1340.242881] dump_backtrace.part.0+0xec/0x100
[ 1340.247338] show_stack+0x20/0x30
[ 1340.250726] dump_stack_lvl+0x88/0xb4
[ 1340.254472] dump_stack+0x18/0x34
[ 1340.257860] panic+0x1a0/0x370
[ 1340.260984] __stack_chk_fail+0x28/0x30
[ 1340.264904] sps30_trigger_handler+0x0/0xdc [sps30]
[ 1340.269897] iio_read_channel_info+0xe0/0xf4 [industrialio]
[ 1340.275632] dev_attr_show+0x28/0x64
[ 1340.279293] sysfs_kf_seq_show+0x94/0x110
[ 1340.283388] kernfs_seq_show+0x34/0x40
[ 1340.287223] seq_read_iter+0x16c/0x45c
[ 1340.291054] kernfs_fop_read_iter+0x148/0x1b4
[ 1340.295508] vfs_read+0x214/0x2c0
[ 1340.298898] ksys_read+0x78/0x10c
[ 1340.302284] __arm64_sys_read+0x24/0x30
[ 1340.306202] invoke_syscall+0x50/0x120
[ 1340.310036] el0_svc_common.constprop.0+0x68/0x124
[ 1340.314932] do_el0_svc+0x34/0xd0
[ 1340.318324] el0_svc+0x30/0x9c
[ 1340.321446] el0t_64_sync_handler+0xf4/0x120
[ 1340.325808] el0t_64_sync+0x18c/0x190
[ 1340.332137] SMP: stopping secondary CPUs
[ 1340.338700] Kernel Offset: 0x16e2800000 from 0xffffffc008000000
[ 1340.346353] PHYS_OFFSET: 0x0
[ 1340.350587] CPU features: 0x80000,2013c080,0000421b
[ 1340.356847] Memory Limit: none
[ 1340.361237] ---[ end Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: sps30_read_raw+0x1c0/0x1c0 [sps30] ]---

Additional context

No response

Dominant language
C
Stars
13.2k
Forks
5.5k
Avg merge
2d 21h
Merged PRs (30d)
21

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/linux

All issues in raspberrypi/linux

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.