public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: libc-alpha@sourceware.org
Subject: [PATCH] Linux: Do not check unused bytes after sched_getattr in tst-sched_setattr
Date: Mon, 20 Jan 2025 10:50:35 +0100	[thread overview]
Message-ID: <87v7u9ddas.fsf@oldenburg.str.redhat.com> (raw)

Linux 6.13 was released with a change that overwrites those bytes.
This means that the check_unused subtest fails.

Update the manual accordingly.

Tested on x86_64-linux-gnu (although not with Linux 6.13).

---
 manual/resource.texi                        |  6 +++---
 sysdeps/unix/sysv/linux/tst-sched_setattr.c | 11 -----------
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/manual/resource.texi b/manual/resource.texi
index 612520d4d9..0b82446817 100644
--- a/manual/resource.texi
+++ b/manual/resource.texi
@@ -1058,9 +1058,9 @@ available in the future.
 
 Upon success, @code{@var{attr}->size} contains the size of the structure
 version used by the kernel.  Fields with offsets greater or equal to
-@code{@var{attr}->size} are not updated by the kernel.  To obtain
-predictable values for unknown fields, use @code{memset} to set
-all @var{size} bytes to zero prior to calling @code{sched_getattr}.
+@code{@var{attr}->size} may not be overwritten by the kernel.  To obtain
+predictable values for unknown fields, use @code{memset} to set all
+@var{size} bytes to zero prior to calling @code{sched_getattr}.
 
 On failure, @code{sched_getattr} returns @math{-1} and sets @code{errno}.
 If @code{errno} is @code{E2BIG}, this means that the buffer is not large
diff --git a/sysdeps/unix/sysv/linux/tst-sched_setattr.c b/sysdeps/unix/sysv/linux/tst-sched_setattr.c
index ebad0ae2a8..bf8d9afd34 100644
--- a/sysdeps/unix/sysv/linux/tst-sched_setattr.c
+++ b/sysdeps/unix/sysv/linux/tst-sched_setattr.c
@@ -33,14 +33,6 @@ union
   unsigned char padding[4096];
 } u;
 
-static void
-check_unused (void)
-{
-  TEST_VERIFY (u.attr.size < sizeof (u));
-  for (unsigned int i = u.attr.size; i < sizeof (u); ++i)
-    TEST_COMPARE (u.padding[i], 0xcc);
-}
-
 static int
 do_test (void)
 {
@@ -53,7 +45,6 @@ do_test (void)
   /* Compiler barrier to bypass write access attribute.  */
   volatile unsigned int size = sizeof (u);
   TEST_COMPARE (sched_getattr (0, (struct sched_attr *) &u, size, 0), 0);
-  check_unused ();
   TEST_COMPARE (sched_setattr (0, &u.attr, 0), 0); /* Apply unchanged.  */
 
   /* Try to switch to the SCHED_OTHER policy.   */
@@ -81,14 +72,12 @@ do_test (void)
   memset (&u, 0xcc, sizeof (u));
   TEST_COMPARE (sched_getattr (0, (struct sched_attr *) &u, size, 0), 0);
   TEST_COMPARE (u.attr.sched_policy, SCHED_OTHER);
-  check_unused ();
 
   /* Raise the niceless level to 19 and observe its effect.  */
   TEST_COMPARE (nice (19), 19);
   TEST_COMPARE (sched_getattr (0, &u.attr, sizeof (u.attr), 0), 0);
   TEST_COMPARE (u.attr.sched_policy, SCHED_OTHER);
   TEST_COMPARE (u.attr.sched_nice, 19);
-  check_unused ();
 
   /* Invalid buffer arguments result in EINVAL (not EFAULT).  */
   {

base-commit: 8ef17919509e909746b0ad6465e9c6c952a3fe34


             reply	other threads:[~2025-01-20  9:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-20  9:50 Florian Weimer [this message]
2025-01-20 12:25 ` Xi Ruoyao
2025-01-20 12:52 ` Adhemerval Zanella Netto
2025-01-20 14:17 ` Adhemerval Zanella Netto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v7u9ddas.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).