All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Kuniyuki Iwashima <kuniyu@amazon.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <simon.horman@corigine.com>,
	Kuniyuki Iwashima <kuni1840@gmail.com>,
	netdev@vger.kernel.org, kernel test robot <oliver.sang@intel.com>
Subject: Re: [PATCH v1 net] af_unix: Terminate sun_path when bind()ing pathname socket.
Date: Wed, 26 Jul 2023 15:15:45 -0700	[thread overview]
Message-ID: <202307261514.BB2AB4E3@keescook> (raw)
In-Reply-To: <20230726190828.47874-1-kuniyu@amazon.com>

On Wed, Jul 26, 2023 at 12:08:28PM -0700, Kuniyuki Iwashima wrote:
> kernel test robot reported slab-out-of-bounds access in strlen(). [0]
> 
> Commit 06d4c8a80836 ("af_unix: Fix fortify_panic() in unix_bind_bsd().")
> removed unix_mkname_bsd() call in unix_bind_bsd().
> 
> If sunaddr->sun_path is not terminated by user and we don't enable
> CONFIG_INIT_STACK_ALL_ZERO=y, strlen() will do the out-of-bounds access
> during file creation.
> 
> Let's go back to strlen()-with-sockaddr_storage way and pack all 108
> trickiness into unix_mkname_bsd() with bold comments.
> 

Okay, this does at least collapse all the scary casting into a single
function. :) Thanks for navigating this!

Reviewed-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

  reply	other threads:[~2023-07-26 22:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-26 19:08 [PATCH v1 net] af_unix: Terminate sun_path when bind()ing pathname socket Kuniyuki Iwashima
2023-07-26 22:15 ` Kees Cook [this message]
2023-07-27  9:40 ` patchwork-bot+netdevbpf

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=202307261514.BB2AB4E3@keescook \
    --to=keescook@chromium.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=kuniyu@amazon.com \
    --cc=netdev@vger.kernel.org \
    --cc=oliver.sang@intel.com \
    --cc=pabeni@redhat.com \
    --cc=simon.horman@corigine.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.