From: Al Viro <viro@zeniv.linux.org.uk>
To: Philipp Stanner <pstanner@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Stanislav Fomichev <sdf@google.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
linux-ppp@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Dave Airlie <airlied@redhat.com>
Subject: Re: [PATCH] drivers/net/ppp: copy userspace array safely
Date: Thu, 2 Nov 2023 20:09:43 +0000 [thread overview]
Message-ID: <20231102200943.GK1957730@ZenIV> (raw)
In-Reply-To: <20231102191914.52957-2-pstanner@redhat.com>
On Thu, Nov 02, 2023 at 08:19:15PM +0100, Philipp Stanner wrote:
> In ppp_generic.c memdup_user() is utilized to copy a userspace array.
> This is done without an overflow check.
>
> Use the new wrapper memdup_array_user() to copy the array more safely.
> fprog.len = uprog->len;
> - fprog.filter = memdup_user(uprog->filter,
> - uprog->len * sizeof(struct sock_filter));
> + fprog.filter = memdup_array_user(uprog->filter,
> + uprog->len, sizeof(struct sock_filter));
Far be it from me to discourage security theat^Whardening, but
struct sock_fprog { /* Required for SO_ATTACH_FILTER. */
unsigned short len; /* Number of filter blocks */
struct sock_filter __user *filter;
};
struct sock_filter { /* Filter block */
__u16 code; /* Actual filter code */
__u8 jt; /* Jump true */
__u8 jf; /* Jump false */
__u32 k; /* Generic multiuse field */
};
so you might want to mention that overflow in question would have to be
in multiplying an untrusted 16bit value by 8...
next prev parent reply other threads:[~2023-11-02 20:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-02 19:19 [PATCH] drivers/net/ppp: copy userspace array safely Philipp Stanner
2023-11-02 20:09 ` Al Viro [this message]
2023-11-02 22:02 ` Philipp Stanner
2023-11-02 22:30 ` Al Viro
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=20231102200943.GK1957730@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=airlied@redhat.com \
--cc=benjamin.tissoires@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-ppp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pstanner@redhat.com \
--cc=sdf@google.com \
/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.