Page MenuHomeFreeBSD

theraven (David Chisnall)
User

Projects

User Details

User Since
Jun 4 2014, 10:37 AM (512 w, 1 d)

Recent Activity

Sat, Mar 2

theraven accepted D44189: libc: actually build bsearch_b.

Oops!

Sat, Mar 2, 7:30 AM

Fri, Mar 1

theraven added inline comments to D44168: lib/msun: Fix tgammal(3) on IEEE 128-bit platforms.
Fri, Mar 1, 4:32 PM

Nov 2 2023

theraven accepted D42438: dtc: Sync with upstream commit 23387dd.
Nov 2 2023, 7:57 AM

Oct 6 2023

theraven added a comment to D40676: ktrace: Record detailed ECAPMODE violations.

I created this patch to make the Capsicumization experience less intimidating for inexperienced developers. Both David and Mariusz may not be the target audience for this change

Oct 6 2023, 7:04 AM · capsicum

Oct 4 2023

theraven added a comment to D40676: ktrace: Record detailed ECAPMODE violations.

It's doable in principle, but in practice dtrace's inability to resolve backtraces in the face of fork/exec makes it mostly unusable

Oct 4 2023, 3:44 PM · capsicum

Sep 29 2023

theraven added a comment to D40676: ktrace: Record detailed ECAPMODE violations.

Are these events exposed to DTrace? When sandboxing, the thing I really want is a stack trace in userspace at the point where the violation happened. If so, it would be great to include a script that logged them. Ideally with an option of an explicit start marker so you can put in a fake cap_enter and be told what you still need to fix.

Sep 29 2023, 6:55 AM · capsicum

Sep 28 2023

theraven added a comment to D40676: ktrace: Record detailed ECAPMODE violations.

To summarize the patch very briefly, this lets you ktrace an application that does not run in capability mode, and ktrace will log all events which would have triggered a Capsicum violation.

Sep 28 2023, 4:54 PM · capsicum

Sep 27 2023

theraven added a comment to D41967: copy_file_range: fix capabilities premissions.

Capsicum-related syscall changes from 2014 on, for reference:

Sep 27 2023, 8:21 AM

Sep 26 2023

theraven added inline comments to D41936: libc: Rewrite quick_exit() and at_quick_exit() using C11 atomics..
Sep 26 2023, 8:21 PM

Sep 25 2023

theraven accepted D41967: copy_file_range: fix capabilities premissions.
Sep 25 2023, 4:21 PM
theraven added a comment to D41967: copy_file_range: fix capabilities premissions.

This looks like it fixes the capsicum bits. I believe we're still missing correct auditing events. In kern_{read,write}*, these are handled in dofile{read,write} but, since copy_file_range bypasses these calls, they need to be added explicitly.

Sep 25 2023, 11:12 AM
theraven added a comment to D41967: copy_file_range: fix capabilities premissions.

Ensure that copy_file_range(2), like pread(2)/pwrite(2), requires the CAP_SEEK capability due to its offset argument.
This alignment prevents unauthorized file offset manipulations by processes.

Sep 25 2023, 9:32 AM

Sep 23 2023

theraven added inline comments to D41936: libc: Rewrite quick_exit() and at_quick_exit() using C11 atomics..
Sep 23 2023, 12:52 PM

Sep 22 2023

theraven added inline comments to D41936: libc: Rewrite quick_exit() and at_quick_exit() using C11 atomics..
Sep 22 2023, 4:56 PM
theraven added a comment to D41936: libc: Rewrite quick_exit() and at_quick_exit() using C11 atomics..

One way out would be to atomic_swap the head to NULL.

Sep 22 2023, 4:54 PM
theraven added inline comments to D41936: libc: Rewrite quick_exit() and at_quick_exit() using C11 atomics..
Sep 22 2023, 2:24 PM
theraven added a comment to D41936: libc: Rewrite quick_exit() and at_quick_exit() using C11 atomics..

Is there a reason to write new code that uses atomics and not use C11 atomics? We’ve had support for them for several releases now and it makes code much harder for new developers to understand if it uses nonstandard features for things that are part of the standard.

Sep 22 2023, 2:17 PM

Aug 23 2023

theraven added a comment to D32360: Add membarrier(2).

It looks as if this landed without a man page?

Aug 23 2023, 7:48 AM

Aug 17 2023

theraven accepted D41482: dtc: Sync with upstream commit 26a0fe5.

LGTM.

Aug 17 2023, 8:21 AM

Aug 10 2023

theraven accepted D41265: Fix mountd's SIGHUP handler to set a variable of the correct type.
Aug 10 2023, 9:18 AM

Jun 26 2023

theraven added a comment to D38336: bhyve: add helper for adding fwcfg files.

Thanks. You can enable fwcfg by -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd,fwcfg=qemu. You can also add additional item with the -f option. It has the same syntax like the -fwcfg option of qemu (https://www.qemu.org/docs/master/specs/fw_cfg.html#externally-provided-items).

Jun 26 2023, 7:42 AM

Jun 25 2023

theraven added a comment to D38336: bhyve: add helper for adding fwcfg files.

Thanks. I've implemented a NetBSD-compatible kernel interface and tested it with the NetBSD FUSE filesystem:

Jun 25 2023, 5:14 PM

Jun 13 2023

theraven added a comment to D38336: bhyve: add helper for adding fwcfg files.

Yes, exactly. It looks as if NetBSD has such a driver (https://man.netbsd.org/qemufwcfg.4), along with a FUSE FS the shared files into the filesystem. If anyone is working on such a thing for FreeBSD, it would be helpful, otherwise I will have a go next time I have some spare time.

Jun 13 2023, 2:30 PM
theraven added a comment to D38336: bhyve: add helper for adding fwcfg files.

Do you have plans to add the guest part of this device? Currently, Podman uses this mechanism to pass configuration information (specifically, accounts to create and ssh keys) to VMs that it creates to run containers. It would be possible to add an alternative mechanism for FreeBSD (though it’s not clear what that mechanism should be) but if there’s an existing device to grab this config and provide it to userspace that someone is working on then that would be much easier to use.

Jun 13 2023, 9:05 AM

Mar 22 2023

theraven accepted D39196: amd64: reduce header pollution in _stdint.h.

This looks fine to me. Assuming I'm reading the code correctly, this change is only for targets where int64_t is long, so there should be no change in any C++ / ObjC name mangling as a result of this. It's a bit curious that we explicitly define it as a fixed-width type for 32-bit targets but long for 64-bit prior to this change, did I do that?

Mar 22 2023, 9:31 AM

Feb 9 2023

theraven abandoned D30635: Pass the syscall number to capsicum permission-denied signals.

12 is getting close to EOL, 14 is close to release, so it's too late for a back-port to 12 to matter to me.

Feb 9 2023, 12:34 PM

Feb 8 2023

theraven added a comment to D33248: Optionally deliver SIGCAP on capsicum violations..

I've rebased this, addressed reviewer comments (except the one that wants me to change some whitespace in a way that I don't fully understand), and tested it again with the Verona process-sandbox code.

Feb 8 2023, 4:49 PM
theraven updated the diff for D33248: Optionally deliver SIGCAP on capsicum violations..
  • Address some reviewer comments.
Feb 8 2023, 11:56 AM
theraven accepted D38408: xlocale: garbage collect references to strtoq_l/strtouq_l.

LGTM. I thought we had those functions, but I've never seen any code in the wild using them, so if we don't then we should get rid of any reference to them.

Feb 8 2023, 11:52 AM

Aug 17 2022

theraven added a comment to D32505: Add rseq(2).

The goal is to have tcmalloc natively working with full capacity and without further patching.

Aug 17 2022, 10:02 AM

Aug 16 2022

theraven added a comment to D32505: Add rseq(2).

I would still like to see a design document and some design review before this is added. This feature in Linux has been quite controversial. I can see a case for copying a Linux feature that is widely used, or for adding a feature in the Linuxulator that is needed by certain workloads, but this doesn't seem to meet either of those requirements (not widely used, not being added to the Linux ABI layer here, only as a native syscall).

Aug 16 2022, 8:34 AM

Jul 15 2022

theraven accepted D35815: Remove unnecessary const and volatile qualifiers from __fp_type_select().

Fantastic, thanks!

Jul 15 2022, 8:01 AM

Jul 14 2022

theraven added a comment to D35815: Remove unnecessary const and volatile qualifiers from __fp_type_select().

This is because the controlling expression always undergoes lvalue
conversion first, dropping any cv-qualifiers

Jul 14 2022, 9:57 PM

Apr 1 2022

theraven added inline comments to D33248: Optionally deliver SIGCAP on capsicum violations..
Apr 1 2022, 2:14 PM
theraven added a comment to D33248: Optionally deliver SIGCAP on capsicum violations..
In D33248#764167, @kib wrote:

Don't you want to have core dumped for unhandled SIGCAP?

Apr 1 2022, 12:20 PM

Mar 9 2022

theraven accepted D34488: Remove compat hacks from libcxxrt's _Unwind_Exception.

Ah, sorry, I thought these were additional changes. Looking more carefully, these all seem to be things that we've done upstream already.

Mar 9 2022, 9:56 AM
theraven added a comment to D34488: Remove compat hacks from libcxxrt's _Unwind_Exception.

Please can you raise a PR upstream that adds a macro to select between the two ABIs, so that we're not carrying a diff in the FreeBSD version?

Mar 9 2022, 7:45 AM

Jan 7 2022

theraven added a comment to D33248: Optionally deliver SIGCAP on capsicum violations..

Are there any other blockers to committing this? @markj, please can you approve if not?

Jan 7 2022, 1:08 PM

Dec 19 2021

theraven added a comment to D32505: Add rseq(2).

It's still not clear what the purpose of this is. It's not added to the Linux ABI. If we're adding a new FreeBSD syscall, there should be some design review or at least motivating use cases. Linux' rseq is mostly useless (far less useful than a lightweight userspace interrupt delivery mechanism or a resume-from-context-switch handler) and is *only* vaguely useful on Linux in combination with the fact that Linux has a lightweight get-CPU system call implemented in the VDSO that is cheaper than a CPUID (which is a serialising instruction and generally costs more than the saving of most of the win from doing per-CPU instead of per-thread things).

Dec 19 2021, 11:36 AM

Dec 7 2021

theraven updated the diff for D33248: Optionally deliver SIGCAP on capsicum violations..
  • Fix comma splice.
Dec 7 2021, 10:39 AM

Dec 6 2021

theraven added a comment to D33248: Optionally deliver SIGCAP on capsicum violations..

FWIW, I tried the tests for your process_sandbox (with this patch applied of course) and one test consistently fails:

markj@biggie> ./test-onebitsem-child
Dec 6 2021, 5:11 PM
theraven updated the diff for D33248: Optionally deliver SIGCAP on capsicum violations..
  • Address code review comments.
Dec 6 2021, 5:11 PM

Dec 3 2021

theraven added inline comments to D33248: Optionally deliver SIGCAP on capsicum violations..
Dec 3 2021, 4:10 PM
theraven updated the diff for D33248: Optionally deliver SIGCAP on capsicum violations..
  • Fix copy-and-paste fail.
Dec 3 2021, 4:09 PM
theraven requested review of D33248: Optionally deliver SIGCAP on capsicum violations..
Dec 3 2021, 3:14 PM

Oct 18 2021

theraven added a comment to D32505: Add rseq(2).

Again, this is clearly outside the design space of rseq.

Oct 18 2021, 8:05 AM

Oct 16 2021

theraven added a comment to D32505: Add rseq(2).
In D32505#733678, @kib wrote:

Lets limit the discussion to rseq(2) and not to some future hypothetical design needed for CheriBSD (which is not FreeBSD).

Oct 16 2021, 5:10 PM
theraven added a comment to D32505: Add rseq(2).
In D32505#733659, @kib wrote:
  • For allocator hardening, we'd like to ensure that signals delivered while executing in the allocator don't expose internal allocator state, so we'd like a mechanism somewhat closer to Windows structured exception handling that allows signals to be redirected based on a specific IP range.

Why should this be done in kernel? More, I believe that Windows does not do it in kernel either. Last time I looked (I admit it was very long time ago) they have a single upcall from kernel to userspace for all that stuff. It is usermode duty to interpret signal source + find the corresponding entry in the exceptions ranges table and do the unwind.

More, I think that there is a strong reason why kernel should not do that. You probably need to distinguish between sync and async signals, and further classify them based on si_code before even taking the look at the unwinding, so that only the events you are prepared for, like GC barriers or whatever you know about, started your specific actions. Kernel should not know about all that details.

Oct 16 2021, 1:18 PM
theraven added a comment to D32505: Add rseq(2).

@brooks, can you take a look at this from a CheriABI perspective? The current version uses the Linux convention of assuming that uint64_t is a sensible type for memory addresses. We probably can't do that in CheriABI because it would allow you to register a jump address that would make other code jump to your handler (or, conversely, it may prevent you from setting a range in some situations where there's a PCC change in between the rseq setup and the destination).

Oct 16 2021, 11:46 AM

Oct 12 2021

theraven added inline comments to D32360: Add membarrier(2).
Oct 12 2021, 9:20 AM

Oct 11 2021

theraven added a comment to D32360: Add membarrier(2).

Thanks for doing this, it will make porting our work to FreeBSD easier. There are some missing man pages (both for the new pmap interfaces and for the syscall).

Oct 11 2021, 5:24 PM

Jul 17 2021

theraven abandoned D31133: Add a pdvfork system call..

Abandoning: This is probably not the right approach and @jhb is working on something similar so I'll wait for his version.

Jul 17 2021, 4:05 PM

Jul 16 2021

theraven committed rGcf98bc28d39d: Pass the syscall number to capsicum permission-denied signals (authored by theraven).
Pass the syscall number to capsicum permission-denied signals
Jul 16 2021, 5:08 PM

Jul 10 2021

theraven committed rGd2b558281aad: Revert "Pass the syscall number to capsicum permission-denied signals" (authored by theraven).
Revert "Pass the syscall number to capsicum permission-denied signals"
Jul 10 2021, 7:27 PM
theraven added a reverting change for rG3a522ba1bc85: Pass the syscall number to capsicum permission-denied signals: rGd2b558281aad: Revert "Pass the syscall number to capsicum permission-denied signals".
Jul 10 2021, 7:27 PM
theraven added a reverting change for D29185: Pass the syscall number to capsicum permission-denied signals: rGd2b558281aad: Revert "Pass the syscall number to capsicum permission-denied signals".
Jul 10 2021, 7:26 PM
theraven added a comment to D31133: Add a pdvfork system call..

@brooks, this should also be useful for combining CHERI coprocesses with Capsicum (coprocesses are currently created with vfork + coexecve).

Jul 10 2021, 4:27 PM
theraven requested review of D31133: Add a pdvfork system call..
Jul 10 2021, 4:25 PM
theraven committed rG3a522ba1bc85: Pass the syscall number to capsicum permission-denied signals (authored by theraven).
Pass the syscall number to capsicum permission-denied signals
Jul 10 2021, 4:20 PM
theraven closed D29185: Pass the syscall number to capsicum permission-denied signals.
Jul 10 2021, 4:20 PM

Jun 25 2021

theraven updated the diff for D30635: Pass the syscall number to capsicum permission-denied signals.
  • Propagate the field on fork.
Jun 25 2021, 1:32 PM
theraven updated the diff for D30635: Pass the syscall number to capsicum permission-denied signals.
  • Add missing siginfo(3) documentation.
  • Propagate the field on fork.
Jun 25 2021, 11:46 AM
theraven updated the diff for D29185: Pass the syscall number to capsicum permission-denied signals.
  • Add missing siginfo(3) documentation.
Jun 25 2021, 10:35 AM

Jun 4 2021

theraven added a comment to D29185: Pass the syscall number to capsicum permission-denied signals.

Let's try option 2 and see if it works :-)

Jun 4 2021, 3:55 PM
theraven added a comment to D29185: Pass the syscall number to capsicum permission-denied signals.

I've never used git send-mail, how does it interact with Phabricator? If I do a rebase / squash to produce a single commit, is that sufficient? You should be able to then arc patch and git push.

Jun 4 2021, 3:40 PM
theraven added a comment to D29185: Pass the syscall number to capsicum permission-denied signals.

Thanks. Please can you commit if you're happy with it?

Jun 4 2021, 1:11 PM
theraven updated the diff for D29185: Pass the syscall number to capsicum permission-denied signals.
  • Use less-ambiguous terminology.
Jun 4 2021, 1:11 PM
theraven updated the diff for D30635: Pass the syscall number to capsicum permission-denied signals.
  • Use less-ambiguous terminology.
Jun 4 2021, 1:09 PM
theraven added a comment to D30635: Pass the syscall number to capsicum permission-denied signals.

Can rfork (or pdfork / vfork / whatever) both fail with a capsicum violation *and* create a new struct proc and return in the child context with a signal? That should be the only case where you need to duplicate the original_code field into the child.

Jun 4 2021, 1:07 PM
theraven added a comment to D29185: Pass the syscall number to capsicum permission-denied signals.

12-STABLE version is D30635.

Jun 4 2021, 11:51 AM
theraven requested review of D30635: Pass the syscall number to capsicum permission-denied signals.
Jun 4 2021, 11:50 AM
theraven added a comment to D29185: Pass the syscall number to capsicum permission-denied signals.

Thanks. I think I'm happy for this version to land in main if reviewers are and I'll work on a version for 12- and 13-stable.

Jun 4 2021, 9:19 AM
theraven updated the diff for D29185: Pass the syscall number to capsicum permission-denied signals.
  • Reorder original_code to fit in padding for 64-bit archs.
Jun 4 2021, 9:18 AM

Mar 16 2021

theraven added inline comments to D29185: Pass the syscall number to capsicum permission-denied signals.
Mar 16 2021, 4:25 PM
theraven added a comment to D29185: Pass the syscall number to capsicum permission-denied signals.
In D29185#655877, @kib wrote:

By themself, syscall_args are not used by anything but syscall entry code (and some ptrace bits). But the structure is embedded into struct thread, and layout of struct thread must be stable.

Mar 16 2021, 4:22 PM
theraven added a comment to D29185: Pass the syscall number to capsicum permission-denied signals.

Are the syscall_args structures part of the stable KBI? This won't quite cleanly apply to older versions of FreeBSD because at least on x86 the system call entry code has been cleaned up to remove some code duplication, but I am running on 12-STABLE with a version of this that doesn't correctly handle the syscall / __syscall syscalls and it would be great to be able to MFC as much as possible, even if we can't get full support without the KBI change.

Mar 16 2021, 1:46 PM
theraven updated the diff for D29185: Pass the syscall number to capsicum permission-denied signals.
  • Add missing architecture support, address reviewer comments.
Mar 16 2021, 1:43 PM

Mar 12 2021

theraven added a comment to D29185: Pass the syscall number to capsicum permission-denied signals.

Sorry, this version does work, I had only updated one of the places in the code using it to check si_syscall and so the test was failing yesterday.

Mar 12 2021, 1:28 PM
theraven updated the diff for D29185: Pass the syscall number to capsicum permission-denied signals.

Add amd64 paths to preserve the original system call number.

Mar 12 2021, 1:21 PM
theraven added a comment to D29185: Pass the syscall number to capsicum permission-denied signals.

When do you need this? Isn't this kind of introspection warrants a use of real debugger which can deduce all the data from debugging information?

Mar 12 2021, 9:02 AM

Mar 11 2021

theraven added a comment to D29185: Pass the syscall number to capsicum permission-denied signals.

I appear to be setting the field in the siginfo structure incorrectly in the new version, but it's now the end of the day for me so I will try to debug this tomorrow.

Mar 11 2021, 5:26 PM
theraven added a comment to D29185: Pass the syscall number to capsicum permission-denied signals.

@emaste, sorry, I don't think I understand this comment.

Mar 11 2021, 4:51 PM
theraven updated the diff for D29185: Pass the syscall number to capsicum permission-denied signals.

Updated based on @kib's feedback.

Mar 11 2021, 4:44 PM
theraven added a comment to D29185: Pass the syscall number to capsicum permission-denied signals.

@kib, thank you, that also mirrors what Linux does for seccomp violation signals. I will update the diff to reflect that.

Mar 11 2021, 4:39 PM

Mar 10 2021

theraven requested review of D29185: Pass the syscall number to capsicum permission-denied signals.
Mar 10 2021, 12:58 PM

Feb 1 2021

theraven added a comment to D28442: Fix null-pointer dereference in rtld.

Thanks, I'll see if I can chase this down later. My commit bit lapsed, please can you land it?

Feb 1 2021, 3:36 PM · capsicum
theraven updated the diff for D28442: Fix null-pointer dereference in rtld.
Feb 1 2021, 3:11 PM · capsicum
theraven added a comment to D28442: Fix null-pointer dereference in rtld.

Yes it should be strdup'ed somewhere but I am surprised that it works. Look at the start of load_object(): if name != NULL, it searches for existing loaded object with the specified name.

Feb 1 2021, 2:35 PM · capsicum
theraven added a comment to D28442: Fix null-pointer dereference in rtld.

Thanks. I can confirm that this change also fixes this problem:

Feb 1 2021, 11:52 AM · capsicum
theraven requested review of D28442: Fix null-pointer dereference in rtld.
Feb 1 2021, 9:33 AM · capsicum

Jun 18 2020

theraven added a comment to D25330: Partially implement Linux MADV_DONTNEED semantics..

For snmalloc, we use this call in the Linux PAL. On FreeBSD, we use mmap to map a new anonymous memory object over the old one, which has the same behaviour. We don't do this on shared memory mappings, but for sandboxing use cases we do need some equivalent mechanism (i.e. something that can zero a large range of shared memory, without requiring the OS to actually allocate physical pages for all of the zeroes). On Linux, we can do this with fallocate on the underlying memory object (I think we can do it with mem_fd objects, we can definitely do it in tmpfs). I am not sure what the correct mechanism for doing this in FreeBSD is.

Jun 18 2020, 9:30 AM

May 5 2020

theraven added inline comments to D8188: Introduce lib/libgcc_eh and lib/libgcc_s for LLVM's implementation.
May 5 2020, 8:15 AM

Feb 24 2020

theraven added inline comments to D23793: kernel: provide panicky version of __unreachable.
Feb 24 2020, 10:35 AM

Feb 14 2020

theraven added a comment to D23662: dtc: remove unknown option printf, since getopt will print it.

This looks fine, but please submit it as a GitHub PR so that it goes through CI (I can't imagine it failing).

Feb 14 2020, 2:46 PM

Jan 15 2020

theraven accepted D23192: 2020-02-29 retire in-tree GPL dtc.
Jan 15 2020, 4:56 PM
theraven added a comment to D23192: 2020-02-29 retire in-tree GPL dtc.

Unless I'm missing something, this leaves GPL'd dtc's sources in the tree but removes the ability to build them. Would it make sense to remove the code at the same time as removing the build system goo?

Jan 15 2020, 3:24 PM

May 25 2019

theraven added a comment to D19735: Add a description on how to configure a local postfix to forward emails to the FreeBSD smtp servers..

I've now tried doing this and have finally managed to get it to work. A couple of things:

May 25 2019, 3:10 PM

Mar 26 2019

theraven added a comment to D19566: WIP to import libcxxabi.
In D19566#422302, @jhb wrote:

I had labored under the incorrect assumption that libcxxrt was somewhat abandoned and that all other libc++ consumers used libc++abi, however, it seems that it's only Apple and OpenBSD that use libc++abi. NetBSD still uses libcxxrt. Also, when I compared the repositories both libcxxrt and libcxxabi had basically no real activity in the last two years. libcxxabi had more commits, but they were all due to relicensing and moving to monorepo.

Mar 26 2019, 5:54 PM

Mar 15 2019

theraven added a comment to D19566: WIP to import libcxxabi.

I'd be very happy to replace the libelftc demangler with the one from libc++abi, but last time this was discussed there were some complaints about the significant increase in binary size. One solution that I'd considered is to replace the demangler in libc++abi with a stub that doesn't actually do any demangling and then import the libc++abi demangler into libc++, possibly excluding it from release builds of the static library (dynamically linked programs probably don't mind paying the size overhead).

Mar 15 2019, 3:00 PM

Mar 14 2019

theraven added a comment to D19566: WIP to import libcxxabi.

Please do not do this. libc++abi implements the Itanium ABI specification, but *not* GNU extensions. This is fine for Apple, because their Objective-C exceptions are thin wrappers around C++ exceptions, but other languages on non-Apple platforms (Objective-C definitely, I think Ada and a few others) rely on GNU extensions. These are supported by libsupc++ and libcxxrt. There's a reason that the product groups at $WORK picked libcxxrt for things that ship libc++...

Mar 14 2019, 12:33 PM