Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3116583pxf; Mon, 15 Mar 2021 01:35:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrtwQvq4XetxX5UL+gYnUxGWjVVcvs/yQcaG7X8xDUb2zK4ipDiKitbg+rNn7R5tE8S71y X-Received: by 2002:a17:906:14d4:: with SMTP id y20mr22421868ejc.190.1615797348749; Mon, 15 Mar 2021 01:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615797348; cv=none; d=google.com; s=arc-20160816; b=QB5j2DtlWF2LURh33hMbFEVL7xdLdnecyfyijLnqzwyj89rZtVzk7fSeg/okGUeo5F dvVXypAcGaJ5de2zzh4+V52sDQcvbtZlao9/Yb94b5QdiT+MLQ9AVc/S6k9Yb/TaSZvr ZTr0+ItD0FO7mHTGm104ZqOnbqANg0wMGxc2wvYJIBkoyTwf7xOPGvl2DRenaitDgfPK 3Tb1ZQwIVzJvNRANAprLIsVrfgTo14XyQgV3Mp8zLyXRyk6JSUfj0Z7K4YWm4gdu1tpo IuKBTQrGRfVt7B5c3vgFt+pzcaCQ9uIsmmGw4sOV0vocFtLdfbEs8pe/HTEBQc6tt9IC C8Jw== 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; bh=eKJqE207SiLtJy2mZcAaEHj0Z8t5cbzUE9GjzqyMw4I=; b=h+tYp6gn5SlPOwYMObVjFEkVu7T//1cuqdYzpu1DKg9+cvmqDfc+97c0ZPDzVWviZ1 SEFxtLSNTN5/w/tCfXmrJfM4tppsFp4uOAW8eZgjyB5fEBWcAwkB1+1SmsJftSlTriSr o1fD/9xxfPzqrtKjZ+Hik9lK/8uJx5SUY+n3e439VnoKDjAFSzdYdrWbdimeI3sYfLum My07oaW93kR0kC7b7uKu0NxBs12C9KMso+MlNWReMvRo06MsiuG5gPH+UPYeUiVthgq4 z55lsE1Pfkw40me6fKjQ8HWYRhzmlpYXul0nKCrZHmCuBLiBe2bqL/NikCXniSD983ad QNcg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d3si10868599eds.83.2021.03.15.01.35.25; Mon, 15 Mar 2021 01:35:48 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229683AbhCOIcA (ORCPT + 99 others); Mon, 15 Mar 2021 04:32:00 -0400 Received: from www62.your-server.de ([213.133.104.62]:50688 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbhCOIbZ (ORCPT ); Mon, 15 Mar 2021 04:31:25 -0400 Received: from sslproxy03.your-server.de ([88.198.220.132]) by www62.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1lLidD-000G6o-WC; Mon, 15 Mar 2021 09:31:20 +0100 Received: from [85.7.101.30] (helo=pc-9.home) by sslproxy03.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lLidD-000FZ1-Qu; Mon, 15 Mar 2021 09:31:19 +0100 Subject: Re: [PATCH v2] bpf: Fix memory leak in copy_process() To: qiang.zhang@windriver.com, ast@kernel.org, andrii@kernel.org Cc: dvyukov@google.com, linux-kernel@vger.kernel.org, syzbot+44908bb56d2bfe56b28e@syzkaller.appspotmail.com References: <20210315081847.16180-1-qiang.zhang@windriver.com> From: Daniel Borkmann Message-ID: Date: Mon, 15 Mar 2021 09:31:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <20210315081847.16180-1-qiang.zhang@windriver.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.102.4/26108/Sun Mar 14 13:05:46 2021) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/15/21 9:18 AM, qiang.zhang@windriver.com wrote: > From: Zqiang Hello Zqiang, please resend this patch with bpf@vger.kernel.org in Cc, so it actually reaches the rest of BPF community for review, thanks! > The syzbot report a memleak follow: > BUG: memory leak > unreferenced object 0xffff888101b41d00 (size 120): > comm "kworker/u4:0", pid 8, jiffies 4294944270 (age 12.780s) > backtrace: > [] alloc_pid+0x66/0x560 > [] copy_process+0x1465/0x25e0 > [] kernel_clone+0xf3/0x670 > [] kernel_thread+0x61/0x80 > [] call_usermodehelper_exec_work > [] call_usermodehelper_exec_work+0xc4/0x120 > [] process_one_work+0x2c9/0x600 > [] worker_thread+0x59/0x5d0 > [] kthread+0x178/0x1b0 > [] ret_from_fork+0x1f/0x30 > > unreferenced object 0xffff888110ef5c00 (size 232): > comm "kworker/u4:0", pid 8414, jiffies 4294944270 (age 12.780s) > backtrace: > [] kmem_cache_zalloc > [] __alloc_file+0x1f/0xf0 > [] alloc_empty_file+0x69/0x120 > [] alloc_file+0x33/0x1b0 > [] alloc_file_pseudo+0xb2/0x140 > [] create_pipe_files+0x138/0x2e0 > [] umd_setup+0x33/0x220 > [] call_usermodehelper_exec_async+0xb4/0x1b0 > [] ret_from_fork+0x1f/0x30 > > after the UMD process exits, the pipe_to_umh/pipe_from_umh and tgid > need to be release. > > Fixes: d71fa5c9763c ("bpf: Add kernel module with user mode driver that populates bpffs.") > Reported-by: syzbot+44908bb56d2bfe56b28e@syzkaller.appspotmail.com > Signed-off-by: Zqiang > --- > v1->v2: > Judge whether the pointer variable tgid is valid.