Skip to content

cpu_linux: Ignore non-cpu info on /proc/cpuinfo#4

Merged
christoph-zededa merged 1 commit intozededa:mainfrom
rene:fix-out-of-bounds
Feb 6, 2026
Merged

cpu_linux: Ignore non-cpu info on /proc/cpuinfo#4
christoph-zededa merged 1 commit intozededa:mainfrom
rene:fix-out-of-bounds

Conversation

@rene
Copy link
Copy Markdown

@rene rene commented Feb 6, 2026

Some arm64 devices might have additional lines on /proc/cpuinfo containing additional information in a non <field>: <value> format, so these lines must be ignored.

Example of a /proc/cpuinfo from a Qualcomm device:

processor : 7
BogoMIPS : 38.40
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x51
CPU architecture: 8
CPU variant : 0xa
CPU part : 0x800
CPU revision : 2

Qualcomm Technologies, Inc QCM6125

The following crash is observed in this device:

2026-02-06T13:31:44.317846806Z;pillar.out;2026-02-06T13:31:44,305770920+00:00 waited 3 for /run/zedagent.touch
2026-02-06T13:31:44.332954097Z;pillar;panic: runtime error: index out of range [1] with length 1
2026-02-06T13:31:44.33298316Z;pillar;
2026-02-06T13:31:44.333068472Z;pillar;goroutine 27 [running]:
2026-02-06T13:31:44.333073837Z;pillar;github.com/zededa/ghw/pkg/cpu.logicalProcessorsFromProcCPUInfo(0x4000568870)
2026-02-06T13:31:44.333104201Z;pillar;	/pillar/vendor/github.com/zededa/ghw/pkg/cpu/cpu_linux.go:380 +0x32c
2026-02-06T13:31:44.346752743Z;pillar;github.com/zededa/ghw/pkg/cpu.processorsGet(0x4000568870)
2026-02-06T13:31:44.346811649Z;pillar;	/pillar/vendor/github.com/zededa/ghw/pkg/cpu/cpu_linux.go:47 +0x34
2026-02-06T13:31:44.346893837Z;pillar;github.com/zededa/ghw/pkg/cpu.(*Info).load(0x40018dd560, 0x11c6a8c?)
2026-02-06T13:31:44.346899253Z;pillar;	/pillar/vendor/github.com/zededa/ghw/pkg/cpu/cpu_linux.go:30 +0x24
2026-02-06T13:31:44.360680972Z;pillar;github.com/zededa/ghw/pkg/cpu.New({0x40017df9b8, 0x1, 0x40018dd4d0?})
2026-02-06T13:31:44.360708003Z;pillar;	/pillar/vendor/github.com/zededa/ghw/pkg/cpu/cpu.go:147 +0x7c
2026-02-06T13:31:44.360793368Z;pillar;github.com/lf-edge/eve/pkg/pillar/hardware.getCPUInfo()
2026-02-06T13:31:44.360798212Z;pillar;	/pillar/hardware/inventory.go:410 +0x54
2026-02-06T13:31:44.360825347Z;pillar;github.com/lf-edge/eve/pkg/pillar/hardware.GetInventoryInfo(0x40005c56f8)
2026-02-06T13:31:44.360829983Z;pillar;	/pillar/hardware/inventory.go:38 +0x3ac
2026-02-06T13:31:44.365867274Z;pillar;github.com/lf-edge/eve/pkg/pillar/cmd/zedagent.Run(0x40008e3a40, 0x4000860e00?, 0x40005c56f8?, {0x4cb5880, 0x0, 0x0}, {0x0, 0x0})
2026-02-06T13:31:44.365898055Z;pillar;	/pillar/cmd/zedagent/zedagent.go:414 +0x464
2026-02-06T13:31:44.36700342Z;pillar;main.startAgentAndDone({0x2b13708?, 0x0?}, {0x40008e8378, 0x8}, 0x0?, 0x484218?, 0x4000081d50?, {0x4cb5880?, 0x400079b0e0?, 0x0?})
2026-02-06T13:31:44.367937847Z;pillar;	/pillar/zedbox/zedbox.go:249 +0x58
2026-02-06T13:31:44.368051858Z;pillar;created by main.handleService in goroutine 1
2026-02-06T13:31:44.36816368Z;pillar;	/pillar/zedbox/zedbox.go:238 +0x2b8
2026-02-06T13:31:44.451876858Z;pillar.out;2026-02-06T13:31:44,450270920+00:00 waited 0 for /run/ledmanager.touch
2026-02-06T13:31:44.53225342Z;newlogd.out;{"file":"/newlog/vendor/github.com/lf-edge/eve/pkg/pillar/pubsub/socketdriver/subscribe.go:278","func":"github.com/lf-edge/eve/pkg/pillar/pubsub/socketdriver.(*Subscriber).read","level":"error","msg":"connectAndRead(zedagent/ConfigItemValueMap): sock read failed EOF","pid":2561,"source":"newlogd","time":"2026-02-06T13:31:44.531316389Z"}
``

Some arm64 devices might have additional lines on /proc/cpuinfo containing
additional information in a non "<field>: <value>" format, so these lines
must be ignored.

Example of a /proc/cpuinfo from a Qualcomm device:

processor	: 7
BogoMIPS	: 38.40
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer	: 0x51
CPU architecture: 8
CPU variant	: 0xa
CPU part	: 0x800
CPU revision	: 2

Qualcomm Technologies, Inc QCM6125

Signed-off-by: Renê de Souza Pinto <rene@renesp.com.br>
@rene rene requested a review from christoph-zededa February 6, 2026 13:02
@christoph-zededa christoph-zededa merged commit 857aae4 into zededa:main Feb 6, 2026
christoph-zededa added a commit to christoph-zededa/eve that referenced this pull request Feb 18, 2026
pull in this fix: zededa/ghw#4
(by @rene)

to prevent crash when parsing /proc/cpuinfo

Signed-off-by: Christoph Ostarek <christoph@zededa.com>
rene pushed a commit to lf-edge/eve that referenced this pull request Feb 19, 2026
pull in this fix: zededa/ghw#4
(by @rene)

to prevent crash when parsing /proc/cpuinfo

Signed-off-by: Christoph Ostarek <christoph@zededa.com>
christoph-zededa added a commit to christoph-zededa/eve that referenced this pull request Feb 19, 2026
pull in this fix: zededa/ghw#4
(by @rene)

to prevent crash when parsing /proc/cpuinfo

Signed-off-by: Christoph Ostarek <christoph@zededa.com>
(cherry picked from commit cab91bb)
eriknordmark pushed a commit to lf-edge/eve that referenced this pull request Feb 19, 2026
pull in this fix: zededa/ghw#4
(by @rene)

to prevent crash when parsing /proc/cpuinfo

Signed-off-by: Christoph Ostarek <christoph@zededa.com>
(cherry picked from commit cab91bb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants