Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1015732pxu; Wed, 16 Dec 2020 23:15:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJzlkMYO7E4f8wcl+elSPtQV2A+J8nt6f1rzSH599DkTrH4U87fwDrTkOp70J5LIXlFV6b3I X-Received: by 2002:a17:907:4271:: with SMTP id nq1mr29796152ejb.358.1608189314491; Wed, 16 Dec 2020 23:15:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608189314; cv=none; d=google.com; s=arc-20160816; b=KIKS6vNhPdThI1R8PNsrj52rYCo9m38/QFAh6cOqgGSpV4YSO2xBVq/LF5TZake8o0 E0BMUJzI1S2DM6FPoeohoto6Qa+eBewm+4jfyriJzcR6RI7mq82zn8R8nN94HgN2I/Jw eDA3UCNO/tbu9r/p8okCjqST1Rqsh8KZC5GwTP551wLOQQnc+HpbU2V7onCqXpO5m8/u 5b2UIAMaa8eVEpxJgITkZvhUec8L3BSgbbkpPwnHZgiE3hfuhahZjNNP3F7M+8QoiR5U 9EWRd5ipun7J/o9FT5TNb0MhJ71H7gvtJosyoVUfkft9bdOxu7A+GRKrUc/r0Z5xWs3A iyGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=f1nw3yxqXf+nqUoMXvlWnpumlDwOsZFsQCw9CVWT6+s=; b=pSvyHMtsM2GaWUszb7LSm4r+EVNWq5Wt0RkEIV2vPwX/GQ+dEY8piRnseUkQSz2Sje 6AGBJLH9IJEiuKK8qSklyrCQ9oLnpJjss6kfUvRwbShNjp9oXwo1RhhCJAGvmXNaU31w R/MKrR55f2stxmVXHikYKuWWbeOAtir+WM1bsO9kVXv9I2sl0d+7ayysZZ1IVMPOQbkY 0q5xVwJHRdyKmSloHewUTzTmx6haeF8TBlLDZHweli3m13aof39Yv0m9EbRrBOjal+2q DJxf3smq0Aa5p64GkJuvO4yLYQIx9hLsYJjkG+ycsThqc/vHnUh66JhFCZGw3WCcM+OH 4uTg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r4si3595038edm.79.2020.12.16.23.14.48; Wed, 16 Dec 2020 23:15:14 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726601AbgLQHNV (ORCPT + 99 others); Thu, 17 Dec 2020 02:13:21 -0500 Received: from mga02.intel.com ([134.134.136.20]:59248 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725950AbgLQHNS (ORCPT ); Thu, 17 Dec 2020 02:13:18 -0500 IronPort-SDR: kvm8tsI0EyuFkWyVx/qz/FupV9VdV2Lxk/RVcEqEVjVUoKhvNsg9SPyctmSM4Q/GmBMrT4g6Xt HTcK8a7DZQLQ== X-IronPort-AV: E=McAfee;i="6000,8403,9837"; a="162252227" X-IronPort-AV: E=Sophos;i="5.78,426,1599548400"; d="scan'208";a="162252227" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Dec 2020 23:12:36 -0800 IronPort-SDR: 5Zfia1INRsXjGay5F2bdewOdEaKE5g0chA4V2oJ3TSGqGBK8f1ypgrNIkTdH8Ldx5ELwnj453R ayg7+6QgdEKQ== X-IronPort-AV: E=Sophos;i="5.78,426,1599548400"; d="scan'208";a="369636444" Received: from bruennej-mobl1.ger.corp.intel.com (HELO btopel-mobl.ger.intel.com) ([10.249.33.70]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Dec 2020 23:12:32 -0800 Subject: Re: memory leak in xskq_create To: Peilin Ye Cc: ast@kernel.org, bpf@vger.kernel.org, daniel@iogearbox.net, davem@davemloft.net, hawk@kernel.org, john.fastabend@gmail.com, jonathan.lemon@gmail.com, kuba@kernel.org, linux-kernel@vger.kernel.org, magnus.karlsson@intel.com, netdev@vger.kernel.org, syzkaller-bugs@googlegroups.com References: <0000000000002aca2e05b659af04@google.com> <20201216181135.GA94576@PWN> From: =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= Message-ID: <0a6cb67b-c24a-07e3-819b-820f3be9e3cd@intel.com> Date: Thu, 17 Dec 2020 08:12:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20201216181135.GA94576@PWN> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-12-16 19:11, Peilin Ye wrote: > Hi all, > > On Sun, Dec 13, 2020 at 06:53:10AM -0800, syzbot wrote: >> BUG: memory leak >> unreferenced object 0xffff88810f897940 (size 64): >> comm "syz-executor991", pid 8502, jiffies 4294942194 (age 14.080s) >> hex dump (first 32 bytes): >> 7f 00 00 00 80 00 00 00 00 00 00 00 00 00 00 00 ................ >> 00 a0 37 0c 81 88 ff ff 00 00 00 00 00 00 00 00 ..7............. >> backtrace: >> [<00000000639d0dd1>] xskq_create+0x23/0xd0 include/linux/slab.h:552 >> [<00000000b680b035>] xsk_init_queue net/xdp/xsk.c:508 [inline] >> [<00000000b680b035>] xsk_setsockopt+0x1c4/0x590 net/xdp/xsk.c:875 >> [<000000002b302260>] __sys_setsockopt+0x1b0/0x360 net/socket.c:2132 >> [<00000000ae03723e>] __do_sys_setsockopt net/socket.c:2143 [inline] >> [<00000000ae03723e>] __se_sys_setsockopt net/socket.c:2140 [inline] >> [<00000000ae03723e>] __x64_sys_setsockopt+0x22/0x30 net/socket.c:2140 >> [<0000000005c2b4a0>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 >> [<0000000003db140f>] entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > I have tested the following diff locally against syzbot's reproducer, > and sent a patch to it [1] for testing. I will send a real patch here > tomorrow if syzbot is happy about it. Please see explanation below. > Hi Peilin Ye! Thanks for taking a look! Magnus has already addressed this problem in another patch [1]. Cheers, Björn [1] https://lore.kernel.org/bpf/20201214085127.3960-1-magnus.karlsson@gmail.com/