All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alli <allison.henderson@oracle.com>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH v2 18/18] xfs_logprint: Add log item printing for ATTRI and ATTRD
Date: Tue, 31 May 2022 18:39:10 -0700	[thread overview]
Message-ID: <764c5e859d2875c1799c0fcc852f85ac705bfeee.camel@oracle.com> (raw)
In-Reply-To: <20220531060321.GB1098723@dread.disaster.area>

On Tue, 2022-05-31 at 16:03 +1000, Dave Chinner wrote:
> On Fri, May 20, 2022 at 12:00:31PM -0700, Allison Henderson wrote:
> > This patch implements a new set of log printing functions to print
> > the
> > ATTRI and ATTRD items and vectors in the log.  These will be used
> > during
> > log dump and log recover operations.
> > 
> > Though most attributes are strings, the attribute operations accept
> > any binary payload, so we should not assume them printable.  This
> > was
> > done intentionally in preparation for parent pointers.  Until
> > parent
> > pointers get here, attributes have no discernible format.  So the
> > print
> > routines are just a simple print or hex dump for now.
> > 
> > Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
> 
> Oh, this reminds me how much I dislike logprint, having multiple,
> very subtly different ways to print the same information in slightly
> different formats.
I did notice that, but I thought I should try and be as consistent as
possible at least for now. 

> 
> Reviewed-by: Dave Chinner <dchinner@redhat.com>
> 
Thank you!

> But this is a bug I needed to fix...
> 
> .....
> > +	if (src_f->alfi_value_len > 0) {
> > +		printf(_("\n"));
> > +		(*i)++;
> > +		head = (xlog_op_header_t *)*ptr;
> > +		xlog_print_op_header(head, *i, ptr);
> > +		error = xlog_print_trans_attri_value(ptr,
> > be32_to_cpu(head->oh_len),
> > +				src_f->alfi_value_len);
> > +	}
> 
> So this passes the length of the region and the length of the
> value. They are not the same, the value can be split across multiple
> regions as the value is split across multiple log writes. so....
> 
> > +int
> > +xlog_print_trans_attri_value(
> > +	char				**ptr,
> > +	uint				src_len,
> > +	int				value_len)
> > +{
> > +	int len = max(value_len, MAX_ATTR_VAL_PRINT);
> > +
> > +	printf(_("ATTRI:  value len:%u\n"), value_len);
> > +	print_or_dump(*ptr, len);
> 
> This dumps the value length from a buffer of src_len, overruns the
> end of the buffer and Bad Things Happen. (i.e. logprint segv's)
> 
> This should be:
> 
> 	int len = min(value_len, src_len);
> 
> So that the dump doesn't overrun the region buffer....
> 
> I'll fix it directly in my stack, I think this is the only remaining
> failure I'm seeing with my current libxfs 5.19 sync branch....

Ah, alrighty then thanks for the catch, I will wait for your updates
then.  Thx!

Allison

> 
> Cheers,
> 
> Dave.


      reply	other threads:[~2022-06-01  1:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-20 19:00 [PATCH v2 00/18] xfsprogs: Port larp, enable injects and log print for attri/d Allison Henderson
2022-05-20 19:00 ` [PATCH v2 01/18] xfsprogs: zero inode fork buffer at allocation Allison Henderson
2022-05-20 19:00 ` [PATCH v2 02/18] xfsprogs: hide log iovec alignment constraints Allison Henderson
2022-05-20 19:00 ` [PATCH v2 03/18] xfsprogs: don't commit the first deferred transaction without intents Allison Henderson
2022-05-20 19:00 ` [PATCH v2 04/18] xfsprogs: tag transactions that contain intent done items Allison Henderson
2022-05-20 19:00 ` [PATCH v2 05/18] xfsprogs: Fix double unlock in defer capture code Allison Henderson
2022-05-20 19:00 ` [PATCH v2 06/18] xfsprogs: Return from xfs_attr_set_iter if there are no more rmtblks to process Allison Henderson
2022-05-20 19:00 ` [PATCH v2 07/18] xfsprogs: Set up infrastructure for log attribute replay Allison Henderson
2022-05-20 19:00 ` [PATCH v2 08/18] xfsprogs: Implement attr logging and replay Allison Henderson
2022-05-20 19:00 ` [PATCH v2 09/18] xfsprogs: Skip flip flags for delayed attrs Allison Henderson
2022-05-20 19:00 ` [PATCH v2 10/18] xfsprogs: Add xfs_attr_set_deferred and xfs_attr_remove_deferred Allison Henderson
2022-05-20 19:00 ` [PATCH v2 11/18] xfsprogs: Remove unused xfs_attr_*_args Allison Henderson
2022-05-20 19:00 ` [PATCH v2 12/18] xfsprogs: Add log attribute error tag Allison Henderson
2022-05-20 19:00 ` [PATCH v2 13/18] xfsprogs: Merge xfs_delattr_context into xfs_attr_item Allison Henderson
2022-05-20 19:00 ` [PATCH v2 14/18] xfsprogs: Add helper function xfs_attr_leaf_addname Allison Henderson
2022-05-20 19:00 ` [PATCH v2 15/18] xfsprogs: Add helper function xfs_init_attr_trans Allison Henderson
2022-05-20 19:00 ` [PATCH v2 16/18] xfsprogs: add leaf split error tag Allison Henderson
2022-05-20 19:00 ` [PATCH v2 17/18] xfsprogs: add leaf to node " Allison Henderson
2022-05-20 19:00 ` [PATCH v2 18/18] xfs_logprint: Add log item printing for ATTRI and ATTRD Allison Henderson
2022-05-31  6:03   ` Dave Chinner
2022-06-01  1:39     ` Alli [this message]

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=764c5e859d2875c1799c0fcc852f85ac705bfeee.camel@oracle.com \
    --to=allison.henderson@oracle.com \
    --cc=david@fromorbit.com \
    --cc=linux-xfs@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.