Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1957120imn; Mon, 1 Aug 2022 06:16:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR6xhD7DUmmA0wFcARrrBUqBy/ZO5szGZvB5KXcdboYo2g7JZi6zyNHWZHtLr2+As6w4wWmI X-Received: by 2002:a63:1b08:0:b0:41b:b373:69ce with SMTP id b8-20020a631b08000000b0041bb37369cemr10647717pgb.451.1659359808794; Mon, 01 Aug 2022 06:16:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659359808; cv=none; d=google.com; s=arc-20160816; b=0YbdUnkJ/DSdwX+vXFOtdi1PYKYJxzEY614qIt1W2qaOij2tAMEB9HopgOcJl1Rwo+ pt39miGwLSK2SSELSA5bxttoxfgxOuCxR+kMEgux/8F7xz4sfzVejl8NZfAUvZTQkFWz erPXy7ZxG68pG4/Ug3QIBWMAZG5vMwJ2cFAcemVW4KS8bzoYTassN/VLTVnNctpWZ9D1 5L/tstnaKGGsakENNT2V7pSHjj3Bddk/f/T030xku6rdFP/DtvdB8QqhTYhBLJT1rxs5 lvaBGU4rLNw9aCeWXIdipp3ebzEpcbqTAOvezxwtCaW2hppNNzvf8JNzYB152EKKsirt Y1Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=hKODFjWKz18z//+0bYIp+DNibtoqLeqcY5uwUnn/wX8=; b=ZnBKDnMObhU4h4+Y7n4LYQHcpUiwLhwFgKPK3IX1Lmvb5kaG1lheX9nYljcujwZkcQ lHAKMDDiQtR6IBRAgofpYWIikXlAa7f7JFJBN2WvHoM5VzPnlIdm6xh9FkPn++GdM+u/ C5xJSA/e5vJVTf57INQQpxgwdHjFgVdQKfWi/p3nAXUZwBO7IW+wiODJxoUKS/vO38Z+ bn6A/a362PuuVbcYKEsvsORLX5JhRUlQiLBogwsLRlE7gV9dx7abFwiE2xuvjw9GANlZ esbbrqtK0XH0WJA51607dfZsATHdKf1E38zj7DVfpeaZEmPUmhxxrJDaGzpq7aBFqwMY 8Jxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=O9qyvyo1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h20-20020a635314000000b0041a3b20ba0esi12292560pgb.383.2022.08.01.06.16.34; Mon, 01 Aug 2022 06:16:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=temperror (no key for signature) header.i=@szeredi.hu header.s=google header.b=O9qyvyo1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234741AbiHAMmf (ORCPT + 99 others); Mon, 1 Aug 2022 08:42:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234841AbiHAMmT (ORCPT ); Mon, 1 Aug 2022 08:42:19 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 919B2B1E1 for ; Mon, 1 Aug 2022 05:20:41 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id ss3so19938656ejc.11 for ; Mon, 01 Aug 2022 05:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hKODFjWKz18z//+0bYIp+DNibtoqLeqcY5uwUnn/wX8=; b=O9qyvyo1A15bIG2D4Q6YtOGekPzpr15IaV7tjs8+IuxT5Fb1erc4U3WXQnbwIm6guW 3JBREcLr3QxGSAGL/M5WZxQ/joqw/dnpZOyKjgf+dnb+yUiS3H/01H2C94ZQzItpeW5g vL8QBmcRtcdvTBmHM/wu0YaXeP65LvQSVjjbM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hKODFjWKz18z//+0bYIp+DNibtoqLeqcY5uwUnn/wX8=; b=dNoHhxr55KK8tdPfHNYwvEruxSkscSED6sDlkCWoJg1rnZQRRuROQT3G7INHBdD7/O vqdzfC2BH6qzf/P2a5hjPaf4nuhHSMhoypHB/H+kYFYRLJEiMBPKrEH+7nDTOENBnX0i Vi8qUO8UREyjB9eW/Ah97vD3P1HIV9gM7pMIEwbmHqHT+BZpsfJK/pgIRitbqIkTjK67 3+dgX5R7Aq5K9hE2zUHy/RKvAZYsQ4n9BvC2idiPQrV4xcsRSxYRYRRnzQ4Hb3PU10S2 HPqMitOENjwSzl8zXtBuTDqjJSKZzO17QK5JRHP9M3HNJCmdR3htOVJrhmqD6EFPAiWY zVwA== X-Gm-Message-State: AJIora8IU5Mpb+swu/8Zu/D2jYWgeyxTee0BP18YP2jKl++OtFY9kHqk udN6YAyzw0ZtV0Y3ILE1H/H4+UjG4NiD/2gCiT55Bg== X-Received: by 2002:a17:907:2855:b0:72b:700e:21eb with SMTP id el21-20020a170907285500b0072b700e21ebmr12643849ejc.270.1659356440144; Mon, 01 Aug 2022 05:20:40 -0700 (PDT) MIME-Version: 1.0 References: <000000000000bdee330594070441@google.com> <000000000000b901a205e51b4f46@google.com> In-Reply-To: <000000000000b901a205e51b4f46@google.com> From: Miklos Szeredi Date: Mon, 1 Aug 2022 14:20:29 +0200 Message-ID: Subject: Re: [syzbot] memory leak in cap_inode_getsecurity To: syzbot Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, marka@mediation.com, phind.uet@gmail.com, syzkaller-bugs , Al Viro Content-Type: multipart/mixed; boundary="0000000000002beb1f05e52d073f" X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_NONE,SORTED_RECIPS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --0000000000002beb1f05e52d073f Content-Type: text/plain; charset="UTF-8" #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master On Sun, 31 Jul 2022 at 17:13, syzbot wrote: > > syzbot has found a reproducer for the following issue on: > > HEAD commit: 6a010258447d Merge tag 'for-linus' of git://git.armlinux.o.. > git tree: upstream > console output: https://syzkaller.appspot.com/x/log.txt?x=15883fee080000 > kernel config: https://syzkaller.appspot.com/x/.config?x=2a1dcc1942e30704 > dashboard link: https://syzkaller.appspot.com/bug?extid=942d5390db2d9624ced8 > compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2 > syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1568846a080000 > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10f5e536080000 > > IMPORTANT: if you fix the issue, please add the following tag to the commit: > Reported-by: syzbot+942d5390db2d9624ced8@syzkaller.appspotmail.com > > executing program > BUG: memory leak > unreferenced object 0xffff88810f0ac060 (size 32): > comm "syz-executor240", pid 3622, jiffies 4294961303 (age 14.040s) > hex dump (first 32 bytes): > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > backtrace: > [] __do_krealloc mm/slab_common.c:1185 [inline] > [] krealloc+0x4d/0xb0 mm/slab_common.c:1218 > [] vfs_getxattr_alloc+0x13c/0x1c0 fs/xattr.c:379 > [] cap_inode_getsecurity+0xb2/0x500 security/commoncap.c:400 > [] security_inode_getsecurity+0x7c/0xb0 security/security.c:1441 > [] xattr_getsecurity fs/xattr.c:327 [inline] > [] vfs_getxattr+0x22a/0x290 fs/xattr.c:423 > [] ovl_xattr_get+0x62/0xa0 fs/overlayfs/inode.c:404 > [] __vfs_getxattr+0x72/0xa0 fs/xattr.c:401 > [] cap_inode_need_killpriv+0x22/0x40 security/commoncap.c:301 > [] security_inode_need_killpriv+0x23/0x60 security/security.c:1419 > [] dentry_needs_remove_privs fs/inode.c:1992 [inline] > [] dentry_needs_remove_privs+0x4e/0xa0 fs/inode.c:1982 > [] do_truncate+0x7d/0x130 fs/open.c:57 > [] vfs_truncate+0x209/0x240 fs/open.c:111 > [] do_sys_truncate.part.0+0xc8/0xe0 fs/open.c:134 > [] do_sys_truncate fs/open.c:128 [inline] > [] __do_sys_truncate fs/open.c:146 [inline] > [] __se_sys_truncate fs/open.c:144 [inline] > [] __x64_sys_truncate+0x33/0x50 fs/open.c:144 > [] do_syscall_x64 arch/x86/entry/common.c:50 [inline] > [] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 > [] entry_SYSCALL_64_after_hwframe+0x63/0xcd > > --0000000000002beb1f05e52d073f Content-Type: text/x-patch; charset="US-ASCII"; name="vfs_getxattr_alloc-dont-allocate-buf-on-failure.patch" Content-Disposition: attachment; filename="vfs_getxattr_alloc-dont-allocate-buf-on-failure.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_l6apyd3r0 LS0tCiBmcy94YXR0ci5jIHwgICAgNSArKysrLQogMSBmaWxlIGNoYW5nZWQsIDQgaW5zZXJ0aW9u cygrKSwgMSBkZWxldGlvbigtKQoKLS0tIGEvZnMveGF0dHIuYworKysgYi9mcy94YXR0ci5jCkBA IC0zODMsNyArMzgzLDEwIEBAIHZmc19nZXR4YXR0cl9hbGxvYyhzdHJ1Y3QgdXNlcl9uYW1lc3Bh Y2UKIAl9CiAKIAllcnJvciA9IGhhbmRsZXItPmdldChoYW5kbGVyLCBkZW50cnksIGlub2RlLCBu YW1lLCB2YWx1ZSwgZXJyb3IpOwotCSp4YXR0cl92YWx1ZSA9IHZhbHVlOworCWlmIChlcnJvciA8 IDAgJiYgdmFsdWUgIT0gKnhhdHRyX3ZhbHVlKQorCQlrZnJlZSh2YWx1ZSk7CisJZWxzZQorCQkq eGF0dHJfdmFsdWUgPSB2YWx1ZTsKIAlyZXR1cm4gZXJyb3I7CiB9CiAK --0000000000002beb1f05e52d073f--