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

Closed
guiniol opened this issue Jan 3, 2025 · 10 comments · Fixed by #172
Closed

captureTouchpads segfaults #171

guiniol opened this issue Jan 3, 2025 · 10 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

@guiniol
Copy link
Author

guiniol commented Jan 11, 2025

It works!!

2025/01/11 22:56:06 INFO building report system=x86_64-linux version=1
2025/01/11 22:56:06 INFO scanning hardware features="[memory pci net serial cpu bios monitor scsi usb prom sbus sys sysfs udev block wlan]"
2025/01/11 22:56:07 INFO reading IOMMU groups
2025/01/11 22:56:07 INFO processing devices count=67
2025/01/11 22:56:07 INFO processing smbios entries count=27
2025/01/11 22:56:07 INFO detecting virtualisation
2025/01/11 22:56:07 INFO report complete

(and sorry for the delay, couldn't make it to the computer yesterday)

@guiniol
Copy link
Author

guiniol commented Jan 11, 2025

Ran it again with --log-level debug and I see the log line you add in #174:

2025/01/11 23:12:52 input.go:35: DEBUG udev data missing input name="ASRock LED Controller" sysfs=/devices/pci0000:00/0000:00:02.1/0000:02:00.0/usb1/1-8/1-8:1.0/0003:26CE:01A2.0002/input/input2

I didn't even know I had a LED controller, but that's what was causing the issue 😄

@Mic92
Copy link
Member

Mic92 commented Jan 14, 2025

Can be closed than.

@Mic92 Mic92 closed this as completed Jan 14, 2025
@guiniol
Copy link
Author

guiniol commented Jan 14, 2025

Awesome. Thanks again!

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.

3 participants