mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: mjurczyk@google.com
Cc: xiyou.wangcong@gmail.com, hannes@stressinduktion.org,
	viro@zeniv.linux.org.uk, keescook@chromium.org,
	mszeredi@redhat.com, iboukris@gmail.com, avagin@openvz.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] af_unix: Add sockaddr length checks before accessing sa_family in bind and connect handlers
Date: Thu, 08 Jun 2017 16:04:25 -0400 (EDT)	[thread overview]
Message-ID: <20170608.160425.3981801836671654.davem@davemloft.net> (raw)
In-Reply-To: <20170608091336.8274-1-mjurczyk@google.com>

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.

  reply	other threads:[~2017-06-08 20:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08  9:13 Mateusz Jurczyk
2017-06-08 20:04 ` David Miller [this message]
2017-06-09 11:15   ` Mateusz Jurczyk
2017-06-09 14:09     ` David Miller

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=20170608.160425.3981801836671654.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=avagin@openvz.org \
    --cc=hannes@stressinduktion.org \
    --cc=iboukris@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjurczyk@google.com \
    --cc=mszeredi@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xiyou.wangcong@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®