[osv-dev] [PATCH] trace: add mechanism to resolve application symbols

2023-04-03 Thread Waldemar Kozaczuk
approach is that 'trace.py prof' works much faster as it simply reads new file .symbols instead of calling addr2line against loader.elf for each symbol which can take half a minute or longer. Signed-off-by: Waldemar Kozaczuk --- scripts/loader.py| 21 + scripts/osv/debug.py | 36

[osv-dev] [PATCH] trace.py: inspect backtrace filename in a safe manner

2023-04-03 Thread Waldemar Kozaczuk
Some collected tracepoints may have missing the filename field. So before trying to filter the frames by filename test if it is present. Signed-off-by: Waldemar Kozaczuk --- scripts/osv/trace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/osv/trace.py b/scripts

[osv-dev] [PATCH] prof.py: remove extra noise from profiler stack traces

2023-04-03 Thread Waldemar Kozaczuk
Eliminate any tracepoint code specific frames from the profiler backtraces. Signed-off-by: Waldemar Kozaczuk --- scripts/osv/prof.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/osv/prof.py b/scripts/osv/prof.py index 2de0d4ac..edb8a5c1 100644 --- a/scripts/osv/prof.py +++ b

[osv-dev] [PATCH] loader.py: use with statement when writing trace file

2023-04-03 Thread Waldemar Kozaczuk
The 'osv trace2file' does not work with python3 so let us fix it by replacing the code to open and write to a file with more portable and succinct "with" construct. Signed-off-by: Waldemar Kozaczuk --- scripts/loader.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)

[osv-dev] [PATCH] libc: add __wcsncpy_chk() to support python 3.10

2022-11-07 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- Makefile| 1 + libc/string/__wcsncpy_chk.c | 15 +++ 2 files changed, 16 insertions(+) create mode 100644 libc/string/__wcsncpy_chk.c diff --git a/Makefile b/Makefile index fcc55e29..b8d5d924 100644 --- a/Makefile +++ b

[osv-dev] [PATCH] aarch64: enable JIT in java tests

2022-10-14 Thread Waldemar Kozaczuk
. Signed-off-by: Waldemar Kozaczuk --- modules/java-tests/Makefile | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/java-tests/Makefile b/modules/java-tests/Makefile index e5a046cb..4646fc08 100644 --- a/modules/java-tests/Makefile +++ b/modules/java-tests

[osv-dev] [PATCH] memory: move malloc virtual address space below 0x800000000000

2022-10-13 Thread Waldemar Kozaczuk
0407de000 407de000 7f822000 rwxp normal page 6000407de000 407de000 7f822000 rwxp normal mempool Fixes #1196 Fixes #1145 Fixes #1157 Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/arch-setup.cc | 5 ++--- core/mmu.cc| 2 +- include/osv/mmu-defs.hh| 4 ++--

[osv-dev] [PATCH] futex: add benchmark test

2022-09-06 Thread Waldemar Kozaczuk
7 (4 500 2) shows OSv peformance worse by ~30% even when number of futex calls is pretty low. Possibly there is a flaw in this test, or some kind of different explanation. Signed-off-by: Waldemar Kozaczuk --- modules/tests/Makefile | 3 +- tests/misc-futex-per

[osv-dev] [PATCH 8/8] lazy stack: new tracepoint for stack pre-faults

2022-08-30 Thread Waldemar Kozaczuk
, exception_frame*) page_fault ex_pf memory::page_pool::l1::alloc_page() untracked_alloc_page memory::alloc_page() std_malloc(unsigned long, unsigned long) malloc operator new(unsigned long) lookup sys_lstat Signed-off-by: Waldemar Kozaczuk --- core/mmu.cc | 11 +++ 1 file

[osv-dev] [PATCH 7/8] lazy stack: activate lazy stack in pthreads

2022-08-30 Thread Waldemar Kozaczuk
This patch adds new mmap flag - mmap_stack - that is used when mmaping a stack when creating new pthread. This new flag is only used when the build parameter CONF_lazy_stack is enabled. Signed-off-by: Waldemar Kozaczuk --- include/osv/mmu-defs.hh | 1 + libc/mman.cc| 7 +-- libc

[osv-dev] [PATCH 5/8] lazy stack: ensure next stack page conditionally if interrupts and preemption enabled

2022-08-30 Thread Waldemar Kozaczuk
cheap. With sampler on other hand, the performance is only affected when starting or stoping the sampler which is quite rare. Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/interrupt.cc | 5 + core/sampler.cc | 31 +++ core/trace.cc | 17

[osv-dev] [PATCH 6/8] lazy stack: prevent deadlock when taking vma_list_mutex for write

2022-08-30 Thread Waldemar Kozaczuk
experienced when testing one of the apps when the page fault handler and mmu::vm_fault() function would try to take the same vma_list_mutex for read. Signed-off-by: Waldemar Kozaczuk --- core/mmu.cc | 17 + 1 file changed, 17 insertions(+) diff --git a/core/mmu.cc b/core/mmu.cc

[osv-dev] [PATCH 4/8] lazy stack: ensure next stack page dynamically if preemption enabled

2022-08-30 Thread Waldemar Kozaczuk
-off-by: Waldemar Kozaczuk --- core/sched.cc| 24 include/osv/sched.hh | 17 + runtime.cc | 3 +++ 3 files changed, 44 insertions(+) diff --git a/core/sched.cc b/core/sched.cc index 1e109694..65842ff3 100644 --- a/core/sched.cc +++ b

[osv-dev] [PATCH 3/8] lazy stack: ensure next stack page statically

2022-08-30 Thread Waldemar Kozaczuk
enabled otherwise code in DROP_LOCK would not work. Also all of those end up calling some form of thread::wait() method that asserts that both interrupts and interrupts are enabled. To validate the reasoning, we add relevant invariants before we pre-fault the stack. Signed-off-by: Waldemar Kozaczuk

[osv-dev] [PATCH 2/8] lazy stack: do nothing in kernel threads and on populated stack

2022-08-30 Thread Waldemar Kozaczuk
_irq_disabled() mostly around preemption_timer to indicate that we should not pre-fault the stack downstream Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/exceptions.cc | 3 ++ arch/aarch64/interrupt.cc | 3 ++ arch/x64/exceptions.cc | 3 ++ arch/x64/mmu.cc| 2 +- ar

[osv-dev] [PATCH 1/8] lazy stack: inline assembly to pre-fault stack

2022-08-30 Thread Waldemar Kozaczuk
ated invariants that will help us to reason about the code and whether we should do nothing, pre-fault stack "blindly" or conditionally. The remaining 7 patches mostly add the pre-fault code in relevant places but also annotate code with some invariants using assert(). Signed-

[osv-dev] [PATCH] trace: do not use malloc/free when interrupts are disabled

2022-08-28 Thread Waldemar Kozaczuk
the vector ahead of time and then simply copy the trace buffer to a relevant spot in the vector. Signed-off-by: Waldemar Kozaczuk --- core/trace.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/trace.cc b/core/trace.cc index 60fa18b9..dc69c807 100644 --- a/core

[osv-dev] [PATCH] aarch64 trace: make compiler pick a register instead of x0

2022-08-28 Thread Waldemar Kozaczuk
likely a typo as I am sure the intention was to use '%0' instead of 'x0' to let compiler correctly pick a register instead of using any garbage in the x0 register. Fixes #1158 Fixes #1195 Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/arch.hh | 2 +- 1 file changed, 1 insertion(+), 1

[osv-dev] [PATCH] routecache: handle case when sent to our non-loopback address

2022-07-23 Thread Waldemar Kozaczuk
ted to the Spirent fork of OSv - https://github.com/SpirentOrion/osv/commit/f6e6e54ba14a7e9c1e04574769d0dd1832d66b92. Co-authored-by: "Jan-Michael Kho" Co-authored-by: Waldemar Kozaczuk Signed-off-by: Waldemar Kozaczuk --- bsd/sys/net/routecache.hh | 25 +++-- 1 fil

[osv-dev] [PATCH] zfs: allow mounting and building on host

2022-07-16 Thread Waldemar Kozaczuk
./scripts/build image=native-example fs=rofs_with_zfs -j$(nproc) --use-openzfs ./scripts/build image=native-example fs=rofs -j$(nproc) --use-openzfs --create-zfs-disk Fixes #1068 Signed-off-by: Waldemar Kozaczuk --- modules/zfs-tools/usr.manifest | 1 + scripts/build | 51

[osv-dev] [PATCH] tests: fix misc-zfs-arc.cc

2022-07-16 Thread Waldemar Kozaczuk
This patch also enhances this test to make it support running with ZFS mounted from non-root. Signed-off-by: Waldemar Kozaczuk --- bsd/sys/cddl/compat/opensolaris/sys/mman.h| 1 + .../opensolaris/uts/common/fs/zfs/arc.c | 4 +- modules/tests/Makefile| 11

[osv-dev] [PATCH] zpool import: do not try devices where ZFS is mounted

2022-07-16 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- .../lib/libzfs/common/libzfs_import.c | 48 +-- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/bsd/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c b/bsd/cddl/contrib/opensolaris/lib/libzfs/common

[osv-dev] [PATCH] tests: add misc-zfs-io to all images

2022-07-16 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- modules/tests/Makefile | 4 ++-- tests/misc-zfs-io.cc | 6 -- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/tests/Makefile b/modules/tests/Makefile index 7d15522c..d1732e75 100644 --- a/modules/tests/Makefile +++ b/modules/tests

[osv-dev] [PATCH] zfs: support building rofs+zfs image and second ZFS disk

2022-07-16 Thread Waldemar Kozaczuk
/vblk1.1,/data /tests/misc-zfs-io.so --random --file-path /data/file' --second-disk-image build/release/zfs_disk.img Fixes #1200 Signed-off-by: Waldemar Kozaczuk --- scripts/build | 59 ++ scripts/export_manifest.py | 7 ++--- scripts/run.py

[osv-dev] [PATCH] vfs: support mounting ZFS from non-root partition

2022-07-16 Thread Waldemar Kozaczuk
-by: Waldemar Kozaczuk --- Makefile | 2 +- bootfs.manifest.skel | 2 +- drivers/zfs.cc | 12 - exported_symbols/osv_libsolaris.so.symbols | 1 + fs/vfs/main.cc | 52

[osv-dev] [PATCH] devfs: print details of mounted partition

2022-07-16 Thread Waldemar Kozaczuk
Print information about the partition and offset child device is created for. This is very helpful to understand the process of mounting the filesystems. Signed-off-by: Waldemar Kozaczuk --- fs/devfs/device.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/devfs/device.cc b/fs/devfs

[osv-dev] [PATCH] zfs: refactor loader to handle loading libsolaris.so

2022-07-16 Thread Waldemar Kozaczuk
#1200 Signed-off-by: Waldemar Kozaczuk --- loader.cc | 61 --- 1 file changed, 27 insertions(+), 34 deletions(-) diff --git a/loader.cc b/loader.cc index ee05033b..3db560e1 100644 --- a/loader.cc +++ b/loader.cc @@ -406,6 +406,31 @@ static

[osv-dev] [PATCH] zfs: use spa_dev_path instead of defaulting to /dev/vblk0.1

2022-07-16 Thread Waldemar Kozaczuk
to import the ZFS root pool from in spa_import_rootpool() function called by ZFS mount disk process and then used by vdev_alloc() downstream. Refs #1200 Signed-off-by: Waldemar Kozaczuk --- bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c | 1 + .../cddl/contrib/opensolaris/uts/common/fs

[osv-dev] [PATCH] syscalls: allocate local iovec copies on the stack instead of the heap

2022-06-28 Thread Waldemar Kozaczuk
nformation in progress. Co-authored-by: "Timmons C. Player" Co-authored-by: Waldemar Kozaczuk Signed-off-by: Waldemar Kozaczuk --- bsd/sys/kern/uipc_syscalls.cc | 26 -- fs/vfs/vfs_syscalls.cc| 14 ++ modules/tests/Makefile| 8 ++-

[osv-dev] [PATCH] virtio-blk: Use multiplex strategy for I/O

2022-06-28 Thread Waldemar Kozaczuk
Firecracker do not provide the VIRTIO_BLK_F_SEG_MAX capability, in which case our driver behaves as if there was no limit which is also the old behavior. Co-authored-by: "Timmons C. Player" Co-authored-by: Waldemar Kozaczuk Signed-off-by: Waldemar Kozaczuk --- drivers/virtio-b

[osv-dev] [PATCH] loader: don't leak directory entries when processing init entries

2022-06-28 Thread Waldemar Kozaczuk
This commit originates from the Spirent fork of OSv - https://github.com/SpirentOrion/osv/commit/502fa31d631bba073e7bb9bc7ce6623e9159dbdd Authored-by: "Timmons C. Player" Reviewed-by: Waldemar Kozaczuk Signed-off-by: Waldemar Kozaczuk --- loader.cc | 1 + 1 file changed, 1 insertio

[osv-dev] [PATCH] x64: fix direct kernel mode boot on qemu

2022-06-27 Thread Waldemar Kozaczuk
. Besides adding DISCARD rule to the linker script this patch also cleans some issue with the assembly code to add the elf notes in entry-xen.S. Signed-off-by: Waldemar Kozaczuk --- arch/x64/entry-xen.S | 4 +++- arch/x64/loader.ld | 5 + 2 files changed, 8 insertions(+), 1 deletion

[osv-dev] [PATCH] iconv: use stubs if iconv functions not used by an app

2022-06-27 Thread Waldemar Kozaczuk
--git a/libc/locale/iconv_stubs.cc b/libc/locale/iconv_stubs.cc new file mode 100644 index ..4c7b7d7d --- /dev/null +++ b/libc/locale/iconv_stubs.cc @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2022 Waldemar Kozaczuk + * + * This work is open source software, licensed under the terms

[osv-dev] [PATCH] libc: fix bugs in if_nametoindex/if_indextoname

2022-06-07 Thread Waldemar Kozaczuk
and adapted to run using boot unit test framework. Fixes #1096 Co-authored-by: Charles Myers Co-authored-by: Waldemar Kozaczuk Signed-off-by: Waldemar Kozaczuk --- Makefile| 6 +- bsd/sys/compat/linux/linux.h| 1 + bsd/sys/compat/linux/linux_ioctl.cc | 33

[osv-dev] [PATCH] libc: use musl implementation of getifaddrs and if_nameindex

2022-06-05 Thread Waldemar Kozaczuk
-by: Waldemar Kozaczuk --- Makefile| 6 +- libc/network/__netlink.h| 4 + libc/network/getifaddrs.c | 252 libc/network/if_nameindex.c | 58 - 4 files changed, 8 insertions(+), 312 deletions(-) create mode 100644 libc/network

[osv-dev] [PATCH 10/10] netlink: enable it and add unit test

2022-06-03 Thread Waldemar Kozaczuk
This changes bsd/net.cc to enables netlink by registering netlink domain and calling netlink_init(). It also adds a unit test to verify the netlink implementation. Signed-off-by: Waldemar Kozaczuk --- bsd/net.cc | 5 + modules/tests/Makefile | 3 +- tests/tst-netlink.c| 441

[osv-dev] [PATCH 09/10] netlink: set negative errno in error responses

2022-06-03 Thread Waldemar Kozaczuk
The netlink specfication requires that error field contains a negative value of errno. Signed-off-by: Waldemar Kozaczuk --- bsd/sys/compat/linux/linux_netlink.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsd/sys/compat/linux/linux_netlink.cc b/bsd/sys/compat/linux

[osv-dev] [PATCH 08/10] netlink: made some functions static

2022-06-03 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- bsd/sys/compat/linux/linux_netlink.cc | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bsd/sys/compat/linux/linux_netlink.cc b/bsd/sys/compat/linux/linux_netlink.cc index 180d81b5..be9ea1b8 100644 --- a/bsd/sys/compat/linux

[osv-dev] [PATCH 06/10] netlink: return stashed pid

2022-06-03 Thread Waldemar Kozaczuk
ant code that builds netlink responses to put the nl_pid stashed during socket attach process to set it as value of inlmsg_pid. It also re-implements the netlink_sockaddr() to make it return information including the source PID. Signed-off-by: Waldemar Kozaczuk --- bsd/sys/compat/linux/l

[osv-dev] [PATCH 07/10] netlink: fix error handling

2022-06-03 Thread Waldemar Kozaczuk
accordingly instead of making sendmsg() return error. Signed-off-by: Waldemar Kozaczuk --- bsd/sys/compat/linux/linux_netlink.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bsd/sys/compat/linux/linux_netlink.cc b/bsd/sys/compat/linux/linux_netlink.cc index 82205d2b..180d81b5

[osv-dev] [PATCH 05/10] netlink: stash nl_pid into netlinkcb

2022-06-03 Thread Waldemar Kozaczuk
This enhances the netlink_attach() to capture or generate the source nl_pid (if 0) and save it in the control back that could be fetched later when necessary. This will be useful in the next patch. Signed-off-by: Waldemar Kozaczuk --- bsd/sys/compat/linux/linux_netlink.cc | 25

[osv-dev] [PATCH 04/10] netlink: do not put IFA_BROADCAST for loopback address

2022-06-03 Thread Waldemar Kozaczuk
This is a minor adjustment to make OSv implementation match what Linux does - skip IFA_BROADCAST attributes for loopback address in NEWADDR response. Signed-off-by: Waldemar Kozaczuk --- bsd/sys/compat/linux/linux_netlink.cc | 14 ++ 1 file changed, 10 insertions(+), 4 deletions

[osv-dev] [PATCH 03/10] netlink: IFA_ADDRESS needs to go first

2022-06-03 Thread Waldemar Kozaczuk
. This does not seem to be documented anywhere but Linux sends RTM_NEWADDR responses with the IFA_ADDRESS attribute first so we follow suit. Signed-off-by: Waldemar Kozaczuk --- bsd/sys/compat/linux/linux_netlink.cc | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bsd

[osv-dev] [PATCH 02/10] netlink: set LINUX_RTM_NEWADDR and LINUX_RTM_NEWNEIGH on responses

2022-06-03 Thread Waldemar Kozaczuk
if it is wrong. Signed-off-by: Waldemar Kozaczuk --- bsd/sys/compat/linux/linux_netlink.cc | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bsd/sys/compat/linux/linux_netlink.cc b/bsd/sys/compat/linux/linux_netlink.cc index bc02bb7f..ea0cf609 100644 --- a/bsd

[osv-dev] [PATCH 01/10] netlink: minimal Linux rtnetlink support

2022-06-03 Thread Waldemar Kozaczuk
ach() - netlink_bind() - netlink_output() - netlink_process_msg() - netlink_process_getlink_msg() - netlink_process_getaddr_msg() - netlink_process_getneigh_msg() Most other pru_* functions delegate to raw_usrreqs as is. Authored-by: Charles Myers Signed-off-by: Waldemar Kozaczuk --- Makef

[osv-dev] [PATCH] vfs: implement renameat()

2022-05-20 Thread Waldemar Kozaczuk
This patch implements the renameat() function and enhances tst-rename.cc to unit test it. This patch also exposes renameat as a syscall. #Refs 1188 Signed-off-by: Waldemar Kozaczuk --- exported_symbols/osv_ld-musl.so.1.symbols | 1 + exported_symbols/osv_libc.so.6.symbols| 1 + fs/vfs

[osv-dev] [PATCH] multibyte: add __mbstowcs_chk

2022-05-20 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- Makefile| 1 + libc/multibyte/__mbstowcs_chk.c | 17 + 2 files changed, 18 insertions(+) create mode 100644 libc/multibyte/__mbstowcs_chk.c diff --git a/Makefile b/Makefile index 3e87a16d..19a4571b 100644

[osv-dev] [PATCH V2] syscall: implement getdents64

2022-05-20 Thread Waldemar Kozaczuk
that is then called by syscall in linux.cc. For details of how this function works please look at the comments. This patch also adds a unit test to verify this syscall works. Refs #1188 Signed-off-by: Waldemar Kozaczuk --- fs/vfs/main.cc | 65 linux.cc

[osv-dev] [PATCH] syscall: implement getcwd

2022-05-20 Thread Waldemar Kozaczuk
#Refs 1188 Signed-off-by: Waldemar Kozaczuk --- linux.cc | 15 +++ tests/tst-syscall.cc | 7 +++ 2 files changed, 22 insertions(+) diff --git a/linux.cc b/linux.cc index dd0dabd1..85c08981 100644 --- a/linux.cc +++ b/linux.cc @@ -366,6 +366,20 @@ static int

[osv-dev] [PATCH V2] vfs: implement symlinkat

2022-05-20 Thread Waldemar Kozaczuk
V2: The implementation uses vfs_fun_at2() instead of vfs_fun_at() to further simplify code. We also expose symlinkat though syscall. This patch implements the symlinkat() function and enhances tst-symlink.cc to unit test it. #Refs 1188 Signed-off-by: Waldemar Kozaczuk --- exported_symbols

[osv-dev] [PATCH V2] unlinkat: fill the gaps in the implementation

2022-05-20 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- fs/vfs/main.cc | 12 +++- linux.cc| 1 + tests/tst-remove.cc | 18 -- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/fs/vfs/main.cc b/fs/vfs/main.cc index 1b7eb588..9b2e2c02 100644 --- a/fs/vfs/main.cc

[osv-dev] [PATCH V2] vfs: refactor the *at() functions

2022-05-20 Thread Waldemar Kozaczuk
. So this patch makes vfs more DRY by introducing a helper function - vfs_fun_at() - which implements common logic and executed a lambda function specific to given VFS action. This patch also adds some unit tests around readlinkat() and mkdirat(). #Refs 1188 Signed-off-by: Waldemar Kozaczuk

[osv-dev] [PATCH] syscall: implement getdents64

2022-05-18 Thread Waldemar Kozaczuk
a unit test to verify this syscall works. Refs #1188 Signed-off-by: Waldemar Kozaczuk --- fs/vfs/main.cc | 68 + linux.cc | 4 ++ modules/tests/Makefile | 2 +- tests/tst-getdents.cc | 111 + 4 files changed

[osv-dev] [PATCH] vfs: implement symlinkat

2022-05-17 Thread Waldemar Kozaczuk
This patch implements the symlinkat() function and enhances tst-symlink.cc to unit test it. Signed-off-by: Waldemar Kozaczuk --- exported_symbols/osv_ld-musl.so.1.symbols | 1 + exported_symbols/osv_libc.so.6.symbols| 1 + fs/vfs/main.cc| 12 tests

[osv-dev] [PATCH] unlinkat: fill the gaps in the implementation

2022-05-17 Thread Waldemar Kozaczuk
This patch enhances the unlinkat() implementation to handle the AT_FDCWD dirfd and AT_REMOVEDIR flags. We also enhance tst-remove.cc to test unlinkat. Signed-off-by: Waldemar Kozaczuk --- fs/vfs/main.cc | 18 ++ tests/tst-remove.cc | 18 -- 2 files changed

[osv-dev] [PATCH] vfs: refactor the *at() functions

2022-05-17 Thread Waldemar Kozaczuk
by introducing a helper function - vfs_fun_at() - which implements common logic and executed a lambda function specific to given VFS action. This patch also adds some unit tests around readlinkat() and mkdirat(). Signed-off-by: Waldemar Kozaczuk --- fs/vfs/main.cc | 188

[osv-dev] [PATCH] syscall: support getgid, getuid, lseek and statfs

2022-05-16 Thread Waldemar Kozaczuk
This patch adds 4 new syscalls that map one-to-one to the four functions listed in the title above. These are required to run SeaweedFS on OSv. Refs #1188 Signed-off-by: Waldemar Kozaczuk --- linux.cc | 5 + 1 file changed, 5 insertions(+) diff --git a/linux.cc b/linux.cc index d3823d00

[osv-dev] [PATCH] sysconf: handle _SC_MINSIGSTKSZ and _SC_SIGSTKSZ

2022-05-11 Thread Waldemar Kozaczuk
New versions (>= ~1.74) of boost unit test library used by some of our tests started using sysconf() with argument _SC_SIGSTKSZ to determine size of the signal stack size. This patch enhances the sysconf() implementation to handle _SC_MINSIGSTKSZ and _SC_SIGSTKSZ. Signed-off-by: Walde

[osv-dev] [PATCH] tests: detect boost setup errors

2022-05-11 Thread Waldemar Kozaczuk
error pattern detection logic in testing.py. This patch adds one more failure pattern. Signed-off-by: Waldemar Kozaczuk --- scripts/tests/testing.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/tests/testing.py b/scripts/tests/testing.py index a1cdec35..50

[osv-dev] [PATCH] libc: implement _dl_find_object()

2022-05-11 Thread Waldemar Kozaczuk
that for now we do not populate the dlfo_link_map field as it is not clear what exactly goes it there and how it is used. We may need to revisit this later. Signed-off-by: Waldemar Kozaczuk --- exported_symbols/osv_libc.so.6.symbols | 1 + include/api/__dlfcn.h | 26

[osv-dev] [PATCH] elf: capture address of PT_GNU_EH_FRAME

2022-05-11 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- core/elf.cc| 5 - include/osv/elf.hh | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/elf.cc b/core/elf.cc index 5170bf53..c96a45ec 100644 --- a/core/elf.cc +++ b/core/elf.cc @@ -124,6 +124,7 @@ object::object(program

[osv-dev] [PATCH] scripts: expand %(libgcc_s_dir) when generating usr.manifest

2022-05-10 Thread Waldemar Kozaczuk
0f6a040) at core/sched.cc:1267 #19 sched::thread_main_c (t=0x80f6a040) at arch/x64/arch-switch.hh:325 #20 0x402fda43 in thread_main () at arch/x64/entry.S:116 Signed-off-by: Waldemar Kozaczuk --- scripts/build | 32 scripts/module.py |

[osv-dev] [PATCH] scripts: tweak loader.py to load libstdc++.so.*-gdb.py on Ubuntu 22.04

2022-05-10 Thread Waldemar Kozaczuk
On newest version of Ubuntu, the location of the python script libstdc++.so.*-gdb.py has moved to a subdirectory under /usr/share/gcc/python. This patch tweaks the relevant logic to try this new place if the /usr/share/gcc-*/python does not work. Signed-off-by: Waldemar Kozaczuk --- scripts

[osv-dev] [PATCH] aarch64: parse correctly cpu nodes in DTB tree

2022-05-10 Thread Waldemar Kozaczuk
ry CPUs to come up. So this patch fixes the code to parse the /cpus node by iterating over all subnodes but filtering only those that have the 'device_type' property set to 'cpu'. This patch also combines dtb_parse_cpus_count() and dtb_parse_cpus_mpid() into a single dtb_parse_cpus() funct

[osv-dev] [PATCH] libc: add number of glibc _chk extension functions

2022-05-09 Thread Waldemar Kozaczuk
in here as an example - http://refspecs.linux-foundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/libc---wmemset-chk-1.html. Signed-off-by: Waldemar Kozaczuk --- Makefile | 5 + exported_symbols/osv_libc.so.6.symbols | 5 + libc/multibyte

[osv-dev] [PATCH] aarch64: fix zfs support

2022-05-03 Thread Waldemar Kozaczuk
misc-zfs-io.cc work as well. Fixes #1131 Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/mmu.cc| 57 ++ scripts/build | 20 ++--- scripts/upload_manifest.py | 10 +-- 3 files changed, 74 insertions(+), 13 deletions(-) diff

[osv-dev] [PATCH] aarch64: implement signal handler

2022-05-03 Thread Waldemar Kozaczuk
enables 3 unit tests to run on aarch64. Fixes #1154 Fixes #1151 Fixes #1152 Fixes #1153 Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/entry.S | 52 + arch/aarch64/exceptions.hh | 2 +- arch/aarch64/signal.cc | 115 +++-- scripts

[osv-dev] [PATCH] aarch64: force TLB flush when mprotect changes permission

2022-05-03 Thread Waldemar Kozaczuk
when the protection vma operation completes. In future we may optimize it. Signed-off-by: Waldemar Kozaczuk --- core/mmu.cc | 8 1 file changed, 8 insertions(+) diff --git a/core/mmu.cc b/core/mmu.cc index 62aebc35..007d4331 100644 --- a/core/mmu.cc +++ b/core/mmu.cc @@ -242,7 +242,15

[osv-dev] [PATCH] aarch64: build tst-elf-permissions.cc with correctly named sections

2022-05-03 Thread Waldemar Kozaczuk
the relevant ifdef directives to make it build correctly on each arch. Signed-off-by: Waldemar Kozaczuk --- tests/tst-elf-permissions.cc | 10 ++ 1 file changed, 10 insertions(+) diff --git a/tests/tst-elf-permissions.cc b/tests/tst-elf-permissions.cc index 3b704787..4ff045a4 100644 --- a/tests

[osv-dev] [PATCH] lockfree ring_spsc: make counter type a template parameter

2022-05-03 Thread Waldemar Kozaczuk
this change this unit test would run for almost 3 minutes on aarch64 and almost 10 seconds on x64. Now it executes way under a second and still verifies the same edge condition (see 1ba76eb03cba4431b557183d1001b16991cd1fa4). Signed-off-by: Waldemar Kozaczuk --- include/lockfree/ring.hh

[osv-dev] [PATCH] aarch64: handle exceptions on dedicated stack

2022-04-28 Thread Waldemar Kozaczuk
v to allow runing Golang apps on AArch64. Fixes #1155 Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/arch-cpu.hh | 1 + arch/aarch64/arch-switch.hh | 12 +++-- arch/aarch64/arch-thread-state.hh | 3 ++ arch/aarch64/entry.S | 73 +-- ar

[osv-dev] [PATCH] aarch64: handle system calls

2022-04-28 Thread Waldemar Kozaczuk
for page faults. Please note the resulting enhancements are enough to make tst-syscall.so pass. Fixes #1156 Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/entry.S | 26 ++ linux.cc | 10 ++ modules/tests/Makefile | 4 ++-- 3 files changed, 38

[osv-dev] [PATCH] aarch64: enable tst-ifaddrs.so

2022-04-28 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- modules/tests/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/tests/Makefile b/modules/tests/Makefile index 9ea648f7..ca489341 100644 --- a/modules/tests/Makefile +++ b/modules/tests/Makefile @@ -133,7 +133,7 @@ tests

[osv-dev] [PATCH] aarch64: adapt tst-syscall.cc to work on aarch64

2022-04-28 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- tests/tst-syscall.cc | 46 +--- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/tests/tst-syscall.cc b/tests/tst-syscall.cc index 79332ad6..12722f1b 100644 --- a/tests/tst-syscall.cc +++ b/tests/tst

[osv-dev] [PATCH V2] aarch64: move kernel to 63rd GB of virtual memory

2022-04-28 Thread Waldemar Kozaczuk
7f7b2000 rwxp normal page a0004084e000 4084e000 7f7b2000 rwxp normal mempool Fixes #1087 Changes since V1: removed some code from loader.cc that got acidentally added as part of the initial version of the patch. Signed-off-by: Waldemar Kozaczuk --- Makefile | 27

[osv-dev] [PATCH] aarch64: move kernel to 63rd GB of virtual memory

2022-04-20 Thread Waldemar Kozaczuk
7f7b2000 rwxp normal page a0004084e000 4084e000 7f7b2000 rwxp normal mempool Fixes #1087 Signed-off-by: Waldemar Kozaczuk --- Makefile | 27 +--- arch/aarch64/arch-dtb.cc | 10 +-- arch/aarch64/arch-mmu.hh | 1 + arch/aarch64/arch-setup.cc | 10

[osv-dev] [PATCH] aarch64: fix atomic_fetchadd_int and atomic_fetchadd_long

2022-04-20 Thread Waldemar Kozaczuk
note the FreeBSD version of the code uses ldxr/stxr instructions instead of ldaxr/stlxr ones with require/release memory ordering semantics which are excessive for atomic_fetchadd_*(). Fixes #1189 Fixes #1190 Signed-off-by: Waldemar Kozaczuk --- bsd/aarch64/machine/atomic.h | 46 +++

[osv-dev] [PATCH] mmap: avoid collisions with linear map

2022-03-16 Thread Waldemar Kozaczuk
vma_range_set instead of vma_list to find next hole. That way it can avoid collisions described in the issue #1135. Fixes #1135 Signed-off-by: Waldemar Kozaczuk --- core/mmu.cc | 76 + include/osv/mmu.hh | 31 ++ include/osv/prio.hh | 1

[osv-dev] [PATCH] loader.py: add linear_mmap command

2022-03-16 Thread Waldemar Kozaczuk
7f92d000 rwxp normal mempool Signed-off-by: Waldemar Kozaczuk --- scripts/loader.py | 29 + 1 file changed, 29 insertions(+) diff --git a/scripts/loader.py b/scripts/loader.py index e39299bf..cfa87e0c 100644 --- a/scripts/loader.py +++ b/scripts/loader.py @@ -1643,11

[osv-dev] [PATCH] sysfs: support linear_maps

2022-03-16 Thread Waldemar Kozaczuk
virtio_mmio_cfg 0x8000406d3000 0x406d3000 7f92d000 rwxp n main 0x9000406d3000 0x406d3000 7f92d000 rwxp n page 0xa000406d3000 0x406d3000 7f92d000 rwxp n mempool Signed-off-by: Waldemar Kozaczuk --- core/mmu.cc | 12 fs/sysfs

[osv-dev] [PATCH] mmu: track linear mmap

2022-03-16 Thread Waldemar Kozaczuk
sysfs pseudo file. Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/arch-setup.cc | 20 +++- arch/x64/apic.cc | 2 +- arch/x64/arch-setup.cc | 11 --- arch/x64/dmi.cc| 4 ++-- arch/x64/ioapic.cc | 2 +- bsd/porting/mmu.cc | 2

[osv-dev] [PATCH] aarch64: improve unexpected exception handling

2022-03-13 Thread Waldemar Kozaczuk
h improves the unexpected exception handling by defining proper handlers for each exception level and exception type. When exception is triggered corresponding handler prints exception type, exception level and all registers and aborts potentially printing a backtrace. Signed-off-by: Waldema

[osv-dev] [PATCH] build: support app version script

2022-03-11 Thread Waldemar Kozaczuk
/app_version_script Please note that some application use dlsym() to dynamically resolve symbols which would be missed by this technique. In such scenarios such symbols would have to be manually added to app_version_script. Fixes #1110 Signed-off-by: Waldemar Kozaczuk --- Makefile

[osv-dev] [PATCH V2] build: support driver profiles

2022-03-07 Thread Waldemar Kozaczuk
addresses #1110 Signed-off-by: Waldemar Kozaczuk --- Makefile | 109 -- arch/aarch64/arch-dtb.cc | 7 ++ arch/aarch64/arch-setup.cc| 41 +- arch/aarch64/boot.S | 3 + arch/aarch64/cpuid.cc

[osv-dev] [PATCH] build: support driver profiles

2022-02-08 Thread Waldemar Kozaczuk
image=native-example drivers_profile=base #most drivers out 3036K build/release/kernel-stripped.elf Partially addresses #1110 Signed-off-by: Waldemar Kozaczuk --- Makefile | 109 -- arch/aarch64/arch-dtb.cc | 7 ++ arch

[osv-dev] [PATCH] PVH boot: move the code to a separate file

2022-02-08 Thread Waldemar Kozaczuk
This patch moves the PVH boot logic handling code out of xen.cc into a new file pvh-boot.cc. This is necessary to support building kernels with a specific set of device drivers. Signed-off-by: Waldemar Kozaczuk --- Makefile | 1 + arch/x64/pvh-boot.cc | 40

[osv-dev] [PATCH] cpuid: make internal functions static

2022-02-08 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- arch/x64/cpuid.cc | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x64/cpuid.cc b/arch/x64/cpuid.cc index 45c0fea4..29bc8d6e 100644 --- a/arch/x64/cpuid.cc +++ b/arch/x64/cpuid.cc @@ -68,7 +68,7 @@ cpuid_bit cpuid_bits

[osv-dev] [PATCH 2/2] add module API symbols to exported list

2022-01-16 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- Makefile| 2 +- exported_symbols/osv_module_api.symbols | 10 ++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 exported_symbols/osv_module_api.symbols diff --git a/Makefile b/Makefile index

[osv-dev] [PATCH] httpserver-monitoring-api: stop using kernel internal C++ API

2022-01-16 Thread Waldemar Kozaczuk
, we link httpserver monitoring app with core/options.cc and thus remove need to have those symbols exposed by the kernel. Signed-off-by: Waldemar Kozaczuk --- modules/httpserver-api/api/fs.cc | 42 ++ modules/httpserver-api/api/hardware.cc | 23 +--- modules

[osv-dev] [PATCH 1/2] add new C-wrappers to expose module API

2022-01-16 Thread Waldemar Kozaczuk
by adding 9 more functions intended to be used by httpserver monitoring api module. Please note that new C-style API will open up access to relevant functionality to new apps/modules implemented in languages different than C++. Signed-off-by: Waldemar Kozaczuk --- core/osv_c_wrappers.cc

[osv-dev] [PATCH] lua: change build process to download artifacts from lua binaries

2022-01-13 Thread Waldemar Kozaczuk
themselves will stop compiling at which point we will need to upgrade those and possibly lua and luarocks itself. Also please note that lua module no longer depends on version of lua installed on host if any. Fixes #1166 Signed-off-by: Waldemar Kozaczuk --- modules/cli/Makefile | 15 +-- modules

[osv-dev] [PATCH] tst-tls-pie.so: use printf in the init functions

2022-01-08 Thread Waldemar Kozaczuk
lifecycle it is called. Signed-off-by: Waldemar Kozaczuk --- tests/tst-tls.cc | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/tst-tls.cc b/tests/tst-tls.cc index 58154382..da09ca1e 100644 --- a/tests/tst-tls.cc +++ b/tests/tst-tls.cc @@ -50,11 +50,15 @@ __thre

[osv-dev] [PATCH] sysconf: support _SC_THREAD_STACK_MIN and _SC_LINE_MAX

2022-01-03 Thread Waldemar Kozaczuk
of _SC_LINE_MAX and this patch makes sysconf handle this parameter as well. Signed-off-by: Waldemar Kozaczuk --- runtime.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runtime.cc b/runtime.cc index 64a9b225..10c72cca 100644 --- a/runtime.cc +++ b/runtime.cc @@ -362,6 +362,8 @@ long sysconf(int

[osv-dev] [PATCH] musl: add tfind and tsearch

2022-01-03 Thread Waldemar Kozaczuk
New version of libtsm.so used by cli app needs tfind() and tsearch() symbols and this patch modifies the Makefile to add their musl implementations. Signed-off-by: Waldemar Kozaczuk --- Makefile | 3 +++ exported_symbols/osv_ld-musl.so.1.symbols | 2

[osv-dev] [PATCH] libc: add __sysconf alias

2022-01-03 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- exported_symbols/osv_libc.so.6.symbols | 1 + libc/aliases.ld| 1 + 2 files changed, 2 insertions(+) diff --git a/exported_symbols/osv_libc.so.6.symbols b/exported_symbols/osv_libc.so.6.symbols index 1854f6a8..8b6c8af4 100644

[osv-dev] [PATCH] setup.py: support Ubuntu 21.10

2022-01-03 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- scripts/setup.py | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/setup.py b/scripts/setup.py index 43b1b0a6..8cb7ca78 100755 --- a/scripts/setup.py +++ b/scripts/setup.py @@ -272,6 +272,13 @@ class Ubuntu(object

[osv-dev] [PATCH] libc: implement posix_madvise

2021-12-21 Thread Waldemar Kozaczuk
-by: Waldemar Kozaczuk --- .../aarch64/osv_ld-musl-aarch64.so.1.symbols | 1 + exported_symbols/aarch64/osv_libc.so.6.symbols | 1 + .../x64/osv_ld-musl-x86_64.so.1.symbols| 1 + exported_symbols/x64/osv_libc.so.6.symbols | 1 + libc/mman.cc

[osv-dev] [PATCH] virtio: fix the bug of reading queue msix vector

2021-12-16 Thread Waldemar Kozaczuk
of warning: cloud-hypervisor: 55.151472ms: WARN:virtio-devices/src/transport/pci_common_config.rs:169 -- invalid virtio register word read: 0x1 Signed-off-by: Waldemar Kozaczuk --- drivers/virtio-pci-device.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virtio-pci

[osv-dev] [PATCH 2/2] zfs: extract zfs code as optional libsolaris.so

2021-12-15 Thread Waldemar Kozaczuk
ests/misc-zfs-io.cc as well as running stress test of MySQL on ZFS image. Fixes #1009 Signed-off-by: Waldemar Kozaczuk --- Makefile | 51 bootfs.manifest.skel | 1 + bsd/init.cc | 7 --- bsd/porting/shrinker.cc | 22 +++-- core

[osv-dev] [PATCH 1/2] zfs: expose some symbols in solaris part of bsd code

2021-12-15 Thread Waldemar Kozaczuk
. These symbols need to be exposed for the main user of libsolaris.so - libzfs.so. Signed-off-by: Waldemar Kozaczuk --- .../opensolaris/kern/opensolaris_kmem.c | 3 + .../opensolaris/kern/opensolaris_taskq.c | 12 ++-- .../cddl/contrib/opensolaris/common/avl/avl.c | 25 +++ .../opensolaris

  1   2   3   4   5   6   >