[osv-dev] [PATCH] aarch64: invalidate instruction cache after loading code into memory

2020-12-19 Thread Waldemar Kozaczuk
64 port, as this architecture has very strong automatic instruction/data cache consistency and there is no need to do anyting special like for aarch64. Fixes #1100 Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/mmu.cc | 19 +++ arch/x64/mmu.cc | 3 +++ core/mmu.cc

[osv-dev] [PATCH] aarch64: update syscall.h with correct numbers

2020-12-19 Thread Waldemar Kozaczuk
ff-by: Waldemar Kozaczuk --- include/api/aarch64/bits/syscall.h | 1211 +--- libc/syscall_to_function.h |2 + linux.cc |8 + 3 files changed, 588 insertions(+), 633 deletions(-) diff --git a/include/api/aarch64/bits/syscall.h b/in

[osv-dev] [PATCH] vfs: add minimal implementation of unlinkat

2020-12-19 Thread Waldemar Kozaczuk
what our version of unlinkat() implements for now. Signed-off-by: Waldemar Kozaczuk --- fs/vfs/main.cc | 9 + 1 file changed, 9 insertions(+) diff --git a/fs/vfs/main.cc b/fs/vfs/main.cc index 60e10b9f..55031380 100644 --- a/fs/vfs/main.cc +++ b/fs/vfs/main.cc @@ -1109,6 +1109,15 @@ int

[osv-dev] [PATCH] kernel: enforce object files are compiled with '-fno-pie'

2020-12-16 Thread Waldemar Kozaczuk
be loaded at specific address in memory. Fixes #1112 Signed-off-by: Waldemar Kozaczuk --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 12077105..a173c5ad 100644 --- a/Makefile +++ b/Makefile @@ -1853,6 +1853,8 @@ boost-libs := $(boost-lib-dir)/libbo

[osv-dev] [PATCH] aarch64: properly handle unexpected synchronous exceptions

2020-12-14 Thread Waldemar Kozaczuk
guest. Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/entry.S | 11 --- arch/aarch64/exceptions.cc | 14 ++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/arch/aarch64/entry.S b/arch/aarch64/entry.S index 606bad44..dea409a2 100644 --- a/arch/aarch64

[osv-dev] [PATCH] build: enforce Partial RELRO for internal apps

2020-12-13 Thread Waldemar Kozaczuk
telling gcc to use Partial RELRO mode for mkf.so, zfs.so and other internal apps and libraries regardless of what defaults are on given Linux distribution. Signed-off-by: Waldemar Kozaczuk --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index

[osv-dev] [PATCH] boot: early console code should not need symbol relocation

2020-11-24 Thread Waldemar Kozaczuk
vely makes it possible to build functional AArch64 OSv binaries on Ubuntu. Fixes #1112 Signed-off-by: Waldemar Kozaczuk --- Makefile | 12 1 file changed, 12 insertions(+) diff --git a/Makefile b/Makefile index d1597263..891f167e 100644 --- a/Makefile +++ b/Makefile @@ -295,6 +295

[osv-dev] [PATCH] aarch64: store ESR (Exception Syndrom Register) in the exception frame

2020-11-21 Thread Waldemar Kozaczuk
This patch fixes it but adding single line of assembly in entry.S to save ESR_EL1 under esr field of the frame. Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/entry.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/aarch64/entry.S b/arch/aarch64/entry.S index aafd76fb..606bad44 100644

[osv-dev] [PATCH] aarch64: implement dump_registers()

2020-11-21 Thread Waldemar Kozaczuk
This patch provides full implementation of dump_registers() to help diagnose exceptions. It lists state of all relevant registers including x0-x30, sp, esr (Exception Syndrom Register) and pstate (Processor State). Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/dump.cc | 19

[osv-dev] [PATCH V2] aarch64: support static TLS (Thread Local Storage)

2020-10-18 Thread Waldemar Kozaczuk
riteups/TLS/RFC-TLSDESC-ARM.txt. The version of this patch cleans up some debugging code that was part of the original patch. Fixes #1101 Signed-off-by: Waldemar Kozaczuk --- Makefile| 3 +- arch/aarch64/arch-elf.cc| 79 ++-- arch/aarc

[osv-dev] [PATCH] aarch64: support static TLS (Thread Local Storage)

2020-10-18 Thread Waldemar Kozaczuk
riteups/TLS/RFC-TLSDESC-ARM.txt. Fixes #1101 Signed-off-by: Waldemar Kozaczuk --- Makefile| 3 +- arch/aarch64/arch-elf.cc| 79 ++-- arch/aarch64/arch-elf.hh| 1 + arch/aarch64/arch-switch.hh | 81 +++-

[osv-dev] [PATCH] aarch64: fix memory mapping initialization when booting with #vCPUs >= 2

2020-10-09 Thread Waldemar Kozaczuk
vCPUs with KVM acceleration on. Fixes #1092 Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/boot.S | 2 ++ arch/aarch64/mmu.cc | 9 +++-- arch/aarch64/smp.cc | 4 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/aarch64/boot.S b/arch/aarch64/boot.S index aa0ae01c

[osv-dev] [PATCH] aarch64: implement sigsetjmp/siglongjmp

2020-10-07 Thread Waldemar Kozaczuk
that pass on aarch64 from 81 to 100. Finally this patch makes tst-setjmp.cc pass on aarch64. Signed-off-by: Waldemar Kozaczuk --- Makefile | 4 +-- libc/arch/aarch64/setjmp/block.c | 29 - libc/arch/aarch64/setjmp/siglongjmp.c

[osv-dev] [PATCH] tests: add simple tst-setjmp.cc to verify setjmp/longjmp/sigsetjmp/siglongjmp functionality

2020-10-07 Thread Waldemar Kozaczuk
This test fails on aarch64 until we fix broken setjmp/longjmp/sigsetjmp/siglongjmp for aarch64. Signed-off-by: Waldemar Kozaczuk --- modules/tests/Makefile | 2 +- tests/tst-setjmp.cc| 59 ++ 2 files changed, 60 insertions(+), 1 deletion(-) create

[osv-dev] [PATCH] aarch64: implement feenableexcept/fedisableexcept/fegetexcept

2020-10-06 Thread Waldemar Kozaczuk
because sigsetjmp/siglongjmp is still missing. Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/feexcept.cc | 70 ++-- 1 file changed, 61 insertions(+), 9 deletions(-) diff --git a/arch/aarch64/feexcept.cc b/arch/aarch64/feexcept.cc index 0d296314..9b0e9eec

[osv-dev] [PATCH] rename musl submodule to musl_0.9.12 and add new submodule musl_1.1.24

2020-09-20 Thread Waldemar Kozaczuk
ikernel/musl musl_1.1.24 pushd musl_1.1.24 && git checkout v1.1.24 && popd && git add musl_1.1.24 ``` and hopefully can be applied as a patch without any manual intervention. Signed-off-by: Waldemar Kozaczuk --- .gitmodules | 9 ++--- musl| 2 +-

[osv-dev] [PATCH] tests: added bionic based tst-stdio.cc unit test

2020-09-20 Thread Waldemar Kozaczuk
stdio is one of most delicate parts of libc/musl that needs better test coverage to have confidence that the musl upgrade is relatively bug-free. Signed-off-by: Waldemar Kozaczuk --- include/api/unistd.h |1 + tests/tst-stdio.cc | 2522 ++ 2 files changed

[osv-dev] [PATCH/RFC] Upgrade to musl 1.1.24

2020-09-06 Thread Waldemar Kozaczuk
ors 12 Fixed CURRENT_LOCALE problem and couple of other ones 13.Fixed stdio/ftell.c 14.Updated __tz.c with latest musl and dlfcn.c 15.Replaced encrypt.c with latest musl. Signed-off-by: Waldemar Kozaczuk --- Makefile | 133 ++- f

[osv-dev] [PATCH] libc: replace libc/internal/libm.h with a symlink to musl original

2020-08-30 Thread Waldemar Kozaczuk
et us replaces it with a symlink to original musl. Signed-off-by: Waldemar Kozaczuk --- libc/internal/libm.h | 177 +-- 1 file changed, 1 insertion(+), 176 deletions(-) mode change 100644 => 12 libc/internal/libm.h diff --git a/libc/internal/libm.

[osv-dev] [PATCH] headers: get rid of fenv.h copy

2020-08-28 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/feexcept.cc | 1 + arch/x64/feexcept.cc | 1 + include/api/__fenv.h | 15 +++ include/api/fenv.h | 32 +--- tests/tst-feexcept.cc| 1 + 5 files changed, 19 insertions(+), 31 deletions

[osv-dev] [PATCH] libc: drop 5 more headers with symlinks to musl copies

2020-08-28 Thread Waldemar Kozaczuk
replace the headers with symlinks we drop LFS64 in favor of aliases.ld mechanism which achieves the same goal. Signed-off-by: Waldemar Kozaczuk --- bsd/sys/cddl/compat/opensolaris/sys/stat.h | 1 + fs/ramfs/ramfs_vnops.cc| 1 + fs/vfs/main.cc

[osv-dev] [PATCH] libc: replace include/api/sys/eventfd.h with symlink to musl copy

2020-08-28 Thread Waldemar Kozaczuk
-by: Waldemar Kozaczuk --- include/api/sys/eventfd.h | 28 +--- linux.cc| 2 ++ 3 files changed, 4 insertions(+), 27 deletions(-) mode change 100644 => 12 include/api/sys/eventfd.h diff --git a/include/api/sys/eventfd.h b/include/api/

[osv-dev] [PATCH] libc: replace include/api/aarch64/bits/mman.h with a symlink to musl copy

2020-08-28 Thread Waldemar Kozaczuk
This file and its aarch64 equivalent differs only to musl copies by extra MAP_UNINITIALIZED macro. In order to drop this header we create extra __mman.h headers and use them in libc/mman.cc. Signed-off-by: Waldemar Kozaczuk --- include/api/aarch64/bits/__mman.h | 13 +++ include/api/aarch64

[osv-dev] [PATCH] libc: replace include/api/x64/bits/socket.h with a symlink to musl copy

2020-08-28 Thread Waldemar Kozaczuk
This file is identical to musl copy except for added #ifndef OSV_BITS_SOCKET_H ... which may have been necessary at some point but it is not now. Signed-off-by: Waldemar Kozaczuk --- include/api/x64/bits/socket.h | 23 +-- 1 file changed, 1 insertion(+), 22 deletions

[osv-dev] [PATCH] api: replace 3 more include/api headers with musl copies

2020-08-28 Thread Waldemar Kozaczuk
/stdint.h. Signed-off-by: Waldemar Kozaczuk --- include/api/aarch64/bits/alltypes.h.sh | 1 + include/api/aarch64/bits/stdint.h | 13 +- include/api/stdint.h | 110 +- include/api/stdio.h| 199 + include/api/x64/bits

[osv-dev] [PATCH] libc: replace 8 headers in include/api with their symlinked copies

2020-08-26 Thread Waldemar Kozaczuk
__bsd_unused2 we are reverting these files to musl copies with symlinks. Signed-off-by: Waldemar Kozaczuk --- include/api/mqueue.h | 37 +-- include/api/netinet/ip_icmp.h | 193 +- include/api/sys/sem.h | 75 + include/api/sys/shm.h

[osv-dev] [PATCH] bsd: rename __unused* macros to __bsd_unused* to avoid conflicts with musl headers

2020-08-26 Thread Waldemar Kozaczuk
will never start using field names like __bsd_unused. Alternatively we could have modified BSD source files to use __attribute__((unused)) directly without any macros. Signed-off-by: Waldemar Kozaczuk --- bsd/porting/bus.h | 2 +- bsd/porting/netport.h

[osv-dev] [PATCH 5/5] libc: replaced wcsftime files with their almost identical musl copies

2020-08-25 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- Makefile | 3 +-- libc/locale/wcsftime_l.c | 11 --- libc/time/wcsftime.c | 32 3 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 libc/locale/wcsftime_l.c delete mode 100644

[osv-dev] [PATCH 1/5] tests: added bionic-based unit test to test time libc functions

2020-08-25 Thread Waldemar Kozaczuk
document. Please note that some of the tests mostly related to strptime and strftime are commented out as they fail with current version of musl. Hopefully we will enable them once we upgrade to newer version of musl. Signed-off-by: Waldemar Kozaczuk --- tests/tst-time.cc | 698

[osv-dev] [PATCH 2/5] libc: copy time/__tz.c from musl as is

2020-08-25 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- libc/time/__tz.c | 389 +++ 1 file changed, 389 insertions(+) create mode 100644 libc/time/__tz.c diff --git a/libc/time/__tz.c b/libc/time/__tz.c new file mode 100644 index ..a76a7b48 --- /dev/null +++ b

[osv-dev] [PATCH 3/5] libc: replaced most libc/time/ files with their musl copies

2020-08-25 Thread Waldemar Kozaczuk
-off-by: Waldemar Kozaczuk --- Makefile| 25 +++-- libc/aliases.ld | 4 + libc/locale/strftime_l.c| 11 -- libc/syscall_to_function.h | 4 +- libc/time/__time.h | 9 -- libc/time/__time_to_tm.c| 88

[osv-dev] [PATCH 4/5] libc: replace langinfo with musl copies

2020-08-25 Thread Waldemar Kozaczuk
The relevant files under libc/locale and libc/time/__asctime.c are pretty much identical to their copies under musl/ so we are replacing them with current version. Signed-off-by: Waldemar Kozaczuk --- Makefile| 5 ++- libc/locale/langinfo.c | 61

[osv-dev] [PATCH] libc: replace string/strsignal.c with musl copy

2020-08-25 Thread Waldemar Kozaczuk
newer version of musl. I have also noticed that on Linux strsignal() returns messages ending with signal number like so: 'Unknown signal -1' whereas musl version simply returns 'Unknown signal' without the signal number. This might be fixed in future version of musl. Signed-off-b

[osv-dev] [PATCH] libc: replace floatscan.c, intscan.c and shgetc.c with the symlinks to its almost identical copies

2020-08-21 Thread Waldemar Kozaczuk
eir musl copies. Also, to make header inclusion work, we add a 2nd symlink (there is already one under libc/stdio) to shgetc.h. Please see the commit 5a1d4c2451a94809d1ad580272410d8c51e5171b for some background info. Signed-off-by: Waldemar Kozaczuk --- l

[osv-dev] [PATCH] fs:change uiomove() to use size_t in the signature instead of int

2020-08-17 Thread Waldemar Kozaczuk
size_t for n parameter. This patch fixes it. Fixes #1095 Signed-off-by: Waldemar Kozaczuk --- fs/vfs/subr_uio.cc | 4 ++-- include/osv/uio.h | 8 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/fs/vfs/subr_uio.cc b/fs/vfs/subr_uio.cc index bf138b8e..fdc89bd4 100644 --- a

[osv-dev] [PATCH 18/18] libc: replaced 6 files in /libc/stdio/ that uses syscall instruction with musl copies and macros

2020-08-14 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- Makefile | 18 - libc/aliases.ld| 3 +++ libc/stdio/__stdio_close.c | 7 - libc/stdio/__stdio_seek.c | 7 - libc/stdio/fopen.c | 32 -- libc/stdio/freopen.c | 55

[osv-dev] [PATCH 9/9] libc: replace locale/strcoll*.c (from old musl) with musl copy of locale/strcoll.c

2020-08-14 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- Makefile| 3 +-- libc/locale/strcoll.c | 6 -- libc/locale/strcoll_l.c | 11 --- 3 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 libc/locale/strcoll.c delete mode 100644 libc/locale/strcoll_l.c diff --git

[osv-dev] [PATCH 6/9] libc: replace locale/wcscoll*.c (from old musl) with musl copy of locale/wcscoll.c

2020-08-14 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- Makefile| 3 +-- libc/locale/wcscoll.c | 7 --- libc/locale/wcscoll_l.c | 10 -- 3 files changed, 1 insertion(+), 19 deletions(-) delete mode 100644 libc/locale/wcscoll.c delete mode 100644 libc/locale/wcscoll_l.c diff --git

[osv-dev] [PATCH 5/9] libc: replace locale/wcsxfrm*.c (from old musl) with musl copy of locale/wcsxfrm.c

2020-08-14 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- Makefile| 3 +-- libc/locale/wcsxfrm.c | 12 libc/locale/wcsxfrm_l.c | 10 -- 3 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 libc/locale/wcsxfrm.c delete mode 100644 libc/locale/wcsxfrm_l.c diff

[osv-dev] [PATCH 1/9] libc: replace iswctype_l and wctype_l.c with musl equivalent

2020-08-14 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- Makefile | 4 ++-- libc/locale/iswctype_l.c | 11 --- libc/locale/wctype_l.c | 10 -- 3 files changed, 2 insertions(+), 23 deletions(-) delete mode 100644 libc/locale/iswctype_l.c delete mode 100644 libc/locale/wctype_l.c

[osv-dev] [PATCH 8/9] libc: replace locale/strfmon.c with the musl copy

2020-08-14 Thread Waldemar Kozaczuk
/used. As a matter of fact dropping the statements 'fill = *++fmt;' and 'intl = *fmt++ == 'i';' affects fmt variable and possibly has a bug. TODO: Add a test. Signed-off-by: Waldemar Kozaczuk --- Makefile | 2 +- libc/locale/strfmon.c | 91 ---

[osv-dev] [PATCH 3/9] libc: drop towlower_l and towupper_l in favor of musl copies

2020-08-14 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- Makefile | 4 ++-- libc/locale/towlower_l.c | 10 -- libc/locale/towupper_l.c | 10 -- 3 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 libc/locale/towlower_l.c delete mode 100644 libc/locale/towupper_l.c

[osv-dev] [PATCH 7/9] libc: replace locale/strxfrm*.c (from old musl) with musl copy of locale/strxfrm.c

2020-08-14 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- Makefile| 3 +-- libc/locale/strxfrm.c | 9 - libc/locale/strxfrm_l.c | 10 -- 3 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 libc/locale/strxfrm.c delete mode 100644 libc/locale/strxfrm_l.c diff

[osv-dev] [PATCH 2/9] libc: drop OSv toupper_l in favor of musl copy and add alias __toupper_l

2020-08-14 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- Makefile| 2 +- libc/aliases.ld | 3 +++ libc/locale/toupper_l.c | 11 --- 3 files changed, 4 insertions(+), 12 deletions(-) delete mode 100644 libc/locale/toupper_l.c diff --git a/Makefile b/Makefile index 27f46011

[osv-dev] [PATCH 4/9] libc: drop setlocale.c and duplocale.c and add __setlocale alias

2020-08-14 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- Makefile| 4 ++-- libc/aliases.ld | 1 + libc/locale/duplocale.c | 15 --- libc/locale/setlocale.c | 13 - 4 files changed, 3 insertions(+), 30 deletions(-) delete mode 100644 libc/locale/duplocale.c delete

[osv-dev] [PATCH 1/2] tests: add verbatim copies of Bionic tests for w/ctype

2020-08-14 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- tests/tst-ctype.cc | 332 tests/tst-wctype.cc | 247 2 files changed, 579 insertions(+) create mode 100644 tests/tst-ctype.cc create mode 100644 tests/tst-wctype.cc diff --git a

[osv-dev] [PATCH 2/2] tests: adapted w/ctype tests to work with boost unittest and added tst-string

2020-08-14 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- modules/tests/Makefile | 2 +- tests/tst-ctype.cc | 123 - tests/tst-string.cc| 61 tests/tst-wctype.cc| 38 +++-- 4 files changed, 166 insertions(+), 58 deletions(-) create

[osv-dev] [PATCH] libc: replace some headers libc/internal with symlinks to identical copies under musl/src/

2020-08-14 Thread Waldemar Kozaczuk
copies which will save us time when upgrading musl. Hopefully, once we upgrade musl we might be able to get away from having many of the *.c files in libc/internal and delete the symlinks altogether as well. Signed-off-by: Waldemar Kozaczuk --- libc/internal/floatscan.h | 9 +-- libc/internal

[osv-dev] [PATCH] libc: point 3 more files from libc/ to musl/

2020-08-10 Thread Waldemar Kozaczuk
/strtok_r.c] 1a2 > #include 3c4,5 < char *strtok_r(char *restrict s, const char *restrict sep, char **restrict p) --- > #undef strtok_r > char *strtok_r(char *__restrict s, const char *__restrict sep, char > **__restrict p) 12a15,16 > > weak_alias(strtok_r, __strtok_r);

[osv-dev] [RFC 1] libc: replace syscall call with function calls using a macro

2020-08-09 Thread Waldemar Kozaczuk
nested preprocessor directives (preprocessor runs once). Signed-off-by: Waldemar Kozaczuk --- Makefile | 10 +++--- libc/aliases.ld| 3 +++ libc/syscall_to_function.h | 24 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644

[osv-dev] [RFC 2] libc: replace syscall call with variadic macro and inlined function

2020-08-09 Thread Waldemar Kozaczuk
d inlines and do not incur any extra function call overhead as it was checked by disassembling tmpnam.o. Signed-off-by: Waldemar Kozaczuk --- Makefile | 3 ++- libc/syscall_to_function.h | 15 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Makef

[osv-dev] [PATCH] libc: replace more include/api/ headers with their musl copies

2020-08-07 Thread Waldemar Kozaczuk
WTMP_FILE _PATH_WTMP > #define UTMP_FILENAME _PATH_UTMP > #define WTMP_FILENAME _PATH_WTMP - DIFF: [wctype.h] #define __NEED_wctrans_t <

[osv-dev] [PATCH] libc: replace weak_alias and wrapper functions with linker symbol copy mechanism

2020-08-05 Thread Waldemar Kozaczuk
/finite*.c files once we upgrade to musl 1.1.24 which provides the finite*( functions. Finally this patch also adds some simple unit tests to verify that modified functions still work. Signed-off-by: Waldemar Kozaczuk --- Makefile| 3 +-- libc/aliases.ld | 13 + libc

[osv-dev] [PATCH] libc: replace unistd/ttyname.c with the musl copy

2020-08-02 Thread Waldemar Kozaczuk
ans up OSv specific implementation of ttyname_r() - removes '\0' from a string and unnecessary return - per original review of Rean's patch. Finally, this patch effectively makes all files (*.c,*.cc) under libc/unistd/ "neutral" to future musl upgrades. Signed-off-b

[osv-dev] [PATCH] libc: replace include/api/ifaddrs.h with the symlink to its identical musl copy

2020-07-31 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- include/api/ifaddrs.h | 35 +-- 1 file changed, 1 insertion(+), 34 deletions(-) mode change 100644 => 12 include/api/ifaddrs.h diff --git a/include/api/ifaddrs.h b/include/api/ifaddrs.h deleted file mode 100644 in

[osv-dev] [PATCH] libc: replace identical headers with the symlinks to musl copies

2020-07-31 Thread Waldemar Kozaczuk
under musl/include. Signed-off-by: Waldemar Kozaczuk --- include/api/arpa/nameser_compat.h | 2 +- include/api/arpa/tftp.h | 31 +- include/api/errno.h | 27 + include/api/scsi/scsi.h | 150 +--- include/api/scsi/sg.h

[osv-dev] [PATCH] libc: replace two more files with the musl copies

2020-07-30 Thread Waldemar Kozaczuk
This patch removes two more files from libc directory that are pretty much identical to their musl equivalent: ``` DIFF: [/misc/basename.c] 2d1 < #include DIFF: [/network/h_errno.c] 8c8 < return &h_errno; --- > return &h_errno; ``` Signed-off-by: Waldemar Kozacz

[osv-dev] [PATCH] libc: revert more files with "#undef" to point back to musl

2020-07-28 Thread Waldemar Kozaczuk
Just like one of the earlier patches this one also removes more files from libc/ folder that only differ by "#undef" macro which is not necessary anymore. Signed-off-by: Waldemar Kozaczuk --- Makefile | 50 +++ libc/locale/isalnum_

[osv-dev] [PATCH] libc: remove more string functions from libc/ in favor of the original musl ones

2020-07-27 Thread Waldemar Kozaczuk
l these cases, but based on my understanding of the operator precedence in C, adding extra parentheses around '(x)-ONES' should not change the end result (the subtraction and negation should be evaluated first anyway followed by bitwise and). Signed-off-by: Waldemar Kozaczuk --- Makef

[osv-dev] [PATCH V2] libc: revert some files with "__restrict" to point back to musl

2020-07-27 Thread Waldemar Kozaczuk
nce and simply point to the original musl sources. This patch further eliminates unnecessary files in libc/ folder. Signed-off-by: Waldemar Kozaczuk --- Makefile | 30 ++-- libc/string/strcat.c | 7 --- libc/string/strcpy.c | 16 --- libc/string/strncat.c |

[osv-dev] [PATCH] libc: revert some files with "__restrict" to point back to musl

2020-07-27 Thread Waldemar Kozaczuk
nce and simply point to the original musl sources. This patch further eliminates unnecessary files in libc/ folder. Signed-off-by: Waldemar Kozaczuk --- Makefile | 30 ++-- libc/string/strcat.c | 7 --- libc/string/strcpy.c | 16 --- libc/string/strncat.c |

[osv-dev] [PATCH] libc: revert some files with "#undef" to point back to musl

2020-07-27 Thread Waldemar Kozaczuk
not have to do it anymore so this patch simply removes those files from libc/ folder and changes Makefile to point back to the musl equivalent ones. Signed-off-by: Waldemar Kozaczuk --- Makefile | 26 +- libc/network/htonl.c | 9 - libc/network/htons.c

[osv-dev] [PATCH] scripts: enhance run.py to allow running aarch64 images with KVM enabled

2020-07-20 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- scripts/run.py | 41 ++--- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/scripts/run.py b/scripts/run.py index ee08d901..6d4cc9c1 100755 --- a/scripts/run.py +++ b/scripts/run.py @@ -14,6 +14,8 @@ devnull

[osv-dev] [PATCH] licenses: add newlib license

2020-07-19 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- licenses/newlib.txt | 55 + 1 file changed, 55 insertions(+) create mode 100644 licenses/newlib.txt diff --git a/licenses/newlib.txt b/licenses/newlib.txt new file mode 100644 index ..5d78cc16 --- /dev

[osv-dev] [PATCH] aarch64: fix memmove bug

2020-07-19 Thread Waldemar Kozaczuk
versions of these functions have been heavily optimized for speed. Fixes #1090 Signed-off-by: Waldemar Kozaczuk --- Makefile | 5 +- arch/aarch64/memcpy.S | 230 + arch/aarch64/memmove.S | 155 arch/aarch64/memset.S | 240 ++ arch

[osv-dev] [PATCH] aarch64: support building unit tests image

2020-07-14 Thread Waldemar Kozaczuk
ot work on aarch64. For now we should somehow disable adding to the aarch64 test image. Signed-off-by: Waldemar Kozaczuk --- modules/tests/Makefile | 104 +++ modules/tests/add_aarch64_boost_libraries.sh | 11 ++ scripts/build

[osv-dev] [PATCH 2/2] aarch64: parse and activate virtio mmio devices

2020-07-13 Thread Waldemar Kozaczuk
aarch64 version of firecracker. Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/arch-dtb.cc | 46 ++ arch/aarch64/arch-dtb.hh | 7 ++ arch/aarch64/arch-setup.cc | 10 +++-- drivers/virtio-mmio.cc | 16 - drivers/virtio-mmio.hh

[osv-dev] [PATCH 1/2] aarch64: support virtio mmio devices

2020-07-13 Thread Waldemar Kozaczuk
This is a pretty trivial patch that adds support of virtio net and block devices over mmio for aarch64 architecture. It accomplishes it by adding proper factory methods to register relevant interrupt handlers. Signed-off-by: Waldemar Kozaczuk --- Makefile | 1 + drivers/virtio

[osv-dev] [PATCH] debugging: enhance loader.py to support both x64 and aarch64

2020-07-09 Thread Waldemar Kozaczuk
: Waldemar Kozaczuk --- scripts/loader.py | 95 +-- 1 file changed, 75 insertions(+), 20 deletions(-) diff --git a/scripts/loader.py b/scripts/loader.py index c59d7e6f..8ee021e8 100644 --- a/scripts/loader.py +++ b/scripts/loader.py @@ -8,8 +8,8 @@ import

[osv-dev] [PATCH] debugging: fix loader.py to handle "osv runqueue" properly

2020-07-08 Thread Waldemar Kozaczuk
to help us navigate runqueue in a more resilient way. Signed-off-by: Waldemar Kozaczuk --- scripts/loader.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/loader.py b/scripts/loader.py index 6270d980..c59d7e6f 100644 --- a/scripts/loader.py +++ b/scripts/loader.py

[osv-dev] [PATCH] dynamic linker: fix the old bug in the logic to calculate the ELF base

2020-07-08 Thread Waldemar Kozaczuk
there are multiple PT_LOAD and non-PT_LOAD headers sharing the same p_vaddr value, it ends up using wrong header and then overwriting other segments data. This patch fixes it by separating filtering of PT_LOAD headers and indentifying the lowest and highest ones. Signed-off-by: Waldemar Kozaczuk

[osv-dev] [PATCH] aarch64: until MSI-X support becomes functional do not try to setup vqueue MSI-X vector

2020-07-06 Thread Waldemar Kozaczuk
This patch is a follow up to the previous commit b98cd8dc851282bd1b53860460831f77c63b18b3 and disables the logic to set MSI-X vector when setting up vqueues. Refs #1088 Signed-off-by: Waldemar Kozaczuk --- drivers/virtio-pci-device.cc | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions

[osv-dev] [PATCH] scripts: support running aarch64 rofs images

2020-07-06 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- scripts/run.py | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/run.py b/scripts/run.py index 9e2ed146..c226056e 100755 --- a/scripts/run.py +++ b/scripts/run.py @@ -72,7 +72,7 @@ def set_imgargs(options

[osv-dev] [PATCH] aarch64: until MSI-X support becomes functional enable regular PCI interrupt

2020-07-03 Thread Waldemar Kozaczuk
tested yet) and execute an app from it. Signed-off-by: Waldemar Kozaczuk --- drivers/virtio-pci-device.cc | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/virtio-pci-device.cc b/drivers/virtio-pci-device.cc index 378332ff..c7420747 100644 --- a/drivers/virtio-pci-device.cc +++ b

[osv-dev] [PATCH V2] serial console: refactor common logic to allow re-use when implementing mmio version

2020-06-21 Thread Waldemar Kozaczuk
: Waldemar Kozaczuk --- Makefile | 1 + drivers/{isa-serial.cc => isa-serial-base.cc} | 47 drivers/{isa-serial.hh => isa-serial-base.hh} | 23 ++-- drivers/isa-serial.cc | 106 +- drivers/isa-ser

[osv-dev] [PATCH] serial console: refactor common logic to allow re-use when implementing mmio version

2020-06-20 Thread Waldemar Kozaczuk
: Waldemar Kozaczuk --- Makefile | 1 + drivers/isa-serial-base.cc | 85 drivers/isa-serial-base.hh | 76 + drivers/isa-serial.cc | 110 +++-- drivers/isa-serial.hh | 17 +- 5

[osv-dev] [PATCH] pthreads: expose pthread_attr_getscope() symbol properly

2020-06-12 Thread Waldemar Kozaczuk
declaration to export the symbol properly: ```C pthread_attr_getscope ``` Signed-off-by: Waldemar Kozaczuk --- libc/pthread.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/pthread.cc b/libc/pthread.cc index 2f0afb7f..60158b31 100644 --- a/libc/pthread.cc +++ b/libc

[osv-dev] [PATCH] readme: revise and add new information

2020-05-10 Thread Waldemar Kozaczuk
This patch revises the readme by adding information about some new features introduced by new upcoming release. It also enriches it by adding links to relevant Wiki pages to better explain existing capabilities of OSv. Signed-off-by: Waldemar Kozaczuk --- README.md | 358

[osv-dev] [PATCH] module.py: replace "is" literal with "==" to make Python 3.8 happy

2020-05-05 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- scripts/module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/module.py b/scripts/module.py index d7128388..8a1a5406 100755 --- a/scripts/module.py +++ b/scripts/module.py @@ -110,7 +110,7 @@ def make_cmd(cmdline, j, jobserver

[osv-dev] [PATCH V2 4/4] gcc 10: fix duplicate linker symbol errors

2020-05-05 Thread Waldemar Kozaczuk
All of the sudden gcc 10 linker has found number of duplicate ZFS related symbols which this patch fixes: - g_zfs - aok - zfsdev_state Signed-off-by: Waldemar Kozaczuk --- bsd/cddl/contrib/opensolaris/cmd/zfs/zfs_util.h | 2 +- bsd/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c

[osv-dev] [PATCH 4/4] gcc 10: fix duplicate linker symbol errors

2020-05-05 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- bsd/cddl/contrib/opensolaris/cmd/zfs/zfs_util.h | 2 +- bsd/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h | 2 +- .../contrib/opensolaris/lib/libzfs/common/libzfs_util.c | 2 -- .../contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c | 8

[osv-dev] [PATCH 1/4] pthreads: add stubs for new *clockwait/*clocklock functions to fix gcc 10 errors

2020-05-05 Thread Waldemar Kozaczuk
a stub (nobody ever complained...), pthread_mutex_clocklock() can also be a stub. I think this will be easy, and hopefully work." Signed-off-by: Waldemar Kozaczuk --- include/api/pthread.h | 2 ++ libc/pthread.cc | 16 2 files changed, 18 insertions(+) diff --git a/inc

[osv-dev] [PATCH 3/4] zfs: replace strncpy with safer strlcpy which is detected by gcc 10

2020-05-05 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c b/bsd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c

[osv-dev] [PATCH 2/4] gcc 10: fix warnings but including various standard headers in couple of files

2020-05-05 Thread Waldemar Kozaczuk
All of the sudden new gcc 10 complains about some missing types definitions so we make it happy by including proper headers in right places. Signed-off-by: Waldemar Kozaczuk --- arch/x64/string-ssse3.cc | 1 + include/osv/index-list.hh | 2 ++ tests/tst-sendfile.cc | 1 + tests/tst-tcp

[osv-dev] [PATCH] run.py: add support of mounting directory via virtiofs device

2020-05-01 Thread Waldemar Kozaczuk
rtiofs /tmp/virtiofs/hello' -V Signed-off-by: Waldemar Kozaczuk --- scripts/run.py | 26 ++ 1 file changed, 26 insertions(+) diff --git a/scripts/run.py b/scripts/run.py index 95cca87b..9e2ed146 100755 --- a/scripts/run.py +++ b/scripts/run.py @@ -172,6 +172,13 @@ def

[osv-dev] [PATCH] loader: add option to mount extra filesystem

2020-05-01 Thread Waldemar Kozaczuk
sing /tools/mountfs which has to be already present in the image. Here is a cmdline example of mounting virtio-fs filesystem: '--mount-fs=virtiofs,/dev/virtiofs1,/tmp/virtiofs /tmp/virtiofs/hello' Signed-off-by: Waldemar Koza

[osv-dev] [PATCH V3 1/2] pagecache: refactor to allow integration with non-ZFS filesystems

2020-04-28 Thread Waldemar Kozaczuk
by non-ZFS filesystem implementations to register cached file pages into page cache. Signed-off-by: Waldemar Kozaczuk --- core/pagecache.cc| 200 +-- fs/vfs/vfs_fops.cc | 2 +- include/osv/pagecache.hh | 1 + include/osv/vfs_file.hh | 2

[osv-dev] [PATCH V3 2/2] rofs: optimize memory utilization by integrating with page cache

2020-04-28 Thread Waldemar Kozaczuk
- rofs_map_cached_page() - that ensures that requested page of a file is loaded from disk into ROFS cache (by triggering read from disk if missing) and eventually registers the page into pagecache by calling pagecache::map_read_cached_page(). This partially addresses #979 Signed-off-by: Waldemar

[osv-dev] [PATCH 1/2] make: add new uniform kernel.elf artifact intended for direct-kernel boot mode

2020-04-10 Thread Waldemar Kozaczuk
firecracker and qemu '-kernel' mode and can be used to boot with either ZFS or ROFS disk. This patch alse changes firecracker.elf and run.py with '-k' option to use kernel.elf instead of loader.elf to boot OSv from. Signed-off-by: Waldemar Kozaczuk --- Makefil

[osv-dev] [PATCH 2/2] build: allow building kernel-less ZFS and ROFS disk images

2020-04-10 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- scripts/build | 55 +++--- scripts/upload_manifest.py | 10 ++- 2 files changed, 48 insertions(+), 17 deletions(-) diff --git a/scripts/build b/scripts/build index dbf1a9d7..5265ad67 100755 --- a/scripts/b

[osv-dev] [PATCH] sysfs: add new pseudo-files free_page_ranges and pools to help monitor memory utilization

2020-04-07 Thread Waldemar Kozaczuk
yer. Signed-off-by: Waldemar Kozaczuk --- core/mempool.cc | 58 - fs/sysfs/sysfs_vnops.cc | 51 include/osv/mempool.hh | 21 +++ 3 files changed, 129 insertions(+), 1 deletion(-) diff --git a/c

[osv-dev] [PATCH V2 3/3] rofs: optimize memory utilization by integrating with page cache

2020-04-06 Thread Waldemar Kozaczuk
- rofs_map_cached_page() - that ensures that requested page of a file is loaded from disk into ROFS cache (by triggering read from disk if missing) and eventually registers the page into pagecache by calling pagecache::map_read_cached_page(). This partially addresses #979 Signed-off-by: Waldemar

[osv-dev] [PATCH 3/3] rofs: optimize memory utilization by integrating with page cache

2020-04-03 Thread Waldemar Kozaczuk
page of a file is loaded from disk into ROFS cache (by triggering read from disk if missing) and eventually registers the page into pagecache by calling pagecache::map_read_cached_page(). This partially addresses #979 Signed-off-by: Waldemar Kozaczuk --- fs/rofs/rofs.hh | 2 ++ fs/rofs

[osv-dev] [PATCH 1/3] vfs: store and track filesystem ID

2020-04-03 Thread Waldemar Kozaczuk
This patch adds new field m_fsid to filesystem configuration structure to identify which filesystem (zfs, rofs, etc) given vnode belongs to. This becomes necessary to properly refactor logic in pagecache. Signed-off-by: Waldemar Kozaczuk --- .../opensolaris/uts/common/fs/zfs/zfs_vfsops.c | 10

[osv-dev] [PATCH 2/3] pagecache: refactor to allow integration with non-ZFS filesystems

2020-04-03 Thread Waldemar Kozaczuk
by non-ZFS filesystem implementations to register cached file pages into page cache. Signed-off-by: Waldemar Kozaczuk --- core/pagecache.cc| 176 --- fs/vfs/vfs_fops.cc | 2 +- include/osv/pagecache.hh | 1 + include/osv/vfs_file.hh | 2

[osv-dev] [PATCH V5 2/2] mempool: use map_anon() for large allocations or when memory is fragmented

2020-03-29 Thread Waldemar Kozaczuk
bject_size() needed to be adjusted to work with new malloc_large() implementation. It was discovered that therefore other related issues are fixed by this patch as well. Lastly this patch adds new test verifying realloc() and malloc_usable_size(). Fixes #784 Fixes #854 Fixes #1077 Signed-off-by

[osv-dev] [PATCH V5 1/2] mempool: fix a bug in page_range_allocator() when handling worst case O(n) scenario

2020-03-29 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- core/mempool.cc | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/mempool.cc b/core/mempool.cc index d902eea8..11fd1456 100644 --- a/core/mempool.cc +++ b/core/mempool.cc @@ -702,10 +702,13 @@ page_range* page_range_allocator::alloc

[osv-dev] [PATCH V4 2/2] mempool: use map_anon() for large allocations or when memory is fragmented

2020-03-26 Thread Waldemar Kozaczuk
t verifying realloc() and malloc_usable_size(). Signed-off-by: Waldemar Kozaczuk --- core/mempool.cc| 66 +++-- modules/tests/Makefile | 2 +- tests/tst-realloc.cc | 94 ++ 3 files changed, 149 insertions(+), 13 deletions(-)

[osv-dev] [PATCH V3 2/2] mempool: use map_anon() for large allocations or when memory is fragmented

2020-03-25 Thread Waldemar Kozaczuk
nd < 2MB that cannot be satisfied when mamory is fragmented. It is supposed to help OSv memory allocation behave better when memory in free_page_ranges is heavily fragmented and large allocations (>=2MB) cannot be satisfied with single contiguous page range. Fixes #854 Signed-off-by

[osv-dev] [PATCH V2 1/2] mempool: fix a bug in page_range_allocator() when handling worst case O(n) scenario

2020-03-23 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- core/mempool.cc | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/mempool.cc b/core/mempool.cc index d902eea8..11fd1456 100644 --- a/core/mempool.cc +++ b/core/mempool.cc @@ -702,10 +702,13 @@ page_range* page_range_allocator::alloc

<    1   2   3   4   5   6   7   >