Opened on 03/13/23 at 09:26:17
Last modified on 03/13/23 at 14:29:09
#4877 assigned defect
sptests/spsysinit01 sem_open call only has 3 parameters with O_CREAT flag
Reported by: | Lucian-Raul Silistru | Owned by: | Sebastian Huber |
---|---|---|---|
Priority: | normal | Milestone: | 5.4 |
Component: | test | Version: | 5 |
Severity: | normal | Keywords: | |
Cc: | Blocked By: | ||
Blocking: |
Description
When calling sem_open with the O_CREAT flag the sem_open function requires 4 parameters. It will:
value = va_arg(args, unsigned int);
so the "value" argument will be randomly chosen.
sem_open can fail if the random value is not a valid semaphore value, failing the test.
Change History (4)
comment:1 Changed on 03/13/23 at 13:31:05 by Joel Sherrill
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed on 03/13/23 at 13:35:06 by Lucian-Raul Silistru
It's the RTEMS test spstests/spsysinit01 that calls sem_open with only 3 arguments (line 911 in init.c - master branch on github right now).
comment:3 Changed on 03/13/23 at 14:28:50 by Sebastian Huber
Milestone: | → 5.4 |
---|---|
Resolution: | invalid |
Status: | closed → reopened |
Thanks, you found the reason for a sporadic test failure which is on my TODO list for a long time.
comment:4 Changed on 03/13/23 at 14:29:09 by Sebastian Huber
Owner: | changed from joel@… to Sebastian Huber |
---|---|
Status: | reopened → assigned |
Note: See
TracTickets for help on using
tickets.
This is an error on the caller's part. Per https://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_open.html, the fourth argument is required if you include O_CREAT. Since you did not explicitly pass a value, the result is undefined.