From: Quentin Perret <qperret@google.com>
To: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
linux-kernel@vger.kernel.org
Cc: Quentin Perret <qperret@google.com>
Subject: [PATCH 2/2] sched: Don't report SCHED_FLAG_SUGOV in sched_getattr()
Date: Tue, 27 Jul 2021 11:11:02 +0100 [thread overview]
Message-ID: <20210727101103.2729607-3-qperret@google.com> (raw)
In-Reply-To: <20210727101103.2729607-1-qperret@google.com>
SCHED_FLAG_SUGOV is supposed to be a kernel-only flag that userspace
cannot interact with. However, sched_getattr() currently reports it
in sched_flags if called on a sugov worker even though it is not
actually defined in a UAPI header. To avoid this, make sure to
clean-up the sched_flags field in sched_getattr() before returning to
userspace.
Signed-off-by: Quentin Perret <qperret@google.com>
---
kernel/sched/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 2d9ff40f4661..d8f489dcc383 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7535,6 +7535,7 @@ SYSCALL_DEFINE4(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr,
kattr.sched_priority = p->rt_priority;
else
kattr.sched_nice = task_nice(p);
+ kattr.sched_flags &= SCHED_FLAG_ALL;
#ifdef CONFIG_UCLAMP_TASK
/*
--
2.32.0.432.gabb21c7263-goog
next prev parent reply other threads:[~2021-07-27 10:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-27 10:11 [PATCH 0/2] A couple of sched_getattr() fixes for DL Quentin Perret
2021-07-27 10:11 ` [PATCH 1/2] sched/deadline: Fix reset_on_fork reporting of DL tasks Quentin Perret
2021-07-29 16:26 ` Dietmar Eggemann
2021-08-05 9:34 ` [tip: sched/core] " tip-bot2 for Quentin Perret
2021-07-27 10:11 ` Quentin Perret [this message]
2021-07-28 9:12 ` [PATCH 2/2] sched: Don't report SCHED_FLAG_SUGOV in sched_getattr() Juri Lelli
2021-07-28 9:39 ` Quentin Perret
2021-07-28 12:36 ` Juri Lelli
2021-07-29 17:21 ` Dietmar Eggemann
2021-07-29 17:28 ` Quentin Perret
2021-08-05 9:34 ` [tip: sched/core] " tip-bot2 for Quentin Perret
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=20210727101103.2729607-3-qperret@google.com \
--to=qperret@google.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.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