[SCM] Socket Wrapper Repository - branch master updated
Andreas Schneider
asn at samba.org
Mon Oct 20 08:48:00 MDT 2014
The branch, master has been updated
via db8edc8 src: Add support for running with address sanitizer.
via 390cfbe torture: Check the return code of kill().
from 95c39b3 swrap: Fix the loop for older gcc versions.
http://gitweb.samba.org/?p=socket_wrapper.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit db8edc87e6a1a771336d832a6da02c4760c74100
Author: Andreas Schneider <asn at samba.org>
Date: Mon Oct 20 09:13:36 2014 +0200
src: Add support for running with address sanitizer.
It address sanitzer will complain about our hack with variable function
attributes. This disables the checking of it.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>
commit 390cfbef05e42439f82d301752b74f8865f32225
Author: Andreas Schneider <asn at samba.org>
Date: Thu Oct 2 06:28:10 2014 +0200
torture: Check the return code of kill().
CID #73654
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Guenther Deschner <gd at samba.org>
-----------------------------------------------------------------------
Summary of changes:
ConfigureChecks.cmake | 11 +++++++++++
config.h.cmake | 1 +
src/socket_wrapper.c | 8 ++++++++
tests/torture.c | 20 ++++++++++++++++----
4 files changed, 36 insertions(+), 4 deletions(-)
Changeset truncated at 500 lines:
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index ea0a208..32cd9bb 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -194,6 +194,17 @@ int main(void) {
return 0;
}" HAVE_FUNCTION_ATTRIBUTE_FORMAT)
+check_c_source_compiles("
+void test_address_sanitizer_attribute(void) __attribute__((no_sanitize_address));
+
+void test_address_sanitizer_attribute(void)
+{
+ return;
+}
+
+int main(void) {
+ return 0;
+}" HAVE_ADDRESS_SANITIZER_ATTRIBUTE)
check_library_exists(dl dlopen "" HAVE_LIBDL)
if (HAVE_LIBDL)
diff --git a/config.h.cmake b/config.h.cmake
index 8b66420..91e1206 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -57,6 +57,7 @@
#cmakedefine HAVE_GCC_THREAD_LOCAL_STORAGE 1
#cmakedefine HAVE_DESTRUCTOR_ATTRIBUTE 1
+#cmakedefine HAVE_ADDRESS_SANITIZER_ATTRIBUTE 1
#cmakedefine HAVE_SOCKADDR_STORAGE 1
#cmakedefine HAVE_IPV6 1
#cmakedefine HAVE_FUNCTION_ATTRIBUTE_FORMAT 1
diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index b30303f..82e5737 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -100,6 +100,12 @@ enum swrap_dbglvl_e {
#define DESTRUCTOR_ATTRIBUTE
#endif
+#ifdef HAVE_ADDRESS_SANITIZER_ATTRIBUTE
+#define DO_NOT_SANITIZE_ADDRESS_ATTRIBUTE __attribute__((no_sanitize_address))
+#else
+#define DO_NOT_SANITIZE_ADDRESS_ATTRIBUTE
+#endif
+
#ifdef HAVE_GCC_THREAD_LOCAL_STORAGE
# define SWRAP_THREAD __thread
#else
@@ -598,6 +604,7 @@ static int libc_eventfd(int count, int flags)
}
#endif
+DO_NOT_SANITIZE_ADDRESS_ATTRIBUTE
static int libc_vfcntl(int fd, int cmd, va_list ap)
{
long int args[4];
@@ -649,6 +656,7 @@ static int libc_getsockopt(int sockfd,
return swrap.fns.libc_getsockopt(sockfd, level, optname, optval, optlen);
}
+DO_NOT_SANITIZE_ADDRESS_ATTRIBUTE
static int libc_vioctl(int d, unsigned long int request, va_list ap)
{
long int args[4];
diff --git a/tests/torture.c b/tests/torture.c
index 02ddc96..eab36de 100644
--- a/tests/torture.c
+++ b/tests/torture.c
@@ -48,6 +48,7 @@
#include <string.h>
#include <unistd.h>
#include <time.h>
+#include <stdbool.h>
#define TORTURE_ECHO_SRV_IPV4 "127.0.0.10"
/* socket wrapper IPv6 prefix fd00::5357:5fxx */
@@ -259,6 +260,8 @@ void torture_teardown_echo_srv(void **state)
ssize_t rc;
pid_t pid;
int fd;
+ bool is_running = true;
+ int count;
/* read the pidfile */
fd = open(s->srv_pidfile, O_RDONLY);
@@ -281,11 +284,20 @@ void torture_teardown_echo_srv(void **state)
pid = (pid_t)(tmp & 0xFFFF);
- /* Make sure the daemon goes away! */
- kill(pid, SIGTERM);
+ for (count = 0; count < 10; count++) {
+ /* Make sure the daemon goes away! */
+ kill(pid, SIGTERM);
- kill(pid, 0);
- if (rc == 0) {
+ usleep(200);
+
+ rc = kill(pid, 0);
+ if (rc != 0) {
+ is_running = false;
+ break;
+ }
+ }
+
+ if (is_running) {
fprintf(stderr,
"WARNING the echo server is still running!\n");
}
--
Socket Wrapper Repository
More information about the samba-cvs
mailing list