From: Philippe Gerum <rpm@xenomai.org>
To: "François Legal" <francois.legal@thom.fr.eu.org>
Cc: xenomai@xenomai.org
Subject: Re: [Patch 3/5] Problems with upstream SPECTRE mitigation found in sendmsg/recvmsg syscalls
Date: Mon, 07 Dec 2020 15:36:25 +0100 [thread overview]
Message-ID: <87eek1vg2e.fsf@xenomai.org> (raw)
In-Reply-To: <1174-5fce0b80-71-37e14c00@74919572>
François Legal via Xenomai <xenomai@xenomai.org> writes:
> From: François LEGAL <devel@thom.fr.eu.org>
>
> Add rtipc_get_arg (copy_from_ser) call on struct user_msghdr.
>
> Signed-off-by: François LEGAL <devel@thom.fr.eu.org>
> ---
> kernel/drivers/ipc/bufp.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/drivers/ipc/bufp.c b/kernel/drivers/ipc/bufp.c
> index 45c917e..c09524c 100644
> --- a/kernel/drivers/ipc/bufp.c
> +++ b/kernel/drivers/ipc/bufp.c
> @@ -352,12 +352,17 @@ static ssize_t __bufp_recvmsg(struct rtdm_fd *fd,
> }
>
> static ssize_t bufp_recvmsg(struct rtdm_fd *fd,
> - struct user_msghdr *msg, int flags)
> + struct user_msghdr *u_msg, int flags)
> {
> struct iovec iov_fast[RTDM_IOV_FASTMAX], *iov;
> struct sockaddr_ipc saddr;
> + struct user_msghdr _msg, *msg = & _msg;
> ssize_t ret;
>
> + ret = rtipc_get_arg(fd, &_msg, u_msg, sizeof(_msg));
> + if (ret)
> + return -ret;
rtipc_get_arg() returns zero on sucess, or negated error codes already
(-EFAULT typically).
> +
> if (flags & ~MSG_DONTWAIT)
> return -EINVAL;
>
> @@ -598,14 +603,19 @@ fail:
> }
>
> static ssize_t bufp_sendmsg(struct rtdm_fd *fd,
> - const struct user_msghdr *msg, int flags)
> + const struct user_msghdr *u_msg, int flags)
> {
> struct rtipc_private *priv = rtdm_fd_to_private(fd);
> struct iovec iov_fast[RTDM_IOV_FASTMAX], *iov;
> struct bufp_socket *sk = priv->state;
> struct sockaddr_ipc daddr;
> + struct user_msghdr _msg, *msg = & _msg;
> ssize_t ret;
>
> + ret = rtipc_get_arg(fd, &_msg, u_msg, sizeof(_msg));
> + if (ret)
> + return -ret;
> +
ditto.
> if (flags & ~MSG_DONTWAIT)
> return -EINVAL;
--
Philippe.
next prev parent reply other threads:[~2020-12-07 14:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-07 11:00 [Patch 3/5] Problems with upstream SPECTRE mitigation found in sendmsg/recvmsg syscalls François Legal
2020-12-07 14:36 ` Philippe Gerum [this message]
2020-12-07 15:40 ` François Legal
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=87eek1vg2e.fsf@xenomai.org \
--to=rpm@xenomai.org \
--cc=francois.legal@thom.fr.eu.org \
--cc=xenomai@xenomai.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.