Bug 32040 - CPU affinity test skeleton for sched_setaffinity and pthread_setaffinity_np can fail to report failure.
Summary: CPU affinity test skeleton for sched_setaffinity and pthread_setaffinity_np c...
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: nptl (show other bugs)
Version: 2.41
: P2 normal
Target Milestone: 2.41
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-31 17:24 UTC by Carlos O'Donell
Modified: 2024-08-15 19:34 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos O'Donell 2024-07-31 17:24:27 UTC
The file sysdeps/unix/sysv/linux/tst-skeleton-affinity.c is used to implement the testing for sched_setaffinity and pthread_setaffiniyt_np, among various APIs.

In the "test_size" routine we have this code:

152   if (getaffinity (kernel_size, initial_set) < 0)
153     {
154       printf ("error: size %zu: getaffinity: %m\n", size);
155       return false;
156     }
157   if (setaffinity (kernel_size, initial_set) < 0)
158     {
159       printf ("error: size %zu: setaffinity: %m\n", size);
160       return true;
161     }

The point being that you should be able to get, and then set the affinity of the process (they should match) and this should be idempotent for the test.

But in the "setaffinity" case we "return true;" on error which skips the rest of the tests and silently doesn't report the error.

This looks like a typo, and it should be "return false;" for this case?
Comment 2 Carlos O'Donell 2024-08-15 19:34:05 UTC
Fixed with b22923abb046311ac9097a36b97b9b97342bac44