Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161127105425.GA14788@hotdamn.lan>
Date: Sun, 27 Nov 2016 11:54:34 +0100
From: Sebastian Kemper <sebastian_ml@....net>
To: musl@...ts.openwall.com
Cc: Szabolcs Nagy <nsz@...t70.net>
Subject: Re: Robust shared mutexes?

On Sun, Nov 27, 2016 at 12:01:10AM +0100, Szabolcs Nagy wrote:
> * Rich Felker <dalias@...c.org> [2016-11-26 17:56:18 -0500]:
> > On Sat, Nov 26, 2016 at 11:51:05PM +0100, Sebastian Kemper wrote:
> > > 
> > > http://lists.openembedded.org/pipermail/openembedded-core/2016-March/119214.html
> > > 
> > > It says musl doesn't have process shared mutexes so one should set
> > > apr_cv_process_shared_works=no. I take it that is correct?
> > 
> > No, it's incorrect and I have no idea where that idea came from. I'll
> > ask Khem.
> > 
> 
> apr might care about sharing mutexes across i386 vs x86_64 ?
> 
> that does not work (glibc ditto)

Hello Szabolcs, list,

I installed a Gentoo musl-1.1.15 x86_64 chroot on my computer. Then I
ran ./configure in apr-1.5.2 in the musl chroot and also outside the
chroot in a glibc-2.22 environment.

The outcome was the same except for apr_cv_mutex_robust_shared:

ac_cv_func_setpgrp_void         musl yes glibc yes
ac_cv_file__dev_zero            musl yes glibc yes
apr_cv_tcp_nodelay_with_cork    musl yes glibc yes
apr_cv_mutex_recursive          musl yes glibc yes
ac_cv_func_pthread_rwlock_init  musl yes glibc yes
apr_cv_type_rwlock_t=yes        musl yes glibc yes
apr_cv_process_shared_works     musl yes glibc yes
apr_cv_mutex_robust_shared      musl no  glibc yes

I've posted the corresponding part from config.log below. It fails
because musl doesn't define PTHREAD_MUTEX_ROBUST_NP (glibc does). And
apr uses PTHREAD_MUTEX_ROBUST_NP. It means that I should set
apr_cv_mutex_robust_shared=no when cross-compiling this apr, I suppose
:)

configure:25459: checking for robust cross-process mutex support
configure:25500: gcc -o conftest -g -O2 -DLINUX -D_REENTRANT -D_GNU_SOURCE  conftest.c -lpthread >&5
conftest.c: In function 'main':
conftest.c:197:47: error: 'PTHREAD_MUTEX_ROBUST_NP' undeclared (first use in this function)
     if (pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP))
                                               ^
conftest.c:197:47: note: each undeclared identifier is reported only once for each function it appears in
configure:25500: $? = 1
configure: program exited with status 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define __EXTENSIONS__ 1
| #define _ALL_SOURCE 1
| #define _GNU_SOURCE 1
| #define _POSIX_PTHREAD_SEMANTICS 1
| #define _TANDEM_SOURCE 1
| #define HAVE_DLFCN_H 1
| #define LT_OBJDIR ".libs/"
| #define HAVE_ATOMIC_BUILTINS 1
| #define HAVE_PTHREAD_H 1
| #define HAVE_PTHREAD_H 1
| #define HAVE_PTHREAD_MUTEX_RECURSIVE 1
| #define HAVE_PTHREAD_KEY_DELETE 1
| #define HAVE_PTHREAD_RWLOCK_INIT 1
| #define HAVE_PTHREAD_ATTR_SETGUARDSIZE 1
| #define HAVE_PTHREAD_RWLOCKS 1
| #define HAVE_SCHED_H 1
| #define HAVE_SCHED_YIELD 1
| #define HAVE_GETHOSTBYNAME_R 1
| #define HAVE_GETHOSTBYADDR_R 1
| #define HAVE_GETSERVBYNAME_R 1
| #define HAVE_SIGSUSPEND 1
| #define HAVE_SIGWAIT 1
| #define HAVE_POLL 1
| #define HAVE_EPOLL 1
| #define HAVE_EPOLL_CREATE1 1
| #define HAVE_DUP3 1
| #define HAVE_ACCEPT4 1
| #define HAVE_SOCK_CLOEXEC 1
| #define HAVE_FDATASYNC 1
| #define HAVE_EPOLL_CREATE1 1
| #define HAVE_DUP3 1
| #define HAVE_ACCEPT4 1
| #define HAVE_SOCK_CLOEXEC 1
| #define HAVE_GETPWNAM_R 1
| #define HAVE_GETPWUID_R 1
| #define HAVE_GETGRNAM_R 1
| #define HAVE_GETGRGID_R 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_MMAN_H 1
| #define HAVE_SYS_IPC_H 1
| #define HAVE_SYS_SHM_H 1
| #define HAVE_SYS_FILE_H 1
| #define HAVE_MMAP 1
| #define HAVE_MUNMAP 1
| #define HAVE_SHM_OPEN 1
| #define HAVE_SHM_UNLINK 1
| #define HAVE_SHMGET 1
| #define HAVE_SHMAT 1
| #define HAVE_SHMDT 1
| #define HAVE_SHMCTL 1
| #define HAVE_MAP_ANON 1
| #define anonymous shared memory allocation method 1
| #define USE_SHMEM_MMAP_ANON 1
| #define namebased memory allocation method 1
| #define USE_SHMEM_SHMGET 1
| #define HAVE_ALLOCA_H 1
| #define HAVE_ALLOCA 1
| #define HAVE_CALLOC 1
| #define HAVE_SETSID 1
| #define HAVE_GETENV 1
| #define HAVE_PUTENV 1
| #define HAVE_SETENV 1
| #define HAVE_UNSETENV 1
| #define HAVE_WRITEV 1
| #define HAVE_GETIFADDRS 1
| #define HAVE_UTIME 1
| #define HAVE_UTIMES 1
| #define HAVE_SETRLIMIT 1
| #define HAVE_GETRLIMIT 1
| #define HAVE_SENDFILE 1
| #define HAVE_SIGACTION 1
| #define HAVE_DECL_SYS_SIGLIST 0
| #define HAVE_FORK 1
| #define HAVE_STRERROR_R 1
| #define STRERROR_R_RC_INT 1
| #define HAVE_MMAP 1
| #define HAVE_MEMMOVE 1
| #define HAVE_GETPASS 1
| #define HAVE_GMTIME_R 1
| #define HAVE_LOCALTIME_R 1
| #define HAVE_MKSTEMP 1
| #define STDC_HEADERS 1
| #define HAVE_CRYPT_H 1
| #define HAVE_CTYPE_H 1
| #define HAVE_DIRENT_H 1
| #define HAVE_DLFCN_H 1
| #define HAVE_ERRNO_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_GRP_H 1
| #define HAVE_LIMITS_H 1
| #define HAVE_MALLOC_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_NETDB_H 1
| #define HAVE_POLL_H 1
| #define HAVE_PWD_H 1
| #define HAVE_SEMAPHORE_H 1
| #define HAVE_SIGNAL_H 1
| #define HAVE_STDARG_H 1
| #define HAVE_STDDEF_H 1
| #define HAVE_STDIO_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_TERMIOS_H 1
| #define HAVE_TIME_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_ARPA_INET_H 1
| #define HAVE_NETINET_IN_H 1
| #define HAVE_SYS_FILE_H 1
| #define HAVE_SYS_IOCTL_H 1
| #define HAVE_SYS_MMAN_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_SYS_POLL_H 1
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_SYS_SELECT_H 1
| #define HAVE_SYS_SEM_H 1
| #define HAVE_SYS_SENDFILE_H 1
| #define HAVE_SYS_SIGNAL_H 1
| #define HAVE_SYS_SOCKET_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_UIO_H 1
| #define HAVE_SYS_UN_H 1
| #define HAVE_SYS_WAIT_H 1
| #define HAVE_NETINET_TCP_H 1
| #define SETPGRP_VOID 1
| #define HAVE_SOCKLEN_T 1
| #define SIZEOF_VOIDP 8
| #define SIZEOF_CHAR 1
| #define SIZEOF_INT 4
| #define SIZEOF_LONG 8
| #define SIZEOF_SHORT 2
| #define SIZEOF_LONG_LONG 8
| #define SIZEOF_PID_T 4
| #define SIZEOF_SSIZE_T 8
| #define SIZEOF_SIZE_T 8
| #define SIZEOF_OFF_T 8
| #define SIZEOF_INO_T 8
| #define SIZEOF_STRUCT_IOVEC 16
| #define HAVE_STRNCASECMP 1
| #define HAVE_STRCASECMP 1
| #define HAVE_STRDUP 1
| #define HAVE_STRSTR 1
| #define HAVE_MEMCHR 1
| #define APR_INT64_STRFN strtol
| #define APR_OFF_T_STRFN strtol
| #define DSO_USE_DLFCN 1
| #define HAVE_WAITPID 1
| #define HAVE_VLA 1
| #define HAVE_SEMGET 1
| #define HAVE_SEMCTL 1
| #define HAVE_FLOCK 1
| #define HAVE_SEMAPHORE_H 1
| #define HAVE_SEM_CLOSE 1
| #define HAVE_SEM_UNLINK 1
| #define HAVE_SEM_POST 1
| #define HAVE_SEM_WAIT 1
| #define HAVE_LOCK_EX 1
| #define HAVE_F_SETLK 1
| #define HAVE_SEM_UNDO 1
| #define HAVE_POLLIN 1
| #define HAVE_PTHREAD_PROCESS_SHARED 1
| #define HAVE_PTHREAD_MUTEXATTR_SETPSHARED 1
| /* end confdefs.h.  */
|
| #include <sys/types.h>
| #include <pthread.h>
| #include <stdlib.h>
|
| int main(int argc, char **argv)
| {
|     pthread_mutex_t mutex;
|     pthread_mutexattr_t attr;
|
|     if (pthread_mutexattr_init(&attr))
|         exit(1);
|     if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED))
|         exit(2);
|     if (pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP))
|         exit(3);
|     if (pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT))
|         exit(4);
|     if (pthread_mutex_init(&mutex, &attr))
|         exit(5);
|     if (pthread_mutexattr_destroy(&attr))
|         exit(6);
|     if (pthread_mutex_destroy(&mutex))
|         exit(7);
|
|     exit(0);
| }
configure:25510: result: no
configure:25895: result: decision on apr_lock implementation method... SysV IPC semget()

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.