From patchwork Fri Dec 15 10:07:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hou Tao X-Patchwork-Id: 13494205 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADB1B18C01 for ; Fri, 15 Dec 2023 10:06:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4Ss4cJ25Nrz4f3kjg for ; Fri, 15 Dec 2023 18:06:08 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 8E43B1A05EB for ; Fri, 15 Dec 2023 18:06:09 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.124.27]) by APP1 (Coremail) with SMTP id cCh0CgBHlQsLJXxlJTfVDg--.54090S4; Fri, 15 Dec 2023 18:06:05 +0800 (CST) From: Hou Tao To: bpf@vger.kernel.org Cc: Martin KaFai Lau , Alexei Starovoitov , Andrii Nakryiko , Song Liu , Hao Luo , Yonghong Song , Daniel Borkmann , KP Singh , Stanislav Fomichev , Jiri Olsa , John Fastabend , xingwei lee , houtao1@huawei.com Subject: [PATCH bpf-next v3 0/5] bpf: Fix warnings in kvmalloc_node() Date: Fri, 15 Dec 2023 18:07:03 +0800 Message-Id: <20231215100708.2265609-1-houtao@huaweicloud.com> X-Mailer: git-send-email 2.29.2 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: cCh0CgBHlQsLJXxlJTfVDg--.54090S4 X-Coremail-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udrp/ X-Patchwork-Delegate: bpf@iogearbox.net From: Hou Tao Hi, The patch set aims to fix the warnings in kvmalloc_node() when passing an abnormally big cnt during multiple kprobes/uprobes attachment. Patch #1 and #2 fix the warning by limiting the maximal number of uprobes/kprobes. Patch #3, #4, and #5 add tests to ensure these warnings are fixed. Please see individual patches for more details. Comments are always welcome. Change Log: v3: * add ack tags from Jiri * return -E2BIG instead of -EINVAL for too-big cnt (Andrii) * patch #3: rename the subtest from "failed_link_api" to "attach_api_fails", so it is consistent with the naming convention in multi-kprobe test. * patch #4: newly-added patch to remove libbpf_get_error() in kprobe_multi_test (Andrii) v2: https://lore.kernel.org/bpf/20231213112531.3775079-1-houtao@huaweicloud.com/ * limit the number of uprobes/kprobes instead of suppressing the out-of-memory warning message (Alexei) * provide a faked non-zero offsets to simplify the multiple uprobe test (Jiri) v1: https://lore.kernel.org/bpf/20231211112843.4147157-1-houtao@huaweicloud.com/ Hou Tao (5): bpf: Limit the number of uprobes when attaching program to multiple uprobes bpf: Limit the number of kprobes when attaching program to multiple kprobes selftests/bpf: Add test for abnormal cnt during multi-uprobe attachment selftests/bpf: Don't use libbpf_get_error() in kprobe_multi_test selftests/bpf: Add test for abnormal cnt during multi-kprobe attachment kernel/trace/bpf_trace.c | 7 ++++ .../bpf/prog_tests/kprobe_multi_test.c | 31 +++++++++++++++--- .../bpf/prog_tests/uprobe_multi_test.c | 32 ++++++++++++++++++- 3 files changed, 64 insertions(+), 6 deletions(-) Acked-by: Andrii Nakryiko