Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3509993imu; Mon, 7 Jan 2019 04:50:01 -0800 (PST) X-Google-Smtp-Source: AFSGD/UYJdCJks/Pz42Oie6Je0px+eC3gPt2obUkuYTopBg9/baUY74h7AhqMm2FhiKRT34F8UpC X-Received: by 2002:a62:b2c3:: with SMTP id z64mr62283054pfl.120.1546865401503; Mon, 07 Jan 2019 04:50:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546865401; cv=none; d=google.com; s=arc-20160816; b=MQnOfQrXGLZk6rS/XkaERpRSWyvWhtNoK6JAQovaxS7sKbyAOeOmaVp5XrqVkyN9lz dkcn6mRaO1CtPqAMJM1FojmPh+XshMLA37iT+KNcQLV6GORiP+WWKwxxBuH2bA42zGmn SfBA/TQ/Kbb3wFF3oYHX5SHQ1rS7WIuDmgGgRzag9g/k0QUDk0R/qYygpMrktQQtb23C Q5aklcCPMQVx5s5eVQoGAc5a0et2UPREngUTmKOfqAiae/KKKd20TEr7ZHa3scirpUPe PQvf0/cS9SKkKNENw+yNT9s+DK8i55gGQ6848GEjIRcxyhC42mh8x5E8QgI+nqFgReR/ iGrw== 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=/EcGxxWvVWCzjuoTTgXSLeTXie/s7P9dEyYEezQkt6k=; b=VuA/3RyyqIDb1jrKUwCv9C4+b+qOg1Cf9S+HIu2bEXpNzTM/es63xLIBYq0uJluJ86 /masSAfN/W+pz+cgerDJkFKILK0b7qpKJNMot4RNckux3hl/6v7/fL32i+jUv2/BsZpY eAA0oQem1r7jqnDhJghXS1Am3pdpJ+pHpjBhsy4tJlvtAWcEBRG2HVcc9pOFw23rmwXc KxS6BmZtXiK0aqhgiae4+RHLsZS0cV3J5qqNKx29quiOrrXQqpMXrRK8jjhBD2EYH3Jx Kp/FnKS+8ewrDNaeT77jH6lKfiGVi/3AXDV8ly5JzIGfGtT3bqr7dBHxVnVdaU3uMdwX AFDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=k5fVLyRR; 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 r7si63863191ple.281.2019.01.07.04.49.46; Mon, 07 Jan 2019 04:50:01 -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=k5fVLyRR; 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 S1728607AbfAGMqy (ORCPT + 99 others); Mon, 7 Jan 2019 07:46:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:36828 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728582AbfAGMqu (ORCPT ); Mon, 7 Jan 2019 07:46:50 -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 1F333218A1; Mon, 7 Jan 2019 12:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546865209; bh=1VH9i5EzF2v0GgZHFyuBTZhMcFRK2CtH9vs1K7CpOSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k5fVLyRRpwFUSnBudPd1j4f/T2L5eys9lSYJ3yeFaOcYL/r6e68bcmL1eCTFSxOZC dGB8AMOJPjltE7Hjs9/1vivFieMu974XwxKOaW27IVcXeJ5zrqrZ4JHXJPcrmqjhlT KSCJ0UvKGM52XBxXYGWDfnpupNy1g0x9Sa62iZ2k= 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.19 030/170] sctp: initialize sin6_flowinfo for ipv6 addrs in sctp_inet6addr_event Date: Mon, 7 Jan 2019 13:30:57 +0100 Message-Id: <20190107104456.648121005@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107104452.953560660@linuxfoundation.org> References: <20190107104452.953560660@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.19-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;