From: "Darrick J. Wong" <djwong@kernel.org>
To: bugzilla-daemon@kernel.org
Cc: linux-xfs@vger.kernel.org
Subject: Re: [Bug 217522] xfs_attr3_leaf_add_work produces a warning
Date: Sun, 4 Jun 2023 11:31:58 -0700 [thread overview]
Message-ID: <20230604183158.GI72241@frogsfrogsfrogs> (raw)
In-Reply-To: <bug-217522-201763-NVge3HI5rt@https.bugzilla.kernel.org/>
On Sun, Jun 04, 2023 at 03:31:20AM +0000, bugzilla-daemon@kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=217522
>
> --- Comment #2 from Vladimir Lomov (lomov.vl@bkoty.ru) ---
> Hello
> ** bugzilla-daemon@kernel.org <bugzilla-daemon@kernel.org> [2023-06-03 14:50:24
> +0000]:
>
> >https://bugzilla.kernel.org/show_bug.cgi?id=217522
> >
> >--- Comment #1 from Darrick J. Wong (djwong@kernel.org) ---
> >On Sat, Jun 03, 2023 at 03:58:25AM +0000, bugzilla-daemon@kernel.org wrote:
> >> https://bugzilla.kernel.org/show_bug.cgi?id=217522
> >>
> >> Bug ID: 217522
> >> Summary: xfs_attr3_leaf_add_work produces a warning
> >> Product: File System
> >> Version: 2.5
> >> Hardware: All
> >> OS: Linux
> >> Status: NEW
> >> Severity: normal
> >> Priority: P3
> >> Component: XFS
> >> Assignee: filesystem_xfs@kernel-bugs.kernel.org
> >> Reporter: lomov.vl@bkoty.ru
> >> Regression: No
> >>
> >> Hi.
> >>
> >> While running linux-next
> >> (6.4.0-rc4-next-20230602-1-next-git-06849-gbc708bbd8260) on one of my hosts,
> >> I
> >> see the following message in the kernel log (`dmesg`):
> >> ```
> >> Jun 02 20:01:19 smoon.bkoty.ru kernel: ------------[ cut here ]------------
> >> Jun 02 20:01:19 smoon.bkoty.ru kernel: memcpy: detected field-spanning write
> >> (size 12) of single field "(char *)name_loc->nameval" at
> >
> > Yes, this bug is a collision between the bad old ways of doing flex
> > arrays:
> >
> > typedef struct xfs_attr_leaf_name_local {
> > __be16 valuelen; /* number of bytes in value */
> > __u8 namelen; /* length of name bytes */
> > __u8 nameval[1]; /* name/value bytes */
> > } xfs_attr_leaf_name_local_t;
>
> > And the static checking that gcc/llvm purport to be able to do properly.
>
> Something similar has caused problems with kernel compilation before:
> https://lkml.org/lkml/2023/5/24/576 (I'm not 100% sure if the origin is the
> same though).
Yup.
> > This is encoded into the ondisk structures, which means that someone
> > needs to do perform a deep audit to change each array[1] into an
> > array[] and then ensure that every sizeof() performed on those structure
> > definitions has been adjusted. Then they would need to run the full QA
> > test suite to ensure that no regressions have been introduced. Then
> > someone will need to track down any code using
> > /usr/include/xfs/xfs_da_format.h to let them know about the silent
> > compiler bomb heading their way.
>
> > I prefer we leave it as-is since this code has been running for years
> > with no problems.
>
> Should I assume that this problem is not significant and won't have any effect
> to the FS and won't cause the FS to misbehave or become corrupted? If so, why
> does the problem only show up on one host but not on the other? Or is this a
> runtime check, and it somehow happens on the first system (even rebooted
> twice), but not on the second one.
AFAICT, there's no real memory corruption problem here; it's just that
the compiler treats array[1] as a single-element array instead of
turning on whatever magic enables it to handle flexarrays (aka array[]
or array[0]). I don't know why you'd ever want a real single-element
array, but legacy C is fun like that. :/
--D
> [...]
>
> ---
> Vladimir Lomov
>
> --
> You may reply to this email to add a comment.
>
> You are receiving this mail because:
> You are watching the assignee of the bug.
next prev parent reply other threads:[~2023-06-04 18:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-03 3:58 [Bug 217522] New: xfs_attr3_leaf_add_work produces a warning bugzilla-daemon
2023-06-03 14:50 ` Darrick J. Wong
2023-06-03 14:50 ` [Bug 217522] " bugzilla-daemon
2023-06-04 3:31 ` bugzilla-daemon
2023-06-04 18:31 ` Darrick J. Wong [this message]
2023-06-04 18:32 ` bugzilla-daemon
2023-06-05 2:35 ` bugzilla-daemon
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=20230604183158.GI72241@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=bugzilla-daemon@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox