* [PATCH 1/2] mkfs,xfs_repair: don't pass a daddr as the flags argument
@ 2025-02-19 4:08 Darrick J. Wong
2025-02-19 4:08 ` [PATCH 2/2] xfs_db: obfuscate rt superblock label when metadumping Darrick J. Wong
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Darrick J. Wong @ 2025-02-19 4:08 UTC (permalink / raw)
To: Andrey Albershteyn; +Cc: linux-xfs, hch
From: Darrick J. Wong <djwong@kernel.org>
libxfs_buf_get_uncached doesn't take a daddr argument, so don't pass one
as the flags argument. Also take the opportunity to use
xfs_buf_set_daddr to set the actual disk address.
Cc: <linux-xfs@vger.kernel.org> # v6.13.0
Fixes: 0d7c490474e5e5 ("mkfs: format realtime groups")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
mkfs/xfs_mkfs.c | 5 ++---
repair/rt.c | 4 ++--
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index f5556fcc4040ed..79ce68e96bd2a5 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -4989,15 +4989,14 @@ write_rtsb(
}
error = -libxfs_buf_get_uncached(mp->m_rtdev_targp,
- XFS_FSB_TO_BB(mp, 1), XFS_RTSB_DADDR,
- &rtsb_bp);
+ XFS_FSB_TO_BB(mp, 1), 0, &rtsb_bp);
if (error) {
fprintf(stderr,
_("%s: couldn't grab realtime superblock buffer\n"), progname);
exit(1);
}
- rtsb_bp->b_maps[0].bm_bn = XFS_RTSB_DADDR;
+ xfs_buf_set_daddr(rtsb_bp, XFS_RTSB_DADDR);
rtsb_bp->b_ops = &xfs_rtsb_buf_ops;
libxfs_update_rtsb(rtsb_bp, sb_bp);
diff --git a/repair/rt.c b/repair/rt.c
index 5ba04919bc3ccf..12cc9bb8a88aeb 100644
--- a/repair/rt.c
+++ b/repair/rt.c
@@ -616,12 +616,12 @@ rewrite_rtsb(
_("couldn't grab primary sb to update realtime sb\n"));
error = -libxfs_buf_get_uncached(mp->m_rtdev_targp,
- XFS_FSB_TO_BB(mp, 1), XFS_RTSB_DADDR, &rtsb_bp);
+ XFS_FSB_TO_BB(mp, 1), 0, &rtsb_bp);
if (error)
do_error(
_("couldn't grab realtime superblock\n"));
- rtsb_bp->b_maps[0].bm_bn = XFS_RTSB_DADDR;
+ xfs_buf_set_daddr(rtsb_bp, XFS_RTSB_DADDR);
rtsb_bp->b_ops = &xfs_rtsb_buf_ops;
libxfs_update_rtsb(rtsb_bp, sb_bp);
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 2/2] xfs_db: obfuscate rt superblock label when metadumping
2025-02-19 4:08 [PATCH 1/2] mkfs,xfs_repair: don't pass a daddr as the flags argument Darrick J. Wong
@ 2025-02-19 4:08 ` Darrick J. Wong
2025-02-19 5:37 ` Christoph Hellwig
2025-02-19 5:37 ` [PATCH 1/2] mkfs,xfs_repair: don't pass a daddr as the flags argument Christoph Hellwig
2025-02-19 5:46 ` [PATCH v1.1 " Darrick J. Wong
2 siblings, 1 reply; 9+ messages in thread
From: Darrick J. Wong @ 2025-02-19 4:08 UTC (permalink / raw)
To: Andrey Albershteyn; +Cc: linux-xfs, hch
From: Darrick J. Wong <djwong@kernel.org>
Metadump can obfuscate the filesystem label on all the superblocks on
the data device, so it must perform the same transformation on the
realtime device superblock to avoid leaking information and so that the
mdrestored filesystem is consistent.
Found by running xfs/503 with realtime turned on and a patch to set
labels on common/populated filesystem images.
Cc: <linux-xfs@vger.kernel.org> # v6.13.0
Fixes: 6bc20c5edbab51 ("xfs_db: metadump realtime devices")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
db/metadump.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/db/metadump.c b/db/metadump.c
index 4f4b4f8a39a551..4d090942bf29cd 100644
--- a/db/metadump.c
+++ b/db/metadump.c
@@ -3073,6 +3073,17 @@ copy_rtsb(void)
print_warning("cannot read realtime superblock");
return !metadump.stop_on_read_error;
}
+
+ /* Replace any filesystem label with "L's" */
+ if (metadump.obfuscate) {
+ struct xfs_rtsb *rtsb = iocur_top->data;
+
+ memset(rtsb->rsb_fname, 'L',
+ min(strlen((char *)rtsb->rsb_fname),
+ sizeof(rtsb->rsb_fname)));
+ iocur_top->need_crc = 1;
+ }
+
error = write_buf(iocur_top);
pop_cur();
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 1/2] mkfs,xfs_repair: don't pass a daddr as the flags argument
2025-02-19 4:08 [PATCH 1/2] mkfs,xfs_repair: don't pass a daddr as the flags argument Darrick J. Wong
2025-02-19 4:08 ` [PATCH 2/2] xfs_db: obfuscate rt superblock label when metadumping Darrick J. Wong
@ 2025-02-19 5:37 ` Christoph Hellwig
2025-02-19 5:45 ` Darrick J. Wong
2025-02-19 5:46 ` [PATCH v1.1 " Darrick J. Wong
2 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2025-02-19 5:37 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Andrey Albershteyn, linux-xfs, hch
On Tue, Feb 18, 2025 at 08:08:13PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> libxfs_buf_get_uncached doesn't take a daddr argument, so don't pass one
> as the flags argument. Also take the opportunity to use
> xfs_buf_set_daddr to set the actual disk address.
Should it take a daddr argument? I've been wondering that a bit as the
interface that doesn't pass one seems a bit odd.
The patch itself looks fine, although I don't really see the point in
the xfsprogs-only xfs_buf_set_daddr (including the current two callers).
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] mkfs,xfs_repair: don't pass a daddr as the flags argument
2025-02-19 5:37 ` [PATCH 1/2] mkfs,xfs_repair: don't pass a daddr as the flags argument Christoph Hellwig
@ 2025-02-19 5:45 ` Darrick J. Wong
2025-02-19 5:48 ` Christoph Hellwig
0 siblings, 1 reply; 9+ messages in thread
From: Darrick J. Wong @ 2025-02-19 5:45 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Andrey Albershteyn, linux-xfs
On Wed, Feb 19, 2025 at 06:37:17AM +0100, Christoph Hellwig wrote:
> On Tue, Feb 18, 2025 at 08:08:13PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > libxfs_buf_get_uncached doesn't take a daddr argument, so don't pass one
> > as the flags argument. Also take the opportunity to use
> > xfs_buf_set_daddr to set the actual disk address.
>
> Should it take a daddr argument? I've been wondering that a bit as the
> interface that doesn't pass one seems a bit odd.
We'd have to change the kernel first, there are libxfs callers with that
signature.
> The patch itself looks fine, although I don't really see the point in
> the xfsprogs-only xfs_buf_set_daddr (including the current two callers).
Eh, yeah. Want me to resend with those bits cut out?
--D
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] mkfs,xfs_repair: don't pass a daddr as the flags argument
2025-02-19 5:45 ` Darrick J. Wong
@ 2025-02-19 5:48 ` Christoph Hellwig
2025-02-19 5:53 ` Darrick J. Wong
0 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2025-02-19 5:48 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, Andrey Albershteyn, linux-xfs
On Tue, Feb 18, 2025 at 09:45:15PM -0800, Darrick J. Wong wrote:
> > The patch itself looks fine, although I don't really see the point in
> > the xfsprogs-only xfs_buf_set_daddr (including the current two callers).
>
> Eh, yeah. Want me to resend with those bits cut out?
As long as the helper is around there's probably no reason not to use
it. Removing it would probably pair pretty well with passing a daddr
to xfs_get_buf_uncached. Or maybe killing xfs_{get,read}_buf_uncached
entirely in favor of just using xfs_buf_oneshot more..
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH 1/2] mkfs,xfs_repair: don't pass a daddr as the flags argument
2025-02-19 5:48 ` Christoph Hellwig
@ 2025-02-19 5:53 ` Darrick J. Wong
0 siblings, 0 replies; 9+ messages in thread
From: Darrick J. Wong @ 2025-02-19 5:53 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Andrey Albershteyn, linux-xfs
On Wed, Feb 19, 2025 at 06:48:51AM +0100, Christoph Hellwig wrote:
> On Tue, Feb 18, 2025 at 09:45:15PM -0800, Darrick J. Wong wrote:
> > > The patch itself looks fine, although I don't really see the point in
> > > the xfsprogs-only xfs_buf_set_daddr (including the current two callers).
> >
> > Eh, yeah. Want me to resend with those bits cut out?
>
> As long as the helper is around there's probably no reason not to use
> it. Removing it would probably pair pretty well with passing a daddr
> to xfs_get_buf_uncached. Or maybe killing xfs_{get,read}_buf_uncached
> entirely in favor of just using xfs_buf_oneshot more..
<nod> I think I'd rather rid of it entirely and fix the _uncached API to
take a daddr. It's not like we can't pass in DADDR_NULL if we *really*
don't know where it's going.
--D
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v1.1 1/2] mkfs,xfs_repair: don't pass a daddr as the flags argument
2025-02-19 4:08 [PATCH 1/2] mkfs,xfs_repair: don't pass a daddr as the flags argument Darrick J. Wong
2025-02-19 4:08 ` [PATCH 2/2] xfs_db: obfuscate rt superblock label when metadumping Darrick J. Wong
2025-02-19 5:37 ` [PATCH 1/2] mkfs,xfs_repair: don't pass a daddr as the flags argument Christoph Hellwig
@ 2025-02-19 5:46 ` Darrick J. Wong
2025-02-19 5:49 ` Christoph Hellwig
2 siblings, 1 reply; 9+ messages in thread
From: Darrick J. Wong @ 2025-02-19 5:46 UTC (permalink / raw)
To: Andrey Albershteyn; +Cc: linux-xfs, hch
From: Darrick J. Wong <djwong@kernel.org>
libxfs_buf_get_uncached doesn't take a daddr argument, so don't pass one
as the flags argument.
Cc: <linux-xfs@vger.kernel.org> # v6.13.0
Fixes: 0d7c490474e5e5 ("mkfs: format realtime groups")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
v1.1: drop the xfs_buf_set_addr change
---
mkfs/xfs_mkfs.c | 3 +--
repair/rt.c | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index f5556fcc4040ed..86bc9865b1071e 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -4989,8 +4989,7 @@ write_rtsb(
}
error = -libxfs_buf_get_uncached(mp->m_rtdev_targp,
- XFS_FSB_TO_BB(mp, 1), XFS_RTSB_DADDR,
- &rtsb_bp);
+ XFS_FSB_TO_BB(mp, 1), 0, &rtsb_bp);
if (error) {
fprintf(stderr,
_("%s: couldn't grab realtime superblock buffer\n"), progname);
diff --git a/repair/rt.c b/repair/rt.c
index 5ba04919bc3ccf..e0a4943ee3b766 100644
--- a/repair/rt.c
+++ b/repair/rt.c
@@ -616,7 +616,7 @@ rewrite_rtsb(
_("couldn't grab primary sb to update realtime sb\n"));
error = -libxfs_buf_get_uncached(mp->m_rtdev_targp,
- XFS_FSB_TO_BB(mp, 1), XFS_RTSB_DADDR, &rtsb_bp);
+ XFS_FSB_TO_BB(mp, 1), 0, &rtsb_bp);
if (error)
do_error(
_("couldn't grab realtime superblock\n"));
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-02-19 5:53 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-19 4:08 [PATCH 1/2] mkfs,xfs_repair: don't pass a daddr as the flags argument Darrick J. Wong
2025-02-19 4:08 ` [PATCH 2/2] xfs_db: obfuscate rt superblock label when metadumping Darrick J. Wong
2025-02-19 5:37 ` Christoph Hellwig
2025-02-19 5:37 ` [PATCH 1/2] mkfs,xfs_repair: don't pass a daddr as the flags argument Christoph Hellwig
2025-02-19 5:45 ` Darrick J. Wong
2025-02-19 5:48 ` Christoph Hellwig
2025-02-19 5:53 ` Darrick J. Wong
2025-02-19 5:46 ` [PATCH v1.1 " Darrick J. Wong
2025-02-19 5:49 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox