Skip to content

Conversation

@huyc-arista
Copy link
Contributor

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

I noticed showtech crash when run as non root due to printGpio segfault.

  • Adds error handling to printGpio to prevent segfaults when gpiod_chip_open() fails.
  • Enforces root execution for showtech to guarantee complete debug info.
  • Update gpio printing format

Test Plan

Ran showtech as non-root

[admin@vpr424 ~]$ showtech --details all
Please run this program as root

Ran showtech --details gpio with invalid gpio path and ensure no crash

[root@vpr424 admin]# showtech --details gpio --config_file "/opt/fboss/share/platform_configs/showtech.json"
I1121 18:42:00.221478  6438 ConfigLib.cpp:50] Using config file: /opt/fboss/share/platform_configs/showtech.json
I1121 18:42:00.221558  6438 Main.cpp:72] Executing: gpio
##### GPIO Information #####
#### GPIO Chip Details /run/devmap/gpiochips/INVALID_GPIO ####
line  0: SCD_DONE        -> Error: failed to read gpio line: GpiodLineTrace: Invalid gpiod_chip* passed in for SCD_DONE
line  1: OVER_TEMP_L     -> Error: failed to read gpio line: GpiodLineTrace: Invalid gpiod_chip* passed in for OVER_TEMP_L
line  2: SYS_PGOOD       -> Error: failed to read gpio line: GpiodLineTrace: Invalid gpiod_chip* passed in for SYS_PGOOD
line  3: P1V2_CP_PGOOD   -> Error: failed to read gpio line: GpiodLineTrace: Invalid gpiod_chip* passed in for P1V2_CP_PGOOD
line  4: SCD_CRC_ERR     -> Error: failed to read gpio line: GpiodLineTrace: Invalid gpiod_chip* passed in for SCD_CRC_ERR
line  5: P1V0_CP_PGOOD   -> Error: failed to read gpio line: GpiodLineTrace: Invalid gpiod_chip* passed in for P1V0_CP_PGOOD
line  6: P1V8_CP_PGOOD   -> Error: failed to read gpio line: GpiodLineTrace: Invalid gpiod_chip* passed in for P1V8_CP_PGOOD
line  7: P3V3_CP_PGOOD   -> Error: failed to read gpio line: GpiodLineTrace: Invalid gpiod_chip* passed in for P3V3_CP_PGOOD
line  8: SCD_PRGM_L      -> Error: failed to read gpio line: GpiodLineTrace: Invalid gpiod_chip* passed in for SCD_PRGM_L
line  9: SCD_HOLD_L      -> Error: failed to read gpio line: GpiodLineTrace: Invalid gpiod_chip* passed in for SCD_HOLD_L
line 12: CPU_QSPI_SEL    -> Error: failed to read gpio line: GpiodLineTrace: Invalid gpiod_chip* passed in for CPU_QSPI_SEL
line 14: SCD_RESET_L     -> Error: failed to read gpio line: GpiodLineTrace: Invalid gpiod_chip* passed in for SCD_RESET_L

@meta-cla meta-cla bot added the CLA Signed label Dec 8, 2025
@huyc-arista
Copy link
Contributor Author

@somasun Can we assume showtech can always be run as root user? Non root showtech output is still usefull just not as complete. I don't want this guard to prevent us getting showtech logs if such scenario exist.

@meta-codesync
Copy link

meta-codesync bot commented Dec 8, 2025

@somasun has imported this pull request. If you are a Meta employee, you can view this in D88675606.

@somasun
Copy link
Contributor

somasun commented Dec 8, 2025

@somasun Can we assume showtech can always be run as root user? Non root showtech output is still usefull just not as complete. I don't want this guard to prevent us getting showtech logs if such scenario exist.

I think this should be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants