[osv-dev] [PATCH V2] Move kernel to 0x40200000 address (1 GiB higher) in virtual memory

2019-06-19 Thread Waldemar Kozaczuk
locally in HVM mode Fixes #1043 Signed-off-by: Waldemar Kozaczuk --- Makefile | 7 +- arch/x64/arch-setup.cc| 39 ++ arch/x64/boot.S | 41 +--- arch/x64/entry-xen.S | 3 ++- arch/x64/loader.ld

[osv-dev] [PATCH] Move kernel to 0x40200000 address (1 GiB higher) in virtual memory

2019-06-15 Thread Waldemar Kozaczuk
higher at the end of the 2GiB limit (small memory model) and thus support virtually any non-PIE built using small memory model. Fixes #1043 Signed-off-by: Waldemar Kozaczuk --- Makefile | 6 +++-- arch/x64/arch-setup.cc| 39 +--- arch/x64/boot.S

[osv-dev] [PATCH] Change vmlinux_entry64 to switch to protected mode and jump to start32

2019-06-14 Thread Waldemar Kozaczuk
the vmlinux boot code (used with firecracker) by making sure that all data segment registers (ES, DS, etc) are setup correctly to point to OSv GDT table (see start32) which is critical when kernel is not mapped 1:1. Signed-off-by: Waldemar Kozaczuk --- arch/x64/boot.S | 28 +++ arch

[osv-dev] [PATCH] Make rebuilding loader.elf automatic and more efficient when changing kernel_base

2019-06-08 Thread Waldemar Kozaczuk
re-built when kernel_base is changed. Signed-off-by: Waldemar Kozaczuk --- Makefile | 8 ++-- arch/aarch64/arch-dtb.cc | 1 + arch/aarch64/arch.hh | 2 +- arch/x64/arch-setup.cc | 1 + arch/x64/arch.hh | 2 +- arch/x64/boot16.S

[osv-dev] [PATCH] Start using memory below kernel

2019-06-04 Thread Waldemar Kozaczuk
almost 10M of memory. Fixes #1012 Signed-off-by: Waldemar Kozaczuk --- arch/x64/arch-setup.cc | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/x64/arch-setup.cc b/arch/x64/arch-setup.cc index 9317dd25..62236486 100644 --- a/arch/x64/arch-setup.cc +++ b/arch

[osv-dev] [PATCH] Allow running non-PIE executables that do not collide with kernel

2019-06-01 Thread Waldemar Kozaczuk
using -Wl,-Ttext-segment,0x?? option. 2) Change kernel_base in OSv makefile to a higher address that makes it not collide with the executable (for example 0xa0); most non-PIEs by default load at 0x40 Signed-off-by: Waldemar Kozaczuk --- core/elf.cc| 35

[osv-dev] [PATCH] Provide full implementation of epoll_pwait

2019-06-01 Thread Waldemar Kozaczuk
This patch provides full implementation of epoll_pwait and exposes it as a public function which is needed by Node.JS 10. The implementation is modeled after pselect/select. Signed-off-by: Waldemar Kozaczuk --- core/epoll.cc | 11 +++ linux.cc | 14 +- 2 files changed

[osv-dev] [PATCH] Fix slow write/append to files on ramfs

2019-05-21 Thread Waldemar Kozaczuk
is stored by using std::map where keys are file offsets and values are file segments at that offset. This eliminates the need to copy data as well as only allocates enough memory needed for next 10% of file or desired increase. Fixes #884 Signed-off-by: Waldemar Kozaczuk --- fs/ramfs/ramfs.h

[osv-dev] [PATCH V2] Enhanced __fxstata to handle AT_SYMLINK_NOFOLLOW

2019-05-19 Thread Waldemar Kozaczuk
This patch also effectively makes unmodified coreutils find work as expected: ./scripts/manifest_from_host.sh -w find && ./scripts/build fs=rofs --append-manifest ./scripts/run.py -e '/find / -ls' Signed-off-by: Waldemar Kozaczuk --- fs/vfs/main.cc | 11 ++- tests/tst-fs

[osv-dev] [PATCH] Move _post_main invocation to run_main

2019-05-19 Thread Waldemar Kozaczuk
This patch also fixes __libc_start_main() used for example by java to terminate any remaining app threads by _post_main. Signed-off-by: Waldemar Kozaczuk --- core/app.cc| 8 include/osv/app.hh | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/core/app.cc b

[osv-dev] [PATCH] vfs: Harden task_conv() to return EFAULT when cpath argument is null

2019-05-19 Thread Waldemar Kozaczuk
This patch also reverts the commit a0dcf8530c352536ab6633952b6f614f73eed154. Signed-off-by: Waldemar Kozaczuk --- fs/vfs/main.cc | 5 - fs/vfs/vfs_syscalls.cc | 4 fs/vfs/vfs_task.cc | 4 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/fs/vfs/main.cc b

[osv-dev] [PATCH V2] Added option suffix "!" to force termination of remaining application threads

2019-05-19 Thread Waldemar Kozaczuk
. In order to run unmodified JVM on OSV without OSV 'java wrapper' we need to allow an ability to pass a suffix '!' in command line that gives a hint to OSv to terminate any remaining application threads like so: ./scripts/run.py -e '/usr/bin/java -cp / Hello !' Signed-off-by: Waldemar Kozaczuk --- core

[osv-dev] [PATCH] Enhanced __fxstata to handle AT_SYMLINK_NOFOLLOW

2019-05-17 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- fs/vfs/main.cc | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/vfs/main.cc b/fs/vfs/main.cc index 889aa268..876ae2ba 100644 --- a/fs/vfs/main.cc +++ b/fs/vfs/main.cc @@ -592,10 +592,6 @@ extern "C" int __fxstat

[osv-dev] [PATCH] Added option suffix "!" to force termination of remaining application threads

2019-05-17 Thread Waldemar Kozaczuk
to run unmodified JVM on OSV without OSV 'java wrapper' we need to allows ability to pass a suffix '!' in command line that gives a hint to OSv to terminate any remaining application threads like so: ./scripts/run.py -e '/usr/bin/java -cp / Hello !' Signed-off-by: Waldemar Kozaczuk --- core/app.cc

[osv-dev] [PATCH] Make RAMFS not to free file data when file is still opened

2019-05-15 Thread Waldemar Kozaczuk
-by: Waldemar Kozaczuk --- fs/ramfs/ramfs.h| 2 ++ fs/ramfs/ramfs_vnops.cc | 38 +++--- tests/tst-mmap-file.cc | 31 +++ 3 files changed, 68 insertions(+), 3 deletions(-) diff --git a/fs/ramfs/ramfs.h b/fs/ramfs/ramfs.h index 88ccbe72

[osv-dev] [PATCH 2/2 V3] Enhance getopt family of functions to work with PIEs

2019-05-13 Thread Waldemar Kozaczuk
ler copies of those variables. Fixes #689 Signed-off-by: Waldemar Kozaczuk --- core/elf.cc | 13 +++ include/osv/elf.hh | 4 + libc/misc/getopt.cc | 9 +- libc/misc/getopt.hh | 66 +++ libc/misc/getopt_long.cc | 5 +- modules/tests/Makefile | 9 +-

[osv-dev] [PATCH 2/2 V2] Enhance getopt family of functions to work with PIEs

2019-05-12 Thread Waldemar Kozaczuk
ler copies of those variables. Fixes #689 Signed-off-by: Waldemar Kozaczuk --- core/elf.cc | 13 +++ include/osv/elf.hh | 4 + libc/misc/getopt.cc | 54 - libc/misc/getopt.hh | 21 libc/misc/getopt_long.cc | 7 +- modules/tests/Makefile | 9 +-

[osv-dev] [PATCH] Fix fopen to return EFAULT when filename is NULL

2019-05-11 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- libc/stdio/fopen.c | 5 + 1 file changed, 5 insertions(+) diff --git a/libc/stdio/fopen.c b/libc/stdio/fopen.c index 83452407..c6053c21 100644 --- a/libc/stdio/fopen.c +++ b/libc/stdio/fopen.c @@ -10,6 +10,11 @@ FILE *fopen(const char *restrict filename

[osv-dev] [PATCH] Simplify building images out of artifacts found on host filesystem

2019-05-09 Thread Waldemar Kozaczuk
for 'ls' executable and build image Signed-off-by: Waldemar Kozaczuk --- scripts/build | 13 ++- scripts/manifest_from_host.sh | 180 ++ 2 files changed, 192 insertions(+), 1 deletion(-) create mode 100755 scripts/manifest_from_host.sh diff --git a

[osv-dev] [PATCH] Support local-exec TLS access

2019-05-05 Thread Waldemar Kozaczuk
be sufficient for most applications which either use tiny TLS (Golang uses 8-bytes long) if at all. Rust ELFs tend to rely on quite large TLS in which case the limit in loader.ld needs to be increased accordingly and loader.elf relinked. Fixes #352 Signed-off-by: Waldemar Kozaczuk --- arch/x64

[osv-dev] [PATCH V2] Add GNU libc extension variables __progname and __progname_full

2019-04-30 Thread Waldemar Kozaczuk
This patch adds GNU libc extension variables __progname and __progname_full used by coreutils. These seem to come from BSD as 'BSD' paragraph explains - https://rosettacode.org/wiki/Program_name#C. Signed-off-by: Waldemar Kozaczuk --- libc/libc.cc | 3 +++ 1 file changed, 3 insertions(+) diff

[osv-dev] [PATCH 2/2] Enhance getopt family of functions to work with PIEs

2019-04-30 Thread Waldemar Kozaczuk
ler copies of those variables. Fixes #689 Signed-off-by: Waldemar Kozaczuk --- core/elf.cc | 14 +++ include/osv/elf.hh | 4 + libc/misc/getopt.cc | 62 +-- libc/misc/getopt_long.cc | 37 ++- modules/tests/Makefile | 9 +- tests/tst-getopt.cc

[osv-dev] [PATCH 1/2] Move getopt* files to libc folder and convert to C++

2019-04-30 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- Makefile | 4 +-- libc/misc/getopt.cc | 77 libc/misc/getopt_long.cc | 61 +++ 3 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 libc/misc

[osv-dev] [PATCH 0/2] Enhance getopt functions to work with PIEs

2019-04-30 Thread Waldemar Kozaczuk
Waldemar Kozaczuk (2): Move getopt* files to libc folder and convert to C++ Enhance getopt family of functions to work with PIEs Makefile | 4 +- core/elf.cc | 14 +++ include/osv/elf.hh | 4 + libc/misc/getopt.cc | 125 + libc

[osv-dev] [PATCH] Add GNU libc extension variables __progname and __progname_full

2019-04-27 Thread Waldemar Kozaczuk
This patch adds GNU libc extension variables __progname and __progname_full used by coreutils. These seem to come from BSD as 'BSD' paragraph explains - https://rosettacode.org/wiki/Program_name#C. Signed-off-by: Waldemar Kozaczuk --- core/app.cc | 6 -- libc/libc.cc | 4 2 files

[osv-dev] [PATCH] Add GNU libc extension function error()

2019-04-27 Thread Waldemar Kozaczuk
This patch adds GNU libc extension function error() as specified at https://linux.die.net/man/3/error. This function is used by core utils programs on Linux. Signed-off-by: Waldemar Kozaczuk --- Makefile | 1 + libc/misc/error.c | 37 + 2 files

[osv-dev] [PATCH] Update nbd_client.py to do newstyle handshake

2019-04-27 Thread Waldemar Kozaczuk
qemu-nbd as of QEMU 3.1.5 stopped supporting old style of handshake. This patch updates nbd_client.py to use new handshake. Signed-off-by: Waldemar Kozaczuk --- scripts/nbd_client.py | 21 - 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/scripts/nbd_client.py

[osv-dev] [PATCH V2] Changed loader to print total boot time by default

2019-03-25 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- core/chart.cc | 7 +++ include/osv/boot.hh | 1 + loader.cc | 3 +++ 3 files changed, 11 insertions(+) diff --git a/core/chart.cc b/core/chart.cc index 59311a93..c3355907 100644 --- a/core/chart.cc +++ b/core/chart.cc @@ -45,3 +45,10

[osv-dev] [PATCH] Changed loader to print total boot time by default

2019-03-25 Thread Waldemar Kozaczuk
--- core/chart.cc | 7 +++ include/osv/boot.hh | 1 + loader.cc | 3 +++ 3 files changed, 11 insertions(+) diff --git a/core/chart.cc b/core/chart.cc index 59311a93..c3355907 100644 --- a/core/chart.cc +++ b/core/chart.cc @@ -45,3 +45,10 @@ void boot_time_chart::print_chart()

[osv-dev] [PATCH] Refactor and enhance firecracker script

2019-03-24 Thread Waldemar Kozaczuk
This patch: - refactors firecracker.py to better handle error scenarios - adds ability to use external networking bridge through -b parameter (see scripts/setup-external-bridge.sh) - adds ability to specify custom location of kernel and image files Signed-off-by: Waldemar Kozaczuk --- scripts

[osv-dev] [PATCH] Add script to setup external bridge

2019-03-24 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- scripts/setup-external-bridge.sh | 27 +++ 1 file changed, 27 insertions(+) create mode 100755 scripts/setup-external-bridge.sh diff --git a/scripts/setup-external-bridge.sh b/scripts/setup-external-bridge.sh new file mode 100755

[osv-dev] [PATCH V2] Add virtio mmio implementation

2019-03-03 Thread Waldemar Kozaczuk
Adds implementation of virtio mmio devices needed to support block and networking devices on firecracker. Signed-off-by: Waldemar Kozaczuk --- Makefile | 1 + arch/x64/arch-setup.cc | 5 + drivers/virtio-mmio.cc | 216 + drivers/virtio

[osv-dev] [PATCH] Refactor vmlinux boot code

2019-03-03 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- Makefile | 2 + arch/x64/arch-setup.cc| 124 +- arch/x64/arch-setup.hh| 39 arch/x64/boot.S | 55 + arch/x64/loader.ld| 2 +- arch/x64/setup.S

[osv-dev] [PATCH] Enhance SMP logic to parse MP table

2019-03-01 Thread Waldemar Kozaczuk
Adds logic to parse information about CPUs on system where ACPI is not available. It does it by parsing so called MP table. If MP table not found assumes single vCPU. Signed-off-by: Waldemar Kozaczuk --- arch/x64/smp.cc | 125 ++-- 1 file changed, 111

[osv-dev] [PATCH] Clean virtio code

2019-03-01 Thread Waldemar Kozaczuk
edge interrupt handlers that will be used by virtio mmio drivers code in next patch Signed-off-by: Waldemar Kozaczuk --- drivers/virtio-blk.cc| 46 drivers/virtio-blk.hh| 20 +--- drivers/virtio-device.hh | 4 drivers

[osv-dev] [PATCH] Add missing readlinkat function and corresponding syscall

2019-02-24 Thread Waldemar Kozaczuk
Fixes #956 Signed-off-by: Waldemar Kozaczuk --- fs/vfs/main.cc | 33 + linux.cc | 1 + 2 files changed, 34 insertions(+) diff --git a/fs/vfs/main.cc b/fs/vfs/main.cc index 7cc4291d..4adf4434 100644 --- a/fs/vfs/main.cc +++ b/fs/vfs/main.cc @@ -1760,6

[osv-dev] [PATCH V2] Add python script to run OSv on fireracker

2019-02-22 Thread Waldemar Kozaczuk
This patch adds simple Python script that allows booting OSv loader.elf on firecracker. It also automates process of downloading and installing firecracker. Evenntually it might be incorporated into scripts/run.py Signed-off-by: Waldemar Kozaczuk --- scripts/firecracker.py | 126

[osv-dev] [PATCH V2] Make OSv boot without ACPI present

2019-02-22 Thread Waldemar Kozaczuk
probing panic driver as it relies on ACPI as well. Lastly we skip MADT table parsing if APCI is off and for now assume there is single vCPU only. Eventually we should parse vCPU information from MP table as an alternative. Signed-off-by: Waldemar Kozaczuk --- arch/x64/power.cc | 30

[osv-dev] [PATCH] Add python script to run OSv on fireracker

2019-02-20 Thread Waldemar Kozaczuk
This patch adds simple Python script that allows booting OSv loader.elf on firecracker. It also automates process of downloading and installing firecracker. Evenntually it might be incorporated into scripts/run.py Signed-off-by: Waldemar Kozaczuk --- scripts/firecracker.py | 100

[osv-dev] [PATCH] Make OSv boot without ACPI present

2019-02-19 Thread Waldemar Kozaczuk
probing panic driver as it relies on ACPI as well. Lastly we skip MADT table parsing if APCI is off and for now assume there is single vCPU only. Eventually we should parse vCPU information from MP table as an alternative. Signed-off-by: Waldemar Kozaczuk --- arch/x64/power.cc | 26

[osv-dev] [RFC] Remaining work to support OSv on firecracker

2019-02-10 Thread Waldemar Kozaczuk
time end Signed-off-by: Waldemar Kozaczuk --- Makefile | 1 + arch/x64/arch-setup.cc | 180 - arch/x64/boot.S| 37 - arch/x64/loader.ld | 2 +- arch/x64/power.cc | 14 +--- arch/x64/smp.cc| 16 +++- drivers

[osv-dev] [PATCH] Enhance scripts/test.py to pass extra arguments to run.py

2019-02-08 Thread Waldemar Kozaczuk
/test.py --run_options '--virtio modern' ./scripts/test.py --run_options '--virtio modern -S' Signed-off-by: Waldemar Kozaczuk --- scripts/test.py | 8 +++- scripts/tests/testing.py | 10 +++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/scripts/test.py b

[osv-dev] [PATCH] Implemented modern virtio PCI device

2019-02-06 Thread Waldemar Kozaczuk
or transitional devices simulated by QEMU by passing correct value of a new '--virtio' parameter to scripts/run.py. Signed-off-by: Waldemar Kozaczuk --- drivers/pci-function.cc | 16 ++- drivers/pci-function.hh | 2 + drivers/virtio-blk.cc| 22 - drivers/virtio-device.hh | 1

[osv-dev] [PATCH] Add option to run OSv with legacy or modern virtio

2019-02-05 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- scripts/run.py | 24 +++- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/scripts/run.py b/scripts/run.py index 92cd4e5f..17a21298 100755 --- a/scripts/run.py +++ b/scripts/run.py @@ -124,7 +124,7 @@ def start_osv_qemu

[osv-dev] [PATCH V2] Refactor virtio layer to support modern PCI and mmio devices

2019-02-05 Thread Waldemar Kozaczuk
removes some unused code. Signed-off-by: Waldemar Kozaczuk --- Makefile | 1 + drivers/pci-generic.cc | 25 +- drivers/virtio-blk.cc| 37 +--- drivers/virtio-blk.hh| 6 +- drivers/virtio-device.hh | 86 ++ drivers/virtio

[osv-dev] [PATCH V2] Reset FPU state after saving it and upon context switch

2019-01-28 Thread Waldemar Kozaczuk
n over 100 successful test runs where it would crash almost every time Fixes #1018 - based on over successful 50 test runs with /os/threads API being used in tight loop and before patch would crash sporadically Signed-off-by: Waldemar Kozaczuk --- arch/x64/arch-cpu.hh| 5 +++ arch/x64/arch-swit

[osv-dev] [PATCH] Add sys_exit_group syscall used by golang

2019-01-25 Thread Waldemar Kozaczuk
OSv is a unikernel and exit() in OSv terminates both app and kernel, it makes sense for sys_exit_group() do the same thing. Signed-off-by: Waldemar Kozaczuk --- linux.cc | 8 1 file changed, 8 insertions(+) diff --git a/linux.cc b/linux.cc index d548db93..1eff6ffc 100644 --- a/linux.cc

[osv-dev] [PATCH] Add scripts helping to automate testing of FPU-related bugs

2019-01-25 Thread Waldemar Kozaczuk
THIS is just for testing -> is not meant to be applied to OSv github tree. Helps recreating and testing issues #536, #1010 and #1018 Signed-off-by: Waldemar Kozaczuk --- fpu_test_scripts/poll_threads.sh | 16 + fpu_test_scripts/run_cassandra.sh |

[PATCH] Delete assigned_virtio driver

2019-01-18 Thread Waldemar Kozaczuk
irtio MMIO devices, we have decided to remove it from OSv codebase. In future if somebody finds it useful again we will bring it back and adjust accordingly. Signed-off-by: Waldemar Kozaczuk --- Makefile | 1 - arch/x64/arch-setup.cc | 9 +- drivers/virtio-assign.cc

[RFC] Support firecracker - addendum

2019-01-17 Thread Waldemar Kozaczuk
Tweaked virtio device initialization to conform to more stricter enforcement of protocol on firecracker side Makes OSv boot on newest firecracker. Signed-off-by: Waldemar Kozaczuk --- drivers/virtio-blk.cc | 5 - drivers/virtio-net.cc | 21 ++--- drivers/virtio-net.hh | 7

[PATCH] Refactor virtio layer to support modern PCI and mmio devices

2019-01-15 Thread Waldemar Kozaczuk
of creating/registering proper interrupt logic for each transport. Signed-off-by: Waldemar Kozaczuk --- Makefile | 1 + drivers/device.hh| 2 + drivers/pci-generic.cc | 25 +++- drivers/virtio-assign.cc | 40 ++- drivers/virtio-blk.cc| 29

[RFC] Support firecracker

2019-01-04 Thread Waldemar Kozaczuk
'Accept: application/json' \ -H 'Content-Type: application/json'\ -d '{ "action_type": "InstanceStart" }' Signed-off-by: Waldemar Kozaczuk --- Makefile | 2 + arch/x64/arch-setup.cc | 180 +++---

[PATCH] Reset FPU state after saving it and upon context switch

2018-12-19 Thread Waldemar Kozaczuk
most every time Fixes #1018 - based on over successful 50 test runs with /os/threads API being used in tight loop and before patch would crash sporadically Signed-off-by: Waldemar Kozaczuk --- arch/x64/arch-cpu.cc| 10 ++ arch/x64/arch-switch.hh | 8 + modules/tests/Makefile | 4

[RFC] Implemented read-only subset of SMB2/3 filesystem

2018-12-12 Thread Waldemar Kozaczuk
. In order to use it one needs to as smbfs to an image and then mount desired share by using REST app API (see mount-samba.sh) or add an init script to call mount-fs.so. Signed-off-by: Waldemar Kozaczuk --- Makefile | 3 +- fs/smbfs/smbfs_null_vfsops.cc

[PATCH V3] Implement more space-efficient early memory allocation scheme

2018-12-11 Thread Waldemar Kozaczuk
around 125K and new scheme uses ~44 pages (176K) of memory to satisfy all requests. With this patch it is possible to run native example with 18.5M of memory: ./scripts/build -j6 fs=rofs image=native-example ./scripts/run.py -c 1 -m 19M Fixes #270 Signed-off-by: Waldemar Kozaczuk --- core/memp

[PATCH V2] Implement more space-efficient early memory allocation scheme

2018-12-09 Thread Waldemar Kozaczuk
around 125K and new scheme uses ~44 pages (176K) of memory to satisfy all requests. Fixes #270 Signed-off-by: Waldemar Kozaczuk --- core/mempool.cc| 144 - include/osv/mempool.hh | 10 +++ 2 files changed, 152 insertions(+), 2 deletions(-) diff

[PATCH v2] Add libc aliases to some mathematical functions

2018-11-22 Thread Waldemar Kozaczuk
would avoid unnecessary instructions involved in calling a function. Signed-off-by: Waldemar Kozaczuk --- Makefile| 1 + libc/math/aliases.c | 26 ++ 2 files changed, 27 insertions(+) create mode 100644 libc/math/aliases.c diff --git a/Makefile b/Makefile

[PATCH] Implement more space-efficient early memory allocation scheme

2018-11-21 Thread Waldemar Kozaczuk
around 125K and new scheme uses ~44 pages (176K) of memory to satisfy all requests. Fixes #270 Signed-off-by: Waldemar Kozaczuk --- core/mempool.cc| 133 - include/osv/mempool.hh | 5 ++ 2 files changed, 136 insertions(+), 2 deletions(-) diff

[PATCH] Add libc aliases to some mathematical functions

2018-11-21 Thread Waldemar Kozaczuk
unnecessary instructions involved in calling a function. Signed-off-by: Waldemar Kozaczuk --- Makefile | 5 + libc/math/exp.c | 6 ++ libc/math/log.c | 6 ++ libc/math/log10.c | 6 ++ libc/math/log2.c | 6 ++ libc/math/pow.c | 6 ++ 6 files changed, 35

[PATCH] Refine tst-small-malloc to check alignment

2018-11-21 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- core/mempool.cc | 2 +- tests/tst-small-malloc.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/mempool.cc b/core/mempool.cc index 23dc67da..102e4e6e 100644 --- a/core/mempool.cc +++ b/core/mempool.cc @@ -1547,7

[PATCH] Refine malloc pool allocations to accomodate more edge cases

2018-11-20 Thread Waldemar Kozaczuk
scenarios. Signed-off-by: Waldemar Kozaczuk --- core/mempool.cc | 13 +++--- tests/tst-small-malloc.cc | 52 ++- 2 files changed, 49 insertions(+), 16 deletions(-) diff --git a/core/mempool.cc b/core/mempool.cc index deb7a0bb..23dc67da 100644 --- a/core

[PATCH] Handle small memory allocations ( < 16 bytes) more space efficiently

2018-11-16 Thread Waldemar Kozaczuk
#1011 Signed-off-by: Waldemar Kozaczuk --- core/mempool.cc | 5 +++-- modules/tests/Makefile| 2 +- tests/tst-small-malloc.cc | 45 +++ 3 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 tests/tst-small-malloc.cc diff --git

[RFC] Partially fix soabort() to not free freed socket

2018-11-04 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- bsd/sys/kern/uipc_socket.cc | 11 +++ bsd/sys/net/raw_usrreq.cc | 3 ++- bsd/sys/net/rtsock.cc | 5 ++--- bsd/sys/netinet/raw_ip.cc | 3 ++- bsd/sys/netinet/tcp_usrreq.cc | 6 -- bsd/sys/netinet/udp_usrreq.cc | 3 ++- bsd

[PATCH V2] Support non-fPIC shared objects

2018-10-29 Thread Waldemar Kozaczuk
. Eventually it fixes permissions of PT_LOAD sections to make it non-writable. This patch most notably allows to run GraalVM generated Java apps. Fixes #1004 Signed-off-by: Waldemar Kozaczuk --- core/elf.cc| 47 +++--- include/osv/elf.hh | 5

[PATCH] Support non-fPIC shared objects

2018-10-24 Thread Waldemar Kozaczuk
it fixes permissions of PT_LOAD sections to make it non-writable. This patch most notably allows to run GraalVM generated Java apps. Fixes #1004 Signed-off-by: Waldemar Kozaczuk --- core/elf.cc| 47 +++--- include/osv/elf.hh | 5 - modules

[PATCH] Disable linking libgcc.a with --whole-archive option

2018-10-12 Thread Waldemar Kozaczuk
be565320c082c00069614c850d29b42831b3dea6 Signed-off-by: Waldemar Kozaczuk --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 44a86c01..2270206b 100644 --- a/Makefile +++ b/Makefile @@ -1869,9 +1869,9 @@ $(out)/loader.elf: $(stage1_targets) arch/$(arch)/loader.ld $(out

[PATCH] Enhance multiboot mode

2018-09-16 Thread Waldemar Kozaczuk
can boot and execute in around 50ms. This is an example of how to execute OSv on hyperkit: hyperkit -A -m 512M \ -s 0:0,hostbridge \ -s 31,lpc \ -l com1,stdio \ -s 4,virtio-blk,build/release/usr.img \ -f multiboot,build/release/loader.bin,,'/hello.so' Signed-off-by: Waldemar Kozaczuk

[PATCH V2] Implemented almost-in-place kernel decompression

2018-09-08 Thread Waldemar Kozaczuk
lzkernel_base to build bigger ramfs images. Fixes #985 Signed-off-by: Waldemar Kozaczuk --- Makefile| 12 ++- arch/x64/lzloader.ld| 1 + fastlz/fastlz.h | 20 +++ fastlz/lz.cc| 69 ++--- fastlz

[PATCH V4] Changed syscall stack implementation to use mmap

2018-09-06 Thread Waldemar Kozaczuk
logic to setup large stack. Signed-off-by: Waldemar Kozaczuk --- arch/x64/arch-switch.hh | 55 +++-- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/arch/x64/arch-switch.hh b/arch/x64/arch-switch.hh index e376954..223e4db 100644

[PATCH V3] Changed syscall stack implementation to use mmap

2018-09-06 Thread Waldemar Kozaczuk
logic to setup large stack. Signed-off-by: Waldemar Kozaczuk --- arch/x64/arch-switch.hh | 52 + 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/arch/x64/arch-switch.hh b/arch/x64/arch-switch.hh index e3769540..817ea7ed 100644 --- a/arch/x64

[PATCH] Changed syscall stack implementation to use mmap

2018-09-05 Thread Waldemar Kozaczuk
logic to setup large stack. Tiny stack had to be increased to 4096 bytes to accomodate mmap call. Signed-off-by: Waldemar Kozaczuk --- arch/x64/arch-switch.hh | 40 ++-- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/arch/x64/arch-switch.hh b

[PATCH V2] Revive multiboot mode

2018-08-31 Thread Waldemar Kozaczuk
multiboot info structure into the low memory. Signed-off-by: Waldemar Kozaczuk --- Makefile | 5 +++-- arch/x64/boot32.S | 2 +- scripts/run.py| 16 ++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 770b28d0..0ca95c64 100644

[PATCH] Revive multiboot mode

2018-08-30 Thread Waldemar Kozaczuk
multiboot info structure in low memory. Signed-off-by: Waldemar Kozaczuk --- Makefile | 5 +++-- arch/x64/boot32.S | 2 +- scripts/run.py| 10 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 770b28d0..0ca95c64 100644 --- a/Makefile

[PATCH V3] Relax ELF symbol resolution failure when BIND_NOW

2018-08-29 Thread Waldemar Kozaczuk
referenced later. So in essence we are postponing abort until absolutely necessary. Fixes #993 Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/arch-elf.cc | 11 --- arch/x64/arch-elf.cc | 11 --- core/elf.cc | 21 - include/osv/elf.hh

[PATCH V2] Relax ELF symbol resolution failure when BIND_NOW

2018-08-28 Thread Waldemar Kozaczuk
referenced later. So in essence we are postponing abort until absolutely necessary. Fixes #993 Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/arch-elf.cc | 11 --- arch/x64/arch-elf.cc | 11 --- core/elf.cc | 22 +- include/osv/elf.hh |

[PATCH] Optimize bootfs memory utilization

2018-08-23 Thread Waldemar Kozaczuk
likely not aligned which possibly means slower access. This could be improved by making individual files aligned in bootfs.bin. Fixes #977 Signed-off-by: Waldemar Kozaczuk --- fs/ramfs/ramfs.h| 1 + fs/ramfs/ramfs_vnops.cc | 38 ++ fs/vfs/main.cc

[PATCH] [PATCH] Optimize bootfs memory utilization

2018-08-23 Thread Waldemar Kozaczuk
likely not aligned which possibly means slower access. This could be improved by making individual files aligned in bootfs.bin. Fixes #977 Signed-off-by: Waldemar Kozaczuk --- fs/ramfs/ramfs.h| 1 + fs/ramfs/ramfs_vnops.cc | 38 ++ fs/vfs/main.cc

[PATCH] Implemented almost-in-place kernel decompression

2018-08-23 Thread Waldemar Kozaczuk
lzkernel_base to build bigger ramfs images Fixes #985 Signed-off-by: Waldemar Kozaczuk --- Makefile| 11 -- arch/x64/lzloader.ld| 1 + fastlz/fastlz.h | 20 +++ fastlz/lz.cc| 69 ++--- fastlz

[PATCH] Relax ELF symbol resolution failure when BIND_NOW

2018-08-16 Thread Waldemar Kozaczuk
referenced later. So in essence we are postponing abort until absolutely necessary. Fixes #993 Signed-off-by: Waldemar Kozaczuk --- arch/aarch64/arch-elf.cc | 11 --- arch/x64/arch-elf.cc | 11 --- core/elf.cc | 19 --- include/osv/elf.hh |

[PATCH] Changed getrandom() to return ENOSYS when GRND_NONBLOCK passed in

2018-08-15 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk --- libc/include/sys/random.h | 9 + libc/random.c | 7 +++ 2 files changed, 16 insertions(+) diff --git a/libc/include/sys/random.h b/libc/include/sys/random.h index 143ccb26..ef7eaa27 100644 --- a/libc/include/sys/random.h +++ b/libc

[PATCH] Added getrandom() implementation

2018-08-14 Thread Waldemar Kozaczuk
Fixes #989 Signed-off-by: Waldemar Kozaczuk --- Makefile | 1 + include/api/sys/random.h | 1 + include/api/x64/bits/syscall.h | 1 + libc/include/sys/random.h | 13 ++ libc/random.c | 44 ++ linux.cc

[PATCH] Improved python27

2018-08-13 Thread Waldemar Kozaczuk
This patch renames python27 to python2x and improves it by discovering Python home directory by reading sys.* variables. Signed-off-by: Waldemar Kozaczuk --- python27/README | 8 {python27 => python2x}/GET | 17 ++--- {python27 => py

[PATCH] Added libc __wcscpy_chk function

2018-08-13 Thread Waldemar Kozaczuk
This patch adds libc __wcscpy_chk needed by Python 3. Please see http://refspecs.linux-foundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/libc---wcscpy-chk-1.html for details. Signed-off-by: Waldemar Kozaczuk --- Makefile | 1 + libc/string/__wcscpy_chk.c | 15

[RFC] Implemented more memory-efficient mmap for ROFS

2018-08-11 Thread Waldemar Kozaczuk
e9 0x00396c0e 0x00395a66 0x00427379 , std::allocator > const&, 0x10402fbf 0x616e2d64616f6c78 Test tst-namespace.so FAILED There are actually more tests failing in similar way as tst-libc-locking which seems to indicate lack of necessary lock in some pl

[PATCH] Changed MySQL to use InnoDB and properly setup admin user

2018-05-28 Thread Waldemar Kozaczuk
performance is achieved when using fairl new version of QEMU/KVM (>= 2.11). Fixes cloudius-systems/osv#955 Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- mysql/GET | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql/GET b/mysql/GET index 2e3d673..788f8

[PATCH 3/3] Upgraded node to 8.11.2

2018-05-24 Thread Waldemar Kozaczuk
Updated Makefile and dopatch to properly patch new version 8.11.2 and older one. Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- node/Makefile | 3 ++- node/dopatch | 21 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/node/Makefile

[PATCH 0/3] Upgrade mysql, nginx and node

2018-05-24 Thread Waldemar Kozaczuk
Upgrade mysql, nginx and node Waldemar Kozaczuk (3): Upgraded nginx to 1.12.2 Upgraded mysql to 5.6.40 Upgraded node to 8.11.2 mysql/GET | 4 ++-- nginx/Makefile | 2 +- nginx/module.py | 1 + node/Makefile | 3 ++- node/dopatch| 21 + 5 files changed

[PATCH 2/3] Upgraded mysql to 5.6.40

2018-05-24 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- mysql/GET | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql/GET b/mysql/GET index edc033e..2e3d673 100755 --- a/mysql/GET +++ b/mysql/GET @@ -1,6 +1,6 @@ #!/bin/sh -VERSION=5.6.21 +VERSION=5.6.40 B

[PATCH 1/3] Upgraded nginx to 1.12.2

2018-05-24 Thread Waldemar Kozaczuk
Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- nginx/Makefile | 2 +- nginx/module.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/nginx/Makefile b/nginx/Makefile index 3ef2359..4fae78f 100644 --- a/nginx/Makefile +++ b/nginx/Makefile @@ -1,4 +1,4 @@ -V

[PATCH] Added simple implementation of epoll_pwait

2018-05-19 Thread Waldemar Kozaczuk
Golang 1.10.x started using epoll_pwait instead of regular epoll_wait and the golang-httpserver app does not work anymore. This patch adds basic implementation of epoll_pwait that returns error if non-null sigmask was passed otherwise delegates to epoll_wait. Signed-off-by: Waldemar Kozaczuk

[PATCH v6] Implement switch to separate SYSCALL call stack

2018-05-15 Thread Waldemar Kozaczuk
original patch provided by @Hawxchen. Fixes #808 Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- arch/x64/arch-switch.hh | 108 arch/x64/arch-tls.hh| 19 + arch/x64/entry.S| 95 +

[PATCH v5] Implement switch to separate SYSCALL call stack

2018-05-15 Thread Waldemar Kozaczuk
original patch provided by @Hawxchen. Fixes #808 Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- arch/x64/arch-switch.hh | 108 arch/x64/arch-tls.hh| 19 + arch/x64/entry.S| 100 +++

[PATCH v4] Implement switch to separate SYSCALL call stack

2018-05-14 Thread Waldemar Kozaczuk
original patch provided by @Hawxchen. Fixes #808 Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- arch/x64/arch-switch.hh | 108 arch/x64/arch-tls.hh| 19 + arch/x64/entry.S| 99 +++

[PATCH] Remove soisconnected() from syncache_socket()

2018-04-25 Thread Waldemar Kozaczuk
(around 10-15K request per second with 4 cpus setup). Fixes #859 Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- bsd/sys/netinet/tcp_input.cc| 1 + bsd/sys/netinet/tcp_syncache.cc | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/bsd/sys/netinet/tcp_input.cc

[PATCH] Added golang-httpserver app and modified golang-example

2018-04-23 Thread Waldemar Kozaczuk
This patch adds new Golang app to demonstrate simple httpserver in Golang. It also modifies existing golang-example app to be bootstrapped by tiny golang front-end. Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- golang-example/.gitignore | 3 +++ golang-example/Ma

[PATCH v2] Add tiny golang front-end module

2018-04-23 Thread Waldemar Kozaczuk
. Fixes #850 Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- core/app.cc | 26 +++--- include/osv/app.hh| 17 ++--- modules/golang/.gitignore | 3 +++ modules/golang/Makefile | 34 ++ modules/

[PATCH] Add tiny golang front-end module

2018-04-07 Thread Waldemar Kozaczuk
it + +module: init $(TARGET).so + echo '/go.so: $${MODULE_DIR}/go.so' > usr.manifest + +clean: + rm -f $(TARGET)*.so usr.manifest + $(call very-quiet, $(RM) -rf obj) diff --git a/modules/golang/go.cc b/modules/golang/go.cc new file mode 100644 index 000..0bb1986 --- /d

[PATCH v3 3/4] Enhanced ramfs implementation to handle time and mode node attributes

2018-03-22 Thread Waldemar Kozaczuk
This patch enhances ramfs implementation to handle time and mode node attributes. Additionally it adds extra checks in relevant places to enforce maximum name length. Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- fs/ramfs/ramfs.h| 4 +++ fs/ramfs/ramfs_vnops.c

[PATCH v2 3/4] Enhanced ramfs implementation to handle time and mode node attributes

2018-03-21 Thread Waldemar Kozaczuk
This patch enhances ramfs implementation to handle time and mode node attributes. Additionally it adds extra checks in relevant places to enforce maximum name length. Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- fs/ramfs/ramfs.h| 4 ++ fs/ramfs/ramfs_vnops.cc

[PATCH v2 2/4] Added read-around cache layer to ROFS

2018-03-21 Thread Waldemar Kozaczuk
ys in memory forever as there is no LRU logic implemented that could limit memory used. Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com> --- Makefile | 1 + fs/rofs/rofs.hh| 29 +- fs/rofs/rofs_cache.cc | 274 +++

<    1   2   3   4   5   6   >