Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 13 Jul 2011 15:07:23 +0400
From: Solar Designer <solar@...nwall.com>
To: musl@...ts.openwall.com
Subject: cluts review

Hi Luka, Rich -

I've just experimented with cluts a bit.  I'll start by posting a patch
containing only changes that I had to make for cluts to build (without
fixing any warnings, etc. - there are still lots of them).

The uses of SA_NODEFER appeared to be a bug anyway, so I am simply
removing them.

-std=c99 appears to be needed to get LLONG_MAX, etc. defined by glibc's
header files when compiling with older gcc (I used 3.4.5).

As it is, this patch is a hack.  I think that extensive cleanups to the
code being patched are needed.

I have other observations as well (such as from actually running the
tests), which I hope to post separately.

diff -urp cluts.orig/cluts.c cluts/cluts.c
--- cluts.orig/cluts.c	2011-07-09 11:26:23 +0000
+++ cluts/cluts.c	2011-07-13 10:13:29 +0000
@@ -1,3 +1,4 @@
+#define _BSD_SOURCE /* for scandir() and alphasort() */
 #include <dirent.h>
 #include <stdio.h>
 #include <unistd.h>
@@ -5,6 +6,7 @@
 #include <sys/stat.h>
 #include <errno.h>
 #include <sys/wait.h>
+#include <sys/param.h> /* for PATH_MAX */
 
 /*
  * Copyright (c) 2011 Luka Marд█etiд┤<paxcoder@...il.com>
diff -urp cluts.orig/makefile cluts/makefile
--- cluts.orig/makefile	2011-07-09 11:26:23 +0000
+++ cluts/makefile	2011-07-13 10:08:29 +0000
@@ -7,7 +7,7 @@
 # There's ABSOLUTELY NO WARRANTY, express or implied.
 #
 
-CFLAGS = -O2 -Wall -Wextra
+CFLAGS = -std=c99 -O2 -Wall -Wextra
 LIBS = -lpthread -lrt -lm
 SRC = $(wildcard tests/*.c) $(wildcard *.c)
 BIN = $(SRC:.c=)
diff -urp cluts.orig/tests/alloc.c cluts/tests/alloc.c
--- cluts.orig/tests/alloc.c	2011-07-09 11:26:23 +0000
+++ cluts/tests/alloc.c	2011-07-13 10:09:50 +0000
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE /* for sigaction() */
 #include <stdio.h>
 #include <stdlib.h>
 #include <pthread.h>
@@ -57,7 +58,7 @@ int main()
     sem_t sem; ///< semaphore is used for thread mutex
 
     act.sa_handler = bridge_sig_jmp;
-    act.sa_flags   = SA_NODEFER;
+    act.sa_flags   = 0;
     sigaction(SIGSEGV, &act, &oldact[0]);
     
     //make a head element for the ring-queue which will hold info about blocks:
@@ -230,7 +231,7 @@ int safe_free(void *vp, char *err_msg)
 {
         struct sigaction oldact, act;
         act.sa_handler = bridge_sig_jmp;
-        act.sa_flags   = SA_NODEFER;
+        act.sa_flags   = 0;
         
         sigaction(SIGABRT, &act, &oldact);
         if (!setjmp(env[1]))
diff -urp cluts.orig/tests/string.c cluts/tests/string.c
--- cluts.orig/tests/string.c	2011-07-09 11:26:23 +0000
+++ cluts/tests/string.c	2011-07-13 10:10:25 +0000
@@ -1,3 +1,4 @@
+#define _XOPEN_SOURCE
 #include <signal.h>
 #include <stdio.h>
 #include <sys/mman.h>
@@ -54,7 +55,7 @@ int main()
 
     //call bridge_sig_jmp on segmentation fault:
     act.sa_handler=bridge_sig_jmp;
-    act.sa_flags=SA_NODEFER;
+    act.sa_flags=0;
     sigaction(SIGSEGV, &act, &oldact);
     for (i=0; i<sizeof(buf_size)/sizeof(buf_size[0]); ++i) {
         //stretch to a page size:

Alexander

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.