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


Groups > linux.kernel > #1661635

Re: [PATCH] af_unix: Add sockaddr length checks before accessing sa_family in bind and connect handlers

From David Miller <davem@davemloft.net>
Newsgroups linux.kernel
Subject Re: [PATCH] af_unix: Add sockaddr length checks before accessing sa_family in bind and connect handlers
Date 2017-06-08 22:10 +0200
Message-ID <tQbUK-nj-13@gated-at.bofh.it> (permalink)
References <tQ1LI-2jR-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Mateusz Jurczyk <mjurczyk@google.com>
Date: Thu,  8 Jun 2017 11:13:36 +0200

> Verify that the caller-provided sockaddr structure is large enough to
> contain the sa_family field, before accessing it in bind() and connect()
> handlers of the AF_UNIX socket. Since neither syscall enforces a minimum
> size of the corresponding memory region, very short sockaddrs (zero or
> one byte long) result in operating on uninitialized memory while
> referencing .sa_family.
> 
> Signed-off-by: Mateusz Jurczyk <mjurczyk@google.com>

The sockaddr comes from a structure on the caller's kernel stack, even
if the user gives a smaller length, it is legal to access that memory.

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


Thread

[PATCH] af_unix: Add sockaddr length checks before accessing sa_family in bind and connect handlers Mateusz Jurczyk <mjurczyk@google.com> - 2017-06-08 11:20 +0200
  Re: [PATCH] af_unix: Add sockaddr length checks before accessing  sa_family in bind and connect handlers David Miller <davem@davemloft.net> - 2017-06-08 22:10 +0200
    Re: [PATCH] af_unix: Add sockaddr length checks before accessing  sa_family in bind and connect handlers Mateusz Jurczyk <mjurczyk@google.com> - 2017-06-09 13:20 +0200
      Re: [PATCH] af_unix: Add sockaddr length checks before accessing  sa_family in bind and connect handlers David Miller <davem@davemloft.net> - 2017-06-09 16:20 +0200

csiph-web