linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, Miklos Szeredi <mszeredi@redhat.com>
Subject: Re: [BUG] fuse/virtiofs: kernel module build fail
Date: Sat, 14 Jun 2025 06:55:40 -0400	[thread overview]
Message-ID: <aE1VLOtagir-EyRM@bfoster> (raw)
In-Reply-To: <CAJnrk1ZOP60By0XozFy+6zXYzbkEznye6rGSet16-g-JQoGfTw@mail.gmail.com>

On Fri, Jun 13, 2025 at 04:42:00PM -0700, Joanne Koong wrote:
> On Fri, Jun 13, 2025 at 4:41 AM Brian Foster <bfoster@redhat.com> wrote:
> >
> > On Thu, Jun 12, 2025 at 02:56:56PM -0700, Joanne Koong wrote:
> > > On Thu, Jun 12, 2025 at 4:19 AM Brian Foster <bfoster@redhat.com> wrote:
...
> 
> You didn't mess up the bisect, I was able to verify that it is that
> commit that causes the issue. I misunderstood the error message and
> thought it was complaining about alignment in a struct being broken
> somewhere.
> 
> This fixes the commit:
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -1147,7 +1147,7 @@ static ssize_t fuse_send_write_pages(struct
> fuse_io_args *ia,
>  static ssize_t fuse_fill_write_pages(struct fuse_io_args *ia,
>                                      struct address_space *mapping,
>                                      struct iov_iter *ii, loff_t pos,
> -                                    unsigned int max_pages)
> +                                    unsigned int max_folios)
>  {
>         struct fuse_args_pages *ap = &ia->ap;
>         struct fuse_conn *fc = get_fuse_conn(mapping->host);
> @@ -1157,12 +1157,11 @@ static ssize_t fuse_fill_write_pages(struct
> fuse_io_args *ia,
>         int err = 0;
> 
>         num = min(iov_iter_count(ii), fc->max_write);
> -       num = min(num, max_pages << PAGE_SHIFT);
> 
>         ap->args.in_pages = true;
>         ap->descs[0].offset = offset;
> 
> -       while (num) {
> +       while (num && ap->num_folios < max_folios) {
>                 size_t tmp;
>                 struct folio *folio;
>                 pgoff_t index = pos >> PAGE_SHIFT;
> 
> 
> The bug is that I incorrectly assumed that I could use max_pages <<
> PAGE_SHIFT as the upper limit for how many bytes to copy in, but
> there's the possibility that the copy_folio_from_iter_atomic() call
> that we do can copy over bytes from the iov_iter that are less than
> the length of the folio, so using max_pages << PAGE_SHIFT as the bound
> for max_pages is wrong.
> 
> I ran the fix locally on top of origin/master (commit 27605c8c0) as
> well and verified that it fixes the issue. I'll send this fix
> upstream.
> 

Ah, great thanks. That makes sense.. I'll give it a try.

> Sorry for the inconvenience. Hope this bug didn't waste too much of
> your time. Thanks for reporting it.
> 

No worries at all, thanks for tracking it down!

Brian

> >
> > Brian
> >
> > > >
> > > > ... and ends up spitting out link time errors like this as of commit
> > > > 63c69ad3d18a ("fuse: refactor fuse_fill_write_pages()"):
> > > >
> > > > ...
> > > >   CC [M]  xfs.mod.o
> > > >   CC [M]  .module-common.o
> > > >   LD [M]  xfs.ko
> > > >   BTF [M] xfs.ko
> > > > die__process: DW_TAG_compile_unit, DW_TAG_type_unit, DW_TAG_partial_unit or DW_TAG_skeleton_unit expected got subprogram (0x2e) @ ed957!
> > > > error decoding cu i_mmap_rwsem
> > > > error decoding cu
> > > > ...
> > > > error decoding cu
> > > > pahole: xfs.ko: Invalid argument
> > > > make[3]: *** [/root/repos/linux/scripts/Makefile.modfinal:57: xfs.ko] Error 1
> > > > make[3]: *** Deleting file 'xfs.ko'
> > > > make[2]: *** [/root/repos/linux/Makefile:1937: modules] Error 2
> > > > make[1]: *** [/root/repos/linux/Makefile:248: __sub-make] Error 2
> > > > make[1]: Leaving directory '/root/repos/linux/fs/xfs'
> > > > make: *** [Makefile:248: __sub-make] Error 2
> > > >
> > > > ... or this on latest master:
> > > >
> > > > ...
> > > >   LD [M]  fs/xfs/xfs.o
> > > > fs/xfs/xfs.o: error: objtool: can't find reloc entry symbol 2145964924 for .rela.text
> > > > make[4]: *** [scripts/Makefile.build:501: fs/xfs/xfs.o] Error 1
> > > > make[4]: *** Deleting file 'fs/xfs/xfs.o'
> > > > make[3]: *** [scripts/Makefile.build:554: fs/xfs] Error 2
> > > > make[2]: *** [scripts/Makefile.build:554: fs] Error 2
> > > > make[1]: *** [/root/repos/linux/Makefile:2006: .] Error 2
> > > > make: *** [Makefile:248: __sub-make] Error 2
> > > >
> > > > The latter failure is what I saw through most of a bisect so I suspect
> > > > one of the related followon commits alters the failure characteristic
> > > > from the former, but I've not confirmed that. Also note out of
> > > > convenience my test was to just recompile xfs.ko out of the same tree I
> > > > was bisecting from because the failures were consistent and seemed to be
> > > > a runtime kernel issue and not a source tree issue.
> > > >
> > > > I haven't had a chance to dig any further than this (and JFYI I'm
> > > > probably not going to be responsive through the rest of today). I just
> > > > completed the bisect and wanted to get it on list sooner rather than
> > > > later..
> > > >
> > > > Brian
> > > >
> > >
> >
> 


  reply	other threads:[~2025-06-14 10:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-12 11:22 [BUG] fuse/virtiofs: kernel module build fail Brian Foster
2025-06-12 21:56 ` Joanne Koong
2025-06-13 11:44   ` Brian Foster
2025-06-13 23:42     ` Joanne Koong
2025-06-14 10:55       ` Brian Foster [this message]
2025-06-13 14:06   ` Luis Henriques
2025-06-13 22:20     ` Joanne Koong

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=aE1VLOtagir-EyRM@bfoster \
    --to=bfoster@redhat.com \
    --cc=joannelkoong@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mszeredi@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).