Bug 281526 - Linuxulator - fstatat unsupported flag 0x800
Summary: Linuxulator - fstatat unsupported flag 0x800
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 14.1-STABLE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Ed Maste
URL:
Keywords:
Depends on:
Blocks: 247219
  Show dependency treegraph
 
Reported: 2024-09-15 22:46 UTC by sporran-musing0p
Modified: 2024-10-04 18:35 UTC (History)
4 users (show)

See Also:


Attachments
linux binary under linuxulator - NOK (21.38 KB, text/plain)
2024-09-15 22:46 UTC, sporran-musing0p
no flags Details
linux binary linuxulator start OK (14.32 KB, text/plain)
2024-09-15 22:48 UTC, sporran-musing0p
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description sporran-musing0p 2024-09-15 22:46:32 UTC
Created attachment 253594 [details]
linux binary under linuxulator - NOK

Jails are great.
And Linux compatibility also working in jails is great.

I spent last 2 weeks learning how to use both.

I would love to move to FreeBSD + Jails, but have one binary (linux) that does not want to work under linuxulator.
Currently, my main server runs Proxmox with LXC based virtual machines (kernel based, not full VM), and I was hoping to move to FreeBSD (just because I am tired of Linux somehow, and want to move to something more consistent with native zfs and no systemd).



I get this message when I try to run the linux compiled binary, in /var/lob/messages
fstatat unsupported flag 0x800

and this is the symptom when I run the linux compiled binary

************************
EXCEPTION: Exception: type=boost::filesystem::filesystem_error, what="boost::filesystem::status: Invalid argument [system:22]: "/root/.firo""
No debug information available for stacktrace. You should add debug information and then run:
firod -printcrashinfo=bvcgc43iinzgc43ijfxgm3ybaacwm2lsn5sierlymnsxa5djn5xduidupfygkplcn5xxg5b2hjtgs3dfon4xg5dfnu5duztjnrsxg6ltorsw2x3fojzg64rmeb3wqyluhurge33pon2duotgnfwgk43zon2gk3j2hjzxiyluovztuicjnz3gc3djmqqgc4thovwwk3tuebnxg6ltorsw2orsgjotuibcf5zg633uf4xgm2lsn4rcecbp7suqaaaaaaamsx3caaaaaaaaybwgeaaaaaaab64peaaaaaaaac63khaaaaaaaackwjzqccaaaaaalm3taeeaaaaarkcsaaaaaaaaaaa=

Assertion failure:
  assertion: pCurrentParams
  file: chainparams.cpp, line: 1283
  function: const CChainParams& Params()
No debug information available for stacktrace. You should add debug information and then run:
firod -printcrashinfo=bvcgc43iinzgc43ijfxgm3ybaacwm2lsn5shwqltonsxe5djn5xcaztbnfwhk4tfhifcaidbonzwk4tunfxw4oraobbxk4tsmvxhiudbojqw24ykeaqgm2lmmu5cay3imfuw44dbojqw24zomnyhalbanruw4zj2eayteobtbiqcaztvnzrxi2lpny5cay3pnzzxiicdinugc2lokbqxeylnomtcaudbojqw24zifef6ntdeaaaaaaaa6ovvwaaaaaaaaakupeaaaaaaac76woyaaaaaaafvay6aaaaaaaafbcjbaaaaaaaa5ojcaaaaaaaabpnvdqaaaaaaabfle4ybbaaaaaafwnzqccaaaaaivbjaaaaaaaaaaa======
firod: chainparams.cpp:1283: const CChainParams& Params(): Assertion `pCurrentParams' failed.
Aborted (core dumped)


I tried to re-compile it under FreeBSD directly, but it fails on some tor library not present (different topic).

Other linux stuff I want to have running works fine in linux jails, and I see even better memory/cpu usage than directly on linux.

So this is the one thing that holds me back from moving.

Any help would be appreciated
Attaching the strace from linux binary start, OK and NOK
Comment 1 sporran-musing0p 2024-09-15 22:48:55 UTC
Created attachment 253595 [details]
linux binary linuxulator start OK

example strace when successfully started
Comment 2 Ed Maste freebsd_committer freebsd_triage 2024-09-19 21:00:36 UTC
0x800 is AT_NO_AUTOMOUNT,

AT_NO_AUTOMOUNT (since Linux 2.6.38)
    Don't automount the terminal ("basename") component of pathname if it is a directory that is an automount point. This allows the caller to gather attributes of an automount point (rather than the location it would mount). This flag can be used in tools that scan directories to prevent mass-automounting of a directory of automount points. The AT_NO_AUTOMOUNT flag has no effect if the mount point has already been mounted over.

We silently ignore AT_NO_AOTOMOUNT for statx() as of ff39d74aa99a4, but not other stat variants.

Are you able to build and test a patched kernel?
Comment 3 sporran-musing0p 2024-09-19 21:40:51 UTC
(In reply to Ed Maste from comment #2)
I do not have idea how (new to FreeBSD, but cant be that hard, right?)
but yes, I could try.
can you tell me what to do?
or what to patch ?
Comment 4 Konstantin Belousov freebsd_committer freebsd_triage 2024-09-20 06:36:31 UTC
https://reviews.freebsd.org/D46710 FreeBSD native AT_NO_AUTOMOUNT
Comment 5 sporran-musing0p 2024-09-21 22:55:40 UTC
I followed https://docs.freebsd.org/en/books/handbook/kernelconfig/ and compiled latest kernel with the git apply D46710.diff file

root@bsdtest:~ # uname -a
FreeBSD bsdtest 15.0-CURRENT FreeBSD 15.0-CURRENT #2 main-n272413-66fcbd9556b0-dirty: Sat Sep 21 22:43:15 UTC 2024     root@bsdtest:/usr/obj/usr/src/amd64.amd64/sys/MYKERNEL amd64


I still get the same error though.

linux: jid 1 pid 1386 (firo-shutoff): fstatat unsupported flag 0x800


strace (linux jail) output that is relevant (same as before)

mmap(NULL, 1060864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x80291b000
arch_prctl(ARCH_SET_FS, 0x802a1ab40)    = 0
set_tid_address(0x802a1ae10)            = 1402
set_robust_list(0x802a1ae20, 24)        = 0
rseq(0x802a1b460, 0x20, 0, 0x53053053)  = -1 ENOSYS (Function not implemented)
mprotect(0x802906000, 16384, PROT_READ) = 0
mprotect(0x802736000, 4096, PROT_READ)  = 0
mprotect(0x802716000, 4096, PROT_READ)  = 0




maybe I am doing something wrong, no idea ¯\_(ツ)_/¯ .
Comment 6 Ed Maste freebsd_committer freebsd_triage 2024-09-22 06:42:31 UTC
(In reply to sporran-musing0p from comment #5)
Sorry there's some confusion here - that patch (by itself) won't address the issue. Please give the patch in https://reviews.freebsd.org/D46711 a try.
Comment 7 Ed Maste freebsd_committer freebsd_triage 2024-09-22 06:44:20 UTC
(In reply to Ed Maste from comment #6)
Oh, also D46711 does not depend on another patch. It won't hurt if D46710 is also applied, but it is not necessary.
Comment 8 Oleg 2024-09-22 12:57:41 UTC
The patch fixed the issue! Thanks.
Comment 9 sporran-musing0p 2024-09-22 14:44:32 UTC
I can confirm the patch D46711 fixed my issue. 
thank you very much
Comment 10 Ed Maste freebsd_committer freebsd_triage 2024-09-22 15:04:49 UTC
Thank you for testing!
Comment 11 commit-hook freebsd_committer freebsd_triage 2024-09-24 17:59:16 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=3cf834d069d1dcdbe464ea74624930eaf916715d

commit 3cf834d069d1dcdbe464ea74624930eaf916715d
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-09-19 21:11:19 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-09-24 17:58:42 +0000

    linuxulator: ignore AT_NO_AUTOMOUNT for all stat variants

    Commit ff39d74aa99a ignored AT_NO_AUTOMOUNT for statx(), but did not
    change fstat64() or newfstatat(), which also take an equivalent flags
    argument.  Add a linux_to_bsd_stat_flags() helper and use it in all
    three places.

    PR:             281526
    Reviewed by:    trasz
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D46711

 sys/compat/linux/linux_stats.c | 65 +++++++++++++++++++++++-------------------
 1 file changed, 36 insertions(+), 29 deletions(-)
Comment 12 commit-hook freebsd_committer freebsd_triage 2024-09-29 22:38:24 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=99d3ce80ba07e751226a7ff07afc51ad2d79ccce

commit 99d3ce80ba07e751226a7ff07afc51ad2d79ccce
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2024-09-19 21:11:19 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-09-29 22:37:02 +0000

    linuxulator: ignore AT_NO_AUTOMOUNT for all stat variants

    Commit ff39d74aa99a ignored AT_NO_AUTOMOUNT for statx(), but did not
    change fstat64() or newfstatat(), which also take an equivalent flags
    argument.  Add a linux_to_bsd_stat_flags() helper and use it in all
    three places.

    PR:             281526
    Reviewed by:    trasz
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D46711

    (cherry picked from commit 3cf834d069d1dcdbe464ea74624930eaf916715d)

 sys/compat/linux/linux_stats.c | 65 +++++++++++++++++++++++-------------------
 1 file changed, 36 insertions(+), 29 deletions(-)
Comment 13 Ed Maste freebsd_committer freebsd_triage 2024-10-04 18:35:13 UTC
Flag ignored in main and stable/14 now. The patch does not apply cleanly to stable/13 and won't be merged there. Native FreeBSD support (D46710) can continue independent of this bug report.