All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/5] btrfs-progs: btrfs path leak fix, part 1
Date: Thu, 29 Oct 2026 20:16:10 +1030	[thread overview]
Message-ID: <cover.1793266694.git.wqu@suse.com> (raw)

To avoid future LLM script kiddos, we need to fix path leaks.

This is part 1, focusing on leaks on btrfs_alloc_path().

The most important part is the second patch, which introduces
BTRFS_PATH_AUTO_(FREE|RELEASE), so that we can finally get the same
capability.

Unfortunately this will require the compiler support for the __cleanup__
attribute. If not supported, configure will reject the build.

Then several fixes using BTRFS_PATH_AUTO_FREE().

The last one has several other small fixes batched together, as they are
all inside the same btrfs-corrupt-block.

Part 2 will focus on the on-stack paths, which can still leak the ebs,
and are the most common sites in btrfs-progs.

Qu Wenruo (5):
  btrfs-progs: introduce compiler_attributes.h
  btrfs-progs: utilize __cleanup__ attribute for btrfs_path
  btrfs-progs: sync btrfs_translate_remap() to fix a path leak
  btrfs-progs: fix a path leak in alloc_reserved_tree_block()
  btrfs-progs: fix several memory bugs in btrfs-corrupt-block

 btrfs-corrupt-block.c         | 34 ++++++++-----
 configure.ac                  | 15 ++++++
 include/compiler_attributes.h | 39 +++++++++++++++
 include/kerncompat.h          |  7 +--
 kernel-lib/overflow.h         |  8 +---
 kernel-shared/cleanup.h       | 89 +++++++++++++++++++++++++++++++++++
 kernel-shared/ctree.h         | 10 ++++
 kernel-shared/extent-tree.c   |  4 +-
 kernel-shared/volumes.c       | 55 +++++-----------------
 9 files changed, 193 insertions(+), 68 deletions(-)
 create mode 100644 include/compiler_attributes.h
 create mode 100644 kernel-shared/cleanup.h

--
2.56.0


             reply	other threads:[~2026-10-29  9:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29  9:46 Qu Wenruo [this message]
2026-10-29  9:46 ` [PATCH 1/5] btrfs-progs: introduce compiler_attributes.h Qu Wenruo
2026-10-29  9:46 ` [PATCH 2/5] btrfs-progs: utilize __cleanup__ attribute for btrfs_path Qu Wenruo
2026-10-29  9:46 ` [PATCH 3/5] btrfs-progs: sync btrfs_translate_remap() to fix a path leak Qu Wenruo
2026-10-29  9:46 ` [PATCH 4/5] btrfs-progs: fix a path leak in alloc_reserved_tree_block() Qu Wenruo
2026-10-29  9:46 ` [PATCH 5/5] btrfs-progs: fix several memory bugs in btrfs-corrupt-block Qu Wenruo

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=cover.1793266694.git.wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.