Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

ch_fuse: switch SquashFUSE to libfuse3 types #1859

Merged
merged 1 commit into from
Apr 7, 2024

Conversation

olifre
Copy link
Contributor

@olifre olifre commented Mar 11, 2024

The forget operation in libfuse3 takes uint64_t as third parameter, while SquashFUSE defaults to unsigned long as used in libfuse2. This causes a mess on arches with different size of these types, so explicitly switch to the libfuse3 variant.

closes #1858

@wiene (or someone with armhf / armel hardware): Please let me know if that indeed fixes the problem 🤞 .

The forget operation in libfuse3 takes uint64_t as third parameter,
while SquashFUSE defaults to unsigned long as used in libfuse2.
This causes a mess on arches with different size of these types,
so explicitly switch to the libfuse3 variant.

closes hpc#1858
@wiene
Copy link
Contributor

wiene commented Mar 16, 2024

Thanks @olifre for providing this PR. I tried it but unfortunately it did not fix the FTBFS issue on arm{el,hf}. Here are the new build logs:

@olifre
Copy link
Contributor Author

olifre commented Mar 16, 2024

Thanks for testing, @wiene !

I get the reason why it did not fix the problems on Debian — the necessary counterpart in Squashfuse is only present starting with 0.5.1 (see vasi/squashfuse@cb148fc ), while Debian unstable is still using 0.5.0.

However, it took me a while to understand how Squashfuse itself can compile on armel / armhf (or anything 32 bit, basically) on Debian.

Debian unstable on 32 bit should run into the very same problem right here:
https://salsa.debian.org/sgmoore/squashfuse/-/blob/debian/0.5.0-2/ll_main.c#L164
The left hand side of that assignment comes from:
https://sources.debian.org/src/fuse3/3.14.0-5/include/fuse_lowlevel.h/#L281
i.e. with uint64_t type as third argument, the right hand side from here:
https://salsa.debian.org/sgmoore/squashfuse/-/blob/debian/0.5.0-2/ll.h#L111-112
i.e. unsigned long as third argument.

Well, it turns out when checking build logs for Squashfuse on Debian armel, for example:
https://buildd.debian.org/status/fetch.php?pkg=squashfuse&arch=armel&ver=0.5.0-2%2Bb1&stamp=1707534165&raw=0
that they contain the following:

ll_main.c: In function ‘main’:
ll_main.c:164:41: warning: assignment to ‘void (*)(struct fuse_req *, fuse_ino_t,  uint64_t)’ {aka ‘void (*)(struct fuse_req *, long long unsigned int,  long long unsigned int)’} from incompatible pointer type ‘void (*)(struct fuse_req *, fuse_ino_t,  long unsigned int)’ {aka ‘void (*)(struct fuse_req *, long long unsigned int,  long unsigned int)’} [-Wincompatible-pointer-types]
  164 |         sqfs_ll_ops.forget              = sqfs_ll_op_forget;
      |                                         ^

So indeed they see the warning, but just ignore it / don't compile with -Werror.

So maybe the best way to proceed would be to raise a bug report with squashfuse on Debian unstable, recommend them to use -Werror in packaging if possible to catch such issues, and propose to upgrade to a version > 0.5.0 to fix this warning?

@wiene
Copy link
Contributor

wiene commented Mar 16, 2024

Thanks again for your careful analysis, @olifre. I followed your advice and filed a bug against libsquashfuse-dev: https://bugs.debian.org/1067010

@reidpr
Copy link
Collaborator

reidpr commented Mar 18, 2024

Charliecloud’s configure does have --enable-buggy-build which turns off -Werror. If this warning does not reflect a true functionality problem, that is a (hopefully temporary) option.

@olifre
Copy link
Contributor Author

olifre commented Mar 18, 2024

Actually, I'm not fully sure this is harmless — if the forget operation is called with a third argument with wrong size, it may be interpreted as a wrong value, leading to a false "forget" operation of the associated inode.

That is probably really exotic, I assume one would need to do make nlookup exceed unsigned long on 32 bit e.g. by opening a file 2^32 times (if I understand the mechanics correctly), and then trigger forget e.g. by pressurizing memory. If my understanding is correct, this could lead to the FUSE layer forgetting about an inode even though it is still referenced.
However, my understanding of FUSE is quite basic.

If this is true, though, it's a harmful bug in Squashfuse, and we should push the Debian maintainer to fix it in testing by upgrading (and ideally also enable -Werror in packaging of Squashfuse, which I would consider good practice for binary distros). Since @wiene has opened the bug against Squashfuse with Severity: serious I expect the maintainer will take action soon.

@wiene
Copy link
Contributor

wiene commented Apr 6, 2024

After applying the patch from this PR and fixing

Charliecloud builds successfully on arm{el,hf}:

Thus this PR is ready to be merged from my point of view.

@olifre
Copy link
Contributor Author

olifre commented Apr 6, 2024

Thus this PR is ready to be merged from my point of view.

Many thanks, @wiene! I've marked the PR as "ready for review" right now.

@olifre olifre marked this pull request as ready for review April 6, 2024 20:48
@reidpr
Copy link
Collaborator

reidpr commented Apr 7, 2024

Thank you @olifre and @wiene!!

The test failure looks spurious so I am going to just merge.

@reidpr reidpr merged commit e94d375 into hpc:master Apr 7, 2024
5 of 6 checks passed
@olifre olifre deleted the squashfuse_uint64_t branch April 8, 2024 01:51
kchilleri pushed a commit that referenced this pull request May 8, 2024
The forget operation in libfuse3 takes uint64_t as third parameter,
while SquashFUSE defaults to unsigned long as used in libfuse2.
This causes a mess on arches with different size of these types,
so explicitly switch to the libfuse3 variant.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build failure on arm{el,hf}: Incompatible pointer types in ch_fuse.c
3 participants