Giter VIP home page Giter VIP logo

lib-newlib's Introduction

newlib for Unikraft

Please refer to the README.md as well as the documentation in the doc/ subdirectory of the main unikraft repository.

lib-newlib's People

Contributors

andreittr avatar clupuishere avatar craciunoiuc avatar danield20 avatar eduardvintila avatar felipehuici avatar gabrielmocanu avatar gaulthiergain avatar hlef avatar justin-he avatar lascubogdan96 avatar marcrittinghaus avatar mariasfiraiala avatar mihaipogonaru avatar mogasergiu avatar nderjung avatar razvand avatar razvanvirtan avatar roxanan1996 avatar skuenzer avatar stefanjum avatar stefanteodorescu avatar vladandrew avatar yvolchkov avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lib-newlib's Issues

Error running the makefile

I come across this error when adding lib-newlib to the helloworld.

  CC      libsyscall_shim: uk_prsyscall.o
/home/galves46/Desktop/HackathonUnikraftPorto2023/git/scripts/workdir/unikraft/lib/syscall_shim/uk_prsyscall.c: In function ‘param_okflag’:
/home/galves46/Desktop/HackathonUnikraftPorto2023/git/scripts/workdir/unikraft/lib/syscall_shim/uk_prsyscall.c:431:38: error: ‘R_OK’ undeclared (first use in this function)
  431 |         PR_FLAG(sb, fmtf, orig_seek, R_, OK, okflags);
      |                                      ^~
/home/galves46/Desktop/HackathonUnikraftPorto2023/git/scripts/workdir/unikraft/lib/syscall_shim/uk_prsyscall.c:50:32: note: in definition of macro ‘PR_FLAG’
   50 |                 if ((flags) & (prefix##flagname)) {                     \
      |                                ^~~~~~
/home/galves46/Desktop/HackathonUnikraftPorto2023/git/scripts/workdir/unikraft/lib/syscall_shim/uk_prsyscall.c:431:38: note: each undeclared identifier is reported only once for each function it appears in
  431 |         PR_FLAG(sb, fmtf, orig_seek, R_, OK, okflags);
      |                                      ^~
/home/galves46/Desktop/HackathonUnikraftPorto2023/git/scripts/workdir/unikraft/lib/syscall_shim/uk_prsyscall.c:50:32: note: in definition of macro ‘PR_FLAG’
   50 |                 if ((flags) & (prefix##flagname)) {                     \
      |                                ^~~~~~
/home/galves46/Desktop/HackathonUnikraftPorto2023/git/scripts/workdir/unikraft/lib/syscall_shim/uk_prsyscall.c:432:38: error: ‘W_OK’ undeclared (first use in this function)
  432 |         PR_FLAG(sb, fmtf, orig_seek, W_, OK, okflags);
      |                                      ^~
/home/galves46/Desktop/HackathonUnikraftPorto2023/git/scripts/workdir/unikraft/lib/syscall_shim/uk_prsyscall.c:50:32: note: in definition of macro ‘PR_FLAG’
   50 |                 if ((flags) & (prefix##flagname)) {                     \
      |                                ^~~~~~
/home/galves46/Desktop/HackathonUnikraftPorto2023/git/scripts/workdir/unikraft/lib/syscall_shim/uk_prsyscall.c:433:38: error: ‘X_OK’ undeclared (first use in this function)
  433 |         PR_FLAG(sb, fmtf, orig_seek, X_, OK, okflags);
      |                                      ^~
/home/galves46/Desktop/HackathonUnikraftPorto2023/git/scripts/workdir/unikraft/lib/syscall_shim/uk_prsyscall.c:50:32: note: in definition of macro ‘PR_FLAG’
   50 |                 if ((flags) & (prefix##flagname)) {                     \
      |                                ^~~~~~
make[3]: *** [/home/galves46/Desktop/HackathonUnikraftPorto2023/git/scripts/workdir/unikraft/support/build/Makefile.build:27: /home/galves46/Desktop/HackathonUnikraftPorto2023/git/scripts/workdir/apps/app-helloworld/build/libsyscall_shim/uk_prsyscall.o] Error 1
make[2]: *** [Makefile:1032: sub-make] Error 2
make[1]: *** [Makefile:32: _all] Error 2

include/fcntl.h: mismatch between `O_NONBLOCK` and `FNONBLOCK` causes a blocking socket for `redis` on `AArch64`

Describe the bug

redis doesn't accept requests when run on AArch64.

There seems to be a mismatch between O_NONBLOCK and FNONBLOCK. FNONBLOCK shoud be an alias for O_NONBLOCK used by vfscore to create a nonblocking socket. However, redis makes use of the O_NONBLOCK flag, and even though the value for these 2 flags should be the same, it isn't.

That is because on AArch64 the O_NONBLOCK flag is redefined in include/fcntl.h, while, FNONBLOCK isn't.

The result is a blocking socket, which makes it impossible for redis to accept further requests.

Steps to reproduce

Build and run redis using newlib support on AArch64.

Download this executable and run it using this command:

$./redis-cli -h 172.44.0.2 -p 6379

Expected behavior

redis to be responding to requests:

$./redis-cli -h 172.44.0.2 -p 6379
172.44.0.2:6379> PING
PONG
172.44.0.2:6379> exit

Which architectures were you using or does this bug affect?

AArch64

Which platforms were you using or does this bug affect?

KVM

Error caused by uk/time_types.h

In file included from /data1/deepl/workdir/libs/lib-newlib/include/sys/_types.h:37:0,
from /data1/deepl/workdir/apps/nginx/build/libnewlibc/origin/newlib-2.5.0.20170922/newlib/libc/include/machine/endian.h:5,
from /data1/deepl/workdir/apps/nginx/build/libnewlibc/origin/newlib-2.5.0.20170922/newlib/libc/include/sys/param.h:10,
from /data1/deepl/workdir/libs/lib-newlib/include/sys/param.h:4,
from /data1/deepl/workdir/unikraft/include/uk/essentials.h:48,
from /data1/deepl/workdir/unikraft/lib/ukdebug/include/uk/print.h:41,
from /data1/deepl/workdir/unikraft/plat/common/x86/trace.c:34:
/data1/deepl/workdir/libs/lib-newlib/include/uk/_types.h:44:10: fatal error: uk/time_types.h: No such file or directory
#include <uk/time_types.h>
^~~~~~~~~~~~~~~~~

failed to compile the nginx and other libs are ok.

include/limits.h: wrong size for `LONG_MAX` causes crash on `AArch64` apps

Describe the bug

Default size of the data model for AArch64 is 8 (64 bits) for long types, however newlibc ends up defining LONG_MAX as 32 bits.

This issue causes extremely optimized functions, such as memchr (which parses DTB for apps like SQLite or redis), to crash when compiled for AArch64.

Steps to reproduce

Build and run SQLite on AArch64 using newlib support.

Expected behavior

Run the SQLite app without any errors.

Which architectures were you using or does this bug affect?

AArch64

Which platforms were you using or does this bug affect?

KVM

Relevant log output

When I run the SQLite app this is the error I get:

[    0.000000] ERR:  [libkvmpl031] <pl031.c @  187> Failed to find RTC IRQ from DTB

Most likely it is caused by the behaviour of memchr when parsing DTB.

uksignal support crashes app-helloworld-go build

When trying to build app-helloworld-go, we get this error:

/home/razvan/Documents/Unikraft/debug_helloworld_go/apps/app-helloworld-go/build/libgcc/origin/gcc-7.3.0/libgo/runtime/go-signal.c:200:33: error: ‘siginfo_t {aka struct <anonymous>}’ has no member named ‘si_addr’; did you mean ‘si_code’?
   ret.sigaddr = (uintptr)(info->si_addr);

This didn't happen before the uksignal support was integrated in newlib [1].
Apparently, the definition for siginfo_t is now provided by lib-newlib/musl-imported/include/signal.h and it is lighter than before, not including si_addr (this patch has lost it's effect [2]).

I think some newlib/uksignal updates will be needed in order to cover this usecase again.

[1] 08d36e6
[2] https://github.com/unikraft/lib-newlib/blob/staging/patches/0006-Add-si_addr-field-for-siginfo_t-and-use-__rtems__-de.patch

Bump version to 4.0.0

Bump the newlib library version to 4.0.0.
Aditional porting might be required since it's a significant bump.

Newlib compilation throws hundreds of errors with `gcc-11`

When using newlib with anything and compiling with gcc-11 hundreds of warnings are shown regarding alloc_size.

These warnings have the following format:

In file included from /home/***/.unikraft/libs/newlib/include/stdlib.h:37,
                 from /home/***/.unikraft/apps/hello-test/build/libnewlibc/origin/newlib-2.5.0.20170922/newlib/libc/argz/envz_remove.c:10:
/home/***/.unikraft/apps/hello-test/build/libnewlibc/origin/newlib-2.5.0.20170922/newlib/libc/include/stdlib.h:144:13: warning: ignoring attribute ‘alloc_size (3)’ because it conflicts with previous ‘alloc_size (2)’ [-Wattributes]
  144 |             __alloc_size(3);
      | 

This is because chained alloc_size attributes are deprecated in gcc-11.
To fix this, multiple arguments are given to alloc_size as per the documentation.

This has been fixed in newer versions of newlib. The patch that fixes this issue will no longer apply when bumping the version.

I will add these fixes as a Pull Request and link this issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.