All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Raphael Pinsonneault-Thibeault <rpthibeault@gmail.com>,
	cem@kernel.org, chandanbabu@kernel.org, bfoster@redhat.com,
	david@fromorbit.com, linux-xfs@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linux.dev,
	syzbot+9f6d080dece587cfdd4c@syzkaller.appspotmail.com
Subject: Re: [PATCH v5] xfs: validate log record version against superblock log version
Date: Tue, 25 Nov 2025 09:06:24 -0800	[thread overview]
Message-ID: <20251125170624.GA23380@frogsfrogsfrogs> (raw)
In-Reply-To: <aSVNOhcK3PvdlSET@infradead.org>

On Mon, Nov 24, 2025 at 10:31:22PM -0800, Christoph Hellwig wrote:
> > Hrmm maybe we ought to reserve XLOG_VERSION==0x3 so that whenever we do
> > log v3 we don't accidentally write logs with bits that won't be
> > validated quite right on old kernels?
> 
> Why do we need to reserve that?  The code checks for either 1 or 2
> right now based on the log feature flag.  If we add a v3 log we'll
> have to ammend this, but reservations won't help with that.

Yeah, I suppose you're right -- log v3 will require a new sb feature
bit, and that's good enough.

--D

> > > +	if (xfs_has_logv2(mp)) {
> > > +		if (XFS_IS_CORRUPT(mp, h_version != XLOG_VERSION_2))
> > 
> > Being pedantic here, but the kernel cpu_to_be32 wrappers are magic in
> > that they compile to byteswapped constants so you can avoid the runtime
> > overhead of byteswapping rhead->h_version by doing:
> > 
> > 	if (XFS_IS_CORRUPT(mp,
> > 	    rhead->h_version != cpu_to_be32(XLOG_VERSION_2)))
> > 		return -EFSCORRUPTED;
> > 
> > But seeing as this is log validation for recovery, I think the
> > performance implications are vanishingly small.
> 
> Yes.
> 
> 

  reply	other threads:[~2025-11-25 17:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-12 14:10 [PATCH] xfs: ensure log recovery buffer is resized to avoid OOB Raphael Pinsonneault-Thibeault
2025-11-12 15:28 ` Christoph Hellwig
2025-11-12 18:18   ` [PATCH] xfs: reject log records with v2 size but v1 header version " Raphael Pinsonneault-Thibeault
2025-11-12 18:45     ` Darrick J. Wong
2025-11-13  6:55       ` Christoph Hellwig
2025-11-12 22:19 ` [PATCH] xfs: ensure log recovery buffer is resized " Dave Chinner
2025-11-13 19:01   ` [PATCH v3] xfs: validate log record version against superblock log version Raphael Pinsonneault-Thibeault
2025-11-18 20:19     ` Dave Chinner
2025-11-19 15:37       ` [PATCH v4] " Raphael Pinsonneault-Thibeault
2025-11-19 20:16         ` Dave Chinner
2025-11-20  6:57         ` Christoph Hellwig
2025-11-24 17:47           ` [PATCH v5] " Raphael Pinsonneault-Thibeault
2025-11-24 18:52             ` Darrick J. Wong
2025-11-25  6:31               ` Christoph Hellwig
2025-11-25 17:06                 ` Darrick J. Wong [this message]
2025-11-25  6:31             ` Christoph Hellwig

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=20251125170624.GA23380@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=bfoster@redhat.com \
    --cc=cem@kernel.org \
    --cc=chandanbabu@kernel.org \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=rpthibeault@gmail.com \
    --cc=syzbot+9f6d080dece587cfdd4c@syzkaller.appspotmail.com \
    /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.