Commit 62ed968
committed
rtapi: warn on stock kernel, gate Xenomai/RTAI on setuid
Address two review concerns from @hdiethelm on PR #3964:
1. SCHED_FIFO probe was too generous on PREEMPT_DYNAMIC stock kernels.
The probe correctly reports that SCHED_FIFO is achievable, but the
resulting latency on a non-PREEMPT_RT kernel can be tens of
milliseconds, surprising users who read 'POSIX realtime' and expect
bounded scheduling. Restore detect_preempt_rt() (uname-based) and
emit a one-shot warning at makeApp() when the SCHED_FIFO path is
chosen but the kernel lacks PREEMPT_RT and there is no Xenomai/RTAI
backend. Behavior is unchanged: SCHED_FIFO on stock is still
strictly better than SCHED_OTHER, the warning just makes the
tradeoff visible.
2. Xenomai/RTAI backends still need root for iopl() (RTAI) or RTDM
device access (Xenomai/EVL) and were being selected for unprivileged
users on a Xenomai kernel, leading to 'iopl() failed: Operation not
permitted'. Gate detect_rtai/detect_xenomai/detect_xenomai_evl on
geteuid()==0 so unprivileged callers fall through to the SCHED_FIFO
probe and a clean POSIX path. This is a band-aid pending proper
capability/group support (udev rules + 'xenomai'/'evl' group
membership, the approach Xenomai's own docs recommend); marked with
a FIXME pointing at @hdiethelm's planned follow-up.
The probe-based rtapi_is_realtime() itself is unchanged: it remains a
pure capability check, matching the convention in JACK, PipeWire,
rtkit, and Klipper. Kernel quality is reported as a separate
diagnostic, not folded into the boolean.1 parent 54c3f57 commit 62ed968
2 files changed
Lines changed: 51 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
356 | 393 | | |
357 | 394 | | |
| 395 | + | |
358 | 396 | | |
359 | 397 | | |
360 | 398 | | |
| |||
366 | 404 | | |
367 | 405 | | |
368 | 406 | | |
| 407 | + | |
369 | 408 | | |
370 | 409 | | |
371 | 410 | | |
| |||
377 | 416 | | |
378 | 417 | | |
379 | 418 | | |
| 419 | + | |
380 | 420 | | |
381 | 421 | | |
382 | 422 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
995 | 995 | | |
996 | 996 | | |
997 | 997 | | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
998 | 1009 | | |
999 | 1010 | | |
1000 | 1011 | | |
| |||
0 commit comments