[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202307261514.BB2AB4E3@keescook>
Date: Wed, 26 Jul 2023 15:15:45 -0700
From: Kees Cook <keescook@...omium.org>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <simon.horman@...igine.com>,
Kuniyuki Iwashima <kuni1840@...il.com>, netdev@...r.kernel.org,
kernel test robot <oliver.sang@...el.com>
Subject: Re: [PATCH v1 net] af_unix: Terminate sun_path when bind()ing
pathname socket.
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@...omium.org>
--
Kees Cook
Powered by blists - more mailing lists