Age | Commit message (Collapse) | Author |
|
permission error a single time in symbolic execution mode.
The rewrite also fixes a bug reported in #1230.
Rewrote the FilePerm.c test accordingly.
|
|
This variable was introduced by d2f5906da4ae37a41ae257e5308d50e19689877b
but not included in `config.h` before. As a result `#ifdef` would always
fail. Moving the code is necessary to set the variable before `config.h`
is created using `configure_file()` in CMakeLists.txt.
|
|
|
|
|
|
|
|
Former build system provided additional flags for building bitcode while
they were not required, e.g. under BSD or MacOS.
|
|
|
|
macOS versions, where stat64 is not defined anymore.
|
|
|
|
|
|
|
|
commit 8ed005daf0ab of glibc-2.33 (Remove stat wrapper functions, move
them to exported symbols) removed renames of `__fxstat`, `__xstat`, and
`__lxstat` to `__fxstat64`, `__xstat64`, and `__lxstat64`, respectively.
But we relied on the renames to build `fd_64.c` properly. With glibc
2.33, we now see link failures of the POSIX runtime:
error: Linking globals named '__xstat': symbol multiply defined!
Rename the functions using `__REDIRECT_NTH` in the code as
`__USE_FILE_OFFSET64` case (which we define at the top of the file by
`#define _FILE_OFFSET_BITS 64`) did exactly that.
Fixes #1384.
|
|
* failing malloc was not handled before, now returns null/ENOMEM
* when path is non-null and size is zero return null/EINVAL
|
|
|
|
Every runtime library can be build with multiple configurations.
Replace the Makefile-based setup by cmake one.
Currently, we generate 32bit and 64bit libraries simultaneously and can link against them.
|
|
|
|
|
|
to function names.
|
|
|
|
Hoist increment of `sc` into the loop header.
Memory locations can only be written to if they are writeable.
Avoid concretising a value by writing it. If the location is not symbolic in the first place.
This avoids writing read-only memory locations.
|
|
glibc 2.30 moved definition of getdents64 to dirent_ext.h. Hence, it
became visible to us (via dirent.h) and conflicts with our definition:
runtime/POSIX/fd_64.c:112:5: error: conflicting types for 'getdents64'
int getdents64(unsigned int fd, struct dirent *dirp, unsigned int count) {
^
/usr/include/bits/dirent_ext.h:29:18: note: previous declaration is here
extern __ssize_t getdents64 (int __fd, void *__buffer, size_t __length)
We use the parameters defined by kernel, not by userspace (libc). Both
glibc and uclibc define it as:
ssize_t __getdents64 (int fd, char *buf, size_t nbytes)
so follow it.
|
|
|
|
|
|
|
|
consistent naming convention
|
|
|
|
|
|
|
|
|
|
* also adds klee-replay as dependency for systemtests
|
|
add a corresponding check.
|
|
test.
|
|
To enable the POSIX support, the former implementation instrumented the
main function and inserted a call to `klee_init_env` at the beginning.
This has multiple disadvantages:
* debugging information was not correctly propagated leaving the call to
`klee_init_env` without debug information
* the main function always required `int arg, char**` as part of the
function definition of `main`
Based on the new linking infrastructure, we can now add an additional
wrapper `__klee_posix_wraper(int, char**)` that gets always called when
POSIX support is enabled. It executes `klee_init_env` and after that
calls the `main` function.
Enabling POSIX support only requires the renaming of the user provided
`main` into `__klee_posix_wrapped_main` in addition to linking.
|
|
Fixes #46 and reverts #47. As stated in #46, the solution works for
musl, glibc etc. However, the code in stub.c is executed by uclibc
and uclibc doesn't allocate the target buffer in realpath. The
memory error occured while running df for 10min with DFS.
|
|
|
|
If an external function in KLEE is invoked, it might update errno.
Previously, the errno specific variable in a state was only updated
if it was part of the executed instructions.
That opened up a timeframe that increased the likelihood of errno being
overwritten by another method call.
This patch fixes two issues:
* the errno of the KLEE process state is updated before the external
function call allowing to detect changes to it later on
* after the external call, the memory object of errno is directly
updated
with its new value, reducing the likelihood to be overwritten by
another
call
Additional features:
* Add support for `errno()` for Darwin as well.
* Simplified errno handling in POSIX layer
|
|
configuration, TravisCI scripts and Dockerfile build appropriately.
There are a bunch of clean ups this enables but this commit doesn't
attempt them. We can do that in future commits.
|
|
This was introduced when we added the --readable-posix-inputs option.
|
|
runtime: POSIX, make it compile with glibc 2.25
|
|
clang warns about check-after-use in POSIX runtime:
runtime/POSIX/fd.c:573:17: warning: nonnull parameter 'path' will evaluate to 'true' on first r [-Wpointer-bool-conversion]
(path ? __concretize_string(path) : NULL),
^~~~ ~
path is dereferenced in __get_sym_file before this check. So add a check
to __get_sym_file and handle NULL appropriatelly by returning NULL too.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
With glibc 2.25, we see:
runtime/POSIX/stubs.c:243:14: error: conflicting types for 'gnu_dev_major'
unsigned int gnu_dev_major(unsigned long long int __dev) __attribute__((weak));
^
/usr/include/sys/sysmacros.h:79:27: note: previous definition is here
__SYSMACROS_DEFINE_MAJOR (__SYSMACROS_IMPL_TEMPL)
^
Glibc 2.25 switched from ULL to dev_t for gnu_dev_major, gnu_dev_minor,
and gnu_dev_makedev. Handle by using an appropriate type according to
the glibc version.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
|
|
This is based off intial work by @jirislaby in #481. However it
has been substantially modified.
Notably it includes a separate build sytem to build the runtimes which
is inspired by the old build system. The reason for doing this is
because CMake is not well suited for building the runtime:
* CMake is configured to use the host compiler, not the bitcode
compiler. These are not the same thing.
* Building the runtime using `add_custom_command()` is flawed
because we can't automatically get transitive depencies (i.e.
header file dependencies) unless the CMake generator is makefiles.
(See `IMPLICIT_DEPENDS` of `add_custom_command()` in CMake).
So for now we have a very simple build system for building the runtimes.
In the future we can replace this with something more sophisticated if
we need it.
Support for all features of the old build system are implemented apart
from recording the git revision and showing it in the output of
`klee --help`.
Another notable change is the CMake build system works much better with
LLVM installs which don't ship with testing tools. The build system
will download the sources for `FileCheck` and `not` tools if the
corresponding binaries aren't available and will build them. However
`lit` (availabe via `pip install lit`) and GTest must already be
installed.
Apart from better support for testing a significant advantage of the
new CMake build system compared to the existing "Autoconf/Makefile"
build system is that it is **not** coupled to LLVM's build system
(unlike the existing build system). This means that LLVM's
autoconf/Makefiles don't need to be installed somewhere on the system.
Currently all tests pass.
Support has been implemented in TravisCI and the Dockerfile for
building with CMake.
The existing "Autoconf/Makefile" build system has been left intact
and so both build systems can coexist for a short while. We should
remove the old build system as soon as possible though because it
creates an unnecessary maintance burden.
|
|
|
|
Fixed the stub for times() not to dereference a NULL pointer when cal…
|
|
|
|
a NULL argument. In respose of issue https://github.com/klee/klee/issues/399
|
|
|
|
The SELinux function signatures have changed between version 2.2 and
2.3. In particular, the type of the "security context" parameter was
changed from char * to const char *, with the following patch:
SELinuxProject/selinux@9eb9c9327563014ad6a807814e7975424642d5b9.
Recent Linux distributions (e.g. Ubuntu 15.10) ship with the updated
version of libselinux. This change makes the SELinux runtime compatible
with the newer versions of the library by replacing security_context_t
with its original char * definition and defining it as const only if the
installed library does so. Whether the system uses const char * types is
detected with the configure script.
Fixes klee/klee#303.
|
|
preferences added in the POSIX model. Removed option --prefer-cex which controlled all CEX preferences.
|