Skip to content

gantry: loadrt without personality crashes rtapi_app when function runs #4302

Description

@grandixximo

Loading gantry without a personality modparam and adding its function to a thread segfaults rtapi_app.

Reproduced on current master (uspace sim, RIP build):

loadrt threads name1=t period1=1000000 fp1=0
loadrt gantry
addf gantry.0.read t
start

rtapi_app dies as soon as the thread runs.

What I think happens: personality defaults to 0, so no joint pins are created, but FUNCTION(read) unconditionally accesses joint_home(0) (and again limit=joint_home(0)) before the while (i < personality) loop. With zero pins that reference is invalid.

Documented usage always passes personality=N, which works fine, so this only bites on a bare loadrt. Might be worth either erroring out at load when personality == 0, or guarding the first-joint access.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions