From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935375AbdKPOBa (ORCPT ); Thu, 16 Nov 2017 09:01:30 -0500 Received: from shards.monkeyblade.net ([184.105.139.130]:44106 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935281AbdKPOAc (ORCPT ); Thu, 16 Nov 2017 09:00:32 -0500 Date: Thu, 16 Nov 2017 23:00:26 +0900 (KST) Message-Id: <20171116.230026.45581437273132607.davem@davemloft.net> To: ebiederm@xmission.com Cc: keescook@chromium.org, eric.dumazet@gmail.com, kcc@google.com, andreyknvl@google.com, edumazet@google.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, security@kernel.org, glider@google.com, linux-sctp@vger.kernel.org, nhorman@tuxdriver.com, vyasevich@gmail.com Subject: Re: [PATCH net] net/sctp: Always set scope_id in sctp_inet6_skb_msgname From: David Miller In-Reply-To: <871skyzwk3.fsf_-_@xmission.com> References: <871skyzwk3.fsf_-_@xmission.com> X-Mailer: Mew version 6.7 on Emacs 25.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 16 Nov 2017 06:00:32 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: ebiederm@xmission.com (Eric W. Biederman) Date: Wed, 15 Nov 2017 22:17:48 -0600 > > Alexandar Potapenko while testing the kernel with KMSAN and syzkaller > discovered that in some configurations sctp would leak 4 bytes of > kernel stack. > > Working with his reproducer I discovered that those 4 bytes that > are leaked is the scope id of an ipv6 address returned by recvmsg. > > With a little code inspection and a shrewd guess I discovered that > sctp_inet6_skb_msgname only initializes the scope_id field for link > local ipv6 addresses to the interface index the link local address > pertains to instead of initializing the scope_id field for all ipv6 > addresses. > > That is almost reasonable as scope_id's are meaniningful only for link > local addresses. Set the scope_id in all other cases to 0 which is > not a valid interface index to make it clear there is nothing useful > in the scope_id field. > > There should be no danger of breaking userspace as the stack leak > guaranteed that previously meaningless random data was being returned. > > Fixes: 372f525b495c ("SCTP: Resync with LKSCTP tree.") > History-tree: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git > Reported-by: Alexander Potapenko > Tested-by: Alexander Potapenko > Signed-off-by: "Eric W. Biederman" Applied and queued up for -stable, thanks Eric.