Received: by 10.223.176.5 with SMTP id f5csp2578842wra; Thu, 1 Feb 2018 02:41:47 -0800 (PST) X-Google-Smtp-Source: AH8x22735nHVDU8UxRuZFHPcMG45j/nntlMtHz3EARrNRPzAWXHJuWx1kJ8EE8XmyC40ZfsyteeX X-Received: by 10.99.125.74 with SMTP id m10mr29574934pgn.354.1517481706942; Thu, 01 Feb 2018 02:41:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517481706; cv=none; d=google.com; s=arc-20160816; b=eraGIgGM4zdLuHiuE/QQnsQT8MVw75QWepspOG5oiVpUQeTBN7uv0l1gensXhQTIcE +wSPoXh6gdFEOmoc7N6oPTxI9Baej1ipargl1VsnxGghRmGznUUlnm2QfjkbkSgDj8m2 nj0TVW8YRWYDk1YO/Ap92GDNmLNc7Y+krB6LT8UobLXy0g4h5FrQmTbUjwHtydDTMUBJ 9ynx/04tTFjvqSQuSNIhT30302TIT3ozTT/gMVe6LDdGzSAlgbVK4iQ1OLb5sayKIoG2 Ot2OQ5nQxCnb0qIpZJ1QO99Dv5oMPnt2PLTIxA5fz9G67aKpfrNFV9C7D8hsilwppKEL ekeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Ug5E7y7HSA4zNtJFBGYH3umX/lL3fbUrkAdzzg1u6hE=; b=ofB3K/zoPAxcexhn5yM9qGzaD2AZWSHNu086UDWlw8HmczPrTXjqDT6W9mqIfaQeVJ a4y9Gi+41kfXOzRXYChXoExkAGQCfdmBr6wRiDkeChSsSu4GiTS1lcpBU8XFcbfdyeLR hsZVvuel1qhDqsf/N67Ewi9XWlju51Mmknfk11XrzF6H5sML1c+Z4+owZC2M3tvc1ndW 66rGMpTaP0RghzS/GkwbGcgeiS1JIkSqvA/biivFaHMBARnwUr07ZmUH54P4YtdsaqJV 9J4bYrUpzj0m9CeiERojowncclx1UlJU2W5b7djviEyH2eohxEH501XwTOtSXQ6goMd+ yoow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=r4Q7PPJJ; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e12si1411600pgu.56.2018.02.01.02.41.32; Thu, 01 Feb 2018 02:41:46 -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=@google.com header.s=20161025 header.b=r4Q7PPJJ; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752178AbeBAKj2 (ORCPT + 99 others); Thu, 1 Feb 2018 05:39:28 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:43411 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751909AbeBAKj0 (ORCPT ); Thu, 1 Feb 2018 05:39:26 -0500 Received: by mail-pf0-f195.google.com with SMTP id y26so15199387pfi.10 for ; Thu, 01 Feb 2018 02:39:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Ug5E7y7HSA4zNtJFBGYH3umX/lL3fbUrkAdzzg1u6hE=; b=r4Q7PPJJcX7tOcxV2oy08d3l7D4J8ErhowmdI6caQYSAOLItnjOvkQr6qH4ZL0otDc gZCZCUXdJYbje7cPs7vCcKXXSAFTOjtQipQcDmhxqjnGBMnuccCdEb8hlnQFqOu8TKqz Ub5TPs3zinXE1CVm3v1SiIKmTVNQ7dJZV0F8bONbDcLvDJjhhO57+NZSP3Dvn9E6vMxh UaO0eWf5urw1x2rBH4q2veeRvNGLhof4qGq244c4ABnnisAa3J3kcxZIBZ+ISFi3vsiJ jsDL2kWhpE9f+Xv7Hy5STEM9VpRyjfn4FH6eFRo+mx/AZQWQNcOF92aB9CyBY/7qXFqu LLyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Ug5E7y7HSA4zNtJFBGYH3umX/lL3fbUrkAdzzg1u6hE=; b=W+lIuavii+ClRHHIQsDXo7sKemewd7H2w1r+ABTDbvFOVNpdToiF6Iuwd28PqaoDIv iU+hwJVZ8XaRykegjhhHXuxf5KtkQLNglVW83y7JPRFqlVPd3dtDG/FvfrUFyjMcrXtN pVuTaKBSsRKSI2OxnFyKHMJIrRTohnJzFE97XcApRZq4uPwTfXOJ5hPC5yfWEyXvhtpY /oxxgPxsVPFd/o8MaDWjP71H7nKTf9/eKKzgID5gaG4bMdZBhGc4F6SFO0h1iXUcmqXc BLXKaYnyxERt9g4HLk3fVmvt65UaeHGPuw3JjWj7Lc+ULaBmP1JwZa2NugQsvG7vX7Rk Na4g== X-Gm-Message-State: AKwxytdAZ4fo5lKZvoiU+LA2lcgWrIPeu6x5AV5tT2ECSDGiHCCmWJv4 kyWUNWOALa6yTCfFySrSZtH8DYdQEl2rkDcpmqbZ3Q== X-Received: by 10.98.107.71 with SMTP id g68mr35967611pfc.96.1517481565613; Thu, 01 Feb 2018 02:39:25 -0800 (PST) MIME-Version: 1.0 Received: by 10.236.140.151 with HTTP; Thu, 1 Feb 2018 02:39:05 -0800 (PST) In-Reply-To: References: <001a1148251a36716f0564148ba9@google.com> <20180201083418.rfarzrodccdy54xx@gauss3.secunet.de> From: Dmitry Vyukov Date: Thu, 1 Feb 2018 11:39:05 +0100 Message-ID: Subject: Re: KASAN: stack-out-of-bounds Read in xfrm_state_find (4) To: Steffen Klassert Cc: syzbot , David Miller , Herbert Xu , LKML , netdev , syzkaller-bugs@googlegroups.com, Eric Biggers Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 1, 2018 at 11:30 AM, Dmitry Vyukov wrote: > On Thu, Feb 1, 2018 at 9:34 AM, Steffen Klassert > wrote: >> On Wed, Jan 31, 2018 at 07:58:01AM -0800, syzbot wrote: >>> Hello, >>> >>> syzbot hit the following crash on upstream commit >>> 72906f38934a49faf4d2d38ea9ae32adcf7d5d0c (Tue Jan 30 21:04:50 2018 +0000) >>> Merge branch 'x86-hyperv-for-linus' of >>> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip >>> >>> So far this crash happened 4 times on net-next, upstream. >>> C reproducer is attached. >>> syzkaller reproducer is attached. >>> Raw console output is attached. >>> compiler: gcc (GCC) 7.1.1 20170620 >>> .config is attached. >>> user-space arch: i386 >> >> Looks like we forgot to refuse to insert socket policies >> when userspace is 32 bit and kernel is 64 bit. We do this >> already for policies inserted with netlink because we don't >> have a compat layer for xfrm. This means that userspace >> and kernel structues don't match, leading to broken >> configurations. >> >> I don't have 32 bit userspace on 64 bit machines, so I >> can't test this myself. Can you please test this patch: > > > Hi Steffen, > > Please see the email footer: > >> If you want to test a patch for this bug, please reply with: >> #syz test: git://repo/address.git branch >> and provide the patch inline or as an attachment. And please add the Reported-by tag as syzbot asked: Reported-by: syzbot+e1a1577ca8bcb47b769a@syzkaller.appspotmail.com This is really important for overall process. In particular, syzbot will never report bugs in xfrm_state_find again as it will think that it's still the old bug not fixed. This is 4-th out-of-bounds in xfrm_state_find, so you can see this is important. I guess syzbot actually found this more than a month ago, but did not report, because nobody told it that the previous one is fixed. It reported it now because Eric updated the old bug with the fix yesterday. >> Subject: [PATCH RFC] xfrm: Refuse to insert 32 bit userspace socket policies on 64 bit systems >> >> We don't have compat layer for xfrm, so userspace and kernel >> structures have different sizes in this case. This results in >> a broken confuguration, so refuse to configure socket policies >> when trying to insert from 32 bit userspace as we do it already >> with policies inserted via netlink. >> >> Signed-off-by: Steffen Klassert >> --- >> net/xfrm/xfrm_state.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c >> index a3785f538018..25861a4ef872 100644 >> --- a/net/xfrm/xfrm_state.c >> +++ b/net/xfrm/xfrm_state.c >> @@ -2056,6 +2056,11 @@ int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen >> struct xfrm_mgr *km; >> struct xfrm_policy *pol = NULL; >> >> +#ifdef CONFIG_COMPAT >> + if (in_compat_syscall()) >> + return -EOPNOTSUPP; >> +#endif >> + >> if (optlen <= 0 || optlen > PAGE_SIZE) >> return -EMSGSIZE; >> >> -- >> 2.14.1 >> >> -- >> You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group. >> To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bugs+unsubscribe@googlegroups.com. >> To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/20180201083418.rfarzrodccdy54xx%40gauss3.secunet.de. >> For more options, visit https://groups.google.com/d/optout.