Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1323754pxk; Mon, 31 Aug 2020 16:28:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKl//g2Pnm161YEEAFcQG/di7haff9f4gpHbwub2fxCIECvHQWj0C1/oGEh7StRAcXgr6N X-Received: by 2002:a50:8881:: with SMTP id d1mr3286910edd.306.1598916539318; Mon, 31 Aug 2020 16:28:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598916539; cv=none; d=google.com; s=arc-20160816; b=S3VWxQZv7NLgUctJZrnC6w2xMcAgg06dsWAv6OerFBbu/8Pfh0zLs1gQOM7XI2DFv0 xyjSOa24pUOKkb5hbqqoK0vnZrNcszqhUX5CQZjTMh4upy6N2mAG9MvYZMxocXh/uEam +lnoyLAYEMd7meH0vFn4qQVROsCdW+Eew2sgAfNr69xgu1GY9buBV9K5oWqBYuR7KPMh iw2w9omRYrt37QcVr1ljnmrGGgKvAHxmWIaHs0C6aMBShWZr1rrXubnmkh6UAyhaa/cd JjCLzGMNR7fvuZ18pTzy1nsiaXYt4IXPWalxEaMA4EC8E+iDnZxd1Xy4z9Thu8EZbI9A DoBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ryNxh31n4GLtr4wiLiu+HxZgOdeShQwzv0bbbDwyQqU=; b=Imlcpp/9w5twddwJbKQCdWtGezEeL4+UqphzoJII7UlJz+Y3K85M73XcwgpCHUnOZG jzF5dG3k6qFpmTf+ZA5NtR/pbe0zOrsqdee7Cx4UGmPh6delY3vIychrxUeFNMzYWMJi OkhnjC87eMYYG/J56eMyxl/7XhBkaC7j1pFRZKzzy6hz3sxjctjLQWDfFVKmCBLkjrXK rb93tjubW1wo+oknVlyk+619F6tzf+h6rFkjobfsJlzXA/Ycwg9e6Yo45cHORFnFKkbY F4+SccwB+1WO79YzSo8WQE3N9DcM2AzpgdQa2MyfPEp4E0YQ4Q4e5JP+xRwvz+HmP2ds pZTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WLmlKkEz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si4809127edq.339.2020.08.31.16.28.35; Mon, 31 Aug 2020 16:28:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=WLmlKkEz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726020AbgHaXZj (ORCPT + 99 others); Mon, 31 Aug 2020 19:25:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725886AbgHaXZi (ORCPT ); Mon, 31 Aug 2020 19:25:38 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 279F8C061573 for ; Mon, 31 Aug 2020 16:25:38 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id m8so1580311pfh.3 for ; Mon, 31 Aug 2020 16:25:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ryNxh31n4GLtr4wiLiu+HxZgOdeShQwzv0bbbDwyQqU=; b=WLmlKkEzXowd/E5iK8eqKrx/dsSzW1FdD3sz3nvMzEwWFyIYOl+Z3WEHAy8pOJUZDT BV+BFsZ63xjAX+7omPTfFQk+eN1bn8P+S+ZHad1snvOZUOxQ/SpVPcgvldI3hi+CpFgu FAbWUGEEYtqRX1NKbEa3rGa57dEwXGTBla5/c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ryNxh31n4GLtr4wiLiu+HxZgOdeShQwzv0bbbDwyQqU=; b=aKqKHK46zevad6Tv5J3bODiQtKapMEqaJo7+zVZYXOtr+9BUBCLpWXAxafaFESct13 z3M0ULXMbVBbpt389BzcAUCZyFRMreIrBlS8USQFdrohr/8Hnrn3BFXf70Cy/YOdJ+7C k4muYQBicUjA9QEHOqhQtjEA4CqmgNRwV9yPEt01YbiG/qiAk7QZ4cCq7nugXHeEST/h 6CusWO22XlYrfZfz0sGccRdzhtCRCDkdpGGCI1aQ9KUIwdZsk4FI6TjVlKF0cs9u7Cvj feDLdYVk1s16/8HLNVc94e6Mx5SZ/sapZ+TI6+w8JOpllea99dmXjmxAbJKweUJoU4DD huiQ== X-Gm-Message-State: AOAM530Wdh0xJVCuvySUsLsF+CuTJSOC/hYkryhPsAA91o1pW8jP7ibg v1gk3ywetJmZ9WJbTaKF0LkegQ== X-Received: by 2002:aa7:924b:: with SMTP id 11mr3189196pfp.185.1598916337542; Mon, 31 Aug 2020 16:25:37 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id v11sm8477459pgs.22.2020.08.31.16.25.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2020 16:25:36 -0700 (PDT) Date: Mon, 31 Aug 2020 16:25:35 -0700 From: Kees Cook To: Tycho Andersen , Christian Brauner Cc: linux-kernel@vger.kernel.org, luto@amacapital.net, syzbot , syzkaller-bugs@googlegroups.com, wad@chromium.org Subject: Re: memory leak in do_seccomp Message-ID: <202008311620.AC4A7047D@keescook> References: <000000000000e5ea9e05ac9d16c1@google.com> <000000000000df80ae05ae244c2b@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <000000000000df80ae05ae244c2b@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 30, 2020 at 08:50:15PM -0700, syzbot wrote: > syzbot has found a reproducer for the following issue on: > > HEAD commit: dcc5c6f0 Merge tag 'x86-urgent-2020-08-30' of git://git.ke.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=10b297d5900000 > kernel config: https://syzkaller.appspot.com/x/.config?x=903b9fecc3c6d231 > dashboard link: https://syzkaller.appspot.com/bug?extid=3ad9614a12f80994c32e > compiler: gcc (GCC) 10.1.0-syz 20200507 > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14649561900000 > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=118aacc1900000 > > IMPORTANT: if you fix the issue, please add the following tag to the commit: > Reported-by: syzbot+3ad9614a12f80994c32e@syzkaller.appspotmail.com > > executing program > executing program > executing program > executing program > executing program > BUG: memory leak > unreferenced object 0xffff88811ba93600 (size 64): > comm "syz-executor680", pid 6503, jiffies 4294951104 (age 21.940s) > hex dump (first 32 bytes): > 00 00 00 00 00 00 00 00 08 36 a9 1b 81 88 ff ff .........6...... > 08 36 a9 1b 81 88 ff ff 11 ce 98 89 3a d5 b4 8f .6..........:... > backtrace: > [<00000000896418b0>] kmalloc include/linux/slab.h:554 [inline] > [<00000000896418b0>] kzalloc include/linux/slab.h:666 [inline] > [<00000000896418b0>] init_listener kernel/seccomp.c:1473 [inline] > [<00000000896418b0>] seccomp_set_mode_filter kernel/seccomp.c:1546 [inline] > [<00000000896418b0>] do_seccomp+0x8ce/0xd40 kernel/seccomp.c:1649 > [<000000002b04976c>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 > [<00000000322b4126>] entry_SYSCALL_64_after_hwframe+0x44/0xa9 I haven't narrowed this down yet (and it *might* be a false positive), but it looks like this is filter->notif. The only way that's possible is if seccomp_notify_release() was never called *and* seccomp_filter_free() got called... which would imply a reference counting problem. The way there doesn't jump out at me yet, but I haven't yet decoded the C reproducer into the actual seccomp arguments, etc. -- Kees Cook