From ab03c1cdce90660dcb75d000ebda817ae589aaec Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Sat, 5 May 2018 00:04:13 +0100 Subject: Fix handling of errno if external functions are invoked 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 --- lib/Core/SpecialFunctionHandler.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/Core/SpecialFunctionHandler.h') diff --git a/lib/Core/SpecialFunctionHandler.h b/lib/Core/SpecialFunctionHandler.h index 7e58018f..b11a4974 100644 --- a/lib/Core/SpecialFunctionHandler.h +++ b/lib/Core/SpecialFunctionHandler.h @@ -107,6 +107,7 @@ namespace klee { HANDLER(handleDelete); HANDLER(handleDeleteArray); HANDLER(handleExit); + HANDLER(handleErrnoLocation); HANDLER(handleAliasFunction); HANDLER(handleFree); HANDLER(handleGetErrno); -- cgit 1.4.1