Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp71292pxb; Tue, 26 Oct 2021 21:38:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiw3mO5jIWQsO4IE/IL/tWHC/BnI6Ub1zF8xAjQp2715f3upAbyBy4dFRhCrZSwhOIdYFn X-Received: by 2002:a17:902:d2c4:b0:140:57d9:7fbd with SMTP id n4-20020a170902d2c400b0014057d97fbdmr14913398plc.87.1635309518147; Tue, 26 Oct 2021 21:38:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635309518; cv=none; d=google.com; s=arc-20160816; b=p8zc6ZObf5sofay99CWBtssHX+Zv6N4e29YbbD1wfL5fHrcLEPKr7OeVqhhOnSWaP6 86ZyPrVDfChRoiSOIq1za0lhS90QqBiwWyQ9ujcW0xfpvwRRjxB12UksEJbwe4K8P3Q6 Uma1LOt9lIG0Z+bSDKg2kpb9yQW1xbpxwQWpO0oz51B6gWD50dBFik+FEE7nn2ilCiSo 7MV3ZyFyMK1Wuot2HHIIXhTyr22/c/luReXbqAf6KIU5b5bKPpAk4Oju6xx/V0OBKcxN 9toli7z1YJGijNKm3uH4MJ2qALobwkqha3g/HSUCGMi2522ILHi3dzbvkJ/Nk9Hh1nU4 qHLQ== 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=225l4SA1OGtdUSNrI/zTvcHrB7dEaQw3+UttA1rDb8E=; b=xMUKdczzD5taikQ57WzNQXd8ibv7jfFjnWYNmZlP2F2Zg5EjoY+ghKQtu2aAhlyXBL Z5hxuwHrKkZ8WgZ74UQYM/r59mamUkLnPOlpfd+P9pMtdxfXsTCxg2aMQhTneo1pjR+Z uAnEULGF1taYZZcLSd/g2C+ufB6h1PK9/+hFPKcIftGmApHJJ1ES8ec2JIZI0X/faigO mDuG83bubyeXqbNs6gUz2H061SPoEMq7NIm9Tq1uCc4+Kp3H3dVePfGHCKbfHmxzKN1T kbHCRbakAZtrn3FXQ/N4+f4iG2el2aTvN26TMYalRl3ZvLf/IfPZwFLs/4rYVnogSu3/ EkrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=BZFrlCMj; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k4si27615989plt.314.2021.10.26.21.37.56; Tue, 26 Oct 2021 21:38:38 -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=@gmail.com header.s=20210112 header.b=BZFrlCMj; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237980AbhJZR53 (ORCPT + 99 others); Tue, 26 Oct 2021 13:57:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232088AbhJZR52 (ORCPT ); Tue, 26 Oct 2021 13:57:28 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1130C061745; Tue, 26 Oct 2021 10:55:04 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id c4so69093plg.13; Tue, 26 Oct 2021 10:55:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=225l4SA1OGtdUSNrI/zTvcHrB7dEaQw3+UttA1rDb8E=; b=BZFrlCMj/rV6HcmWYv8j/HdU0pdqvvR1cBDAoJhSUU3QKaCbApIPAdOIBovnSdIszu mpLhbZcAy+S+AKwZtafdpdwfyex82nE9S/EL+ALUkZFCE/H6F5dEWzr2xOFiWcB5jETw zJNM0H9wgriHQSZSHhAwY67pYq1dPiNKZfZDsWLpvnmwIMkpq+IgrZn+nMYQ1QfDosJN wnd648K6iDkOfuJNDHALSLeQ2HFmad/7sLL5OPieaCnBLvT2yWh2MZ+/z02lJOJBWYyj Jj8lCcbPczk93iKvd4CfVje1Uw7njLUSFXFrI/IhGgG2fjLsWvW20RpeqFDC8kABnWo8 BO8g== 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=225l4SA1OGtdUSNrI/zTvcHrB7dEaQw3+UttA1rDb8E=; b=pWlBohf9hoUYcZ6qg6WaGClgRI9Fr0GqjJVNwHFAHcA2zkAS3R5tUaFf4rdAVhXO0Y PqGvDb65iNrEaKvVY4GaaRdcDjmTmfhgKUQFLimbTt6o06KzGsjLfR/213iM5hR5p4zj 9F47jAewwMApXlHH5OPuVlQqT7SIeoHVl6MNr860vIR7uvq7cMweQXK3g066wNr0Zufp 9Oilt26XhIvarqENu1p5IuIgFO6r3X9kwXVV/sgg3/efjtfh8Gs0Bfhn2lh0Lh+7XwBU ugwPr2vpBbclsZScbfl+xsh7GeRICrJ2BxUzfkRbbg+0sL9WJsBNWCOYNhMGeevlNP5y 2EBw== X-Gm-Message-State: AOAM530LjWusczm9uAriRVzZvSRiCd9c/X3RfMtiHTlYbCkqfU/f0Kyg jK0QXM0VtqvzPvB+mNeK9LvjgKcEiDIkGEesnrlE170/z38= X-Received: by 2002:a17:902:8211:b0:13f:afe5:e4fb with SMTP id x17-20020a170902821100b0013fafe5e4fbmr23969092pln.20.1635270904246; Tue, 26 Oct 2021 10:55:04 -0700 (PDT) MIME-Version: 1.0 References: <20211026143409.42666-1-andrea.righi@canonical.com> In-Reply-To: From: Alexei Starovoitov Date: Tue, 26 Oct 2021 10:54:53 -0700 Message-ID: Subject: Re: [PATCH] selftests/bpf: fix fclose/pclose mismatch To: Shuah Khan Cc: Andrea Righi , Shuah Khan , Daniel Borkmann , Alexei Starovoitov , Andrii Nakryiko , "open list:KERNEL SELFTEST FRAMEWORK" , bpf , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 26, 2021 at 10:47 AM Shuah Khan wrote: > > On 10/26/21 8:34 AM, Andrea Righi wrote: > > Make sure to use pclose() to properly close the pipe opened by popen(). > > > > Fixes: 81f77fd0deeb ("bpf: add selftest for stackmap with BPF_F_STACK_BUILD_ID") > > Signed-off-by: Andrea Righi > > --- > > tools/testing/selftests/bpf/test_progs.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c > > index cc1cd240445d..e3fea6f281e4 100644 > > --- a/tools/testing/selftests/bpf/test_progs.c > > +++ b/tools/testing/selftests/bpf/test_progs.c > > @@ -370,7 +370,7 @@ int extract_build_id(char *build_id, size_t size) > > > > if (getline(&line, &len, fp) == -1) > > goto err; > > - fclose(fp); > > + pclose(fp); > > > > if (len > size) > > len = size; > > @@ -379,7 +379,7 @@ int extract_build_id(char *build_id, size_t size) > > free(line); > > return 0; > > err: > > - fclose(fp); > > + pclose(fp); > > return -1; > > } > > > > > > Thank you for the patch. The return logic could be simpler > doing out handling common for error and success path with > just one call to close. Not related to this change though. > > Adding bpf maintainers to the thread Ohh. That's odd. I see the patch in: https://patchwork.kernel.org/project/netdevbpf/list/?delegate=121173 but not in my gmail. vger is probably slow.