linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aleksa Sarai <cyphar@cyphar.com>
To: mtk.manpages@gmail.com
Cc: Aleksa Sarai <cyphar@cyphar.com>,
	Thadeu Lima de Souza Cascardo <cascardo@canonical.com>,
	Ingo Molnar <mingo@kernel.org>,
	Arnaldo Carvalho de Melo <acme@infradead.org>,
	Jiri Olsa <jolsa@redhat.com>,
	Patrick Bellasi <patrick.bellasi@arm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-man@vger.kernel.org, linux-api@vger.kernel.org
Subject: [PATCH 1/2] sched_getattr.2: update to include changed size semantics
Date: Wed, 30 Sep 2020 08:35:08 +1000	[thread overview]
Message-ID: <20200929223509.11783-1-cyphar@cyphar.com> (raw)
In-Reply-To: <CAKgNAkiMNssJ2kCtGXd9ZUMFrG6uVtECBXMLGf2EZeS5-rkPKA@mail.gmail.com>

Due to a userspace breakage, commit 1251201c0d34 ("sched/core: Fix
uclamp ABI bug, clean up and robustify sched_read_attr() ABI logic and
code") changed the semantics of sched_getattr(2) when the userspace
struct is smaller than the kernel struct. Now, any trailing non-zero
data in the kernel structure is ignored when copying to userspace. We
also document the original error code correctly (it was EFBIG not
E2BIG) in the BUGS section.

Ref: 1251201c0d34 ("sched/core: Fix uclamp ABI bug, clean up and
                    robustify sched_read_attr() ABI logic and code")
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
---
 man2/sched_setattr.2 | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/man2/sched_setattr.2 b/man2/sched_setattr.2
index 2592a761a086..da0972a6a86d 100644
--- a/man2/sched_setattr.2
+++ b/man2/sched_setattr.2
@@ -286,10 +286,8 @@ structure,
 the additional bytes in the user-space structure are not touched.
 If the caller-provided structure is smaller than the kernel
 .I sched_attr
-structure and the kernel needs to return values outside the provided space,
-.BR sched_getattr ()
-fails with the error
-.BR E2BIG .
+structure, the kernel will silently not return any values which would be stored
+outside the provided space.
 As with
 .BR sched_setattr (),
 these semantics allow for future extensibility of the interface.
@@ -416,6 +414,16 @@ failed with the error
 instead of
 .BR E2BIG
 for the case described in ERRORS.
+.PP
+In Linux versions up to 5.3,
+.BR sched_getattr ()
+failed with the error
+.BR EFBIG
+if the in-kernel
+.IR sched_attr
+structure was larger than the
+.IR size
+passed by user space.
 .\" In Linux versions up to up 3.15,
 .\" FIXME . patch from Peter Zijlstra pending
 .\" .BR sched_setattr ()
-- 
2.28.0


  reply	other threads:[~2020-09-29 22:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-28 12:01 [PATCH] sched_getattr.2: update to include changed size semantics Aleksa Sarai
2019-11-28 13:08 ` Thadeu Lima de Souza Cascardo
2019-11-28 13:55   ` Aleksa Sarai
2020-04-25 19:12     ` Michael Kerrisk (man-pages)
2020-05-15 12:10       ` Michael Kerrisk (man-pages)
2020-09-29 22:35         ` Aleksa Sarai [this message]
2020-09-29 22:35           ` [PATCH 2/2] openat2.2: fix minor reference typo Aleksa Sarai
2020-09-30 10:51             ` Michael Kerrisk (man-pages)
2020-09-30 10:51           ` [PATCH 1/2] sched_getattr.2: update to include changed size semantics Michael Kerrisk (man-pages)

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=20200929223509.11783-1-cyphar@cyphar.com \
    --to=cyphar@cyphar.com \
    --cc=acme@infradead.org \
    --cc=cascardo@canonical.com \
    --cc=jolsa@redhat.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=patrick.bellasi@arm.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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 NNTP newsgroup(s).