326743 |
10-Dec-2017 |
ed |
MFC r326228 and r326229:
Use TO_PTR() to convert integers to pointers.
For FreeBSD/arm64's cloudabi32 support, I'm going to need a TO_PTR() in this place. Also use it for all of the other source files, so that the difference remains as minimal as possible. |
322394 |
11-Aug-2017 |
ed |
MFC r321924:
Keep top page on CloudABI to work around AMD Ryzen stability issues.
Similar to r321899, reduce sv_maxuser by one page inside of CloudABI. This ensures that the stack, the vDSO and any allocations cannot touch the top page of user virtual memory.
Considering that CloudABI userspace is completely oblivious to virtual memory layout, don't bother making this conditional based on the CPU of the running system. |
321343 |
21-Jul-2017 |
kib |
MFC r319873: Move struct syscall_args syscall arguments parameters container into struct thread. |
316576 |
06-Apr-2017 |
kib |
Improvements for the brand detection and prioritization.
MFC r315701 (by ed): Set the interpreter path to /nonexistent.
MFC r315749: Adjust r314851 to not require every brand to specify interpreter path.
MFC r315753: Add a flag BI_BRAND_ONLY_STATIC to specify that the brand only matches static binaries.
MFC r315754: Update r315753 with the proper flag name.
MFC r316211: A followup to r315749, two more places where brand->interp_path was accessed unconditionally. |
316574 |
06-Apr-2017 |
ed |
Bring kernel space CloudABI code in sync with HEAD.
MFC r312353, r312354 and r312355:
Sync in the latest CloudABI generated source files.
Languages like C++17 and Go provide direct support for slice types: pointer/length pairs. The CloudABI generator now has more complete for this, meaning that for the C binding, pointer/length pairs now use an automatic naming scheme of ${name} and ${name}_len.
Apart from this change and some reformatting, the ABI definitions are identical. Binary compatibility is preserved entirely.
MFC r315700:
Make file descriptor passing work for CloudABI's sendmsg().
Reduce the potential amount of code duplication between cloudabi32 and cloudabi64 by creating a cloudabi_sock_recv() utility function. The cloudabi32 and cloudabi64 modules will then only contain code to convert the iovecs to the native pointer size.
In cloudabi_sock_recv(), we can now construct an SCM_RIGHTS cmsghdr in an mbuf and pass that on to kern_sendit().
MFC r315736:
Make file descriptor passing for CloudABI's recvmsg() work.
Similar to the change for sendmsg(), create a pointer size independent implementation of recvmsg() and let cloudabi32 and cloudabi64 call into it. In case userspace requests one or more file descriptors, call kern_recvit() in such a way that we get the control message headers in an mbuf. Iterate over all of the headers and copy the file descriptors to userspace. |
316570 |
06-Apr-2017 |
ed |
MFC r315861:
Stop providing the compat_3_brand.
As of r315860, the ELF image activator works fine for CloudABI without it. |
307144 |
12-Oct-2016 |
ed |
MFC r303818, r303833, r303941, r304478, r304481, r304483, r304484, r304554, r304555, r304556, r304557, r304558, r304559, r304561, r304563, r304564, r304565, r304615, r304742, r304743, r304744, r304745, r304748, r304886, r304991, r305928, r305938, r305987, r306185:
Bring CloudABI support back in sync with HEAD.
- Add support for running 32-bit executables on amd64, armv6 and i386.
- As these new architectures require the use of the vDSO, merge back vDSO support for 64-bit executables running on amd64 and arm64 as well. This has the advantage that support for vDSO-less execution can be phased out when 11.0 becomes unsupported, as opposed to 11.x.
This change has been tested by running the cloudlibc unit tests on all supported architectures, which seems to work fine. |
302627 |
12-Jul-2016 |
ed |
MFC r302448:
Don't forget to set sa->narg for CloudABI system calls.
It turns out that this value is not used within the system call code under normal conditions, except when using tracing tools like ktrace. If we forget to set this value, it is set to random garbage. This may cause ktrace to hang indefinitely, making it impossible to kill.
Approved by: re@ Reported by: Michael Plass PR: 210800 |
302408 |
08-Jul-2016 |
gjb |
Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle. Prune svn:mergeinfo from the new branch, as nothing has been merged here.
Additional commits post-branch will follow.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
301961 |
16-Jun-2016 |
kib |
Update comments for the MD functions managing contexts for new threads, to make it less confusing and using modern kernel terms.
Rename the functions to reflect current use of the functions, instead of the historic KSE conventions: cpu_set_fork_handler -> cpu_fork_kthread_handler (for kthreads) cpu_set_upcall -> cpu_copy_thread (for forks) cpu_set_upcall_kse -> cpu_set_upcall (for new threads creation)
Reviewed by: jhb (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Approved by: re (hrs) Differential revision: https://reviews.freebsd.org/D6731
|
297613 |
06-Apr-2016 |
ed |
Make CloudABI's way of doing TLS more friendly to userspace emulators.
We're currently seeing how hard it would be to run CloudABI binaries on operating systems cannot be modified easily (Windows, Mac OS X). The idea is that we want to just run them without any sandboxing. Now that CloudABI executables are PIE, this is already a bit easier, but TLS is still problematic:
- CloudABI executables want to write to the %fs, which typically requires extra system calls by the emulator every time it needs to switch between CloudABI's and its own TLS.
- If CloudABI executables overwrite the %fs base unconditionally, it also becomes harder for the emulator to store a backup of the old value of %fs. To solve this, let's no longer overwrite %fs, but just %fs:0.
As CloudABI's C library does not use a TCB, this space can now be used by an emulator to keep track of its internal state. The executable can now safely overwrite %fs:0, as long as it makes sure that the TCB is copied over to the new TLS area.
Ensure that there is an initial TLS area set up when the process starts, only containing a bogus TCB. We don't really care about its contents on FreeBSD.
Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D5836
|
297470 |
31-Mar-2016 |
ed |
Make Position Independent Executables work for CloudABI.
- Set BI_CAN_EXEC_DYN, so we can execute ET_DYN ELF files in addition to regular ET_EXECs. - Provide an AT_BASE entry in the auxiliary vector, so the executable knows at which address it got loaded and can apply relocations.
|
296570 |
09-Mar-2016 |
jhb |
Fix reporting of the CloudABI ABI in kdump.
- Advertise the word size for CloudABI ABIs via the SV_LP64 flag. All of the other ABIs include either SV_ILP32 or SV_LP64. - Fix kdump to not assume a 32-bit ABI if the ABI flags field is non-zero but SV_LP64 isn't set. Instead, only assume a 32-bit ABI if SV_ILP32 is set and fallback to the unknown value of "00" if neither SV_LP64 nor SV_ILP32 is set.
Reviewed by: kib, ed Differential Revision: https://reviews.freebsd.org/D5560
|
295880 |
22-Feb-2016 |
skra |
As <machine/pmap.h> is included from <vm/pmap.h>, there is no need to include it explicitly when <vm/pmap.h> is already included.
Reviewed by: alc, kib Differential Revision: https://reviews.freebsd.org/D5373
|
289747 |
22-Oct-2015 |
ed |
Refactoring: move out generic bits from cloudabi64_sysvec.c.
In order to make it easier to support CloudABI on ARM64, move out all of the bits from the AMD64 cloudabi_sysvec.c into a new file cloudabi_module.c that would otherwise remain identical. This reduces the AMD64 specific code to just ~160 lines.
Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D3974
|
286924 |
19-Aug-2015 |
bapt |
Add a kern.features.cloudabi64 entry when the module is loaded to helps the userland to be able to test is cloudabi64 is supported or not
Reviewed by: ed Differential Revision: https://reviews.freebsd.org/D3430
|
286230 |
03-Aug-2015 |
ed |
Let CloudABI use the SV_CAPSICUM flag.
CloudABI processes will now start up in capabilities mode.
Reviewed by: kib
|
286221 |
03-Aug-2015 |
ed |
Set p_osrel to __FreeBSD_version on process startup.
Certain system calls have quirks applied to make them work as if called on an older version of FreeBSD. As CloudABI executables don't have the FreeBSD OS release number in the ELF header, this value is set to zero, making the system calls fall back to typically historic, non-standard behaviour.
Reviewed by: kib
|
285744 |
21-Jul-2015 |
ed |
Make thread creation work for CloudABI processes.
Summary: Remove the stub system call that was put in place during the system call import and replace it by a target-dependent version stored in sys/amd64. Initialize the thread in a way similar to cpu_set_upcall_kse(). We provide the entry point with two arguments: the thread ID and the argument pointer.
Test Plan: Thread creation still seems to work, both for FreeBSD and CloudABI binaries.
Reviewers: dchagin, mjg, kib
Reviewed By: kib
Subscribers: imp
Differential Revision: https://reviews.freebsd.org/D3110
|
285716 |
20-Jul-2015 |
ed |
Make forking of CloudABI processes work.
Just like FreeBSD+Capsicum, CloudABI uses process descriptors. Return the file descriptor number to the parent process.
To the child process we both return a special value for the file descriptor number (CLOUDABI_PROCESS_CHILD). We also return the thread ID of the new thread in the copied process, so the threading library can reinitialize itself.
Obtained from: https://github.com/NuxiNL/freebsd
|
285641 |
16-Jul-2015 |
ed |
Add a sysentvec for CloudABI on x86-64.
Summary: For CloudABI we need to put two things on the stack of new processes: the argument data (a binary blob; not strings) and a startup data structure. The startup data structure contains interesting things such as a pointer to the ELF program header, the thread ID of the initial thread, a stack smashing protection canary, and a pointer to the argument data.
Fetching system call arguments and setting the return value is similar to FreeBSD. The only differences are that system call 0 does not exist and that we call into cloudabi_convert_errno() to convert the error code. We also need this function in a couple of other places, so we'd better reuse it here.
Reviewers: dchagin, kib
Reviewed By: kib
Subscribers: imp
Differential Revision: https://reviews.freebsd.org/D3098
|