Page MenuHomeFreeBSD
Feed Advanced Search

May 18 2023

dchagin added a reviewer for D40156: linux(4): Fix stack unwinding across signal frame on x86_64: Linux Emulation.
May 18 2023, 7:34 PM · Linux Emulation
dchagin closed D40097: linux(4): Add pokeusr impl for x86_64.
May 18 2023, 5:04 PM · Linux Emulation
dchagin closed D40096: linux(4): Make ptrace_pokeusr machine dependent.
May 18 2023, 5:04 PM · Linux Emulation
dchagin closed D40095: linux(4): Make ptrace_peekusr machine dependend.
May 18 2023, 5:04 PM · Linux Emulation
dchagin closed D40100: linux(4): Check fd passed to unlockpt().
May 18 2023, 7:56 AM · Linux Emulation
imp added a comment to D38459: timerfd: Add native support for Linux's timerfd.

I have contrary opinion about ioctl vs syscall.

May 18 2023, 12:04 AM · linuxkpi, Linux Emulation

May 14 2023

dchagin added a reviewer for D35544: linux(4): Implement xattr syscalls: jrtc27.
May 14 2023, 11:25 PM · Linux Emulation
dchagin added a reviewer for D40100: linux(4): Check fd passed to unlockpt(): Linux Emulation.
May 14 2023, 11:22 PM · Linux Emulation
dchagin added a reviewer for D40096: linux(4): Make ptrace_pokeusr machine dependent: Linux Emulation.
May 14 2023, 8:40 PM · Linux Emulation
dchagin added a reviewer for D40095: linux(4): Make ptrace_peekusr machine dependend: Linux Emulation.
May 14 2023, 8:40 PM · Linux Emulation
dchagin retitled D40097: linux(4): Add pokeusr impl for x86_64 from linux(4): Add pokeusr impl to linux(4): Add pokeusr impl for x86_64.
May 14 2023, 8:39 PM · Linux Emulation
dchagin added a comment to D38933: namei: Add the abilty for the ABI to specify an alternate root path.
In D38933#910452, @kib wrote:

So there is still a case. Imagine that Linux process is chrooted into a subtree with its own '/compat/linux'. It does not start using this new adir. Might be it needs a namei() in chroot (or rather it should be sysent method?).

ugh, now this code in https://reviews.freebsd.org/D40090

May 14 2023, 6:17 PM · Linux Emulation
dchagin retitled D38933: namei: Add the abilty for the ABI to specify an alternate root path from vfs: Allow ABI to translate symlinks according to the ABI prefix to namei: Add the abilty for the ABI to specify an alternate root path.
May 14 2023, 6:06 PM · Linux Emulation
dchagin updated the diff for D38933: namei: Add the abilty for the ABI to specify an alternate root path.

split

May 14 2023, 5:55 PM · Linux Emulation

May 10 2023

markj added a comment to D38459: timerfd: Add native support for Linux's timerfd.
    • and also…
  • EVFILT_TIMER is currently subject to a system-wide and small-by-default kern.kq_calloutmax (kq_ncallouts) limit, which feels very unnerving: imagine an important daemon getting starved of timers by some random user app!! This code as-is is not, and I wouldn't like it to be, but then it would be kinda strange that EVFILT_TIMER would still be.
    • should we convert that to a per-{user,process,…} that both facilities would use? An rlimit sounds appropriate I think?
    • but do we need that limit at all? Maybe just abolish it from EVFILT_TIMER?

A per-proc limit sounds appropriate through rlimit. I'm not sure about abolishing the limit altogether, though. I am guessing it was implemented for a reason.

May 10 2023, 5:37 PM · linuxkpi, Linux Emulation

May 9 2023

jfree added a comment to D38459: timerfd: Add native support for Linux's timerfd.

Hey, couple random notes:

  • re: "Developers that wish to support FreeBSD should avoid using timerfd" in the quarterly… :/
    • file descriptor handle based APIs are actually kinda better because composability / fd-passing / capability mode friendliness
      • FreeBSD invented procdesc(4) soo it's strange that we're not yet striving to turn everything into a file descriptor and Linux has us beat on this…
    • also there's no explicit clock selection in EVFILT_TIMER so when we finally add a suspend-aware monotonic clock it would only be possible to explicitly choose suspend-awareness-or-not with timerfd :)
May 9 2023, 5:56 PM · linuxkpi, Linux Emulation
jfree added a comment to D38459: timerfd: Add native support for Linux's timerfd.

Quick update: I'm nearly finished with my school work for the year, so I've had more time to work on this. I've nearly re-engineered the entire patch and I'm passing ~95% of the epoll-shim timerfd testing suite. I should have a new patch out in the next week (hopefully).

May 9 2023, 5:51 PM · linuxkpi, Linux Emulation

May 6 2023

kib added a comment to D38933: namei: Add the abilty for the ABI to specify an alternate root path.

So there is still a case. Imagine that Linux process is chrooted into a subtree with its own '/compat/linux'. It does not start using this new adir. Might be it needs a namei() in chroot (or rather it should be sysent method?).

May 6 2023, 7:15 PM · Linux Emulation

Apr 28 2023

dchagin updated the diff for D38933: namei: Add the abilty for the ABI to specify an alternate root path.

rebase to main

Apr 28 2023, 9:02 AM · Linux Emulation
dchagin closed D39763: linux(4): Add a dedicated fstat() implementation.
Apr 28 2023, 8:58 AM · Linux Emulation

Apr 26 2023

dchagin added a comment to D38933: namei: Add the abilty for the ABI to specify an alternate root path.

PR: 72920

Apr 26 2023, 8:45 PM · Linux Emulation

Apr 22 2023

kib accepted D39763: linux(4): Add a dedicated fstat() implementation.
Apr 22 2023, 10:37 PM · Linux Emulation
dchagin closed D39649: linux(4): Bump osrelease to 5.15.0.
Apr 22 2023, 7:20 PM · Linux Emulation
dchagin closed D39648: linux(4): Export the AT_MINSIGSTKSZ depending on the process osreldata.
Apr 22 2023, 7:19 PM · Linux Emulation
dchagin closed D39647: linux(4): Export the AT_EXECFN depending on the process osreldata.
Apr 22 2023, 7:19 PM · Linux Emulation
dchagin closed D39646: linux(4): Export the AT_RANDOM depending on the process osreldata.
Apr 22 2023, 7:19 PM · Linux Emulation
dchagin closed D39645: linux(4): Fix LINUX_AT_COUNT comments.
Apr 22 2023, 7:19 PM · Linux Emulation
dchagin closed D39644: linux(4): Deduplicate linux_copyout_auxargs().
Apr 22 2023, 7:18 PM · Linux Emulation
dchagin updated the summary of D39763: linux(4): Add a dedicated fstat() implementation.
Apr 22 2023, 7:12 PM · Linux Emulation
emaste accepted D39649: linux(4): Bump osrelease to 5.15.0.
Apr 22 2023, 3:31 PM · Linux Emulation
trasz accepted D39649: linux(4): Bump osrelease to 5.15.0.
Apr 22 2023, 3:00 PM · Linux Emulation

Apr 20 2023

val_packett.cool added a comment to D38459: timerfd: Add native support for Linux's timerfd.

Hey, couple random notes:

Apr 20 2023, 6:12 AM · linuxkpi, Linux Emulation

Apr 18 2023

ygy removed a watcher for Linux Emulation: ygy.
Apr 18 2023, 4:36 PM
emaste accepted D39646: linux(4): Export the AT_RANDOM depending on the process osreldata.
Apr 18 2023, 1:11 PM · Linux Emulation
emaste accepted D39647: linux(4): Export the AT_EXECFN depending on the process osreldata.
Apr 18 2023, 1:11 PM · Linux Emulation
dchagin added a comment to D39647: linux(4): Export the AT_EXECFN depending on the process osreldata.

I wonder if it makes sense to just inline the LINUX_KERNVER for these kinds of tests?

if ((p->p_osrel >= LINUX_KERNVER(2,6,26) || p->p_osrel == 0) &&
    imgp->execpathp != 0)
Apr 18 2023, 1:09 PM · Linux Emulation
dchagin added a comment to D39646: linux(4): Export the AT_RANDOM depending on the process osreldata.

My quick google suggests Linux AT_CANARY is defined as pointing to 16 random bytes.
Should we add either a runtime test or assertion that imgp->canarylen >= 16?

Apr 18 2023, 1:03 PM · Linux Emulation
emaste added a comment to D39647: linux(4): Export the AT_EXECFN depending on the process osreldata.

I wonder if it makes sense to just inline the LINUX_KERNVER for these kinds of tests?

Apr 18 2023, 12:32 PM · Linux Emulation
emaste added a comment to D39646: linux(4): Export the AT_RANDOM depending on the process osreldata.

My quick google suggests Linux AT_CANARY is defined as pointing to 16 random bytes.
Should we add either a runtime test or assertion that imgp->canarylen >= 16?

Apr 18 2023, 12:28 PM · Linux Emulation
dchagin added a reviewer for D39649: linux(4): Bump osrelease to 5.15.0: Linux Emulation.
Apr 18 2023, 10:23 AM · Linux Emulation
dchagin added a reviewer for D39648: linux(4): Export the AT_MINSIGSTKSZ depending on the process osreldata: Linux Emulation.
Apr 18 2023, 10:23 AM · Linux Emulation
dchagin added a reviewer for D39647: linux(4): Export the AT_EXECFN depending on the process osreldata: Linux Emulation.
Apr 18 2023, 10:23 AM · Linux Emulation
dchagin added a reviewer for D39646: linux(4): Export the AT_RANDOM depending on the process osreldata: Linux Emulation.
Apr 18 2023, 10:22 AM · Linux Emulation
dchagin added a reviewer for D39645: linux(4): Fix LINUX_AT_COUNT comments: Linux Emulation.
Apr 18 2023, 10:22 AM · Linux Emulation
dchagin added a reviewer for D39644: linux(4): Deduplicate linux_copyout_auxargs(): Linux Emulation.
Apr 18 2023, 10:22 AM · Linux Emulation

Apr 17 2023

dchagin added inline comments to D38933: namei: Add the abilty for the ABI to specify an alternate root path.
Apr 17 2023, 10:30 PM · Linux Emulation
dchagin updated the diff for D38933: namei: Add the abilty for the ABI to specify an alternate root path.

rewored, allow emul_path in chroot

Apr 17 2023, 10:28 PM · Linux Emulation

Apr 12 2023

arrowd added a comment to D38933: namei: Add the abilty for the ABI to specify an alternate root path.
In D38933#897702, @mjg wrote:

I strongly suspect the right way is to have linux binaries auto chrooted to /compat/linux

Apr 12 2023, 6:42 PM · Linux Emulation
trasz added a comment to D38933: namei: Add the abilty for the ABI to specify an alternate root path.
In D38933#897702, @mjg wrote:

I strongly suspect the right way is to have linux binaries auto chrooted to /compat/linux or whatever you are looking up against and then have nullfs mounts inside for /home, /tmp and whatever else which makes sense to share. This avoids any suspicious lookups like failing to find a file in Linux because it is missing when it should not and trying to pick up the FreeBSD one. This also avoids adding any complexity to the kernel.

Apr 12 2023, 3:28 PM · Linux Emulation

Apr 9 2023

kib added inline comments to D38933: namei: Add the abilty for the ABI to specify an alternate root path.
Apr 9 2023, 9:53 PM · Linux Emulation

Apr 8 2023

dchagin added inline comments to D38933: namei: Add the abilty for the ABI to specify an alternate root path.
Apr 8 2023, 9:17 AM · Linux Emulation
dchagin updated the diff for D38933: namei: Add the abilty for the ABI to specify an alternate root path.

Done

Apr 8 2023, 9:16 AM · Linux Emulation

Apr 7 2023

grahamperrin removed a watcher for Linux Emulation: grahamperrin.
Apr 7 2023, 8:37 AM
kib added inline comments to D38933: namei: Add the abilty for the ABI to specify an alternate root path.
Apr 7 2023, 4:49 AM · Linux Emulation
kib added inline comments to D38933: namei: Add the abilty for the ABI to specify an alternate root path.
Apr 7 2023, 4:42 AM · Linux Emulation

Apr 6 2023

mjg added a comment to D38933: namei: Add the abilty for the ABI to specify an alternate root path.

You can implement namei_altroot(struct nameidata *nd, struct vnode *altroot) (or whatever the name) where altroot is guaranteed v_usecount > 0. Then it can handle faking pwd for the first pass without polluting any consumers.

Apr 6 2023, 2:26 PM · Linux Emulation
dchagin added a comment to D38933: namei: Add the abilty for the ABI to specify an alternate root path.
In D38933#897720, @mjg wrote:
In D38933#897702, @mjg wrote:

Something does not add up whatsoever with your bench results -- how is this patch supposed to improve scalability for open/close/unlink?

This patch is not supposed to improve scalability, I used will-it-scale to check that I do not broke hot path.

I am saying that according to the graph it did improve, markedly so, but this can't be true and consequently the bench is bogus.

That aside the entire idea of Linux binaries doing 2 lookups was incredibly dodgy from the get go and I don't think this is helping the fundamental problem, albeit it may be it makes it less iffy.

The added branchfest is definitely not nice, especially the restart clause.

I strongly suspect the right way is to have linux binaries auto chrooted to /compat/linux or whatever you are looking up against and then have nullfs mounts inside for /home, /tmp and whatever else which makes sense to share. This avoids any suspicious lookups like failing to find a file in Linux because it is missing when it should not and trying to pick up the FreeBSD one. This also avoids adding any complexity to the kernel.

Even if going this route, I think the functionality can be added without pessimizing existing code. Note that for example vfs_lookup is already a standalone routine.

Well, I mostly agree with all of you statement. Except some sort of pessimization, I tried to minimize touching of the hot path for native binaries.
This patch adds only two compares (pwd->pwd_rdir != pwd->pwd_adir) on error path of namei() for native. I don't think it's worth the cost.

It adds a branch to set things up and another one for failed lookups. clang probably also pessimized namei entry, which already is quite bad. Perhaps I should note there several single-threaded slowdowns remaining, most of them branches and this goes counter to whacking them.

Apr 6 2023, 12:22 PM · Linux Emulation
dchagin updated the diff for D39438: linprocfs: Rework according to the new struct pwd facility.

split, move Makefile's part into the separate commit

Apr 6 2023, 11:48 AM · Linux Emulation
dchagin updated the diff for D38933: namei: Add the abilty for the ABI to specify an alternate root path.

done

Apr 6 2023, 11:46 AM · Linux Emulation

Apr 5 2023

kib added a comment to D38933: namei: Add the abilty for the ABI to specify an alternate root path.
In D38933#897702, @mjg wrote:

I strongly suspect the right way is to have linux binaries auto chrooted to /compat/linux or whatever you are looking up against and then have nullfs mounts inside for /home, /tmp and whatever else which makes sense to share. This avoids any suspicious lookups like failing to find a file in Linux because it is missing when it should not and trying to pick up the FreeBSD one. This also avoids adding any complexity to the kernel.

This functionality (double lookup in the ugly current form) was added exactly to avoid requiring users doing what you described above.

Apr 5 2023, 11:37 PM · Linux Emulation
mjg added a comment to D38933: namei: Add the abilty for the ABI to specify an alternate root path.

I was so startled by the supposed scalability diff I did not take a proper look at the other results.

Apr 5 2023, 10:05 PM · Linux Emulation
mjg added a comment to D38933: namei: Add the abilty for the ABI to specify an alternate root path.
In D38933#897702, @mjg wrote:

Something does not add up whatsoever with your bench results -- how is this patch supposed to improve scalability for open/close/unlink?

This patch is not supposed to improve scalability, I used will-it-scale to check that I do not broke hot path.

Apr 5 2023, 7:16 PM · Linux Emulation
dchagin added a comment to D38933: namei: Add the abilty for the ABI to specify an alternate root path.
In D38933#897702, @mjg wrote:

Something does not add up whatsoever with your bench results -- how is this patch supposed to improve scalability for open/close/unlink?

Apr 5 2023, 6:54 PM · Linux Emulation
mjg added a comment to D38933: namei: Add the abilty for the ABI to specify an alternate root path.

Something does not add up whatsoever with your bench results -- how is this patch supposed to improve scalability for open/close/unlink? Similarly it can't be faster than stock code for regular lookups, but this one is perhaps measurement error.

Apr 5 2023, 5:56 PM · Linux Emulation
dchagin updated the summary of D39438: linprocfs: Rework according to the new struct pwd facility.
Apr 5 2023, 5:51 PM · Linux Emulation
dchagin updated the diff for D38933: namei: Add the abilty for the ABI to specify an alternate root path.
  1. Back to the char linux_emul_path[], this simplifies the code, adding one namei() call to execve() path.
Apr 5 2023, 5:36 PM · Linux Emulation

Apr 4 2023

dchagin closed D39398: linux(4): Implement close_range.
Apr 4 2023, 8:26 PM · Linux Emulation
mjg added inline comments to D39398: linux(4): Implement close_range.
Apr 4 2023, 6:43 PM · Linux Emulation
mjg accepted D39398: linux(4): Implement close_range.
Apr 4 2023, 6:43 PM · Linux Emulation
dchagin added a comment to D39398: linux(4): Implement close_range.
In D39398#896979, @mjg wrote:

ignoring the flag would result in a massive wtf for the unlikely case where someone needs it

just error out

Apr 4 2023, 6:42 PM · Linux Emulation
jfree added a comment to D38459: timerfd: Add native support for Linux's timerfd.
In D38459#896885, @kib wrote:

What is the destiny of these patches? Why did you not committed them still?

Apr 4 2023, 2:18 PM · linuxkpi, Linux Emulation
mjg added a comment to D39398: linux(4): Implement close_range.

ignoring the flag would result in a massive wtf for the unlikely case where someone needs it

Apr 4 2023, 2:04 PM · Linux Emulation
dchagin updated the diff for D39398: linux(4): Implement close_range.

ok,
what if we simply ignore UNSHARE flag and call kern_close_range with flags = 0?
I dont see problem as file manipulation is under FILEDESC_XLOCK.

Apr 4 2023, 2:03 PM · Linux Emulation
mjg added inline comments to D39398: linux(4): Implement close_range.
Apr 4 2023, 8:28 AM · Linux Emulation
mjg added inline comments to D39398: linux(4): Implement close_range.
Apr 4 2023, 8:27 AM · Linux Emulation
kib added a comment to D38459: timerfd: Add native support for Linux's timerfd.

What is the destiny of these patches? Why did you not committed them still?

Apr 4 2023, 7:41 AM · linuxkpi, Linux Emulation

Apr 3 2023

dchagin updated the diff for D39398: linux(4): Implement close_range.

done, 10x

Apr 3 2023, 11:11 PM · Linux Emulation
mjg added a comment to D39398: linux(4): Implement close_range.

that would introduce wtf in debugging, just don't try to mess with the feature

Apr 3 2023, 7:21 PM · Linux Emulation
dchagin added a comment to D39398: linux(4): Implement close_range.
In D39398#896738, @mjg wrote:

linux "fd unsharing" is *not* accurately modeled by fdunshare, which is why I said trying to provide one for native binaries would be weird. they unshare at thread level, while freebsd is doing it at process level. It's all legacy crap.

ah, I completely forgot that the Linux kernel does not make distinction between processes and threads.
I have read only man page )) which is "Unshare the specified file descriptors from any other processes before closing them, avoiding races with other threads sharing the file descriptor table." I.e., it should be process-wide.
So, calling close_range(UNSHARE) from a thread in multi-threaded app can cause unexpected behavior? As that thread can open a new file for which the fd will be reused.

Apr 3 2023, 7:01 PM · Linux Emulation
mjg added a comment to D39398: linux(4): Implement close_range.

linux "fd unsharing" is *not* accurately modeled by fdunshare, which is why I said trying to provide one for native binaries would be weird. they unshare at thread level, while freebsd is doing it at process level. It's all legacy crap.

Apr 3 2023, 2:05 PM · Linux Emulation
dchagin updated the test plan for D39398: linux(4): Implement close_range.
Apr 3 2023, 12:15 PM · Linux Emulation
dchagin closed D38901: linsysfs(4): Make listnics use new if_foreach_sleep method.
Apr 3 2023, 8:23 AM · Linux Emulation

Apr 2 2023

dchagin closed D39383: pseudofs: Simplify pfs_visible_proc.
Apr 2 2023, 8:25 AM · Linux Emulation
dchagin closed D39382: pseudofs: Allow vis callback to be called for a named node.
Apr 2 2023, 8:25 AM · Linux Emulation
dchagin closed D39381: pseudofs: Microoptimize struct pfs_node.
Apr 2 2023, 8:25 AM · Linux Emulation

Apr 1 2023

des accepted D39383: pseudofs: Simplify pfs_visible_proc.
Apr 1 2023, 9:58 PM · Linux Emulation
des accepted D39382: pseudofs: Allow vis callback to be called for a named node.
Apr 1 2023, 9:57 PM · Linux Emulation
des accepted D39381: pseudofs: Microoptimize struct pfs_node.
Apr 1 2023, 9:56 PM · Linux Emulation
dchagin updated the diff for D39383: pseudofs: Simplify pfs_visible_proc.

Done

Apr 1 2023, 8:29 PM · Linux Emulation
dchagin updated the diff for D39382: pseudofs: Allow vis callback to be called for a named node.

Indeed, good idea, done

Apr 1 2023, 8:28 PM · Linux Emulation
dchagin updated the diff for D39381: pseudofs: Microoptimize struct pfs_node.

done, 10x

Apr 1 2023, 8:27 PM · Linux Emulation
dchagin added a comment to D38901: linsysfs(4): Make listnics use new if_foreach_sleep method.

some test result
https://people.freebsd.org/~dchagin/j.txt

Apr 1 2023, 7:12 PM · Linux Emulation
des added inline comments to D39382: pseudofs: Allow vis callback to be called for a named node.
Apr 1 2023, 6:19 PM · Linux Emulation
des requested changes to D39381: pseudofs: Microoptimize struct pfs_node.
Apr 1 2023, 6:12 PM · Linux Emulation
des added a comment to D39383: pseudofs: Simplify pfs_visible_proc.

Perhaps better to drop visible entirely:

Apr 1 2023, 6:06 PM · Linux Emulation
dchagin updated the diff for D38901: linsysfs(4): Make listnics use new if_foreach_sleep method.

fix linsysfs_if_visible, initialize visible

Apr 1 2023, 4:34 PM · Linux Emulation
dchagin added reviewers for D39383: pseudofs: Simplify pfs_visible_proc: des, Linux Emulation.
Apr 1 2023, 3:27 PM · Linux Emulation
dchagin added reviewers for D39381: pseudofs: Microoptimize struct pfs_node: des, Linux Emulation.
Apr 1 2023, 3:27 PM · Linux Emulation
dchagin added reviewers for D39382: pseudofs: Allow vis callback to be called for a named node: des, Linux Emulation.
Apr 1 2023, 3:26 PM · Linux Emulation
dchagin updated the diff for D38901: linsysfs(4): Make listnics use new if_foreach_sleep method.

Handle VNETs

Apr 1 2023, 3:24 PM · Linux Emulation