Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1590859

Re: [PATCH v4] net: don't call strlen() on the user buffer in packet_bind_spkt()

From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [PATCH v4] net: don't call strlen() on the user buffer in packet_bind_spkt()
Date 2017-03-02 07:20 +0100
Message-ID <tgsfL-6BU-5@gated-at.bofh.it> (permalink)
References <tgcb1-3ud-61@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Alexander Potapenko <glider@google.com>
Date: Wed,  1 Mar 2017 12:57:20 +0100

> KMSAN (KernelMemorySanitizer, a new error detection tool) reports use of
> uninitialized memory in packet_bind_spkt():
 ...
> This happens because addr.sa_data copied from the userspace is not
> zero-terminated, and copying it with strlcpy() in packet_bind_spkt()
> results in calling strlen() on the kernel copy of that non-terminated
> buffer.
> 
> Signed-off-by: Alexander Potapenko <glider@google.com>
> ---
> Changes since v3:
>  - addressed comments by Eric Dumazet (avoid using constants,
>    use memcpy() instead of strncpy())

Applied and queued up for -stable.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v4] net: don't call strlen() on the user buffer in packet_bind_spkt() Alexander Potapenko <glider@google.com> - 2017-03-01 14:10 +0100
  Re: [PATCH v4] net: don't call strlen() on the user buffer in  packet_bind_spkt() Eric Dumazet <eric.dumazet@gmail.com> - 2017-03-01 17:00 +0100
  Re: [PATCH v4] net: don't call strlen() on the user buffer in packet_bind_spkt() Cong Wang <xiyou.wangcong@gmail.com> - 2017-03-02 06:30 +0100
  Re: [PATCH v4] net: don't call strlen() on the user buffer in  packet_bind_spkt() David Miller <davem@davemloft.net> - 2017-03-02 07:20 +0100

csiph-web