Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-84258

realtime-tests: FTBFS with sched_setattr/sched_getatttr support in glibc

Linking RHIVOS CVEs to...Migration: Automation ...Sync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • rhel-9.6.z, rhel-9.7
    • realtime-tests
    • None
    • No
    • None
    • rhel-kernel-rts-real
    • ssg_core_kernel
    • 0
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • None

      Based on recommendations from the kernel team, we are adding sched_getattr and sched_setattr support to glibc in RHEL 9.7 (RHEL-56627), RHEL 9.6.z (RHEL-83970) and RHEL 10 (RHEL-58357). This causes realtime-tests to fail to build from source (so far only confirmed for realtime-tests-2.8-4.el9.

      gcc -D VERSION=2.8 -c src/lib/rt-utils.c -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -D_GNU_SOURCE -Isrc/include -DHAVE_LIBCPUPOWER_SUPPORT -o bld/rt-utils.o
      In file included from src/lib/rt-utils.c:28:
      src/include/rt-sched.h:45:8: error: redefinition of 'struct sched_attr'
         45 | struct sched_attr {
            |        ^~~~~~~~~~
      In file included from /usr/include/bits/sched.h:60,
                       from /usr/include/sched.h:43,
                       from src/lib/rt-utils.c:14:
      /usr/include/linux/sched/types.h:102:8: note: originally defined here
        102 | struct sched_attr {
            |        ^~~~~~~~~~
      In file included from src/lib/rt-utils.c:28:
      src/include/rt-sched.h:62:5: error: conflicting types for 'sched_setattr'; have 'int(pid_t,  const struct sched_attr *, unsigned int)' {aka 'int(int,  const struct sched_attr *, unsigned int)'}
         62 | int sched_setattr(pid_t pid,
            |     ^~~~~~~~~~~~~
      In file included from /usr/include/sched.h:43,
                       from src/lib/rt-utils.c:14:
      /usr/include/bits/sched.h:141:5: note: previous declaration of 'sched_setattr' with type 'int(pid_t,  struct sched_attr *, unsigned int)' {aka 'int(int,  struct sched_attr *, unsigned int)'}
        141 | int sched_setattr (pid_t tid, struct sched_attr *attr, unsigned int flags)
            |     ^~~~~~~~~~~~~
      In file included from src/lib/rt-utils.c:28:
      src/include/rt-sched.h:66:5: error: conflicting types for 'sched_getattr'; have 'int(pid_t,  struct sched_attr *, unsigned int,  unsigned int)' {aka 'int(int,  struct sched_attr *, unsigned int,  unsigned int)'}
         66 | int sched_getattr(pid_t pid,
            |     ^~~~~~~~~~~~~
      In file included from /usr/include/sched.h:43,
                       from src/lib/rt-utils.c:14:
      /usr/include/bits/sched.h:146:5: note: previous declaration of 'sched_getattr' with type 'int(pid_t,  struct sched_attr *, unsigned int,  unsigned int)' {aka 'int(int,  struct sched_attr *, unsigned int,  unsigned int)'}
        146 | int sched_getattr (pid_t tid, struct sched_attr *attr, unsigned int size,
            |     ^~~~~~~~~~~~~
      src/lib/rt-utils.c: In function 'tracemark':
      src/lib/rt-utils.c:479:9: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
        479 |         write(tracemark_fd, tracebuf, len);
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      src/lib/rt-utils.c:482:9: warning: ignoring return value of 'write' declared with attribute 'warn_unused_result' [-Wunused-result]
        482 |         write(trace_fd, "0\n", 2);
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~
      make: *** [Makefile:122: bld/rt-utils.o] Error 1
      

      This upstream commit looks relevant:

      From d3a23a0cc76789c3083df3bad78982cd49bc4c5e Mon Sep 17 00:00:00 2001
      From: Yaakov Selkowitz <yselkowi@redhat.com>
      Date: Wed, 29 Jan 2025 16:46:11 -0500
      Subject: Fix rt-tests build with glibc-2.41
      
      The sched_*attr APIs were added to glibc
      https://sourceware.org/git/?p=glibc.git;a=commit;h=21571ca0d70302909cf72707b2a7736cf12190a0
      
      This fixes the build conflict in rt-tests with glibc-2.4
      
      Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
      Signed-off-by: John Kacur <jkacur@redhat.com>
      

      But it won't work for RHEL because we are not changing the glibc minor version. It could be more straightforward to test whether <sched.h> defines SCHED_FLAG_DL_OVERRUN.

              jkacur John Kacur
              fweimer@redhat.com Florian Weimer
              John Kacur John Kacur
              Shizhao Chen Shizhao Chen
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: