hal: Deprecate pyhal and move functionality into hal module#4061
Conversation
|
@BsAtHome heads-up on a defense-in-depth opportunity while you have While debugging the qtdragon ui-smoke segfault on Ubuntu 24.04 I traced a shutdown SIGSEGV to a lifecycle gap between
This PR keeps the by-value snapshot, so the lifecycle bug class survives the rewrite. The qtvcp-side fix (stopping the QPin timer before Reproducer evidence (instrumented halmodule logging How would you like to handle the
Happy to share the instrumented branch and docker repro if useful. |
|
I think you need to open an issue and I'll fold it into a new PR to make it clear that they are separate issues. Accessing a component's pins and other component associated things after you cal hal_exit() on the component is a bug in the program. It is a use-after-free bug. Its like, you closed the door and then want to walk through the door. That will hurt... The whole halmodule code needs (a lot) more adjustment when the hal types are changed. This PR is primarily about porting the hal port code. |
This is phase 0 of the HAL update. We need to get rid of direct access to HAL memory and library from python (anything that bypasses the usual accesses).
The
pyhalmodule, only used by raster, has been deprecated and theHAL_PORTfunctionality has been implemented in halmodule (_halandhalmodules). The port functionality was introduced with laser/raster and has been quite isolated so far. Therefore, the fallout should be minimal.The
halmodule has been updated so that it accepts native values when setting pins, params and signals. Previously, only string arguments were accepted. The type of the pin/param/signal is now considered when accepting values (like True/False for bit pins and a float value like 3.1415 for real pins, etc.)The
HAL_PORTcode has been updated and streamlined. The maximum allowed port queue size is now enforced at 64kByte (because it lives in HAL shared memory). All port API functions do proper argument testing now to prevent unexpected behaviour or crashes. The raster class and test has been updated and the test is no longer skipped.There are also doc updates (full
halmodule API description), but they have been held back until the asciidoctor changes are in for generating the docs. The update causes a2x to generate an error when generating a pdf and it is unclear why and where the error happens (most likely in the TeX processing; asciidoctor says the doc is fine).