BPF List
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: make24@iscas.ac.cn, bpf@vger.kernel.org,
	linux-kselftest@vger.kernel.org, kernel-janitors@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Eduard Zingerman <eddyz87@gmail.com>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Mykola Lysenko <mykolal@fb.com>, Shuah Khan <shuah@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Song Liu <song@kernel.org>,
	Sowmini Varadhan <sowmini.varadhan@oracle.com>,
	Yonghong Song <yonghong.song@linux.dev>
Subject: Re: [PATCH] selftests/bpf:fix a resource leak in main()
Date: Fri, 12 Jul 2024 10:05:31 +0200	[thread overview]
Message-ID: <c341e275-4fac-4aaa-8117-55b654c5c006@web.de> (raw)
In-Reply-To: <20240711071018.2197252-1-make24@iscas.ac.cn>

> The requested resources should be closed before return in main(), otherwise
> resource leak will occur. Add a check of cg_fd before close().
>
> Fixes: 435f90a338ae ("selftests/bpf: add a test case for sock_ops perf-event notification")
> Signed-off-by: Ma Ke <make24@iscas.ac.cn>

Please reconsider such information once more.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10-rc7#n398
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/researcher-guidelines.rst?h=v6.10-rc7#n5


How many source code analysis tools should be able to point out that the return value
from the call of a function like pthread_create() should get more development attention
(also for discussed test functions)?
https://elixir.bootlin.com/linux/v6.10-rc7/source/tools/testing/selftests/bpf/test_tcpnotify_user.c#L122

See also:
* https://cwe.mitre.org/data/definitions/252.html

* https://wiki.sei.cmu.edu/confluence/display/c/POS54-C.+Detect+and+handle+POSIX+library+errors


Regards,
Markus

  parent reply	other threads:[~2024-07-12  8:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-11  7:10 [PATCH] selftests/bpf:fix a resource leak in main() Ma Ke
2024-07-12  0:53 ` Stanislav Fomichev
2024-07-12  8:05 ` Markus Elfring [this message]
2024-07-13  0:59   ` Stanislav Fomichev
  -- strict thread matches above, loose matches on Subject: below --
2024-07-11  7:18 Ma Ke
2024-07-11  7:34 Ma Ke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c341e275-4fac-4aaa-8117-55b654c5c006@web.de \
    --to=markus.elfring@web.de \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=make24@iscas.ac.cn \
    --cc=martin.lau@linux.dev \
    --cc=mykolal@fb.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=sowmini.varadhan@oracle.com \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox