Page MenuHomeFreeBSD

arichardson (Alexander Richardson)
User

Projects

User Details

User Since
Jan 17 2017, 2:21 PM (407 w, 3 d)

Recent Activity

Aug 26 2024

arichardson committed rG04262ed78d23: rtld-elf: Add CFI annotation for .rtld_start on RISC-V (authored by arichardson).
rtld-elf: Add CFI annotation for .rtld_start on RISC-V
Aug 26 2024, 4:54 AM
arichardson closed D46406: rtld-elf: Add CFI annotation for .rtld_start on RISC-V.
Aug 26 2024, 4:53 AM

Aug 23 2024

arichardson added inline comments to D46404: lib/csu/riscv: Remove separate assembly startup file.
Aug 23 2024, 9:59 PM
arichardson abandoned D39916: mi_startup: sort sysinit array using qsort instead of bubble sort.
Aug 23 2024, 9:57 PM

Aug 22 2024

arichardson added inline comments to D46400: [RISC-V] Set ra to zero when calling into userspace.
Aug 22 2024, 5:54 PM
arichardson added inline comments to D46400: [RISC-V] Set ra to zero when calling into userspace.
Aug 22 2024, 5:50 PM
arichardson added a comment to D46403: Introduce vfcntl(), a va_list variant of fcntl().
In D46403#1057654, @kib wrote:
In D46403#1057619, @kib wrote:

Could it be simplified by providing an fcntl variant that takes the third arg unconditionally, instead?

I would also be happy with that approach, just assumed this variant would be more flexible. Would the unconditional one look like this: fcntl2(int, int, __intptr_t)?

The actual syscall takes three args unconditionally, so there is no point in adding more complications IMO. By existing conventions, the function perhaps should be called fcntl3.

Actually, I just remembered this would not help with the interposing of fcntl since the interposer would still need to extract the variadic argument.

Well, fcntl would call fcntl3, and you can then interpose the latter, just as with vfcntl.

Aug 22 2024, 5:38 PM
arichardson added a comment to D46403: Introduce vfcntl(), a va_list variant of fcntl().
In D46403#1057654, @kib wrote:
In D46403#1057619, @kib wrote:

Could it be simplified by providing an fcntl variant that takes the third arg unconditionally, instead?

I would also be happy with that approach, just assumed this variant would be more flexible. Would the unconditional one look like this: fcntl2(int, int, __intptr_t)?

The actual syscall takes three args unconditionally, so there is no point in adding more complications IMO. By existing conventions, the function perhaps should be called fcntl3.

Aug 22 2024, 5:48 AM

Aug 21 2024

arichardson updated the diff for D46404: lib/csu/riscv: Remove separate assembly startup file.

review comments

Aug 21 2024, 11:17 PM
arichardson added inline comments to D46404: lib/csu/riscv: Remove separate assembly startup file.
Aug 21 2024, 11:16 PM
arichardson added a comment to D46403: Introduce vfcntl(), a va_list variant of fcntl().

there
is currently no portable way to interpose a variadic function without
relying on undefined behaviour

That's not entirely true, but it requires you to know how many arguments were passed in every possible case, what types they are, va_arg them in turn and call the interposed function with those arguments (or more). Whereas interposing a function that takes the va_list itself means you only need to interpret the arguments in the cases where you actually want to inspect at them.

Aug 21 2024, 10:58 PM
arichardson added a comment to D46403: Introduce vfcntl(), a va_list variant of fcntl().
In D46403#1057619, @kib wrote:

Could it be simplified by providing an fcntl variant that takes the third arg unconditionally, instead?

Aug 21 2024, 10:57 PM
arichardson updated the summary of D46405: lib/csu/riscv: Mark ra as undefined in _start.
Aug 21 2024, 10:42 PM
arichardson requested review of D46406: rtld-elf: Add CFI annotation for .rtld_start on RISC-V.
Aug 21 2024, 10:39 PM
arichardson requested review of D46405: lib/csu/riscv: Mark ra as undefined in _start.
Aug 21 2024, 10:37 PM
arichardson requested review of D46404: lib/csu/riscv: Remove separate assembly startup file.
Aug 21 2024, 10:35 PM
arichardson requested review of D46403: Introduce vfcntl(), a va_list variant of fcntl().
Aug 21 2024, 9:12 PM
arichardson added a reviewer for D46400: [RISC-V] Set ra to zero when calling into userspace: riscv.
Aug 21 2024, 6:57 PM
arichardson updated the diff for D46400: [RISC-V] Set ra to zero when calling into userspace.

Also zero fp

Aug 21 2024, 6:57 PM
arichardson added a comment to D46400: [RISC-V] Set ra to zero when calling into userspace.

Should we also do fp/s0 to match, like arm64 does?

Aug 21 2024, 6:54 PM
arichardson requested review of D46400: [RISC-V] Set ra to zero when calling into userspace.
Aug 21 2024, 5:29 PM

Jul 8 2024

arichardson added a comment to D45891: rtld: actually resolve memcpy plt.

No sure how much the builtins optimization matters here but if it does the other workaround would be:

Jul 8 2024, 5:39 PM

Jun 17 2024

arichardson added a comment to D44893: Simplify signal handling code in libthr by removing use of SYS_sigreturn.

It looks like removing this call to memcpy might actually also fix the TSan issue I tried to work around in https://reviews.freebsd.org/D28536. Might be time to try run the TSan testsuite again.

Jun 17 2024, 11:10 PM

May 2 2024

arichardson accepted D44216: Make WITHOUT_UNDEFINED_VERSION the default.
May 2 2024, 6:30 AM
arichardson added inline comments to D45052: libgcc_s: __extendxftf2 and __trunctfxf2 are amd64-only.
May 2 2024, 6:28 AM

May 1 2024

arichardson added a comment to D45034: libgcc_s: Don't build __extendxftf2 and __trunctfxf2.

They should build for x86, that was the whole point of the upstream changes (supporting ieee 128-bit float in addition to ld80)

May 1 2024, 1:06 AM
arichardson accepted D45028: libgcc_s: 80-bit long double function are x86-only.
May 1 2024, 1:05 AM

Mar 28 2024

arichardson added inline comments to D28253: Remove all current uses of build-tools during buildworld.
Mar 28 2024, 6:20 AM
arichardson added a comment to D44537: csh: Use HOST_CC when compiling hostprog used by csh build.

Thanks for working on this. This reminds me of my efforts a few years ago to avoid the build-tools awkwardness: https://reviews.freebsd.org/D28253.

Mar 28 2024, 6:15 AM

Mar 6 2024

arichardson added inline comments to D44253: timerfd_create: accept CLOCK_UPTIME/CLOCK_BOOTTIME.
Mar 6 2024, 10:32 PM

Feb 25 2024

arichardson added a comment to D44030: llvm: implement the bits missing for LSan on FreeBSD.

Have you tried running the lsan test suite with this change?

I'm working on it, but just trying to get the llvm test suite running has been... rough. I chose to redirect from your question to the tangentially related and still valuable: "Have you tried running the asan test suite with this change?" since we can know how much of the asan test suite has passed already.

After fumbling around and finally figuring out that I needed to configure llvm/ with -DLLVM_ENABLE_PROJECTS="clang;compiler-rt" because some of the test prereqs are in llvm or clang, most of the tests that actually run fail because they're trying to do something like:

22:56 <@kevans91_>  70252 103012 Asan-aarch64-inline CALL  execve(0,0x81278f78,0x81278f98)
22:56 <@kevans91_>  70252 103012 Asan-aarch64-inline RET   execve -1 errno 9 Bad file descriptor

... and this is the realization that I just burned a not-insignificant chunk of time because this hasn't been upstreamed yet, three months later: https://cgit.freebsd.org/src/commit/?id=4c9a0adad18263ec8725d9bfc5f560c6ad1da8bd

Feb 25 2024, 4:42 AM

Feb 23 2024

arichardson added a comment to D44030: llvm: implement the bits missing for LSan on FreeBSD.

Have you tried running the lsan test suite with this change?

Feb 23 2024, 9:37 PM

Feb 2 2024

arichardson added a comment to D43498: devel/evdev: Forward to dev/evdev headers where possible.

For example the linux joystick.h defines a bunch of ioctls that I don't see implemented on FreeBSD, so we really shouldn't claim support for it? Maybe the header should only includes the constants?

Feb 2 2024, 1:57 AM
arichardson added a comment to D43498: devel/evdev: Forward to dev/evdev headers where possible.

input-event-codes.h hasn't changedu pstream in 4 years (perhaps "of course" because it's a tagged release) but if wulf@ says that that one should be obtained upstream, then that seems reasonable. There's no meaningful difference between the base-system-provided version and upstream that I can see -- it's all defines of constants. One concern I have is that we stopped using base-system headers at some point -- at least that's how I remember it -- because the dev/evdev/ headers were not meant for user-space consumption. I can't find that in ports commit history, though, so maybe I'm dreaming it.

Feb 2 2024, 1:54 AM

Jan 30 2024

arichardson added a comment to D43254: libc: Remove support for pre-C11 C standards.

Commit message should probably be qualified with "for kernel compilation"?

Jan 30 2024, 12:03 AM · Contributor Reviews (src)
arichardson accepted D43237: Use gnu17 for buildworld.

This LGTM but the commit message should also include the minimum Clang+GCC versions

Jan 30 2024, 12:01 AM · Contributor Reviews (src)
arichardson accepted D43236: tcp_wrappers: Use default C standard version.
Jan 30 2024, 12:00 AM · Contributor Reviews (src)

Jan 29 2024

arichardson added a comment to D43498: devel/evdev: Forward to dev/evdev headers where possible.

ping?

Jan 29 2024, 11:55 PM

Jan 18 2024

arichardson requested review of D43498: devel/evdev: Forward to dev/evdev headers where possible.
Jan 18 2024, 6:03 PM

Jan 14 2024

arichardson added a comment to D43426: cdefs: Introduce __result_use_or_ignore_check.

Based on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425#c56 we can use [[nodiscard]] with GCC 11 and higher which has the expected semantics. But for now this change seems fine

Jan 14 2024, 12:36 AM
arichardson accepted D43443: build: Use ls -i | cut rather than stat -f %i to extract inode.

Both of these features are required by POSIX, %% also seems to be required:
https://pubs.opengroup.org/onlinepubs/009604499/utilities/xcu_chap02.html#tag_02_06_02

Jan 14 2024, 12:13 AM

Jan 12 2024

arichardson accepted D43409: Stop using expressions in _Alignof().
Jan 12 2024, 4:06 AM · Contributor Reviews (src)

Jan 2 2024

arichardson added inline comments to D43237: Use gnu17 for buildworld.
Jan 2 2024, 9:46 PM · Contributor Reviews (src)
arichardson added a comment to D43239: Use gnu17 for buildkernel.

Looking at the Clang change that added -std=c17 (https://github.com/llvm/llvm-project/commit/5b6c0f75e01571851b767dc63a3229c962f464f1), the only difference is the value of __STDC_VERSION__, so unless code uses this in preprocessor macros it's identical to -std=c11

Jan 2 2024, 9:34 PM · Contributor Reviews (src)
arichardson added a comment to D43239: Use gnu17 for buildkernel.

I had a look on godbolt to see which compiler versions support c17: https://godbolt.org/z/EGd4TqP3j

Jan 2 2024, 9:20 PM · Contributor Reviews (src)
arichardson committed rG30887c7d48ea: kldxref: fix bootstrapping on Linux with Clang 16 (authored by arichardson).
kldxref: fix bootstrapping on Linux with Clang 16
Jan 2 2024, 7:12 PM

Dec 31 2023

arichardson added a comment to D43239: Use gnu17 for buildkernel.

Overall I'd be very happy to see the standard bumped to c17 but I'm not sure what the current minimum compiler versions are. But then again maybe it's time to say you need a c17 compiler for current...

Dec 31 2023, 6:18 AM · Contributor Reviews (src)

Dec 12 2023

arichardson committed rG60e845ceef25: jevents: fix bootstrapping on Linux with Clang 16 (authored by arichardson).
jevents: fix bootstrapping on Linux with Clang 16
Dec 12 2023, 5:16 AM
arichardson committed rG0156465c6d11: mandoc: fix bootstrapping on Linux with Clang 16 (authored by arichardson).
mandoc: fix bootstrapping on Linux with Clang 16
Dec 12 2023, 5:16 AM
arichardson closed D43000: jevents: fix bootstrapping on Linux with Clang 16.
Dec 12 2023, 5:15 AM
arichardson closed D42999: mandoc: fix bootstrapping on Linux with Clang 16.
Dec 12 2023, 5:15 AM

Dec 11 2023

arichardson requested review of D43000: jevents: fix bootstrapping on Linux with Clang 16.
Dec 11 2023, 11:00 PM
arichardson requested review of D42999: mandoc: fix bootstrapping on Linux with Clang 16.
Dec 11 2023, 10:56 PM

Nov 24 2023

arichardson added inline comments to D42698: bitstring: Support large bit strings..
Nov 24 2023, 3:42 AM

Nov 21 2023

arichardson added inline comments to D42698: bitstring: Support large bit strings..
Nov 21 2023, 3:20 PM

Nov 5 2023

arichardson added a comment to D42415: rtld/arm: fix initial-exec (IE) thread-local storage relocation.

I see you have a reduced test case, would it be possible to turn it into a regression test for in the ld-elf tests?

Nov 5 2023, 5:45 AM · ARM

Oct 20 2023

arichardson accepted D42303: tools/build: Support building with glibc 2.38.
Oct 20 2023, 1:53 PM

Sep 26 2023

arichardson added a comment to D41983: localedef: extract ctype defs from _ctype.h instead of including it.

You could push to a GitHub fork, then it will run the bootstrap steps as part of the GitHub action

Sorry for being slow (that's not the first I'm told about this), but I don't know where exactly should I push? To a branch in my fork of freebsd-src on github (and create a pull request?)?

Sep 26 2023, 8:44 PM
arichardson added a comment to D41983: localedef: extract ctype defs from _ctype.h instead of including it.

You could push to a GitHub fork, then it will run the bootstrap steps as part of the GitHub action

Sep 26 2023, 5:28 PM
arichardson added a comment to D41983: localedef: extract ctype defs from _ctype.h instead of including it.

This will almost certainly break the cross build. The typedefs in the local _ctype.h are needed. Can you modify that file to include the new generated header?

Sep 26 2023, 1:36 PM

Sep 18 2023

arichardson added a comment to D40623: csu: Add a stop indicator to _start to satisfy unwinders on aarch64.

Is there a reason you didn't add __asm__ volatile(".cfi_undefined x30"); to the start of the C function? In my testing with CheriBSD this appears to work in the same way (libunwind tests fail before, succeed after).

Sep 18 2023, 6:13 PM
arichardson added a comment to D40623: csu: Add a stop indicator to _start to satisfy unwinders on aarch64.

Is there a reason you didn't add __asm__ volatile(".cfi_undefined x30"); to the start of the C function? In my testing with CheriBSD this appears to work in the same way (libunwind tests fail before, succeed after).

Sep 18 2023, 6:07 PM

Sep 13 2023

arichardson added a comment to D41844: Add an implementation of the 9P filesystem.

Thanks for working on this - I also tried to get it to work a few years ago but didn't get too far. It looks like this includes the fix to the uninitialized variable that I ran into (https://github.com/arichardson/cheribsd/commits/virtfs-cheribsd) so I think all of my fixes from back then are included.

Sep 13 2023, 3:44 PM

Aug 23 2023

arichardson accepted D41556: tools/build/make.py: Keep bootstrapped bmake binary up-to-date.
Aug 23 2023, 12:20 AM

Jul 26 2023

arichardson added a comment to D41191: etcupdate: Support building with BUILD_WITH_STRICT_TMPPATH enabled.

Thanks for fixing this - I wonder if it's time to try turning on strict tmppath by default again upstream. I initially tried that but gave up after noticing that it broke various cases like etcupdate that I didn't have time to debug.

Jul 26 2023, 5:07 PM

Jul 8 2023

arichardson added a comment to D40898: copy_file_range() support for install(1).

This breaks the macos bootstrap jobs, could you add an ifdef around the new code?

Jul 8 2023, 9:29 PM

Jul 7 2023

arichardson added a comment to D40898: copy_file_range() support for install(1).

IIRC this is also built during bootstrap. Could you check that the GitHub actions CI is still happy before committing?

Jul 7 2023, 4:48 AM

Jun 26 2023

arichardson added a comment to D40722: radix_trie: simplify trimkey functions.

I'm surprised this is needed, you'd hope the compiler could do this transformation. Maybe worth filling a LLVM bug report?

Jun 26 2023, 6:28 AM

Jun 7 2023

arichardson requested changes to D40467: ld(1): Correctly define .init_array and .fini_array for all platforms..

This will sort by name not priority. Ld.lld will sort by priority automatically if you omit init_array from the linker script but for bfd you need SORT_BY_INIT_PRIORITY

Jun 7 2023, 4:18 PM

May 24 2023

arichardson added a comment to D40241: riscv timer: use stimecmp CSR when available.

Thanks for adding this - I was recently trying to debug RISC-V issues using qemu tracing and the constant SBI calls meant that it made essentially zero progress since tracing slowed down qemu so much that the next timer interrupt fired once it returned from the sbi call.

May 24 2023, 2:10 PM

May 20 2023

arichardson added a comment to D39916: mi_startup: sort sysinit array using qsort instead of bubble sort.
Sorting 1125 sysinit items
117378 instructions with qsort()
5509157 instructions with bubble

And if the list is already sorted and you use insertion sort there instead of bubble sort, what is the time then? Can you get that into the list too?

I guess it will be something like 500x instead of your 50x.

--HPS

Yes that would obviously be faster but I don't have time to work on that. If you are planning to work on this and it's going to be ready for review in the near future I'd be happy to drop this patch.

However, using a pre-existing sorting function to obtain a noticeable speedup seems like a valid approach to me. Just because it could be done in a more optimal way at some hypothetical point in the future shouldn't mean we can't make incremental improvements on the way to an ideal solution. Otherwise things would never improve...

Could we make a deal on that? I writeup a patch for the 500x case today, and you can test it and compare against the current results?

May 20 2023, 5:31 PM
arichardson added inline comments to D39916: mi_startup: sort sysinit array using qsort instead of bubble sort.
May 20 2023, 12:54 AM
arichardson added a comment to D39916: mi_startup: sort sysinit array using qsort instead of bubble sort.
Sorting 1125 sysinit items
117378 instructions with qsort()
5509157 instructions with bubble

And if the list is already sorted and you use insertion sort there instead of bubble sort, what is the time then? Can you get that into the list too?

I guess it will be something like 500x instead of your 50x.

--HPS

May 20 2023, 12:47 AM

May 19 2023

arichardson updated the summary of D39916: mi_startup: sort sysinit array using qsort instead of bubble sort.
May 19 2023, 8:21 PM
arichardson updated the diff for D39916: mi_startup: sort sysinit array using qsort instead of bubble sort.

fix tslog

May 19 2023, 8:03 PM
arichardson updated the diff for D39916: mi_startup: sort sysinit array using qsort instead of bubble sort.

Rebased on latest main.
@cperciva it would be great if you could test how much this helps your usecase.

May 19 2023, 5:24 PM
arichardson added a comment to D39916: mi_startup: sort sysinit array using qsort instead of bubble sort.
In D39916#908757, @mjg wrote:

this is a massively dodgy change, one has to expect some of the real orderings work by accident. i think it would be better to take a look at trimming the list instead.

Trimming the list definitely makes sense but I went for the simpler change here. The list is currently somewhat arbitrarily sorted by the linker and I don't think this makes it any worse. We could add a stable sort to libkern but I don't think this should be needed.

Arbitrary ordering of the linker has bitten us in the past, sometimes it seems like it'd be nice to have the option to introduce some intentional chaos so that we can find potential issues by randomly reordering (within a {subsystem, order}, naturally), but you'd really want to be able to do that *and* find a way to make it reproducible (e.g., feed it this seed via tunable and it'll re-order in such a way that GENERIC dies in a horrible fire)

May 19 2023, 5:22 PM
arichardson added inline comments to D39916: mi_startup: sort sysinit array using qsort instead of bubble sort.
May 19 2023, 5:19 PM

May 16 2023

arichardson added a comment to D22630: Include <sys/cdefs.h> in execinfo.h.

Can this be committed, so this header is standalone even if you don't use a patched LLVM?

May 16 2023, 7:50 PM

May 6 2023

arichardson added inline comments to D39909: hwpmc: use kstack_contains().
May 6 2023, 11:53 PM

May 2 2023

arichardson added a comment to D39916: mi_startup: sort sysinit array using qsort instead of bubble sort.
In D39916#908757, @mjg wrote:

this is a massively dodgy change, one has to expect some of the real orderings work by accident. i think it would be better to take a look at trimming the list instead.

May 2 2023, 1:55 AM

May 1 2023

arichardson added a comment to D39916: mi_startup: sort sysinit array using qsort instead of bubble sort.
In D39916#908603, @imp wrote:

does qsort's unstable sort actually change the order of anything?

May 1 2023, 10:23 PM
arichardson requested review of D39916: mi_startup: sort sysinit array using qsort instead of bubble sort.
May 1 2023, 8:34 PM

Apr 28 2023

arichardson committed rGb347c2284603: cross-build: Add common compatibility headers after OS-specific ones (authored by arichardson).
cross-build: Add common compatibility headers after OS-specific ones
Apr 28 2023, 11:15 PM

Apr 23 2023

arichardson added inline comments to D39766: Enable building tar for non-FreeBSD host.
Apr 23 2023, 12:21 AM

Apr 22 2023

arichardson accepted D39744: Simplify building host tools during DIRDEPS_BUILD.

Looks good to me now but please wait for @jrtc27 and/or @imp before committing.

Apr 22 2023, 5:58 PM
arichardson added a comment to D39744: Simplify building host tools during DIRDEPS_BUILD.

Thanks for the update, looks like it's much closer to the build world flags now. Would be good to know if the __unused bits can be removed but otherwise looks good to me (well the parts that I understand).

Apr 22 2023, 5:45 AM

Apr 21 2023

arichardson added inline comments to D39744: Simplify building host tools during DIRDEPS_BUILD.
Apr 21 2023, 11:43 PM
arichardson accepted D39747: llvm: fix some llvm-* tool links when WITH_LLVM_BINUTILS set.
Apr 21 2023, 2:11 PM
arichardson added inline comments to D39744: Simplify building host tools during DIRDEPS_BUILD.
Apr 21 2023, 1:50 PM
arichardson added inline comments to D39744: Simplify building host tools during DIRDEPS_BUILD.
Apr 21 2023, 1:42 PM
arichardson added a comment to D39031: Support byte-sized enums.

I'd prefer if the __enum_uint8(vtype) changes were only inside structs and not in the function signatures but I don't feel strongly about it.

Apr 21 2023, 12:31 AM

Apr 10 2023

arichardson accepted D39496: Remove the riscv64sf architecture..
Apr 10 2023, 11:55 PM

Mar 28 2023

arichardson accepted D39295: cross-build: Add secure_getenv() for MacOS cross builds.
Mar 28 2023, 2:09 PM

Mar 16 2023

arichardson added a comment to D39031: Support byte-sized enums.

I think the second macro is unnecessary based on my experiments with godbolt. Otherwise LGTM once we've decided where to place it (and I'd suggest with the _KERNEL guard).

Mar 16 2023, 7:45 AM

Mar 15 2023

arichardson abandoned D27088: Add .cfi_{start,end}proc annotations for MIPS assembly.
Mar 15 2023, 5:11 PM

Mar 13 2023

arichardson accepted D39073: .github: Test DISK_IMAGE_TOOLS_BOOTSTRAP in CI.

LGTM

Mar 13 2023, 11:32 PM
arichardson added inline comments to D39072: Add new DISK_IMAGE_TOOLS_BOOTSTRAP option.
Mar 13 2023, 11:31 PM
arichardson accepted D39072: Add new DISK_IMAGE_TOOLS_BOOTSTRAP option.

Not tested it but changes LGTM. Looking forward to dropping the workaround from cheribuild

Mar 13 2023, 11:29 PM
arichardson added a comment to D39031: Support byte-sized enums.

Using the C23 underlying enum type extension is IMO better and safer. Support with clang (since version 8) and GCC 13+: https://godbolt.org/z/n4EshMY1j

Mar 13 2023, 11:14 AM