From patchwork Wed Sep 21 02:58:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hou Tao X-Patchwork-Id: 12983027 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8C09C6FA91 for ; Wed, 21 Sep 2022 02:41:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229638AbiIUClF (ORCPT ); Tue, 20 Sep 2022 22:41:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230176AbiIUCk5 (ORCPT ); Tue, 20 Sep 2022 22:40:57 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7555E7D1DA for ; Tue, 20 Sep 2022 19:40:54 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4MXMzw5LHlzKQGd for ; Wed, 21 Sep 2022 10:38:52 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP2 (Coremail) with SMTP id Syh0CgBH53CxeSpj9UifBA--.10379S4; Wed, 21 Sep 2022 10:40:51 +0800 (CST) From: Hou Tao To: bpf@vger.kernel.org Cc: Martin KaFai Lau , Andrii Nakryiko , Song Liu , Hao Luo , Yonghong Song , Alexei Starovoitov , Daniel Borkmann , KP Singh , "David S . Miller" , Jakub Kicinski , Stanislav Fomichev , Jiri Olsa , John Fastabend , Lorenz Bauer , houtao1@huawei.com Subject: [PATCH bpf-next 0/2] Fix resource leaks in test_maps Date: Wed, 21 Sep 2022 10:58:53 +0800 Message-Id: <20220921025855.115463-1-hou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c7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07UZ18PUUUUU= X-CM-SenderInfo: xkrx3t3r6k3tpzhluzxrxghudrp/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net From: Hou Tao Hi, It is just a tiny patch set aims to fix the resource leaks in test_maps after test case succeeds or is skipped. And these leaks are spotted by using address sanitizer and checking the content of /proc/$pid/fd. Please see indiviual patch for more details. Hou Tao (2): selftests/bpf: Destroy the skeleton when CONFIG_PREEMPT is off selftests/bpf: Free the allocated resources after test case succeeds .../bpf/map_tests/array_map_batch_ops.c | 1 + .../bpf/map_tests/htab_map_batch_ops.c | 1 + .../bpf/map_tests/lpm_trie_map_batch_ops.c | 1 + .../bpf/map_tests/task_storage_map.c | 1 + tools/testing/selftests/bpf/test_maps.c | 24 ++++++++++++------- 5 files changed, 19 insertions(+), 9 deletions(-)