Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenZFS 2.3.0-rc3 & UCLIBC. Crash while compiling. MS_RDONLY = 1 #16735

Closed
jlsalvador opened this issue Nov 8, 2024 · 11 comments · Fixed by #16741
Closed

OpenZFS 2.3.0-rc3 & UCLIBC. Crash while compiling. MS_RDONLY = 1 #16735

jlsalvador opened this issue Nov 8, 2024 · 11 comments · Fixed by #16741
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)

Comments

@jlsalvador
Copy link
Contributor

jlsalvador commented Nov 8, 2024

Hi again,

I’m currently outside with very limited internet access and no computer, only a phone. Please excuse the brief explanation and lack of proper debugging.

The compilation crash for uClibc with OpenZFS 2.3.0-rc3 is as follows (note that it works correctly with glibc and musl):

In file included from tests/zfs-tests/cmd/getversion.c:22:
/tmp/tmp.s4lnjcKpqa/TestZfsUclibc/host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/sys/mount.h:35:3: error: expected identifier before numeric constant
   35 |   MS_RDONLY = 1,                /* Mount read-only.  */
      |   ^~~~~~~~~
  CC       tests/zfs-tests/cmd/idmap_util.o
make[4]: *** [Makefile:8906: tests/zfs-tests/cmd/getversion.o] Error 1
make[4]: *** Waiting for unfinished jobs....                                  make[3]: *** [Makefile:12578: all-recursive] Error 1                          make[2]: *** [Makefile:4751: all] Error 2                                     make[1]: *** [package/pkg-generic.mk:289: /tmp/tmp.s4lnjcKpqa/TestZfsUclibc/build/zfs-2.3.0-rc3/.stamp_built] Error 2
make: *** [Makefile:23: _all] Error 2
E                                                                             ======================================================================
ERROR: test_run (tests.package.test_zfs.TestZfsUclibc.test_run)
----------------------------------------------------------------------        Traceback (most recent call last):                                              File "/home/jlsalvador/src/simplek8s-buildroot/buildroot/support/testing/infra/basetest.py", line 74, in setUp                                                self.b.build()                                                              File "/home/jlsalvador/src/simplek8s-buildroot/buildroot/support/testing/infra/builder.py", line 105, in build
    raise SystemError("Build failed")                                         SystemError: Build failed

----------------------------------------------------------------------        Ran 1 test in 471.419s                                                        
FAILED (errors=1)

System information

Type Version/Name
Distribution Name buildroot
Distribution Version main
Kernel Version 5.15.35
Architecture x86-64
OpenZFS Version 2.3.0-rc3

Describe the problem you're observing

Describe how to reproduce the problem

Include any warning/errors/backtraces from the system logs

@jlsalvador jlsalvador added the Type: Defect Incorrect behavior (e.g. crash, hang) label Nov 8, 2024
@jlsalvador
Copy link
Contributor Author

jlsalvador commented Nov 8, 2024

AFK for ~48h. I will debug it later.

@robn
Copy link
Member

robn commented Nov 9, 2024

Just from proximity, I wonder if #15925 broke this? @thesamesam?

@thesamesam
Copy link
Contributor

thesamesam commented Nov 9, 2024

I'll take a look, thanks for the ping. I know what the class of problem is (unfortunate clashes with linux-headers vs libc headers), but the specifics need checking.

@jlsalvador Gentoo doesn't support uclibc anymore so it's not easy for me to quickly get an env setup. Do you have any recommendations for how I can?

@jlsalvador
Copy link
Contributor Author

I'll take a look, thanks for the ping. I know what the class of problem is (unfortunate clashes with linux-headers vs libc headers), but the specifics need checking.

@jlsalvador Gentoo doesn't support uclibc anymore so it's not easy for me to quickly get an env setup. Do you have any recommendations for how I can?

git clone https://gitlab.com/buildroot.org/buildroot.git

cd buildroot

./support/testing/run-tests -d $(pwd)/dl -o $(mktemp -d) -s tests.package.test_zfs.TestZfsUclibc.test_run

patch to openzfs-2.3.0-rc3:
https://gist.github.com/jlsalvador/9b6bd33a569c049438831f38b4054744

@jlsalvador
Copy link
Contributor Author

Just from proximity, I wonder if #15925 broke this? @thesamesam?

It compiles when the commit e12d761 is reverted.

@jlsalvador
Copy link
Contributor Author

tests/zfs-tests/cmd/getversion.c needs as fallback:

#ifdef _KERNEL
#include <sys/fcntl.h>
#else
#include <fcntl.h>
#endif

@thesamesam
Copy link
Contributor

Thanks, that LGTM (and it's the issue I thought I'd seen in that PR but then couldn't reproduce at all later). Want to submit it or should I?

@jlsalvador
Copy link
Contributor Author

Thanks, that LGTM (and it's the issue I thought I'd seen in that PR but then couldn't reproduce at all later). Want to submit it or should I?

I won't be able to make a proper commit for about 24 hours, but I'm happy if you want to commit a proper solution before then. 👍

jlsalvador added a commit to jlsalvador/zfs that referenced this issue Nov 11, 2024
This patch fixes compilation with uClibc by applying the same fallback
as commit e12d761 to the `getversion.c`
file, which was previously overlooked.

Signed-off-by: José Luis Salvador Rufo <[email protected]>
Closes openzfs#16735
@jlsalvador
Copy link
Contributor Author

tests/zfs-tests/cmd/getversion.c needs as fallback:

#ifdef _KERNEL
#include <sys/fcntl.h>
#else
#include <fcntl.h>
#endif

This does not fix the issue.

@jlsalvador
Copy link
Contributor Author

Moving fcntl.h before linux/fs.h fix the problem.
Debugging and testing for others toolchains (glibc, musl and uclibc) before the PR.

jlsalvador added a commit to jlsalvador/zfs that referenced this issue Nov 11, 2024
This patch fixes compilation with uClibc by applying the same fallback
as commit e12d761 to the `getversion.c`
file, which was previously overlooked.

Signed-off-by: José Luis Salvador Rufo <[email protected]>
Closes openzfs#16735
@jlsalvador
Copy link
Contributor Author

Just moving fcntl.h before linux/fs.h is good enough for uClibc.
@thesamesam can you test my PR (#16741) in your environment?

behlendorf pushed a commit that referenced this issue Nov 15, 2024
This patch fixes compilation with uClibc by applying the same fallback
as commit e12d761 to the `getversion.c`
file, which was previously overlooked.
 
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: José Luis Salvador Rufo <[email protected]>
Closes #16735
Closes #16741
behlendorf pushed a commit to behlendorf/zfs that referenced this issue Nov 15, 2024
This patch fixes compilation with uClibc by applying the same fallback
as commit e12d761 to the `getversion.c`
file, which was previously overlooked.
 
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: José Luis Salvador Rufo <[email protected]>
Closes openzfs#16735
Closes openzfs#16741
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Defect Incorrect behavior (e.g. crash, hang)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants