Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCuABI Linuxulator #2237

Draft
wants to merge 188 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
61f12c9
Some initial attempt to compile linuxulator kernel modules
w4123 Oct 16, 2024
268ee2f
linuxulator: Fix build issues and allow execution of vanilla aarch64 …
w4123 Oct 22, 2024
c19e148
Bring in iovec changes
jrtc27 Oct 28, 2024
ad45ab9
Fix ioctl capabilities
w4123 Oct 28, 2024
d5fe500
linuxulator: Fix ptrace
w4123 Oct 29, 2024
2ce9bd6
linuxulator: Fix CToPtr error on hybrid kernel
w4123 Oct 29, 2024
ee570af
linuxulator: Fix invalid __USER_CAP_UNBOUND
w4123 Oct 29, 2024
88ea910
linuxulator: Change the use of iovec to l_iovec64 in linuxulator
w4123 Oct 29, 2024
5c10862
linuxulator: Fix typo
w4123 Oct 29, 2024
4c836c6
linuxulator: Fix IOVEC_INIT arguments to use capabilities
w4123 Oct 29, 2024
09f0392
linuxulator: use IOVEC_INIT_C instead of IOVEC_INIT for user capabili…
w4123 Oct 29, 2024
7e029e4
linuxulator: Enable separate linux_read and linux_readv in syscalls.m…
w4123 Oct 29, 2024
ab50cda
linuxulator: Regenerate syscalls
w4123 Oct 29, 2024
7141aaf
linuxulator: implement linux_read and linux_readv
w4123 Oct 29, 2024
f3752af
linuxulator: Fix typo
w4123 Oct 29, 2024
8431dab
linuxulator: Fix typo
w4123 Oct 29, 2024
8f1d27f
linuxulator: Fix vanilla syscalls that involve pointer conversions
w4123 Nov 6, 2024
e256499
linuxulator: Regenerate syscalls
w4123 Nov 6, 2024
695e3af
linuxulator: Fix typo
w4123 Nov 6, 2024
387eb4b
linuxulator: Fix inconsistent l_timeval
w4123 Nov 6, 2024
f9cd8c7
linuxulator: Regenerate syscalls
w4123 Nov 6, 2024
8e123c3
linuxulator: Fix linux_getrusage
w4123 Nov 6, 2024
8a9d1bc
Merge branch 'linuxulator-dev' of https://github.com/w4123/cheribsd i…
w4123 Nov 6, 2024
f3a6163
linuxulator: Fix linux_settimeofday
w4123 Nov 6, 2024
c4c8284
linuxulator: fix pointer in ioctl structures
w4123 Nov 6, 2024
6b19f43
linuxulator: temporarily force COMPAT_LINUX64 in get_argenv_ptr
w4123 Nov 6, 2024
992af09
linuxulator: Fix wrong pointer arithmatic in get_argenv_ptr
w4123 Nov 6, 2024
4b1b139
linuxulator: Attempt to fix signal capabilities in vanilla aarch64 linux
w4123 Nov 6, 2024
3d3c075
linuxulator: Fix signal capabilities
w4123 Nov 6, 2024
f770629
linuxulator: Attempt to fix invalid capability tag after
w4123 Nov 7, 2024
4cb5b00
linuxulator: Try to fix signal handling capabilities
w4123 Nov 7, 2024
2f35bd6
linuxulator: Fix sigcontext datatype
w4123 Nov 7, 2024
5e4413f
linuxulator: Fix definition for l_handler_t
w4123 Nov 7, 2024
ef17fef
linuxulator: Fix capability issue in sigreturn
w4123 Nov 7, 2024
149b741
linuxulator: Fix gtod
w4123 Nov 7, 2024
b305355
linuxulator: Additionally save ddc on signals
w4123 Nov 7, 2024
fb8a48e
linuxulator: Additionally save ddc on signal
w4123 Nov 7, 2024
191376c
linuxulator: Use allocuio consistently (follow freebsd64)
w4123 Nov 7, 2024
d728fe5
linuxulator: Copy capabilities properly when handling signals
w4123 Nov 7, 2024
1553c74
linuxulator: Bring in linux64c
jrtc27 Nov 12, 2024
8452811
linuxulator: Regenerate syscalls
w4123 Nov 12, 2024
c39a3df
linuxulator: Remove duplicated linux64_copyin*
w4123 Nov 12, 2024
58cbe9c
linuxulator: Fix pointer type definition
w4123 Nov 12, 2024
e720d0e
linuxulator: Fix include in linux_file.c
w4123 Nov 12, 2024
de2752e
linuxulator: Bring in more changes
w4123 Nov 12, 2024
7d0963f
linuxulator: Fix iovec datatype in linux_ptrace
w4123 Nov 12, 2024
817e6a3
linuxulator: Fix l_handler_t type
w4123 Nov 12, 2024
eba35a7
linuxulator: Attempt to fix a bit of linux_sysvec
w4123 Nov 12, 2024
c987961
linuxulator: Fix ptrace include
w4123 Nov 12, 2024
de1a988
linuxulator: Fix type conversion in ptrace
w4123 Nov 12, 2024
f045ec1
linuxulator: Use capability in functions more consistently
w4123 Nov 12, 2024
61fc25e
linuxulator: Use capabilities in functions more consistently
w4123 Nov 12, 2024
12104fc
linuxulator: Fix capability in linux_file
w4123 Nov 12, 2024
c76d445
linuxulator: Fix typo
w4123 Nov 12, 2024
24a4fae
linuxulator: Attempt to fix timespec capabilities
w4123 Nov 12, 2024
ce9ce70
linuxulator: Attempt to fix capabilities in linux_ipc
w4123 Nov 12, 2024
9333791
linuxulator: Attempt to fix type conversion
w4123 Nov 12, 2024
7a7d224
linuxulator: Fix conflicting type in linux_file
w4123 Nov 12, 2024
34505d6
linuxulator: Fix capabilities in linux_misc
w4123 Nov 12, 2024
7192860
linuxulator: Temporarily circumvent the problem in mmap etc.
w4123 Nov 18, 2024
a815c4e
linuxulator: Attempt to fix type conversion issues in linux_ipc
w4123 Nov 18, 2024
d50c82c
linuxulator: Fix capability in linux_socket
w4123 Nov 18, 2024
b878c38
linuxulator: Fix capability in linux_stats
w4123 Nov 18, 2024
8ea3192
linuxulator: Fix typo
w4123 Nov 18, 2024
67cdbd1
linuxulator: Fix capability in linux_file
w4123 Nov 18, 2024
44b3a6a
linuxulator: Fix capability in linux_stats
w4123 Nov 18, 2024
9f7b29a
linuxulator: Regenerate syscalls
w4123 Nov 18, 2024
62e99c7
linuxulator: Attempt to fix type conversion in linux_futex
w4123 Nov 19, 2024
9c32a53
linuxulator: Fix typo
w4123 Nov 19, 2024
0af00d0
linuxulator: Attempt to fix type conversion in linux_futex
w4123 Nov 19, 2024
57c2973
linuxulator: Fix capability issues in linux_misc
w4123 Nov 19, 2024
0786e01
linuxulator: Try to fix capability in linux_misc
w4123 Nov 19, 2024
fc059ea
linuxulator: Try to fix capability in linux_misc
w4123 Nov 19, 2024
f066295
linuxulator: Fix capability in linux_stats
w4123 Nov 19, 2024
dbcc5d6
linuxulator: Try to fix undefined symbols
w4123 Nov 19, 2024
cd10c9f
linuxulator: Try to fix sysvec
w4123 Nov 19, 2024
8d5ca4d
linuxulator: Fix sysvec
w4123 Nov 19, 2024
4d5af04
linuxulator: Fix initial copyout_strings
w4123 Nov 19, 2024
05b8147
linuxulator: Try to set initial vectors properly
w4123 Nov 19, 2024
b3e6277
linuxulator: Fix initial vectors
w4123 Nov 19, 2024
7b20970
linuxulator: Force native handlers to reject linux binaries
w4123 Nov 19, 2024
577ef6e
linuxulator: Test setup of regs
w4123 Nov 19, 2024
ddd8459
linuxulator: Test code
w4123 Nov 19, 2024
1caaf44
linuxulator: Some error messages to locate the error
w4123 Nov 19, 2024
99ea926
linuxulator: more error messages
w4123 Nov 19, 2024
cf13400
linuxulator: Try to fix initial setup
w4123 Nov 19, 2024
d78fe0e
linuxulator: Handle separate region for strings properly
w4123 Nov 19, 2024
3245e66
linuxulator: Fix misaligned access
w4123 Nov 19, 2024
5ee6a9b
linuxulator: Try to fix alignment issue temporarily
w4123 Nov 19, 2024
975df2f
linuxulator: Try to fix misaligned access
w4123 Nov 19, 2024
c955de5
linuxulator: Fix misaligned access
w4123 Nov 19, 2024
044f5a0
linuxulator: Additional error messages
w4123 Nov 19, 2024
9c03fc4
Linuxulator: Temporary uprints for debugging
w4123 Nov 19, 2024
cebdbbc
linuxulator: Debug
w4123 Nov 19, 2024
ed44bb6
linuxulator: Set regs properly
w4123 Nov 19, 2024
fa84d79
linuxulator: Remove debug message
w4123 Nov 19, 2024
6bc005a
linuxulator: Try to fix some auxvecs
w4123 Nov 19, 2024
65f7b14
linuxulator: Try to fix some auxvecs
w4123 Nov 19, 2024
4b89cfc
linuxulator: Try to fix some auxvecs
w4123 Nov 19, 2024
e6d0a26
linuxulator: Try to fix some auxvecs
w4123 Nov 19, 2024
c06ef95
linuxulator: Try to fix some auxvecs
w4123 Nov 19, 2024
8d04c72
linuxulator: Try to fix some auxvecs
w4123 Nov 19, 2024
f9cf85c
linuxulator: Fix typoo
w4123 Nov 19, 2024
72eb8ed
linuxulator: Try to fix some auxvecs
w4123 Nov 19, 2024
094d321
linuxulator: Fix Too many auxargs
w4123 Nov 19, 2024
3e8c571
linuxulator: Fix Too many auxargs
w4123 Nov 19, 2024
21e6770
linuxulator: Try to fix stack alignment issues
w4123 Nov 19, 2024
bf21db6
Linuxulator: Disable alignment check in freebsd_fixup temporarily
w4123 Nov 19, 2024
e08cc91
linuxulator: Fix stack protection for PCuABI
w4123 Nov 19, 2024
c688c66
linuxulator: Implement libsysdecode and truss support for PCuABI
w4123 Nov 19, 2024
e47f672
linuxulator: Fix include in libsysdecode
w4123 Nov 19, 2024
4418743
linuxulator: Fix some auxvecs
w4123 Nov 19, 2024
4ad140a
linuxulator: Fix syscall permissions in PCuABI
w4123 Nov 19, 2024
4935f9e
linuxulator: Fix include
w4123 Nov 19, 2024
4d958a3
linuxulator: Remove unused variable
w4123 Nov 19, 2024
bc9e0a2
Disable armv8_crc32c which does not work with pure cap
w4123 Nov 23, 2024
770d54b
Fix capability bound issue in ext2fs
w4123 Nov 23, 2024
d679031
linuxulator: Add interp auxvec
w4123 Nov 23, 2024
9cdd026
linuxulator: Some initial fix for mmap
w4123 Nov 23, 2024
64fcb29
linuxulator: Disable vDSO until we fix it for PCuABI
w4123 Nov 23, 2024
c161741
linuxulator: Try to fix mmap for PCuABI
w4123 Nov 24, 2024
d994066
linuxulator: Try to fix mmap
w4123 Nov 24, 2024
543b28f
linuxulator: Regenerate syscalls
w4123 Nov 24, 2024
1026e53
Fix mdconfig -l
w4123 Nov 24, 2024
184015f
Merge branch 'linuxulator-dev' of https://github.com/w4123/cheribsd i…
w4123 Nov 24, 2024
ce8930e
Fix mdconfig -l
w4123 Nov 24, 2024
8554d11
Fix mdconfig -l
w4123 Nov 24, 2024
76f8a0f
Fix mdconfig -l
w4123 Nov 24, 2024
8e729d6
Fix mdconfig -l
w4123 Nov 24, 2024
807b65d
linuxulator: Fix kernel panic when unloading the module
w4123 Dec 2, 2024
70817c0
linuxulator: Use SV_ABI_LINUX to detect whether to create revocation …
w4123 Dec 2, 2024
a4ebf63
linuxulator: Fix munmap
w4123 Dec 2, 2024
dbca858
linuxulator: Fix missing definitions
w4123 Dec 2, 2024
515e801
linuxulator: Fix include
w4123 Dec 2, 2024
0eb60a0
linuxulator: Fix cap revoke shadow installation condition
w4123 Dec 2, 2024
47e7823
linuxulator: More complete auxvec
w4123 Dec 18, 2024
1740e8b
linuxulator: Fix pointer conversion
w4123 Dec 18, 2024
17d587b
linuxulator: Fix pointer conversion
w4123 Dec 18, 2024
d526dfe
linuxulator: Fix pointer conversion
w4123 Dec 18, 2024
92564cd
linuxulator: Fix pointer conversion
w4123 Dec 18, 2024
c77fa95
linuxulator: Fix pointer conversion
w4123 Dec 18, 2024
41878cc
linuxulator: Update vDSO platform string capability pointer
w4123 Dec 18, 2024
57fd950
linuxulator: Fix typo
w4123 Dec 18, 2024
3aec19b
linuxulator: Try to update vDSO platform string capability pointer
w4123 Dec 18, 2024
072aab0
Linuxulator: Fix include
w4123 Dec 18, 2024
82478bf
Linuxulator: Fix pointer conversion
w4123 Dec 18, 2024
cbe7a23
linuxulator: Fix vdso sym data type
w4123 Dec 18, 2024
6e435a6
linuxulator: Fix include
w4123 Dec 18, 2024
7f61dbe
linuxulator: Try to update vDSO platform string capability pointer
w4123 Dec 18, 2024
a8e2387
linuxulator: Support some futex edge cases to pass PCuABI tests
w4123 Dec 19, 2024
f2881e6
linuxulator: Try to fix platform string capability temporarily
w4123 Dec 19, 2024
507130f
linuxulator: Fix typo
w4123 Dec 19, 2024
0a32145
linuxulator: Try to fix platform string capability temporarily
w4123 Dec 19, 2024
480096e
linuxulator: Fix typo
w4123 Dec 19, 2024
c1565c7
linuxulator: Fix type conversion
w4123 Dec 19, 2024
9670a8f
linuxulator: Fix signal handler capability
w4123 Dec 19, 2024
983c885
linuxulator: Add some assertions for debugging
w4123 Dec 19, 2024
5549295
linuxulator: Fix capability copy error when handling signals
w4123 Dec 19, 2024
e0d18be
linuxulator: Try to fix signal handler
w4123 Dec 19, 2024
7a4f33d
linuxulator: Try to fix signal handler
w4123 Dec 19, 2024
3791a65
linuxulator: Fix capability issues in sigreturn
w4123 Dec 19, 2024
77303bc
linuxulator: Some attempt to properly fix signal context
w4123 Dec 19, 2024
82a8d0c
linuxulator: Some attempt to properly fix signal context
w4123 Dec 19, 2024
03dc043
linuxulator: Some attempt to properly fix signal context
w4123 Dec 19, 2024
6476604
linuxulator: Round offset correctly
w4123 Dec 19, 2024
3196448
linuxulator: Additional checks for l_siginfo_t
w4123 Dec 19, 2024
2f29f9e
linuxulator: Additional checks for l_siginfo_t
w4123 Dec 19, 2024
80734f8
linuxulator: Merge two sets of registers in signal handler
w4123 Dec 22, 2024
0287b5c
linuxulator: Merge two sets of registers in signal handler
w4123 Dec 22, 2024
178f190
linuxulator: Fix mq_notify
w4123 Dec 22, 2024
419decf
linuxulator: Fix mq_notify
w4123 Dec 22, 2024
5d8b431
linuxulator: Improve siginfo support for LINUX_SIGUSR1 and LINUX_SIGUSR2
w4123 Jan 4, 2025
04bda5a
linuxulator: Copy in capability correctly in linux_timer_create
w4123 Jan 4, 2025
2a6b041
linuxulator: copyin capabilities correctly in linux_rt_sigqueueinfo a…
w4123 Jan 4, 2025
da3f725
linuxulator: copy out siginfo correctly as well
w4123 Jan 4, 2025
c681e5e
linuxulator: Improve mmap related syscalls
w4123 Jan 4, 2025
fcdde4d
Regenerate syscalls
w4123 Jan 4, 2025
f74222d
linuxulator: Fix typo
w4123 Jan 4, 2025
2315832
Merge branch 'linuxulator-dev' of https://github.com/w4123/cheribsd i…
w4123 Jan 4, 2025
8626bf8
Regenerate syscalls
w4123 Jan 4, 2025
e67e3f9
linuxulator: Return EOPNOTSUPP when MAP_GROWSDOWN is specified in PCuABI
w4123 Jan 6, 2025
2c8569a
Merge branch 'linuxulator-dev' of https://github.com/w4123/cheribsd i…
w4123 Jan 6, 2025
8c4742c
linuxulator: Fix clone()
w4123 Jan 6, 2025
1a34d77
Regenerate syscalls
w4123 Jan 6, 2025
5a5bec9
linuxulator: Fix clone()
w4123 Jan 6, 2025
fd54540
Merge branch 'linuxulator-dev' of https://github.com/w4123/cheribsd i…
w4123 Jan 6, 2025
b1c34b8
linuxulator: Fix clone()
w4123 Jan 6, 2025
00da9de
linuxulator: Fix clone()
w4123 Jan 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"files.associations": {
"array": "c",
"bitset": "c",
"deque": "c",
"format": "c",
"initializer_list": "c",
"list": "c",
"queue": "c",
"random": "c",
"ranges": "c",
"regex": "c",
"span": "c",
"stack": "c",
"utility": "c",
"valarray": "c",
"vector": "c",
"xhash": "c",
"xstring": "c",
"xtree": "c",
"xutility": "c",
"__hash_table": "c",
"__split_buffer": "c",
"__tree": "c",
"hash_map": "c",
"hash_set": "c",
"map": "c",
"set": "c",
"string": "c",
"string_view": "c",
"unordered_map": "c",
"unordered_set": "c",
"simd": "c",
"chrono": "c",
"future": "c",
"system_error": "c",
"typeindex": "c",
"xlocale": "c",
"typeinfo": "c",
"*.inc": "c",
"thread": "c",
"__threading_support": "c",
"linux_emul.h": "c",
"linux.h": "c",
"linux32_proto.h": "c",
"__config": "cpp",
"__locale": "c"
}
}
3 changes: 2 additions & 1 deletion lib/libgeom/geom_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* SUCH DAMAGE.
*/

#include <cheri/cheric.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/disk.h>
Expand Down Expand Up @@ -74,7 +75,7 @@ geom_stats_resync(void)
err(1, "DIOCGMEDIASIZE(" _PATH_DEV DEVSTAT_DEVICE_NAME ")");

munmap(statp, npages * pagesize);
p = mmap(statp, mediasize, PROT_READ, MAP_SHARED, statsfd, 0);
p = mmap((void *)(uintptr_t)(uint64_t)(uintptr_t)statp, mediasize, PROT_READ, MAP_SHARED, statsfd, 0);
if (p == MAP_FAILED)
err(1, "mmap(/dev/devstat):");
else {
Expand Down
4 changes: 3 additions & 1 deletion lib/libsysdecode/errno.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ sysdecode_abi_to_freebsd_errno(enum sysdecode_abi abi, int error)
return (error);
#if defined(__aarch64__) || defined(__amd64__) || defined(__i386__)
case SYSDECODE_ABI_LINUX:
case SYSDECODE_ABI_LINUX32: {
case SYSDECODE_ABI_LINUX32:
case SYSDECODE_ABI_LINUX64: {
unsigned int i;

/*
Expand Down Expand Up @@ -80,6 +81,7 @@ sysdecode_freebsd_to_abi_errno(enum sysdecode_abi abi, int error)
#if defined(__aarch64__) || defined(__amd64__) || defined(__i386__)
case SYSDECODE_ABI_LINUX:
case SYSDECODE_ABI_LINUX32:
case SYSDECODE_ABI_LINUX64:
if (error >= 0 && error <= ELAST)
return (linux_errtbl[error]);
break;
Expand Down
10 changes: 10 additions & 0 deletions lib/libsysdecode/syscallnames.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ static
static
#ifdef __aarch64__
#include <arm64/linux/linux_syscalls.c>
#if __has_feature(capabilities)
static
#include <arm64/linux64/linux64_syscalls.c>
#endif
#elif __amd64__
#include <amd64/linux/linux_syscalls.c>
#else
Expand Down Expand Up @@ -93,6 +97,12 @@ sysdecode_syscallname(enum sysdecode_abi abi, unsigned int code)
if (code < nitems(linux_syscallnames))
return (linux_syscallnames[code]);
break;
#if __has_feature(capabilities)
case SYSDECODE_ABI_LINUX64:
if (code < nitems(linux64_syscallnames))
return (linux64_syscallnames[code]);
break;
#endif
#endif
#ifdef __amd64__
case SYSDECODE_ABI_LINUX32:
Expand Down
1 change: 1 addition & 0 deletions lib/libsysdecode/sysdecode.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ enum sysdecode_abi {
* value when merged upstream.
*/
SYSDECODE_ABI_FREEBSD64 = 100,
SYSDECODE_ABI_LINUX64 = 101,
};

int sysdecode_abi_to_freebsd_errno(enum sysdecode_abi _abi, int _error);
Expand Down
6 changes: 6 additions & 0 deletions sys/arm64/arm64/elf_machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,9 @@ elf64c_header_supported(const struct image_params *imgp,
{
uint32_t note_value;

const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header;
if (hdr->e_ident[EI_OSABI] == ELFOSABI_LINUX) return false;

if (get_benchmark_abi_note(imgp, &note_value))
return (note_value == 0);

Expand All @@ -280,6 +283,9 @@ elf64cb_header_supported(const struct image_params *imgp,
{
uint32_t note_value;

const Elf_Ehdr *hdr = (const Elf_Ehdr *)imgp->image_header;
if (hdr->e_ident[EI_OSABI] == ELFOSABI_LINUX) return false;

if (get_benchmark_abi_note(imgp, &note_value))
return (note_value == 1);

Expand Down
20 changes: 15 additions & 5 deletions sys/arm64/linux/linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@
#include <sys/abi_compat.h>

#include <compat/linux/linux.h>

#ifdef COMPAT_LINUX64
#include <arm64/linux64/linux64_syscall.h>
#else
#include <arm64/linux/linux_syscall.h>
#endif

#define LINUX_DTRACE linuxulator

Expand All @@ -43,7 +48,12 @@ typedef uint32_t l_uint;
typedef uint64_t l_ulong;
typedef uint16_t l_ushort;

#if defined(COMPAT_LINUX64) || defined(COMPAT_LINUX32)
typedef l_ulong l_uintptr_t;
#else
typedef uintcap_t l_uintptr_t;
#endif
typedef uintcap_t l_uintcap_t;
typedef l_long l_clock_t;
typedef l_int l_daddr_t;
typedef l_uint l_gid_t;
Expand Down Expand Up @@ -77,7 +87,7 @@ typedef struct {
#define l_fd_set fd_set

/* Miscellaneous */
#define LINUX_AT_COUNT 21 /* Count of used aux entry types.
#define LINUX_AT_COUNT 41 /* Count of used aux entry types.
* Keep this synchronized with
* linux_copyout_auxargs() code.
*/
Expand Down Expand Up @@ -157,7 +167,7 @@ struct l_newstat {
#define LINUX_SA_NOMASK 0x40000000 /* SA_NODEFER */
#define LINUX_SA_ONESHOT 0x80000000 /* SA_RESETHAND */

typedef void (*l_handler_t)(l_int);
typedef l_uintptr_t l_handler_t;

typedef struct {
l_handler_t lsa_handler;
Expand Down Expand Up @@ -189,10 +199,10 @@ struct linux_pt_regset {
l_ulong cpsr;
};


#ifdef _KERNEL
struct reg;
struct syscall_info;

void bsd_to_linux_regset(const struct reg *b_reg,
struct linux_pt_regset *l_regset);
void linux_to_bsd_regset(struct reg *b_reg,
Expand All @@ -202,9 +212,9 @@ void linux_ptrace_get_syscall_info_machdep(const struct reg *reg,
int linux_ptrace_getregs_machdep(struct thread *td, pid_t pid,
struct linux_pt_regset *l_regset);
int linux_ptrace_peekuser(struct thread *td, pid_t pid,
void *addr, void *data);
void * __capability addr, void * __capability data);
int linux_ptrace_pokeuser(struct thread *td, pid_t pid,
void *addr, void *data);
void * __capability addr, void * __capability data);
#endif /* _KERNEL */

#endif /* _ARM64_LINUX_H_ */
5 changes: 5 additions & 0 deletions sys/arm64/linux/linux_dummy_machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@
#include <sys/proc.h>
#include <sys/sdt.h>

#ifdef COMPAT_LINUX64
#include <arm64/linux64/linux.h>
#include <arm64/linux64/linux64_proto.h>
#else
#include <arm64/linux/linux.h>
#include <arm64/linux/linux_proto.h>
#endif
#include <compat/linux/linux_dtrace.h>
#include <compat/linux/linux_util.h>

Expand Down
9 changes: 8 additions & 1 deletion sys/arm64/linux/linux_locore.asm
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,28 @@

#include <machine/asm.h>

#ifdef COMPAT_LINUX64
#include <arm64/linux64/linux64_syscall.h>
#else
#include <arm64/linux/linux_syscall.h>
#endif

.data

.globl linux_platform
linux_platform:
.asciz "aarch64"

.text

EENTRY(__kernel_rt_sigreturn)
nop /* This is what Linux calls a "Mysterious NOP". */

.globl __user_rt_sigreturn
__user_rt_sigreturn:
#ifdef COMPAT_LINUX64
mov x8, #LINUX64_SYS_linux_rt_sigreturn
#else
mov x8, #LINUX_SYS_linux_rt_sigreturn
#endif
svc #0
EEND(__kernel_rt_sigreturn)
22 changes: 14 additions & 8 deletions sys/arm64/linux/linux_machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@

#include <vm/vm_param.h>

#ifdef COMPAT_LINUX64
#include <arm64/linux64/linux.h>
#include <arm64/linux64/linux64_proto.h>
#else
#include <arm64/linux/linux.h>
#include <arm64/linux/linux_proto.h>
#endif
#include <compat/linux/linux_fork.h>
#include <compat/linux/linux_misc.h>
#include <compat/linux/linux_util.h>
Expand All @@ -43,11 +48,11 @@


int
linux_set_upcall(struct thread *td, register_t stack)
linux_set_upcall(struct thread *td, void * __capability stack)
{

if (stack)
td->td_frame->tf_sp = stack;
td->td_frame->tf_sp = (uintcap_t)stack;

/*
* The newly created Linux thread returns
Expand All @@ -58,10 +63,10 @@ linux_set_upcall(struct thread *td, register_t stack)
}

int
linux_set_cloned_tls(struct thread *td, void *desc)
linux_set_cloned_tls(struct thread *td, void * __capability desc)
{

if ((uint64_t)desc >= VM_MAXUSER_ADDRESS)
if ((uint64_t)(uintcap_t)desc >= VM_MAXUSER_ADDRESS)
return (EPERM);

return (cpu_set_user_tls(td, desc));
Expand Down Expand Up @@ -113,19 +118,20 @@ linux_ptrace_getregs_machdep(struct thread *td __unused, pid_t pid __unused,
}

int
linux_ptrace_peekuser(struct thread *td, pid_t pid, void *addr, void *data)
linux_ptrace_peekuser(struct thread *td, pid_t pid, void * __capability addr, void * __capability data)
{

LINUX_RATELIMIT_MSG_OPT1("PTRACE_PEEKUSER offset %ld not implemented; "
"returning EINVAL", (uintptr_t)addr);
"returning EINVAL", (__cheri_addr long)addr);

return (EINVAL);
}

int
linux_ptrace_pokeuser(struct thread *td, pid_t pid, void *addr, void *data)
linux_ptrace_pokeuser(struct thread *td, pid_t pid, void * __capability addr, void * __capability data)
{

LINUX_RATELIMIT_MSG_OPT1("PTRACE_POKEUSER offset %ld "
"not implemented; returning EINVAL", (uintptr_t)addr);
"not implemented; returning EINVAL", (__cheri_addr long)addr);
return (EINVAL);
}
Loading