[LTP] latest ltp not building on RHEL 9.6 ?
Chuck Lever
chuck.lever@oracle.com
Wed May 21 16:03:44 CEST 2025
On 5/20/25 10:00 PM, Li Wang wrote:
> On Tue, May 20, 2025 at 11:16 PM Chuck Lever <chuck.lever@oracle.com> wrote:
>>
>> On 5/19/25 8:38 PM, Li Wang wrote:
>>> On Tue, May 20, 2025 at 2:40 AM Chuck Lever via ltp <ltp@lists.linux.it> wrote:
>>>>
>>>> Hi -
>>>>
>>>> My daily CI builds ltp and runs it against my nfsd-testing branch.
>>>> For the past week or so, the ltp build fails with:
>>>>
>>>> In file included from cve-2017-16939.c:28:
>>>> ../../include/lapi/sched.h:18:8: error: redefinition of ‘struct sched_attr’
>>>> 18 | struct sched_attr {
>>>> | ^~~~~~~~~~
>>>> In file included from /usr/include/bits/sched.h:60,
>>>> from /usr/include/sched.h:43,
>>>> from ../../include/lapi/sched.h:10,
>>>> from cve-2017-16939.c:28:
>>>> /usr/include/linux/sched/types.h:102:8: note: originally defined here
>>>> 102 | struct sched_attr {
>>>> | ^~~~~~~~~~
>>>>
>>>> The test runner is a RHEL 9.6 guest. I don't see any recent changes to
>>>> ltp in this area, so perhaps 9.6 modified /usr/include/linux/sched.h ?
>>>
>>> I saw that LTP has already handle that conflict in lapi header file, in commit
>>> https://github.com/linux-test-project/ltp/commit/c48700d8cdbe6d0d78fda6e6cc658972464b5ccd
>>>
>>> Can you provide the version of your kernel-header and glibc?
>>>
>>> e.g.
>>> $ rpm -qf /usr/include/linux/sched/types.h
>>>
>>> $ rpm -qf /usr/include/bits/sched.h
>>
>> Hi!
>>
>> I test recent kernels in this set-up, so I included the output of
>> "uname" in case that is relevant.
>>
>> [kdevops@ltp-notify ~]$ uname -r
>> 6.15.0-rc6-g7278569740f6
>> [kdevops@ltp-notify ~]$ rpm -qf /usr/include/linux/sched/types.h
>> kernel-headers-5.14.0-570.17.1.el9_6.x86_64
>> [kdevops@ltp-notify ~]$ rpm -qf /usr/include/bits/sched.h
>> glibc-headers-2.34-168.el9_6.14.x86_64
>> [kdevops@ltp-notify ~]$ cat /etc/redhat-release
>> Red Hat Enterprise Linux release 9.6 (Plow)
>> [kdevops@ltp-notify ~]$
>>
>> I guess one thing I might try is running the ltp build on a stock
>> RHEL 9.6 kernel. I'm not sure if the test workflow replaces the
>> kernel headers under /usr/include.
>
>
> That's weird, I wasn't able to reproduce this on the same env.
> Your test system may be polluted with new kernel headers.
I get the same error whether the stock kernel or a custom kernel is in
use. The system is an AWS instance built from the ground up with
terraform before each test run, so there is no debris from previous
tests.
Looks like the problem is actually that my test environment is still
cloning ltp commit b0ae1ee2392d ("rpc_svc_1: Fix incompatible pointer
type error") instead of HEAD. So it's missing commit c48700d8cdbe
("sched_attr: Do not define for glibc >= 2.41").
Once I changed my test workflow to clone LTP from HEAD instead of the
older commit, this build failure goes away.
Thank you, Li, for your advice!
> And, you might need to manually check the struct sched_attr
> in both /usr/include/bits/sched.h and /usr/include/linux/sched/types.h
> to see if something different.
>
> # cat /usr/include/bits/sched.h
> ...
> 54 /* Use "" to work around incorrect macro expansion of the
> 55 __has_include argument (GCC PR 80005). */
> 56 # ifdef __has_include
> 57 # if __has_include ("linux/sched/types.h")
> 58 /* Some older Linux versions defined sched_param in
> <linux/sched/types.h>. */
> 59 # define sched_param __glibc_mask_sched_param
> 60 # include <linux/sched/types.h>
> 61 # undef sched_param
> 62 # endif
> 63 # endif
> 64 # ifndef SCHED_ATTR_SIZE_VER0
> 65 # include <linux/types.h>
> 66 # define SCHED_ATTR_SIZE_VER0 48
> 67 # define SCHED_ATTR_SIZE_VER1 56
> 68 struct sched_attr
> 69 {
> 70 __u32 size;
> 71 __u32 sched_policy;
> 72 __u64 sched_flags;
> 73 __s32 sched_nice;
> 74 __u32 sched_priority;
> 75 __u64 sched_runtime;
> 76 __u64 sched_deadline;
> 77 __u64 sched_period;
> 78 __u32 sched_util_min;
> 79 __u32 sched_util_max;
> 80 /* Additional fields may be added at the end. */
> 81 };
> 82 # endif /* !SCHED_ATTR_SIZE_VER0 */
>
>
> # cat /usr/include/linux/sched/types.h
> ...
>
> #define SCHED_ATTR_SIZE_VER0 48 /* sizeof first published struct */
> #define SCHED_ATTR_SIZE_VER1 56 /* add: util_{min,max} */
>
> struct sched_attr {
> __u32 size;
>
> __u32 sched_policy;
> __u64 sched_flags;
>
> /* SCHED_NORMAL, SCHED_BATCH */
> __s32 sched_nice;
>
> /* SCHED_FIFO, SCHED_RR */
> __u32 sched_priority;
>
> /* SCHED_DEADLINE */
> __u64 sched_runtime;
> __u64 sched_deadline;
> __u64 sched_period;
>
> /* Utilization hints */
> __u32 sched_util_min;
> __u32 sched_util_max;
>
> };
>
>
> -------------------------- test result on my clean 9.6 --------------------
>
> # cat /etc/redhat-release
> Red Hat Enterprise Linux release 9.6 (Plow)
>
> # uname -r
> 5.14.0-570.17.1.el9_6.x86_64
>
> # rpm -qf /usr/include/linux/sched/types.h
> kernel-headers-5.14.0-570.17.1.el9_6.x86_64
>
> # rpm -qf /usr/include/bits/sched.h
> glibc-headers-2.34-168.el9_6.14.x86_64
>
>
> # V=1 make
> gcc -I../../include -I../../include -I../../include/old/ -Wformat
> -Werror=format-security -Werror=implicit-function-declaration
> -Werror=return-type -fno-common -g -O2 -fno-strict-aliasing -pipe
> -Wall -W -Wold-style-definition -std=gnu99 -D_GNU_SOURCE -L../../lib
> cve-2017-16939.c -lltp -o cve-2017-16939
>
> # echo $?
> 0
>
--
Chuck Lever
More information about the ltp
mailing list