From: "Michael Kerrisk (man-pages)" <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Peter Zijlstra <peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
lkml <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Juri Lelli <juri.lelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Dario Faggioli <raistlin-k2GhghHVRtY@public.gmane.org>,
Ingo Molnar <mingo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 1/3] sched: Make sched_setattr() correctly return -EFBIG
Date: Wed, 14 May 2014 05:23:50 +0200 [thread overview]
Message-ID: <5372E1C6.5070109@gmail.com> (raw)
In-Reply-To: <536CEC17.9070903-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Peter,
In the title of this patch, EFBIG should have been E2BIG. Shall
I resubmit a corrected version?
Cheers,
Michael
On 05/09/2014 04:54 PM, Michael Kerrisk (man-pages) wrote:
> From: Michael Kerrisk <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>
> The documented[1] behavior of sched_attr() in your proposed man page text is:
>
> sched_attr::size must be set to the size of the structure, as in
> sizeof(struct sched_attr), if the provided structure is smaller
> than the kernel structure, any additional fields are assumed
> '0'. If the provided structure is larger than the kernel structure,
> the kernel verifies all additional fields are '0' if not the
> syscall will fail with -E2BIG.
>
> As currently implemented, sched_copy_attr() returns -EFBIG for
> for this case, but the logic in sys_sched_setattr() converts that
> error to -EFAULT. This patch fixes the behavior.
>
> [1] http://thread.gmane.org/gmane.linux.kernel/1615615/focus=1697760
>
> Signed-off-by: Michael Kerrisk <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
> kernel/sched/core.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 268a45e..6c9ce28 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -3650,8 +3650,9 @@ SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr,
> if (!uattr || pid < 0 || flags)
> return -EINVAL;
>
> - if (sched_copy_attr(uattr, &attr))
> - return -EFAULT;
> + retval = sched_copy_attr(uattr, &attr);
> + if (retval)
> + return retval;
>
> rcu_read_lock();
> retval = -ESRCH;
>
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: mtk.manpages@gmail.com, lkml <linux-kernel@vger.kernel.org>,
Juri Lelli <juri.lelli@gmail.com>,
Dario Faggioli <raistlin@linux.it>,
Ingo Molnar <mingo@kernel.org>,
"linux-man@vger.kernel.org" <linux-man@vger.kernel.org>
Subject: Re: [PATCH 1/3] sched: Make sched_setattr() correctly return -EFBIG
Date: Wed, 14 May 2014 05:23:50 +0200 [thread overview]
Message-ID: <5372E1C6.5070109@gmail.com> (raw)
In-Reply-To: <536CEC17.9070903@gmail.com>
Peter,
In the title of this patch, EFBIG should have been E2BIG. Shall
I resubmit a corrected version?
Cheers,
Michael
On 05/09/2014 04:54 PM, Michael Kerrisk (man-pages) wrote:
> From: Michael Kerrisk <mtk.manpages@gmail.com>
>
> The documented[1] behavior of sched_attr() in your proposed man page text is:
>
> sched_attr::size must be set to the size of the structure, as in
> sizeof(struct sched_attr), if the provided structure is smaller
> than the kernel structure, any additional fields are assumed
> '0'. If the provided structure is larger than the kernel structure,
> the kernel verifies all additional fields are '0' if not the
> syscall will fail with -E2BIG.
>
> As currently implemented, sched_copy_attr() returns -EFBIG for
> for this case, but the logic in sys_sched_setattr() converts that
> error to -EFAULT. This patch fixes the behavior.
>
> [1] http://thread.gmane.org/gmane.linux.kernel/1615615/focus=1697760
>
> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
> ---
> kernel/sched/core.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 268a45e..6c9ce28 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -3650,8 +3650,9 @@ SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr,
> if (!uattr || pid < 0 || flags)
> return -EINVAL;
>
> - if (sched_copy_attr(uattr, &attr))
> - return -EFAULT;
> + retval = sched_copy_attr(uattr, &attr);
> + if (retval)
> + return retval;
>
> rcu_read_lock();
> retval = -ESRCH;
>
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
next prev parent reply other threads:[~2014-05-14 3:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-09 14:49 [PATCH 0/3] sched: sched_setattr/sched_getattr fixes and improvements Michael Kerrisk (man-pages)
2014-05-09 14:54 ` [PATCH 1/3] sched: Make sched_setattr() correctly return -EFBIG Michael Kerrisk (man-pages)
[not found] ` <536CEC17.9070903-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-05-14 3:23 ` Michael Kerrisk (man-pages) [this message]
2014-05-14 3:23 ` Michael Kerrisk (man-pages)
2014-05-19 13:06 ` [tip:sched/core] " tip-bot for Michael Kerrisk
2014-05-22 12:24 ` tip-bot for Michael Kerrisk
2014-05-09 14:54 ` [PATCH 2/3] sched: Simplify return logic in sched_copy_attr() Michael Kerrisk (man-pages)
2014-05-19 13:08 ` [tip:sched/core] sched: Simplify return logic in sched_copy_attr( ) tip-bot for Michael Kerrisk
2014-05-22 12:26 ` tip-bot for Michael Kerrisk
2014-05-09 14:54 ` [PATCH 3/3] sched: Simplify return logic in sched_read_attr() Michael Kerrisk (man-pages)
2014-05-19 13:08 ` [tip:sched/core] sched: Simplify return logic in sched_read_attr( ) tip-bot for Michael Kerrisk
2014-05-22 12:27 ` tip-bot for Michael Kerrisk
2014-05-09 17:16 ` [PATCH 0/3] sched: sched_setattr/sched_getattr fixes and improvements Peter Zijlstra
2014-05-13 18:09 ` Michael Kerrisk (man-pages)
2014-05-13 19:30 ` Peter Zijlstra
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=5372E1C6.5070109@gmail.com \
--to=mtk.manpages-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=juri.lelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mingo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=raistlin-k2GhghHVRtY@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.