summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* tests: Check return code of connect in test_thread_echo_tcp_sendmsg_recvmsgAndreas Schneider2018-10-231-0/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Check the return code of connect in test_echo_udp_sendmsg_recvmsgAndreas Schneider2018-10-231-0/+3
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Check return code of connnect in test_echo_tcp_sendmsg_recvmsgAndreas Schneider2018-10-231-0/+3
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* echo_srv: Check for a valid pidfile pointerAndreas Schneider2018-10-231-1/+1
| | | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* echo_srv: Only use 128K as buffer size instead of 4MBAndreas Schneider2018-10-231-1/+1
| | | | | | | This produced errors built with clang. Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* torture: Wait longer for echo_srv startupAndreas Schneider2018-10-231-2/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* echo_srv: Do not close bogus file descriptorsAndreas Schneider2018-10-231-4/+2
| | | | | | | | | | | | | | ==1564== Warning: invalid file descriptor 1048564 in syscall close() ==1564== at 0x4D18534: close (in /lib64/libc-2.27.so) ==1564== by 0x4046A74: libc_close (socket_wrapper.c:760) ==1564== by 0x405105C: swrap_close (socket_wrapper.c:5933) ==1564== by 0x40511F5: close (socket_wrapper.c:5979) ==1564== by 0x401679: become_daemon (echo_srv.c:202) ==1564== by 0x402D44: main (echo_srv.c:896) ==1563== Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* swrap: Don't do a deep bind if we run with libasanAndreas Schneider2018-10-231-1/+9
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* swrap: Add a mutex for resetting socket indexAndreas Schneider2018-10-231-2/+22
| | | | | | | Fixes a helgrind error. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* swrap: Fix helgrind errorsAnoop C S2018-10-231-4/+32
| | | | | | Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Use assert_return_code() to get errnoAndreas Schneider2018-10-231-8/+8
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Avoid -Wcast-align warningAnoop C S2018-10-231-28/+18
| | | | | | | | | | | | | | | warning: cast from 'struct sockaddr *' to 'struct sockaddr_in *' increases required alignment from 2 to 4 [-Wcast-align] struct sockaddr_in *sinp = (struct sockaddr_in *)to; ^~~~~~~~~~~~~~~~~~~~~~~~ Above warning can be avoided by making use of sockaddr_in available within torture_address from the caller of echo_udp_recv_from_to(). Following that sa_socklen from torture_address can be used instead of passing sa_socklen explicitly to echo_udp_recv_from_to(). Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Fix -Wformat gcc warningAnoop C S2018-10-231-1/+1
| | | | | | | | | test_fork_thread_deadlock.c:48:25: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘pid_t {aka long int}’ [-Wformat=] Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Fix checking for required system librariesAndreas Schneider2018-10-231-11/+13
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Use target_include_directories()Andreas Schneider2018-10-231-3/+3
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Require modern cmake versionAndreas Schneider2018-10-231-1/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Update AddCMockaTestAndreas Schneider2018-10-232-49/+152
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Update cmocka requirementAndreas Schneider2018-10-231-1/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Support running the tests with AddressSanitizerAndreas Schneider2018-10-231-1/+27
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Add CFLAGS for AddressSanitizer and UndefinedSanitizerAndreas Schneider2018-10-231-0/+24
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Move Compiler flags to new fileAndreas Schneider2018-10-233-13/+22
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Remove obsolete DefineCompilerFlags.cmakeAndreas Schneider2018-10-231-64/+0
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Improve checks for compiler flagsAndreas Schneider2018-10-237-8/+178
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Update CMake defaultsAndreas Schneider2018-10-231-12/+3
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Suppress helgrind race condition warning we created on purposeAndreas Schneider2018-10-233-1/+18
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Create an error if helgrind finds a bugAndreas Schneider2018-10-231-1/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Write helgrind logs to stderr so we can see themAndreas Schneider2018-10-231-2/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* cmake: Don't misuse CMAKE_REQUIRED_LIBRARIESAndreas Schneider2018-10-231-5/+5
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Update valgrind suppression fileAndreas Schneider2018-08-171-1/+9
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* cmake: Require at least cmake 3.2.0Andreas Schneider2018-08-176-22/+14
| | | | | | | This allows us to modernize the CMakeLists.txt Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* ctest: Move to new dashboardAndreas Schneider2018-08-091-3/+3
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Add error check around pthread mutex locksAnoop C S2018-08-091-52/+114
| | | | | | Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tests: Prevent child process falling to defunct stateAnoop C S2018-08-091-0/+2
| | | | | | | | | | | | Parent process does not wait for child process(which gets forked after accepting a client connection) to exit inside echo server which in turn puts child into defunct state. Even though those defunct childs are cleaned up during parent exit it is better to wait from parent process itself. Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* doc: Add SOCKET_WRAPPER_MAX_SOCKETS to manual pageAnoop C S2018-08-092-5/+26
| | | | | | Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Fix thread deadlock found by Coverity scanAnoop C S2018-08-091-2/+4
| | | | | | | | | CID 175897 CID 175898 Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tests: Add missing header for IPPROTO_TCPAndreas Schneider2018-08-091-0/+1
| | | | | | | This fixes the build on FreeBSD. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Update headerAndreas Schneider2018-08-091-4/+6
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* Update LICENSEAndreas Schneider2018-08-091-3/+6
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* Rename COPYING to LICENSEAndreas Schneider2018-08-092-1/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* cpack: Do not package build dirs in source tarballAndreas Schneider2018-08-092-2/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Replace socket_fds linked list with an arrayAnoop C S2018-06-141-192/+122
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following bug: As we are using a doubly linked list, we need a mutex which needs to be locked when we are reading it that we do not end up with invalid pointers. The following can happen: We are in swrap_close() which calls find_socket_info_fd() this locks the mutex for the linked list. Now we get a singal SIGCHILD and the signal handler is called. The signal handler calls swrap_write() and we try to find out if the socket is managed by socket_wrapper calling find_socket_info_fd() again -> DEADLOCK! By moving to an array to handle the socket fds and using the fd as the array access, we do not need a mutex for reading anymore. All we need is a memory barrier. This change also improves the performance as we move from the a linked list to a hash table! Pair-Programmed-With: Andreas Schneider <asn@samba.org> Signed-off-by: Anoop C S <anoopcs@redhat.com> Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tests: Fix resouce leak in echo_srv tcp handlingAndreas Schneider2018-05-041-2/+1
| | | | | | | CID 175587 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* cmake: Run threaded tests with helgrindAndreas Schneider2018-05-032-6/+36
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tests: Add test case to validate free-list indexesAnoop C S2018-05-022-1/+76
| | | | | | Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: Update free-list only when refcount is zeroAnoop C S2018-05-021-5/+6
| | | | | | Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: Move metadata into socket_info_meta structureMichael Adam2018-05-021-10/+16
| | | | | | | | | | | Separating out the metadata related information to another sub-structure to make it more clean and structured. Pair-Programmed-With: Anoop C S <anoopcs@redhat.com> Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org>
* tests: New threaded test casesAnoop C S2018-05-025-1/+591
| | | | | | Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* tests: Modify echo server to accept multiple connectionsAnoop C S2018-05-021-23/+35
| | | | | | | | | | In context of multiple threads, echo server must be capable of accepting connections in a loop rather than be satisfied with one incoming connection. Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* tests: Add new test to check mutex lock contentionMichael Adam2018-05-022-1/+74
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: Implement thread safety using pthread mutexesAnoop C S2018-05-021-38/+235
| | | | | | | | | | | | | | | | | | | Added a new mutex variable to socket_info structure along with new macros for locking and unlocking mutex corresponding to each socket_info entry. Apart from individual mutex defined in socket_info structure, 4 new mutexes are added to protect the concurrent access of globally used swrap parameters from different threads. All other individual wrappers and helper routines are also made capable of acquiring relevant mutex locks before operating on such global parameters. Pair-Programmed-With: Michael Adam <obnox@samba.org> Signed-off-by: Anoop C S <anoopcs@redhat.com> Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>