Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3539363imu; Mon, 7 Jan 2019 05:18:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/VDrsAqD4OV/5NQ6aFMS0eZsHQnK6bOQ3RHwoBY4gEZHXzuBQk3da2jnWU4WUwQHCGso3LQ X-Received: by 2002:a62:8096:: with SMTP id j144mr63898905pfd.140.1546867118712; Mon, 07 Jan 2019 05:18:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546867118; cv=none; d=google.com; s=arc-20160816; b=OtI+85VxZYH3v5bOyTvmw9Yy89X4QsP30EdKvXKaKGYhxdktiTJeAgK5wnllrEzvT7 utYv6R+wzHg4Sr8962Jow7MhK1MCpFn5O9KpqXeXlp+KT3JidmKWAttenb5B36f2MW8D RWSgjbXNAKw4IUzzwXVbCUWg53jVuY2ZmBRbynFxVSnZ5IQhEle31+vhaM7l00svwu1P IU0tog4OJ8gxTwmjPjwZX+Mx9XWOmRltml7C7zQo1dRBZ2SvQuiEopWfAdC0JjdG5oTE leK/cK4aoLmFLWyHeAM75GMQNGpAfvBa3hvNbfs0gvIafFGmaBCMFhDhL5KxBwFUt5wr 80yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jSydAmOcg4gclj8ZXuVrS2vND1JU2duTM9UcXi/0NN0=; b=bRQGvXXSiU3pVbGRdDz93YgkarMIbTmrAJSxLMyrOQOBcd157Q5lKdey32lk02jIdq IzrD7EO/cRn5KqaARZytZlFZcEl3SmgWdMtTnmzhP0H0E4jkjTbJV3CMEAIIRuWhCSrP vkfQxuX00RFItybzJAwrv/ekYLH/DfHK0QxbUXsrJOQ6iTtkI/+LEif9bN9bha7kHErt 5UCZYQ1RJjMmYpJlAAQJVtG7nHu36vyprIes6EadAH2HqxYL8eWEKSUuXTCK5Ze5epS5 dsj8bjp4I+1Qf5MK6YUoNkMgZMEVdVEf5ipjkKe+6tzZF7nDLI+6IjXt/qP3bhuHxfE2 1spQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VBPRJsF9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k62si4150616pfc.208.2019.01.07.05.18.23; Mon, 07 Jan 2019 05:18:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VBPRJsF9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730161AbfAGNAa (ORCPT + 99 others); Mon, 7 Jan 2019 08:00:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:47982 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729599AbfAGNA2 (ORCPT ); Mon, 7 Jan 2019 08:00:28 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5C703206BB; Mon, 7 Jan 2019 13:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546866027; bh=d+Oe8sPu8bJIAQxLJhEfEDlYDbnQ6SNt3r09F6dWsUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VBPRJsF9x0xOrgSdGIDeSPR2l99XqjQbo7JzI0J0wZvf9z4VWMKeDn6MScaHffbiS lflj481N9Mf4gz7ODQSKTZlMvyrxDTio6eJ1eai/SlzC0On6d84C/vhc64eyYWV8S4 2OIih63/IrxKvaRnKtu1J9Y6hzXcEaEomSmgRPIo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+ad5d327e6936a2e284be@syzkaller.appspotmail.com, Xin Long , Marcelo Ricardo Leitner , Neil Horman , "David S. Miller" Subject: [PATCH 4.14 021/101] sctp: initialize sin6_flowinfo for ipv6 addrs in sctp_inet6addr_event Date: Mon, 7 Jan 2019 13:32:09 +0100 Message-Id: <20190107105334.111598005@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107105330.372621917@linuxfoundation.org> References: <20190107105330.372621917@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Xin Long [ Upstream commit 4a2eb0c37b4759416996fbb4c45b932500cf06d3 ] syzbot reported a kernel-infoleak, which is caused by an uninitialized field(sin6_flowinfo) of addr->a.v6 in sctp_inet6addr_event(). The call trace is as below: BUG: KMSAN: kernel-infoleak in _copy_to_user+0x19a/0x230 lib/usercopy.c:33 CPU: 1 PID: 8164 Comm: syz-executor2 Not tainted 4.20.0-rc3+ #95 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x32d/0x480 lib/dump_stack.c:113 kmsan_report+0x12c/0x290 mm/kmsan/kmsan.c:683 kmsan_internal_check_memory+0x32a/0xa50 mm/kmsan/kmsan.c:743 kmsan_copy_to_user+0x78/0xd0 mm/kmsan/kmsan_hooks.c:634 _copy_to_user+0x19a/0x230 lib/usercopy.c:33 copy_to_user include/linux/uaccess.h:183 [inline] sctp_getsockopt_local_addrs net/sctp/socket.c:5998 [inline] sctp_getsockopt+0x15248/0x186f0 net/sctp/socket.c:7477 sock_common_getsockopt+0x13f/0x180 net/core/sock.c:2937 __sys_getsockopt+0x489/0x550 net/socket.c:1939 __do_sys_getsockopt net/socket.c:1950 [inline] __se_sys_getsockopt+0xe1/0x100 net/socket.c:1947 __x64_sys_getsockopt+0x62/0x80 net/socket.c:1947 do_syscall_64+0xcf/0x110 arch/x86/entry/common.c:291 entry_SYSCALL_64_after_hwframe+0x63/0xe7 sin6_flowinfo is not really used by SCTP, so it will be fixed by simply setting it to 0. The issue exists since very beginning. Thanks Alexander for the reproducer provided. Reported-by: syzbot+ad5d327e6936a2e284be@syzkaller.appspotmail.com Signed-off-by: Xin Long Acked-by: Marcelo Ricardo Leitner Acked-by: Neil Horman Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/sctp/ipv6.c | 1 + 1 file changed, 1 insertion(+) --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c @@ -101,6 +101,7 @@ static int sctp_inet6addr_event(struct n if (addr) { addr->a.v6.sin6_family = AF_INET6; addr->a.v6.sin6_port = 0; + addr->a.v6.sin6_flowinfo = 0; addr->a.v6.sin6_addr = ifa->addr; addr->a.v6.sin6_scope_id = ifa->idev->dev->ifindex; addr->valid = 1;