README: fix instruction for network test

I was setting up an OSv with network today, following README instructions
and noticed that to run the test an invoke command is missing.

Maybe it's a syntax change from older versions.

Signed-off-by: Eduardo Piva <efpiva@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cpio: Check header magic number

Add CPIO header magic number checking to fail fast if there's something
wrong with the CPIO format.

Found by code inspection.

Reviewed-by: Glauber Costa <glommer@cloudius-systems.com>
Cc: Benoît Canet <benoit@irqsave.net>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cpio: Fix zero-length files

If c_filesize is zero, bail out immediately from parse_one(). Otherwise
the rdbuf()->pubsetbuf() call will wreak havoc on the stream position
and cause the next header to have corrupt CPIO magic.

Found by streaming openjdk rpm2cpio output to OSv.

Reviewed-by: Glauber Costa <glommer@cloudius-systems.com>
Cc: Benoît Canet <benoit@irqsave.net>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
loader.py: show the thread name while printing all threads

It is really helpful to know who is who when you are printing a backtrace
for all threads.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
modules: fix reference to undefined variable in filemap.py

Looks like an omission. You'd run into this if you had multiple
mappings for the same file on the guest.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: fix serialization of const char * tracepoint arguments

The serializer was reading from the destination buffer instead of the
source string. As a result all string arguments appeard as empty
strings in the trace.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Revert "cpio: Fix zero-length files"

This reverts commit 860d6c53e2ec0cec0e4f5411029cd62767059b6d.  It makes
cpiod.so completely ignore zero-length files.  This breaks 'make check'
because the tmp directory is no longer created, for example.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
upload_manifest.py: Specify file type

Specify file type in the cpio header.  This is needed to make cpiod.so
more robust by explicitly checking file type.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cpio: File type checking

Make cpiod.so more robust by checking the file type explicitly.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cpio: Symbolic link support

Add symbolic link support to cpiod.so parser.  As OSv does not yet
support symlinks, the files are never created on the filesystem.

This is needed for streaming rpm2cpio to OSv guest.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cpio: Directory support

Add support for directories.

Found by streaming openjdk rpm2cpio output to OSv.

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
virtio-net: zero req->mhdr.num_buffers

Zero req->mhdr.num_buffers in Tx path when MRG_RXBUF is negotiated as virtio spec demands.

Reviewed-by Zhi Yong Wu <zwu.kernel@gmail.com>
Reviewed-by: Asias He <asias@cloudius-systems.com>
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
mmu: show address of page fault

Now that we can print formatted stuff into abort, printing the address of the
fault can be helpful

Reviewed-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
upload_manifest.py: Allow an empty directory

Until now, our manifest did not support an empty directory, so we resorted
to uploading a file ".keep" inside the directory, which is kind of ugly
(this file remains in the final image).

Instead, in upload_manifest.py, if the given file is a directory (any
directory...), put it in the cpio as a directory, which causes an empty
directory to be created.

So now our images will no longer have files like /tmp/.keep.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Update gcc version requirement

Our README.md stated that gcc 4.7 is required (but 4.8 is recommended), but
4.7 will no longer work now that sched.hh uses, in class wait_object,
constructor inheritence. That feature was only added in 4.8 (see
http://gcc.gnu.org/gcc-4.8/changes.html).
So this patch fixes the README.md to say that gcc 4.8 is required.

Gcc 4.8 is almost a year old, no reason why we shouldn't use it (and the
C++11 features that were still missing in 4.7).

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
libc: implement secure_getenv()

It's needed by openssl. It supposed to return NULL if the environemnt is not
trusted. Our implementation just delegates to getenv().

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
devfs: implement devfs_getattr()

This fixes openssl issue manifesting itself with inability to
establish an SSL connection. Openssl refused to create new connection
due to insufficient entropy to generate session id. There was no
entropy because RAND_poll() didn't manage to read anything from any of
the randomness sourcess, which by default are:

 /dev/urandom
 /dev/random
 /dev/srandom

We do, however, have /dev/random on OSv. The problem was that when
openssl tries different sources it skips the ones which it already
tried by comparing stat.st_ino and stat.st_dev as returned by
fstat(). Because devfs didn't implement getattr operation both these
fields were always 0 so even though /dev/random was present it was not
considered.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: apply node filter to root node too

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: introduce --group-by option

This option will allow to introduce more grouping criterias than just
by thread. It replaces -m|--merge-threads option. Now by default there
is no grouping. Samples can be grouped by thread by passing '-g
thread'.

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: add ability to group profiles by CPU

Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>