Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

captureTouchpads segfaults #171

Open
guiniol opened this issue Jan 3, 2025 · 6 comments · Fixed by #172
Open

captureTouchpads segfaults #171

guiniol opened this issue Jan 3, 2025 · 6 comments · Fixed by #172
Assignees
Labels
bug Something isn't working

Comments

@guiniol
Copy link

guiniol commented Jan 3, 2025

Describe the bug

facter panics in captureTouchpads. This happens both at v0.3.0 and HEAD. The trace below is from HEAD:

2025/01/03 21:18:29 INFO building report system=x86_64-linux version=1
2025/01/03 21:18:29 INFO scanning hardware features="[memory pci net serial cpu bios monitor scsi usb prom sbus sys sysfs udev block wlan]"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xa pc=0x520f86]

goroutine 1 [running]:
github.com/numtide/nixos-facter/pkg/hwinfo.captureTouchpads(0x4a)
        github.com/numtide/nixos-facter/pkg/hwinfo/input.go:21 +0xc6
github.com/numtide/nixos-facter/pkg/hwinfo.Scan({0xc000098080, 0x10, 0x6f5780?})
        github.com/numtide/nixos-facter/pkg/hwinfo/hwinfo.go:82 +0x59c
github.com/numtide/nixos-facter/pkg/facter.(*Scanner).Scan(0x6d3c00)
        github.com/numtide/nixos-facter/pkg/facter/facter.go:76 +0x273
github.com/numtide/nixos-facter/cmd.Execute()
        github.com/numtide/nixos-facter/cmd/root.go:118 +0x2fd
main.main()
        github.com/numtide/nixos-facter/main.go:8 +0xf

To Reproduce

Steps to reproduce the behavior:

  1. nix run --option experimental-features "nix-command flakes" #nixos-facter -- -o facter.json

Expected behavior

nixos-facter produces facter.json without segfaulting.

System information

Instead here are the list of parts, and I am also attaching a facter.json generated with v0.2.0.

  • Asrock B550m Pro 4
  • Ryzen 5 Pro 5650GE
  • 2x Kingston KSM32ED8/32HC 32GB
  • Kioxia Exceria G2 1TB (boot drive)
  • 6x PM863A 3.84TB
  • Connectx4-Lx 2*25Gb with a single 10G fiber transceiver
  • HDPLEX 250W GaN Passive
  • Streacom FC10 ST-FC10B-ALPHA

I git bisect-ed it down to b7473dd, which doesn't really help since it's the commit that adds input.go.
I thought maybe it would help if it had a peripheral, but plugging a keyboard didn't change anything. This is a headless and fanless system, so the keyboard and the bootable USB stick are the only things plugged in.

@guiniol guiniol added the bug Something isn't working label Jan 3, 2025
@brianmcgee
Copy link
Collaborator

Thanks for the report. I should have some time next week to look into this.

@brianmcgee brianmcgee self-assigned this Jan 4, 2025
@brianmcgee
Copy link
Collaborator

I believe this will be resolved by #172 . I changed how I read udev data and it should account for the nil pointer happening here.

@guiniol
Copy link
Author

guiniol commented Jan 9, 2025

I'm afraid I still get a SEGFAULT at HEAD (and yes, HEAD is after #172 ):

$ sudo nix run .#nixos-facter -- -o facts.json
2025/01/09 22:09:25 INFO building report system=x86_64-linux version=1
2025/01/09 22:09:25 INFO scanning hardware features="[memory pci net serial cpu bios monitor scsi usb prom sbus sys sysfs udev block wlan]"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xa pc=0x520627]

goroutine 1 [running]:
github.com/numtide/nixos-facter/pkg/hwinfo.captureTouchpads(0x48)
        github.com/numtide/nixos-facter/pkg/hwinfo/input.go:34 +0x187
github.com/numtide/nixos-facter/pkg/hwinfo.Scan({0xc00008c080, 0x10, 0x6f4680?})
        github.com/numtide/nixos-facter/pkg/hwinfo/hwinfo.go:82 +0x59c
github.com/numtide/nixos-facter/pkg/facter.(*Scanner).Scan(0x6d2c00)
        github.com/numtide/nixos-facter/pkg/facter/facter.go:76 +0x273
github.com/numtide/nixos-facter/cmd.Execute()
        github.com/numtide/nixos-facter/cmd/root.go:118 +0x2fd
main.main()
        github.com/numtide/nixos-facter/main.go:8 +0xf

Could you reopen the issue?
How can I help you debug this issue?

@brianmcgee brianmcgee reopened this Jan 9, 2025
@brianmcgee
Copy link
Collaborator

brianmcgee commented Jan 9, 2025

@guiniol I'll add some logging tomorrow and then have you run it again to work out what's going on.

I see it's failing after pulling udev data. I'll examine the underlying code to see if there's any obvious edge cases.

@guiniol
Copy link
Author

guiniol commented Jan 9, 2025

Thanks! Happy to help however I can.

@brianmcgee
Copy link
Collaborator

@guiniol please try #174

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants