From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj2-f5.google.com (mail-pj2-f5.google.com [74.125.227.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 567F73EA960 for ; Fri, 11 Sep 2026 05:11:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789103470; cv=none; b=jldFi0U9//m5bt5X4ePPgxVt3l9B26E0AY1qAaIEW3hWFeKPQF3TD2QyaMUw0mtTu4z0xMaAkoSOoYNP8aTGSYeUVG7/JHwx1QxnyjOZwPr5cHZN0lEcWV25tBYvCnnrvozGQbQ/QrTveSL6wj7xyCqPTXDKi+sbeU0M2Q2cy1Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789103470; c=relaxed/simple; bh=7IvC7itx4XTxq3spcZoa8LyRZc07ShqqbOnpseo9EUs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=pPHojPxoFQRtIBSHkdkGLuSwr+pUl4TSbGP/hAdgsy6oOr2szdU8EDvo4VqX4jAWYWjM8cV02IcnZtZQ87YCGQhydm6KNwJZaXfCANy8WH3PoOt1Y3WFHTXYrb2H5Q30EhKijxhduVW+lQv74O8guG4O82HuEytvx45yCOHFHi4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=etT9271o; arc=none smtp.client-ip=74.125.227.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="etT9271o" Received: by mail-pj2-f5.google.com with SMTP id d9443c01a7336-2d6fbdc8772so1790895ad.0 for ; Thu, 10 Sep 2026 22:11:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789103469; x=1789708269; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=+y0Q5tFoIi1MyCWL57hyIY3/f1lBE/4yfnjE9Ega5LU=; b=etT9271oK5A23hpDWNTPRyYPQi6TYatjpbwrDFlA/4A5Yaon6+7Lmev0nNbN5JDd50 2hQCKO0OY89gceouR+yEGGE0Ghm9u2evA40udDUiTtOMl7JhAQgiHNAAMlN3Ad7Tqu39 FuDJocSpJSsE7pfJdZus6X2vcdYlOAJUz1Eim5O5bNLZzX2pJMuuKsiQkXWepRgeXd1s BKo1AfIc7M/cYn+jyt/sggWHciefvrpQ1f1+Nz5BG3AsTAW2eadmrfFSAdLX3M+slV6f xzV+qPao7Vz5tQdNDdPPrxKZyCqA6e9LQ/hIPkWmvmU/zs78xLWPYVq+ltc27ysXC1yh MKZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789103469; x=1789708269; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=+y0Q5tFoIi1MyCWL57hyIY3/f1lBE/4yfnjE9Ega5LU=; b=gvEh4K4rIXiJL4ERd37MNKcCVf6FXuOypzA6azcRPNnqsciFzELgDIh6pkP5sdEGZN 4Sb8znH+yRYbK/pcC2xsd9SNR002j74Z7uGKNg9PzXWyWLmXN9CO76kcGHpznzKDTExE oHiCalzVK6WzqjPHjc0D3zqkxaN7yUR/+dCbu+D4bwSYM3cv5g/uvOzppYQTWj5YFv/p j86d9tejhhP3xHlZSOgYCDOQvGOF4h/l4GnHZCVxl3HDVD7UBylgD8VeVAR76THjx2Wx IHehm5KyvTytMaZPbEidbQkWVUwKSk253KmWBxjlSNI53eE8ZMFBmkAqGP5dlMR7K9O8 C/lg== X-Forwarded-Encrypted: i=1; AKwUvBxJD3Klg1d9m9AbVHdhSBXCcAMYc7CGMeaf8sorT55r6jzAeUropd2shp7hoeHhlkZJsvV7BffYFSAKsNmXWlo=@vger.kernel.org X-Gm-Message-State: AFuF++m8FU27CwlR71Ek9enCGlIU5WwrX62scz27qmCcNzInt8rY3gKR rUZN0tYY/UFkQBnPwXx8SUq0SqOrJCvOy6NrgSRgd63wHyLAyeDr5vrf X-Gm-Gg: AYBFou0q/+Acu0rXa+Hgr2+LkjnRXHzr3AicjY+hk7n57KYI8UNLhiKQ7yYmiAVnBFg iCwkErCKFrtETFtzVmXuiJJ6yTzjDdXVjH6WKWHlpUNnDRaQiIshxXuLDcP3QeU2hDniFy/JvLP tuGFONRQPGB+4n2ML6cNfRVKL39yLYjtn8zCeG4k/tjykGdiYR8n1ScyA6lCSyNbh/iFHGmMAMi 8md+qcUbJBjIz+soYi3r0hpwQYvqsRoIEUXTHlqMosWBAt2UcECx35jx3hDm0N6O6jCUqdwxs9q Ok14EbFhYdUF8edTsgSWsz6vsH1SdSoFS/7HKzeaJpA0VhZTC3vjMS3CPjGOwtwNKwJJkpIi0kU L9pe7M+yd+WijnkQhMe6UAOoJVRjYCsSEBcKJIMGnnqkh6NKNFD2MgAI7rHI4LvIZNeZeDKSQJm cd38Z06/t+EdnHsJ0oE88P92JC6nXihra+UHIKFxueKA== X-Received: by 2002:a17:902:ea0f:b0:2dd:319:c9ef with SMTP id d9443c01a7336-2dd2a1c41camr49447845ad.3.1789103468401; Thu, 10 Sep 2026 22:11:08 -0700 (PDT) Received: from fedora ([2602:f921:f20:17::a]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33ba4e5182fsm3018993eec.9.2026.09.10.22.11.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2026 22:11:07 -0700 (PDT) From: Tianyi Chen To: qmo@kernel.org, bpf@vger.kernel.org Cc: andrii@kernel.org, eddyz87@gmail.com, ihor.solodrai@linux.dev, linux-kselftest@vger.kernel.org Subject: [PATCH bpf-next v6 0/2] bpftool: Add recursive map dumping Date: Fri, 11 Sep 2026 13:10:51 +0800 Message-ID: <20260911051053.283421-1-diannaaav@gmail.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add -r/--recursive to dump referenced inner maps after the selected roots, with deduplication and bounded descriptor use. The second patch checks output formats and operation under a low descriptor limit. Changes in v6: - Grow the pending inner-map ID array with libbpf_ensure_mem() instead of reallocating for every ID. Keep the existing bound on open descriptors. - Check snprintf() failures and truncation before advancing the expected JSON buffer offset in the multiple-root selftest. - Clarify the unused array-slot comment, name the large output buffer size, and shorten the selftest commit message. The formatting check is defensive; I have not established the reported stack overflow in v5's fixed four-map fixture. v5: https://lore.kernel.org/r/20260911034715.219552-1-diannaaav@gmail.com AI reviews: https://lore.kernel.org/r/c55811f4eb2a0d4884ee2eb3167557cd405a5b7aecd988a51acf525c77e3a0e1@mail.kernel.org https://lore.kernel.org/r/4fba1aedc906d6c5072a1ae9a72496e6d307abd60c456cb870077cf93cc8f4ce@mail.kernel.org https://lore.kernel.org/r/20260911035503.891321F000FF@smtp.kernel.org Validation: - Rebuilt bpftool and the focused selftest runner. - All 12 bpftool_map_dump subtests passed, including the 64-inner-map cases under RLIMIT_NOFILE=32 and the multiple-root JSON check. - Tested alongside the pending batch-dump series: all 23 selected subtests passed, with no skips or failures, in an x86-64 KVM guest running Linux 7.3.0-rc2 from bpf/master, using LLVM 20 BPF objects. - Diff and bpftool synchronization checks passed; checkpatch reported no errors. The generated patches apply cleanly to current bpf-next. This was a focused run. Unrelated selftests requiring unavailable kernel features were excluded from the build with PERMISSIVE=1. Tianyi Chen (2): bpftool: Add recursive map dumping selftests/bpf: Cover recursive bpftool map dumps .../bpf/bpftool/Documentation/bpftool-map.rst | 22 +- tools/bpf/bpftool/bash-completion/bpftool | 2 +- tools/bpf/bpftool/main.c | 7 +- tools/bpf/bpftool/main.h | 1 + tools/bpf/bpftool/map.c | 130 ++++- .../bpf/prog_tests/bpftool_map_dump.c | 480 ++++++++++++++++++ 6 files changed, 631 insertions(+), 11 deletions(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/bpftool_map_dump.c base-commit: af0b84a9215d951d16f26b7ee34353b970cf5d4e -- 2.55.0