]> xenbits.xensource.com Git - unikraft/unikraft.git/log
unikraft/unikraft.git
3 years agoplat/common/x86: Fix control protection trap
Marc Rittinghaus [Mon, 14 Jun 2021 09:47:16 +0000 (11:47 +0200)]
plat/common/x86: Fix control protection trap

The current trap number for the control protection exception (in
Unikraft called security trap) is wrong and the asm trap is missing. This
patch fixes these issues.

Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #228

3 years agoplat/xen: x86: Detect initrd entry from start_info
Simon Kuenzer [Thu, 1 Oct 2020 12:43:25 +0000 (14:43 +0200)]
plat/xen: x86: Detect initrd entry from start_info

Registers an init ramdisk as memory region.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Mocanu Gabriel<gabi.mocanu98@gmail.com>
3 years agodocs: Update version to 0.5.0
Simon Kuenzer [Thu, 20 May 2021 22:34:16 +0000 (00:34 +0200)]
docs: Update version to 0.5.0

Bump the version number within the documentation to 0.5.0:
`docs/` and `README.md`

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #214

3 years agolib/vfscore: Register `newfstatat` to syscall_shim
Sergiu Moga [Sat, 24 Apr 2021 17:27:25 +0000 (20:27 +0300)]
lib/vfscore: Register `newfstatat` to syscall_shim

Register `newfstatat` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #190

3 years agolib/vfscore: Register `getdents` to syscall_shim
Sergiu Moga [Thu, 22 Apr 2021 16:49:28 +0000 (19:49 +0300)]
lib/vfscore: Register `getdents` to syscall_shim

Register `getdents` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #189

3 years agolib/vfscore: Register `chroot` to syscall_shim
Sergiu Moga [Tue, 16 Mar 2021 21:25:57 +0000 (23:25 +0200)]
lib/vfscore: Register `chroot` to syscall_shim

Register `chroot` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #158

3 years agolib/uksched: Enable multiple `UK_THREAD_INIT()` in one source
Simon Kuenzer [Thu, 6 May 2021 13:03:11 +0000 (15:03 +0200)]
lib/uksched: Enable multiple `UK_THREAD_INIT()` in one source

In order to enable multiple UK_THREAD_INIT(_PRIO) definitions within
one source file, we generate file-unique symbol names for each entry
by using the priority level, init function name, and fini function name.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #201

3 years agolib/uksched: Remove unnecessary alignment for thread inittab
Simon Kuenzer [Thu, 6 May 2021 13:02:35 +0000 (15:02 +0200)]
lib/uksched: Remove unnecessary alignment for thread inittab

The align parameter within `extra.ld` for the `uk_thread_inttab` was
causing some alignment issues for the `text` section. Some builds
were not able to be executed. It turns out that this extra alignment
statement is not needed for the table.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #201

3 years agolib/vfscore: Register `unlink` to syscall_shim
Sergiu Moga [Mon, 15 Feb 2021 17:47:45 +0000 (19:47 +0200)]
lib/vfscore: Register `unlink` to syscall_shim

Register `unlink` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Florin Diaconescu <florin.diaconescu@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #132

3 years agolib/vfscore: Register `symlink` to syscall_shim
Sergiu Moga [Mon, 15 Feb 2021 17:53:13 +0000 (19:53 +0200)]
lib/vfscore: Register `symlink` to syscall_shim

Register `symlink` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Florin Diaconescu <florin.diaconescu@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #133

3 years agolib/vfscore: Register `pipe2` to syscall_shim
Sergiu Moga [Mon, 15 Feb 2021 18:14:49 +0000 (20:14 +0200)]
lib/vfscore: Register `pipe2` to syscall_shim

Register `pipe2` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Florin Diaconescu <florin.diaconescu@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #134

3 years agolib/vfscore: Register `umount2` to syscall_shim
Sergiu Moga [Mon, 15 Feb 2021 10:28:36 +0000 (12:28 +0200)]
lib/vfscore: Register `umount2` to syscall_shim

Register `umount2` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Cristian Vijelie <cristianvijelie@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #127

3 years agolib/ukmmap: Register `mremap` to syscall_shim
Sergiu Moga [Tue, 16 Mar 2021 20:49:39 +0000 (22:49 +0200)]
lib/ukmmap: Register `mremap` to syscall_shim

Register `mremap` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Cristian Vijelie <cristianvijelie@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #155

3 years agolib/vfscore: Register `mkdir` to syscall_shim
Sergiu Moga [Mon, 15 Feb 2021 17:07:37 +0000 (19:07 +0200)]
lib/vfscore: Register `mkdir` to syscall_shim

Register `mkdir` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Catalin Puscoci <catalinpuscoci@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #130

3 years agolib/vfscore: Register `stat` to syscall_shim
Sergiu Moga [Mon, 15 Feb 2021 09:48:15 +0000 (11:48 +0200)]
lib/vfscore: Register `stat` to syscall_shim

Register `stat` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Catalin Puscoci <catalinpuscoci@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #128

3 years agolib/vfscore: Register `chown` to syscall_shim
Sergiu Moga [Tue, 16 Mar 2021 21:00:04 +0000 (23:00 +0200)]
lib/vfscore: Register `chown` to syscall_shim

Register `chown` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Catalin Puscoci <catalinpuscoci@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #154

3 years agolib/vfscore: Register `lchown` to syscall_shim
Sergiu Moga [Tue, 16 Mar 2021 21:20:16 +0000 (23:20 +0200)]
lib/vfscore: Register `lchown` to syscall_shim

Register `lchown` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Catalin Puscoci <catalinpuscoci@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #157

3 years agolib/vfscore: Register `fchown` to syscall_shim
Sergiu Moga [Tue, 16 Mar 2021 21:13:52 +0000 (23:13 +0200)]
lib/vfscore: Register `fchown` to syscall_shim

Register `fchown` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Catalin Puscoci <catalinpuscoci@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #156

3 years agolib/posix-user: Register `setresgid` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 18:03:32 +0000 (20:03 +0200)]
lib/posix-user: Register `setresgid` to syscall_shim

Register `setresgid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #120

3 years agolib/posix-user: Register `getresuid` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 17:56:05 +0000 (19:56 +0200)]
lib/posix-user: Register `getresuid` to syscall_shim

Register `getresuid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #119

3 years agolib/posix-user: Register `setresuid` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 17:51:44 +0000 (19:51 +0200)]
lib/posix-user: Register `setresuid` to syscall_shim

Register `setresuid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #118

3 years agolib/posix-user: Register `capget` to syscall_shim
Sergiu Moga [Sat, 13 Mar 2021 16:00:50 +0000 (18:00 +0200)]
lib/posix-user: Register `capget` to syscall_shim

Register `capget` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #147

3 years agolib/posix-user: Register `setgroups` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 17:46:53 +0000 (19:46 +0200)]
lib/posix-user: Register `setgroups` to syscall_shim

Register `setgroups` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #117

3 years agolib/posix-user: Register `setregid` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 17:33:45 +0000 (19:33 +0200)]
lib/posix-user: Register `setregid` to syscall_shim

Register `setregid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #115

3 years agolib/posix-user: Register `setreuid` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 17:17:01 +0000 (19:17 +0200)]
lib/posix-user: Register `setreuid` to syscall_shim

Register `setreuid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #114

3 years agolib/posix-user: Register `setgid` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 16:45:47 +0000 (18:45 +0200)]
lib/posix-user: Register `setgid` to syscall_shim

Register `setgid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #113

3 years agolib/posix-user: Register `getresgid` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 18:06:38 +0000 (20:06 +0200)]
lib/posix-user: Register `getresgid` to syscall_shim

Register `getresgid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #111

3 years agoplat/xen/drivers/net: Add receive operation
Costin Lupu [Tue, 17 Nov 2020 08:38:48 +0000 (10:38 +0200)]
plat/xen/drivers/net: Add receive operation

Incoming packets are written in pages allocated by the netfront. Such pages are
allocated and registered to the shared ring after completion of receiving
operations.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
3 years agoplat/xen/drivers/net: Add transmit operation
Costin Lupu [Tue, 17 Nov 2020 08:38:47 +0000 (10:38 +0200)]
plat/xen/drivers/net: Add transmit operation

Whenever a packet is transmitted, the request describing it is written in the
shared ring. The packet itself is written in a page referenced by the request
and shared, as well, with the backend. At the end of each transmit operation, a
cleanup operation is performed free'ing the resources allocated for the
previously transmitted packets.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
3 years agoplat/xen/drivers/net: Start netfront device
Costin Lupu [Tue, 17 Nov 2020 08:38:46 +0000 (10:38 +0200)]
plat/xen/drivers/net: Start netfront device

Starting the device implies establishing the connection between netfront and
netback. The connection is set up after a negociation between the two end
points. After configuring the device queues, the netfront publishes via
Xenstore the information associated with the queues which will be used by the
backend to connect.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
3 years agoplat/xen/drivers/net: Enable/disable interrupts for rx queues
Costin Lupu [Tue, 17 Nov 2020 08:38:45 +0000 (10:38 +0200)]
plat/xen/drivers/net: Enable/disable interrupts for rx queues

The user can enable/disable interrupts for devices according with the operation
mode he or she chooses for the device. This patch follows closely the logic
implemented in the virtio net driver.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
3 years agoplat/xen/drivers/net: Configure netfront rx queue
Costin Lupu [Tue, 17 Nov 2020 08:38:44 +0000 (10:38 +0200)]
plat/xen/drivers/net: Configure netfront rx queue

Incoming packets are saved in buffers allocated with user-provided callbacks.
Whenever such packet is available, the driver is notified via event channels.
This patch introduces the configuration logic for rx queues and the handler
used in dealing with the notifications.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
3 years agoplat/xen/drivers/net: Configure netfront tx queue
Costin Lupu [Tue, 17 Nov 2020 08:38:43 +0000 (10:38 +0200)]
plat/xen/drivers/net: Configure netfront tx queue

For each queue, either rx or tx, the packets references are kept in a Xen
shared ring. This patch introduces the initialization of tx shared ring. Each
time the driver will send a packet it will add a request on the tx shared ring
which will be serviced by the backend. Therefore we need to keep track of the
requests by keeping track of their IDs. Because our resources are limited, we
will maintain a pool of IDs (see `freelist` array) for this purpose.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
3 years agoplat/xen/drivers/net: Create netfront queues
Costin Lupu [Tue, 17 Nov 2020 08:38:42 +0000 (10:38 +0200)]
plat/xen/drivers/net: Create netfront queues

We continue with the device configuration by retrieving the Xenstore
information regarding the number of queues and their associated event channels.
Netfront devices operate pairs of Rx/Tx queues and for notifications we can
either use a single event channel per pair or split event channels.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
3 years agoplat/xen/drivers/net: Configure netfront device
Costin Lupu [Tue, 17 Nov 2020 08:38:41 +0000 (10:38 +0200)]
plat/xen/drivers/net: Configure netfront device

The information needed for configuring netfront devices is in the Xenstore. For
now, we only retrieve the MAC and IP addresses from there in order to
initialize the device.

This patch introduces the `netfront_dev` structure which integrates both netdev
and Xenbus device information and also keeps the configuration parameters.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
3 years agoplat/xen/drivers: Add skeleton for netfront driver
Costin Lupu [Tue, 17 Nov 2020 08:38:40 +0000 (10:38 +0200)]
plat/xen/drivers: Add skeleton for netfront driver

This patch introduces the skeleton for the Xen netfront driver.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Signed-off-by: Razvan Cojocaru <razvan.cojocaru93@gmail.com>
Reviewed-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
3 years agoplat/xen: Add vif device type
Costin Lupu [Tue, 17 Nov 2020 08:38:39 +0000 (10:38 +0200)]
plat/xen: Add vif device type

vif device type is used for virtual network interfaces.

Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Roxana Nicolescu <nicolescu.roxana1996@gmail.com>
3 years agolib/vfscore: Correct the macro name of UK_LIBC_SYSCALLS
Jia He [Thu, 13 May 2021 08:28:33 +0000 (16:28 +0800)]
lib/vfscore: Correct the macro name of UK_LIBC_SYSCALLS

Correct the name from UK_LIBC_SYSCALL to UK_LIBC_SYSCALLS

Otherwise the linking will report:
libs/newlib/musl-imported/src/termios/tcsetattr.c:35:
undefined reference to `ioctl'
/bin/ld:
apps/sqlite/build/sqlite_kvm-x86_64.o: in
function `tcgetattr':
libs/newlib/musl-imported/src/termios/tcgetattr.c:30:
undefined reference to `ioctl'

Reported-by: Alexander Jung <a.jung@lancs.ac.uk>
Signed-off-by: Jia He <justin.he@arm.com>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #204

3 years agolib/vfscore: Update registration of `sync` to syscall_shim
Sergiu Moga [Thu, 13 May 2021 08:49:25 +0000 (11:49 +0300)]
lib/vfscore: Update registration of `sync` to syscall_shim

Change `UK_LIBC_SYSCALL` to `UK_LIBC_SYSCALLS` for the `sync` system call
with respect to the updated documentation.

Reported-by: Alexander Jung <a.jung@lancs.ac.uk>
Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #204

3 years agodoc/developers: Change `UK_LIBC_SYSCALL` to `UK_LIBC_SYSCALLS`
Sergiu Moga [Thu, 13 May 2021 08:42:21 +0000 (11:42 +0300)]
doc/developers: Change `UK_LIBC_SYSCALL` to `UK_LIBC_SYSCALLS`

Change the macro definition from `UK_LIBC_SYSCALL` to `UK_LIBC_SYSCALLS`.

Reported-by: Alexander Jung <a.jung@lancs.ac.uk>
Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #204

4 years agobuild: Introduce `mk_sub_libbuild_dir`
Simon Kuenzer [Mon, 26 Apr 2021 14:28:29 +0000 (16:28 +0200)]
build: Introduce `mk_sub_libbuild_dir`

Inline with `mk_sub_build_dir`, this commit introduces
`mk_sub_libbuild_dir` that enables creating a sub build
directory for a library. This new Makefile command has
two parameters: (1) library name, (2) sub directory
structure.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #194

4 years agolib/uktime: Register time syscall to syscall shim
Razvan Deaconescu [Sun, 14 Feb 2021 19:50:13 +0000 (21:50 +0200)]
lib/uktime: Register time syscall to syscall shim

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #124

4 years agolib/vfscore: Register `fstatfs` to syscall_shim
Sergiu Moga [Mon, 8 Mar 2021 17:25:54 +0000 (19:25 +0200)]
lib/vfscore: Register `fstatfs` to syscall_shim

Register `fstatfs` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #144

4 years agolib/*: Use `UK_WARN_STUBBED()`
Simon Kuenzer [Mon, 25 May 2020 01:53:53 +0000 (03:53 +0200)]
lib/*: Use `UK_WARN_STUBBED()`

Replaces the occurrences of `WARN_STUBBED()` to `UK_WARN_STUBBED()`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #172

4 years agolib/ukdebug: Provide `uk_printd_once()`, `uk_printk_once()`
Simon Kuenzer [Mon, 25 May 2020 01:44:01 +0000 (03:44 +0200)]
lib/ukdebug: Provide `uk_printd_once()`, `uk_printk_once()`

This commit introduces debug and kernel print helpers that print a
message just once. Any successive call of the same location of a
message will produce no output: `uk_printd_once()` and
`uk_printk_once()`, as well as `uk_pr_crit_once()`, `uk_pr_err_once()`,
`uk_pr_warn_once()`, and `uk_pr_info_once()`.
This can be used to limit the amount of shown messages.

This commit updates the macro `WARN_STUBBED()`. Since the
functionality of printing once is made generally available, the macro
is based on `uk_pr_warn_once()`. In order to be inline with the
Unikraft naming scheme and reducing the risk of naming conflicts,
the macro is also introduced under the name `UK_WARN_STUBBED()`.
`WARN_STUBBED()` should be considered as deprecated.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #172

4 years agolib/uktime: Register times syscall in syscall shim
Razvan Deaconescu [Sun, 14 Feb 2021 20:09:16 +0000 (22:09 +0200)]
lib/uktime: Register times syscall in syscall shim

The times syscall is marked as not supported, i.e. returns -ENOTSUP.

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #125

4 years agolib/posix-user: Register `getgroups` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 17:39:06 +0000 (19:39 +0200)]
lib/posix-user: Register `getgroups` to syscall_shim

Register `getgroups` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #116

4 years agolib/posix-user: Register `setfsuid` to syscall_shim
Sergiu Moga [Sat, 13 Mar 2021 13:39:49 +0000 (15:39 +0200)]
lib/posix-user: Register `setfsuid` to syscall_shim

Register `setfsuid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #145

4 years agolib/vfscore: Register `statfs` to syscall_shim
Sergiu Moga [Mon, 8 Mar 2021 17:16:11 +0000 (19:16 +0200)]
lib/vfscore: Register `statfs` to syscall_shim

Register `statfs` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #143

4 years agolib/posix-user: Register `setfsgid` to syscall_shim
Sergiu Moga [Sat, 13 Mar 2021 13:57:35 +0000 (15:57 +0200)]
lib/posix-user: Register `setfsgid` to syscall_shim

Register `setfsgid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #146

4 years agolib/vfscore: Register `ioctl` to syscall_shim
Sergiu Moga [Tue, 16 Mar 2021 19:58:34 +0000 (21:58 +0200)]
lib/vfscore: Register `ioctl` to syscall_shim

Register `ioctl` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Cristian Vijelie <cristianvijelie@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #153

4 years agolib/uksignal: Register alarm syscall to syscall shim
Razvan Deaconescu [Sun, 14 Feb 2021 18:45:42 +0000 (20:45 +0200)]
lib/uksignal: Register alarm syscall to syscall shim

The alarm syscall is stubbed, i.e. the implementation returns 0.

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #122

4 years agolib/nolibc: Add fputc and putchar
Vlad-Andrei Badoiu [Wed, 31 Mar 2021 19:47:32 +0000 (22:47 +0300)]
lib/nolibc: Add fputc and putchar

Signed-off-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Reviewed-by: Dragos Iulian Argint <dragosargint21@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #177

4 years agodevfs: Introduce stdout device
Alexander Jung [Fri, 15 Jan 2021 22:44:56 +0000 (23:44 +0100)]
devfs: Introduce stdout device

This commit introduces a new device, `/dev/stdout` which pipes
output to the platform console.

Signed-off-by: Alexander Jung <a.jung@lancs.ac.uk>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #104

4 years agolib/*: Change `libc-style` syscalls to their `raw` variant
Sergiu Moga [Mon, 15 Feb 2021 16:16:34 +0000 (18:16 +0200)]
lib/*: Change `libc-style` syscalls to their `raw` variant

This commit changes the recently merged `libc-style` syscall registrations to syscall-shim to their `raw` variant.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Cristian Vijelie <cristianvijelie@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #129

4 years agolib/uksignal: Register pause syscall to syscall shim
Razvan Deaconescu [Sun, 14 Feb 2021 18:30:26 +0000 (20:30 +0200)]
lib/uksignal: Register pause syscall to syscall shim

The pause syscall is stubbed, i.e. the implementation returns 0.

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #121

4 years agolib/posix-user: Register `capset` to syscall_shim
Sergiu Moga [Sat, 13 Mar 2021 16:22:47 +0000 (18:22 +0200)]
lib/posix-user: Register `capset` to syscall_shim

Register `capset` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #148

4 years agoplat/common: Fix struct name in `sw_ctx_size()`
Simon Kuenzer [Thu, 22 Apr 2021 21:29:15 +0000 (23:29 +0200)]
plat/common: Fix struct name in `sw_ctx_size()`

By mistake, a wrong struct name (`ukplat_ctx`) was used instead
of `sw_ctx` in `sw_ctx_size()`. The issue was introduced with
commit 9ca0659f6 and caused a Unikraft build to fail.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #188

4 years agobuild: Warn about empty libraries and platforms
Simon Kuenzer [Mon, 15 Mar 2021 09:44:35 +0000 (10:44 +0100)]
build: Warn about empty libraries and platforms

Print a warning on the console when libraries and/or platforms are dropped
from the build because they are empty. The message is shown when verbose
mode is active (`V=1`).

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #152

4 years agolib/uksignal: Use thread creation callbacks for initialization
Simon Kuenzer [Mon, 22 Feb 2021 16:13:41 +0000 (17:13 +0100)]
lib/uksignal: Use thread creation callbacks for initialization

Make use of thread creation callbacks to initializing `signals_container`
of a thread. This is making `lib/uksched` more independent from
`lib/uksignal`. In order to achieve complete independence,
`signals_container` should actually be moved to the thread local storage
of each thread and defined within `uksignal`. So far, we do not have a
helper function to access a variable of a foreign TLS during thread
initialization. Because of this we need to finish this restructuring
later.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #138

4 years agolib/ukbus: Increase initialization class to `platform`
Simon Kuenzer [Mon, 14 Dec 2020 20:23:58 +0000 (21:23 +0100)]
lib/ukbus: Increase initialization class to `platform`

Since buses can have dependencies to other basic libraries and require
their early initialization to be called before (e.g, in order create
threads (XenStore), a potentially used threading API library needs to
be initialized before), we make sure that `UK_INIT_CLASS_EARLY` is
reserved for early library initialization. We scan for devices at the
intended stage `UK_INIT_CLASS_PLAT`.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #138

4 years agolib/uksched: Thread creation callbacks
Simon Kuenzer [Mon, 14 Dec 2020 20:23:57 +0000 (21:23 +0100)]
lib/uksched: Thread creation callbacks

Introduces the ability for libraries to hook into thread creation and
deletion process at `lib/uksched`. Main intended usage are libc's
(like newlibc, musl) that can initialize TLS for each thread, even
when a thread is created/deleted through the uksched API.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #138

4 years agoinclude/: No dependency to `lib/ukalloc` for thread contexts
Simon Kuenzer [Mon, 14 Dec 2020 20:23:56 +0000 (21:23 +0100)]
include/: No dependency to `lib/ukalloc` for thread contexts

Changes the platform API in a way so that there is no dependency to
`ukalloc` for context creation. An API function is added to query the
allocation size for a thread context. Another API function is added to
call the platform-specific thread context initialization.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #138

4 years agoinclude/: Remove libc dependency in `<uk/plat/thread.h>`
Simon Kuenzer [Mon, 14 Dec 2020 20:23:55 +0000 (21:23 +0100)]
include/: Remove libc dependency in `<uk/plat/thread.h>`

Removes the dependency to a libc with the platform header
`<uk/plat/thread.h>`. This is done in order to avoid unexpected
import orders and conflicts caused by generic Unikraft headers.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Daniel Dinca <dincadaniel97@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #138

4 years agolib/vfscore: Register `mount` to syscall_shim
Sergiu Moga [Mon, 15 Feb 2021 10:16:22 +0000 (12:16 +0200)]
lib/vfscore: Register `mount` to syscall_shim

Register `mount` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Dragos Iulian Argint <dragosargint21@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #126

4 years agolib/uktime: Register gettimeofday syscall to syscall shim
Razvan Deaconescu [Sun, 14 Feb 2021 19:08:14 +0000 (21:08 +0200)]
lib/uktime: Register gettimeofday syscall to syscall shim

Signed-off-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #123

4 years agolib/posix-user: Register `setuid` to syscall_shim
Sergiu Moga [Fri, 29 Jan 2021 16:32:11 +0000 (18:32 +0200)]
lib/posix-user: Register `setuid` to syscall_shim

Register `setuid` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #112

4 years agobuild: Support generating C/C++ headers with pre-processing
Simon Kuenzer [Fri, 18 Dec 2020 18:09:24 +0000 (19:09 +0100)]
build: Support generating C/C++ headers with pre-processing

Supports generating C/C++ header files by the pre-processing rules
of the build system.

Example:
 LIBMYLIB_SRCS += $(LIBMYLIB_BASE)/header.m4>.h

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
4 years agobuild: `*.in` files as pure pre-processed files
Simon Kuenzer [Fri, 18 Dec 2020 18:09:23 +0000 (19:09 +0100)]
build: `*.in` files as pure pre-processed files

Registers `*.in` files as purely pre-processed files. The idea is
that such generated files can be used/included by other source
files during pre-processing or compiling.

Example:
 LIBMYLIB_SRCS += $(LIBMYLIB_BASE)/source.m4>.in

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
4 years agobuild: Introduce pre-processing build stage (`preprocess`)
Simon Kuenzer [Fri, 18 Dec 2020 18:09:22 +0000 (19:09 +0100)]
build: Introduce pre-processing build stage (`preprocess`)

Introduces the pre-process build stage which is executed after
`prepare` and before compiling object files. This is done in
order to let header files be generated later.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
4 years agobuild: Pre-processing rule for AWK progfiles
Simon Kuenzer [Fri, 18 Dec 2020 18:09:21 +0000 (19:09 +0100)]
build: Pre-processing rule for AWK progfiles

Introduces an AWK pre-processing rule as another way for generating source
files based on AWK progfiles. One intention of this is to simplify
`Makefile.uk` of `lib/syscall_shim`.
The source file is treated as the AWK progfile which will be executed over
given includes (`AWKINCLUDES[-y]`). Because global flags and includes
would not be meaningful for AWK rules, we support only library-local and
file-local scopes.

Example of compiling `uk_syscall6.o` from `uk_syscall6.awk`
in `lib/syscall_shim`:
 LIBSYSCALL_SHIM_SRCS += $(LIBSYSCALL_SHIM_BASE)/gen_uk_syscall6.awk>.c
 LIBSYSCALL_SHIM_GEN_UK_SYSCALL6_AWKFLAGS    += -F '-'
 LIBSYSCALL_SHIM_GEN_UK_SYSCALL6_AWKINCLUDES += $(LIBSYSCALL_SHIM_BUILD)/provided_syscalls.h.in

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
4 years agobuild: Per-file flags and includes for M4 pre-processing
Simon Kuenzer [Fri, 18 Dec 2020 18:09:20 +0000 (19:09 +0100)]
build: Per-file flags and includes for M4 pre-processing

Similar to build rules, we add support for specifying file-local
flags and includes to M4 pre-processing rules. This can be done
through the following variables:
 <LIBNAME>_<SOURCE NAME>_M4FLAGS
 <LIBNAME>_<SOURCE NAME>_M4INCLUDES

Example: Setting `-myflag` to the M4 pre-processing of `code.m4`:
 LIBMYLIB_SRCS += $(LIBMYLIB_BASE)/code.m4>.c
 LIBMYLIB_CODE_M4FLAGS += -myflag

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
4 years agobuild: Use secondary expansion for M4 pre-processing
Simon Kuenzer [Fri, 18 Dec 2020 18:09:19 +0000 (19:09 +0100)]
build: Use secondary expansion for M4 pre-processing

Similar to our build rules, we enable secondary expansion of
flags and includes to M4 pre-processing rules.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
4 years agobuild: Enable extending pre-processing rules
Simon Kuenzer [Fri, 18 Dec 2020 18:09:18 +0000 (19:09 +0100)]
build: Enable extending pre-processing rules

Similar to build rules, we enable extending the supported pre-process
rules. This can be achieved by specifying a pre-process rule definition
within a libraries' `Makefule.rules` with the following name scheme:

preprule_<source file extension>

Examples:
 preprule_m4 for *.m4 source files
 preprule_awk for *.awk source files

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
4 years agolib: Clean up library names and put them in the same format
Gabriel Mocanu [Thu, 15 Apr 2021 07:57:14 +0000 (10:57 +0300)]
lib: Clean up library names and put them in the same format

Signed-off-by: Gabriel Mocanu <gabi.mocanu98@gmail.com>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #180

4 years agolib/ukmmap: Register `madvise` to syscall_shim
Sergiu Moga [Tue, 23 Mar 2021 14:14:24 +0000 (16:14 +0200)]
lib/ukmmap: Register `madvise` to syscall_shim

Register `madvise` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #162

4 years agolib/vfscore: Register `sync` to syscall_shim
Sergiu Moga [Mon, 15 Feb 2021 18:07:30 +0000 (20:07 +0200)]
lib/vfscore: Register `sync` to syscall_shim

Register `sync` system call to syscall_shim library.

Signed-off-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Mocanu Viorel Gabriel <gabi.mocanu98@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #149

4 years agosupport: checkpatch: Unikraft subject format
Simon Kuenzer [Mon, 29 Mar 2021 12:35:48 +0000 (14:35 +0200)]
support: checkpatch: Unikraft subject format

Checks and fails with an error when the subject line format is not
following the Unikraft scheme.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #169

4 years agosupport: checkpatch: Prefer raw system call definitions
Simon Kuenzer [Mon, 15 Feb 2021 15:52:15 +0000 (16:52 +0100)]
support: checkpatch: Prefer raw system call definitions

Introduces a warning for system call definitions when
`UK_SYSCALL_DEFINE` and `UK_LLSYSCALL_DEFINE` was used:
Raw system call definitions are preferred because `errno`
is not used.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #166

4 years agolib/isrlib: "Interrupt-service-routine"-safe standard functions 160/head
cristian-vijelie [Thu, 28 Jan 2021 11:34:46 +0000 (13:34 +0200)]
lib/isrlib: "Interrupt-service-routine"-safe standard functions

Introduces libisr, a library for providing "interrupt-service-routine"-
safe variants of standard functions so that they can be used in
interrupt handlers and early boot code. This commit provides an initial
set of standard functions normally found with `<string.h>`. The
implementation is derived from nolibc and compiled with the `|isr`
variant which disables the use of extended CPU features, like
vector units (e.g., SSE, AVX) and floating point units.

Signed-off-by: cristian-vijelie <cristianvijelie@gmail.com>
Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #151

4 years agolib/ukboot: Update stack guard initialization
Marc Rittinghaus [Tue, 2 Mar 2021 08:07:40 +0000 (09:07 +0100)]
lib/ukboot: Update stack guard initialization

Use new stack guard initialization function instead of old macro.

Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #141

4 years agolib/uksp: Replace stack guard initialization code
Marc Rittinghaus [Tue, 2 Mar 2021 08:06:52 +0000 (09:06 +0100)]
lib/uksp: Replace stack guard initialization code

The existing setup macro sets only the lower 32 bits, even on
64-bit platforms. This commit creates a canary in full native word
length. It also incorporates a null terminator to mitigate classic
byte-by-byte attacks with str*-functions.

Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #141

4 years agolib/ukswrand: Export uk_swrand_fill_buffer()
Marc Rittinghaus [Tue, 2 Mar 2021 08:05:33 +0000 (09:05 +0100)]
lib/ukswrand: Export uk_swrand_fill_buffer()

Adds uk_swrand_fill_buffer to the exported symbols for
use by other unikernel components.

Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #141

4 years agolib/ukboot: Fix initialization of canary
Marc Rittinghaus [Tue, 2 Mar 2021 08:04:20 +0000 (09:04 +0100)]
lib/ukboot: Fix initialization of canary

Initializing the random stack canary in ukplat_entry() is too
early because at this point lib/ukswrand is not initialized and
uk_swrand_randr() returns fixed known values. We do the
canary initialization after the init table run instead. Although
a bit late, the canary will at least be set before any
application-specific code runs.

Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #141

4 years agolib/uksp: Change default canary to terminator canary
Marc Rittinghaus [Tue, 2 Mar 2021 08:02:33 +0000 (09:02 +0100)]
lib/uksp: Change default canary to terminator canary

The terminator canary contains different terminator characters
for inputs (e.g., newline) and is thus more effective than an
arbitrary constant value in protecting against, for example,
str*-function-based buffer overflows.

Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #141

4 years agoCorrect license headers introduced by UPB
Simon Kuenzer [Mon, 15 Feb 2021 11:19:02 +0000 (12:19 +0100)]
Correct license headers introduced by UPB

This commit removes the additional clause
"THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY"
from BSD license headers that got introduced by mistake
Roxana Nicolescu with the following commit:
 cd1873671 - lib/ukblkdev: Request interface
 9065c15ef - plat/xen/drivers/blk: Register blkfront with libukblkdev
 30f42955f - plat/xen/drivers: Introduce blkfront driver skeleton
 620425c02 - lib/ukblkdev: Blkdev registration
 bff097cd2 - plat/xen/drivers/blk: Init Xenbus Device

On the one hand, this additional clause is redundant because
the BSD license already states that it must remain and the
copyright notice must be kept.
On the other hand, the clause freezes the file header
and prohibits future contributors from extending the
copyright notice for their contributions. This additional
clause is not part of the official BSD 3-clause.

The original author consents to the change with a `Signed-off-by`
or `Reviewed-by` tag to this commit.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Signed-off-by: Roxana Nicolescu <nicolescu.roxana1996@gmail.com>
4 years agoCorrect license headers introduced by UPB
Simon Kuenzer [Mon, 15 Feb 2021 11:19:01 +0000 (12:19 +0100)]
Correct license headers introduced by UPB

This commit removes the additional clause
"THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY"
from BSD license headers that got introduced by mistake
by Bogdan Lascu with the following commit:
 32ad87545 - lib/vfscore: Add anonymous pipe

On the one hand, this additional clause is redundant because
the BSD license already states that it must remain and the
copyright notice must be kept.
On the other hand, the clause freezes the file header
and prohibits future contributors from extending the
copyright notice for their contributions. This additional
clause is not part of the official BSD 3-clause.

The original author consents to the change with a `Signed-off-by`
or `Reviewed-by` tag to this commit.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro> on behalf of Bogdan Lascu
4 years agoCorrect license headers introduced by UPB
Simon Kuenzer [Mon, 15 Feb 2021 11:19:00 +0000 (12:19 +0100)]
Correct license headers introduced by UPB

This commit removes the additional clause
"THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY"
from BSD license headers that got introduced by mistake
by Razvan Cojocaru with the following commit:
 63fac86c7 - lib/uknetdev: Netdev registration

On the one hand, this additional clause is redundant because
the BSD license already states that it must remain and the
copyright notice must be kept.
On the other hand, the clause freezes the file header
and prohibits future contributors from extending the
copyright notice for their contributions. This additional
clause is not part of the official BSD 3-clause.

The original author consents to the change with a `Signed-off-by`
or `Reviewed-by` tag to this commit.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro> on behalf of Razvan Cojocaru
4 years agoCorrect license headers introduced by UPB
Simon Kuenzer [Mon, 15 Feb 2021 11:18:59 +0000 (12:18 +0100)]
Correct license headers introduced by UPB

This commit removes the additional clause
"THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY"
from BSD license headers that got introduced by mistake
by Vlad-Andrei BĂDOIU with the following commits:
 d2967b3b1 - lib/ukswrand: Adapt the library to work with multiple algorithms
 9bb9a617d - lib/ukswrand: Add ChaCha algorithm
 8c5e2b4bb - lib/ukswrand: Add /dev/random and /dev/urandom
 2784ae201 - lib/nolibc: Add pwd.h
 19ebca61d - include/uk: Add page.h
 8c9cd0ec9 - lib/uksysinfo: Introduce uksysinfo library
 3a39d50dd - plat/*: Introduce unikraft internal constructors
 200037918 - lib/nolibc: Add utsname.h

On the one hand, this additional clause is redundant because
the BSD license already states that it must remain and the
copyright notice must be kept.
On the other hand, the clause freezes the file header
and prohibits future contributors from extending the
copyright notice for their contributions. This additional
clause is not part of the official BSD 3-clause.

The original author consents to the change with a `Signed-off-by`
or `Reviewed-by` tag to this commit.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro> on behalf of Vlad-Andrei BĂDOIU
4 years agoCorrect license headers introduced by UPB
Simon Kuenzer [Mon, 15 Feb 2021 11:18:58 +0000 (12:18 +0100)]
Correct license headers introduced by UPB

This commit removes the additional clause
"THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY"
from BSD license headers that got introduced by mistake
by Cristian Banu with the following commits:
 ca9616f9a - lib/uk9p: Add 9P fid abstraction
 b2ce99adc - lib/uk9p: Add 9P transport registration
 5c24de843 - lib/uk9p: Add 9P device implementation
 440259b39 - plat/xen/drivers/9p: Initialize xenbus device
 5282598ae - plat/drivers: Virtio 9P driver skeleton
 7ee9a512d - plat/xen/drivers: Add 9pfront driver skeleton
 f2c29a657 - lib/uk9p: Add 9P requests abstraction
 f74733d49 - lib/9pfs: Implement mount and unmount
 cd65e50e4 - lib/uk9p: Add 9P protocol core definitions
 ef1021378 - lib/9pfs: Add 9pfs header
 e77b99c78 - lib/uk9p: Add 9P helper API

On the one hand, this additional clause is redundant because
the BSD license already states that it must remain and the
copyright notice must be kept.
On the other hand, the clause freezes the file header
and prohibits future contributors from extending the
copyright notice for their contributions. This additional
clause is not part of the official BSD 3-clause.

The original author consents to the change with a `Signed-off-by`
or `Reviewed-by` tag to this commit.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro> on behalf of Cristian Banu
4 years agoCorrect license headers introduced by UPB
Simon Kuenzer [Mon, 15 Feb 2021 11:18:57 +0000 (12:18 +0100)]
Correct license headers introduced by UPB

This commit removes the additional clause
"THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY"
from BSD license headers that got introduced by mistake
by Costin Lupu with the following commits:
 e09db222a - lib/posix-process: Introduce library
 790787e1a - plat/kvm: Add KVM (x86_64) timer support
 495221f5a - plat/common: Common x86 tracing functions
 6ea24ce5f - plat/common: Common x86 segment descriptors definitions
 3174af1a1 - plat/common: Common x86 traps definitions and functions
 f2478ed85 - plat/kvm: Add KVM (x86_64) interrupts support
 9f0389adf - plat/xen: Add Xenbus driver registration support
 ff0c0bf65 - plat/kvm: Fix current thread retrieval in interrupt context on x86_64
 fbbc468c9 - lib/uktime: Introduce time_types.h for type defintions
 a79078c96 - plat/xen: Add API for Xenstore messages
 300c8309c - plat: Introduce API for setting platform default allocator
 45d7afdb5 - lib/uksched: Introduce thread attributes
 9464bdc06 - plat/xen: Introduce client API for Xenbus drivers
 cf2e10677 - plat/common: Common x86 CPU definitions
 3bf7ba15a - plat/xen: Add IRQ subsystem initialization function
 26a59e3d2 - plat/xen: Add support for communication with Xenstore daemon
 cc797499a - plat/common: Common x86 CPU functions
 dde942de7 - lib/ukunistd: Add user.h for user related functions declarations
 1162bca18 - lib/posix-libdl: Add stubs
 0101002ee - plat/common: Halting functions
 5e73e025f - plat/xen: Add Xenstore watch support
 62917eb15 - plat/linuxu: Add linuxu (x86_64) interrupts support
 2c29345cd - lib/ukswrand: Add getrandom() function
 925b04e24 - plat/linuxu: Add linuxu (x86_64) timer support
 df484abae - lib/nolibc: Add time.c

On the one hand, this additional clause is redundant because
the BSD license already states that it must remain and the
copyright notice must be kept.
On the other hand, the clause freezes the file header
and prohibits future contributors from extending the
copyright notice for their contributions. This additional
clause is not part of the official BSD 3-clause.

The original author consents to the change with a `Signed-off-by`
or `Reviewed-by` tag to this commit.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Reviewed-by: Razvan Deaconescu <razvan.deaconescu@cs.pub.ro> on behalf of Costin Lupu
4 years agoplat/common: Fix section variables for .eh_frame and .eh_frame_hdr
Marc Rittinghaus [Tue, 2 Mar 2021 17:35:41 +0000 (18:35 +0100)]
plat/common: Fix section variables for .eh_frame and .eh_frame_hdr

This commit adds missing brackets to the .eh_frame and .eh_frame_hdr
variables.

Signed-off-by: Marc Rittinghaus <marc.rittinghaus@kit.edu>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@upb.ro>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #142

4 years agoCorrect license headers introduced by Arm Ltd.
Simon Kuenzer [Mon, 15 Feb 2021 11:18:56 +0000 (12:18 +0100)]
Correct license headers introduced by Arm Ltd.

This commit removes the additional clause
"THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY"
from BSD license headers that got introduced by mistake
with the following commits:
 c06ff6e61 - plat/common: Implement assembly helper for Arm64 thread context switch
 ac8ebd49e - plat/common: Add cache maintenance support for arm64
 d411a62f8 - plat/common: Implement PSCI despatch functions for arm64
 b329b5143 - plat/common: Move global variables defined in link scripts to a header
 c1827efc4 - plat/kvm: Add Arm64 virtual timer library to provide ticks
 7a65cf0e3 - plat/common: Common arm64 CPU interrupt flag handling
 25ff8503b - plat/kvm: Add interrupt handle APIs for arm64
 70fc87133 - plat/common: Implement CPU halt function for arm64
 74ef78c41 - plat/include: Define macros for Arm64 to access registers
 65b6280b6 - plat/kvm: Add linker script for Arm64
 9c7b1e93b - uk/arch: Add necessary header files for Arm64
 24297ac1a - plat/kvm: Add Arm64 basic entry code
 37e9d07f4 - plat/include: Define address offsets of boot stack and pagetable
 1a16e1046 - plat: Implement tls stub for arm64
 b41faf876 - plat/drivers/ofw: Move gic_get_irq_from_dtb to gic_fdt.c
 8ed802d62 - plat/kvm: Implement stub of ukplat_stack_set_current_thread for arm64
 1f5ea382e - plat/common: Split arch specific codes from time.c to arm{, 64}/time.h
 2def01809 - lib/fdt: Introduce fdt_getprop_u32_by_offset helper
 278ad9eda - plat/common: Add a platform API to get IRQ from device tree
 5183a0a64 - plat/common: Implement gic-v2 library for Arm
 1fc6481a1 - plat/common: Introduce fdt_interrupt_cells helper to parse irq

On the one hand, this additional clause is redundant because
the BSD license already states that it must remain and the
copyright notice must be kept.
On the other hand, the clause freezes the file header
and prohibits future contributors from extending the
copyright notice for their contributions. This additional
clause is not part of the official BSD 3-clause.

The original author or affiliation consents to the change
with a `Signed-off-by` or `Reviewed-by` tag to this
commit.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Signed-off-by: Jia He <justin.he@arm.com>
4 years agoCorrect license headers introduced by NEC Laboratories Europe GmbH
Simon Kuenzer [Mon, 15 Feb 2021 11:18:55 +0000 (12:18 +0100)]
Correct license headers introduced by NEC Laboratories Europe GmbH

This commit removes the additional clause
"THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY"
from BSD license headers that got introduced by mistake
with the following commits:
 d7ab6740e - lib/ukunistd: Introduce ukunistd library
 154a9b466 - lib/ukallocbbuddy: Add binary buddy allocator implementation
 cfa2c08ae - lib/ukboot: Add Unikraft bootstrapping
 17327dfe6 - lib/ukargparse: Add argument parser
 1e1a8f5b5 - lib/ukschedcoop: Add cooperative round-robin scheduler
 c327e9713 - lib/uknetdev: Introduce Netbufs
 3c3dc48b5 - plat/xen: Add Xen (x86_64, ARM) platform code
 1fa094ed7 - plat/kvm: Introduce platform configuration struct
 a8cb90f65 - lib/ukalloc: Add abstraction library for memory allocators
 feb280521 - plat/xen: Split emergency and hypervisor console
 c722184e9 - include: Introduce <uk/prio.h>
 0bc9633a0 - plat/xen: Add console support for x86_64
 3b94c37a5 - plat/*: Add binary system call feature and API
 06cb4527f - plat/common: Add cpu.h for Arm32
 463baa06a - lib/vfscore: Automount option
 27af93b6d - lib/ukalloc: Move internal functions to new header
 1760d9ef4 - lib/nolibc: Add nolibc, a minimal subset of libc functions
 2c9108854 - plat/kvm: Add KVM (x86_64) platform code
 eacdeffea - arch: Add architecture interface
 8dba9141b - lib/nolibc: Provide assertions (assert.h)
 e6d46e521 - plat/kvm: System call trap handler (x86_64)
 8277edb38 - build: Add build and configuration framework
 3afda62dd - lib/ukdebug: Do not rely on libc for uk_pr_*()
 7c7518d28 - plat/linuxu: Add linux userspace (x86_64, ARM) platform code
 347cb7db4 - lib/ukdebug: Add printing and debug helpers
 1353814b3 - lib/uksched: Add abstraction library for schedulers
 828efb76e - plat: Add platform interface
 bd4825025 - lib/ukmmap: mmap trick for Go
 ef5245754 - plat/common: Split ARM generic timer implementation
 1717ee104 - lib/ukbus: Introduce abstraction for device buses
 71ee3e521 - plat/common: Introduce virtio standard header
 2d39b41ca - lib/ukmpi: Introduce mailboxes with libukmpi
 67e70a93b - plat/drivers: Introduce virtio PCI device
 00292f747 - include/uk: Introduce init table
 b49cc5403 - plat/drivers: Introduce the virtio bus
 ae22ad94c - plat/kvm: Add initial PCI bus driver for x86_64
 415e1ed05 - lib/ukswrand: Introduce libukswrand
 87880cde9 - plat/drivers: Reintroduce the virtio ring
 15bea914c - lib/uklibparam: Introduce the library parameter
 80928b929 - lib/uklock: Introduce semaphores and mutexes with libuklock
 340cd8ef6 - plat/common: virt to phys addr conversion
 bb7d1651e - arch: provide thread-local storage helper functions
 fcc07a3cd - lib/nolibc: move shared definitions to special include file
 4c2afee22 - plat: Add global struct to keep x86 CPU information
 11ac352a7 - plat: switch thread-local storage area on context switch
 00b652b41 - lib/vfscore: update license header for imported files
 740fc6014 - lib/ukdebug: save actual data into tracebuffer
 2bc4d9df7 - lib/ukdebug: trace.h - introduce UK_FOREACH and UK_NARGS macros
 917d23a75 - support/scripts: fetch trace data from running Unikraft
 b3fbde2b3 - lib/vfscore: implement fops for std(out|err)
 ccb39b566 - lib/syscall_shim: introduce syscalls macro layer
 146c13e04 - lib/vfscore: introduce vfscore

On the one hand, this additional clause is redundant because
the BSD license already states that it must remain and the
copyright notice must be kept.
On the other hand, the clause freezes the file header
and prohibits future contributors from extending the
copyright notice for their contributions. This additional
clause is not part of the official BSD 3-clause.

The original author or affiliation consents to the change
with a `Signed-off-by` or `Reviewed-by` tag to this
commit.

Signed-off-by: Simon Kuenzer <simon.kuenzer@neclab.eu>
Signed-off-by: Sharan Santhanam<sharan.santhanam@neclab.eu>
Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
4 years agolib/vfscore: Neg error and use UK_SYSCALL_R_DEFINE
Sharan Santhanam [Wed, 10 Feb 2021 13:43:37 +0000 (14:43 +0100)]
lib/vfscore: Neg error and use UK_SYSCALL_R_DEFINE

All flavors of the write/read function return -ve errors. The
syscall is registered using `UK_SYSCALL_R_DEFINE` which  handles
errno appropriately.

Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #109

4 years agolib/vfscore: Implement readv and writev
Sharan Santhanam [Wed, 10 Feb 2021 13:20:54 +0000 (14:20 +0100)]
lib/vfscore: Implement readv and writev

Use do_pwritev and do_preadv to implement readv and writev. The
function removes additional error checks needed for offsets.

Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #109

4 years agolib/vfscore: Perform readv and writev operations
Sharan Santhanam [Wed, 10 Feb 2021 12:28:52 +0000 (13:28 +0100)]
lib/vfscore: Perform readv and writev operations

The actual read and write operations are split from the error
checks so, different flavors of read and write can call the
respective implementation without additional error checks.

Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #109

4 years agolib/vfscore: UK_VFSCORE_NOPOS flag to check seek
Sharan Santhanam [Wed, 10 Feb 2021 11:31:25 +0000 (12:31 +0100)]
lib/vfscore: UK_VFSCORE_NOPOS flag to check seek

When `UK_VFSCORE_NOPOS` is set, seek operation
is not allowed on a file descriptor. ESPIPE is returned
when seek operation is performed on these descriptors.

Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #109

4 years agolib/uksignal: Implement killpg
Sharan Santhanam [Tue, 9 Feb 2021 17:33:31 +0000 (18:33 +0100)]
lib/uksignal: Implement killpg

Implement killpg based on the kill implementation in uksignal.

Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Reviewed-by: Alexander Jung <a.jung@lancs.ac.uk>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #108

4 years agoplat/kvm: Enable more support page for multiboot
Sharan Santhanam [Thu, 10 Sep 2020 13:00:29 +0000 (15:00 +0200)]
plat/kvm: Enable more support page for multiboot

Signed-off-by: Sharan Santhanam <sharan.santhanam@neclab.eu>
Reviewed-by: Laurentiu Barbulescu <lrbarbulescu@gmail.com>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Pull-Request: #107