The Samba-Bugzilla – Attachment 13119 Details for
Bug 12694
socket_wrapper doesn't replace open() on 32-bit
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
socket_wrapper.patch (text/plain), 6.69 KB, created by
Andreas Schneider
on 2017-03-29 08:06:57 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Andreas Schneider
Created:
2017-03-29 08:06:57 UTC
Size:
6.69 KB
patch
obsolete
>From 28ccf63af75e7474f51ec566693a2459342e9644 Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Mon, 20 Mar 2017 11:25:40 +0100 >Subject: [PATCH 1/4] swrap: Increase max wrapped interfaces > >We are hitting the limit of 40 interfaces with Samba. So increase it to >64. > >Signed-off-by: Andreas Schneider <asn@samba.org> >--- > src/socket_wrapper.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c >index 1d94a89..608acf9 100644 >--- a/src/socket_wrapper.c >+++ b/src/socket_wrapper.c >@@ -264,7 +264,7 @@ do { \ > /* This limit is to avoid broadcast sendto() needing to stat too many > * files. It may be raised (with a performance cost) to up to 254 > * without changing the format above */ >-#define MAX_WRAPPED_INTERFACES 40 >+#define MAX_WRAPPED_INTERFACES 64 > > struct swrap_address { > socklen_t sa_socklen; >-- >2.12.0 > > >From 8fcde8ba9369cabb51dae042c54687806a20042e Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Tue, 28 Mar 2017 08:58:14 +0200 >Subject: [PATCH 2/4] cmake: Do not check for LFS support > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12694 > >Signed-off-by: Andreas Schneider <asn@samba.org> >--- > cmake/Modules/DefineCompilerFlags.cmake | 29 ----------------------------- > 1 file changed, 29 deletions(-) > >diff --git a/cmake/Modules/DefineCompilerFlags.cmake b/cmake/Modules/DefineCompilerFlags.cmake >index 53481c3..c60e586 100644 >--- a/cmake/Modules/DefineCompilerFlags.cmake >+++ b/cmake/Modules/DefineCompilerFlags.cmake >@@ -53,35 +53,6 @@ if (UNIX AND NOT WIN32) > endif() > endif (${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)") > >- # >- # Check for large filesystem support >- # >- if (CMAKE_SIZEOF_VOID_P MATCHES "8") >- # with large file support >- execute_process( >- COMMAND >- getconf LFS64_CFLAGS >- OUTPUT_VARIABLE >- _lfs_CFLAGS >- ERROR_QUIET >- OUTPUT_STRIP_TRAILING_WHITESPACE >- ) >- else (CMAKE_SIZEOF_VOID_P MATCHES "8") >- # with large file support >- execute_process( >- COMMAND >- getconf LFS_CFLAGS >- OUTPUT_VARIABLE >- _lfs_CFLAGS >- ERROR_QUIET >- OUTPUT_STRIP_TRAILING_WHITESPACE >- ) >- endif (CMAKE_SIZEOF_VOID_P MATCHES "8") >- if (_lfs_CFLAGS) >- string(REGEX REPLACE "[\r\n]" " " "${_lfs_CFLAGS}" "${${_lfs_CFLAGS}}") >- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_lfs_CFLAGS}") >- endif (_lfs_CFLAGS) >- > endif (UNIX AND NOT WIN32) > > if (MSVC) >-- >2.12.0 > > >From 58cb123be41034a7bde40a75461a4fce350b7b3c Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Tue, 28 Mar 2017 09:03:02 +0200 >Subject: [PATCH 3/4] cmake: Check for open64() function > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12694 > >Signed-off-by: Andreas Schneider <asn@samba.org> >--- > ConfigureChecks.cmake | 1 + > config.h.cmake | 1 + > 2 files changed, 2 insertions(+) > >diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake >index 71b34ce..6a00677 100644 >--- a/ConfigureChecks.cmake >+++ b/ConfigureChecks.cmake >@@ -63,6 +63,7 @@ check_function_exists(eventfd HAVE_EVENTFD) > check_function_exists(timerfd_create HAVE_TIMERFD_CREATE) > check_function_exists(bindresvport HAVE_BINDRESVPORT) > check_function_exists(accept4 HAVE_ACCEPT4) >+check_function_exists(open64 HAVE_OPEN64) > > check_function_exists(pledge HAVE_PLEDGE) > >diff --git a/config.h.cmake b/config.h.cmake >index 6786b8a..9b1cded 100644 >--- a/config.h.cmake >+++ b/config.h.cmake >@@ -40,6 +40,7 @@ > #cmakedefine HAVE_TIMERFD_CREATE 1 > #cmakedefine HAVE_BINDRESVPORT 1 > #cmakedefine HAVE_ACCEPT4 1 >+#cmakedefine HAVE_OPEN64 1 > #cmakedefine HAVE_PLEDGE 1 > > #cmakedefine HAVE_ACCEPT_PSOCKLEN_T 1 >-- >2.12.0 > > >From 185db73c01314195908185a87ee4569f9b4d92a2 Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Tue, 28 Mar 2017 09:09:06 +0200 >Subject: [PATCH 4/4] swrap: Add open64() on systems which provide it > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12694 > >Signed-off-by: Andreas Schneider <asn@samba.org> >--- > src/socket_wrapper.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 57 insertions(+) > >diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c >index 608acf9..b22bd2f 100644 >--- a/src/socket_wrapper.c >+++ b/src/socket_wrapper.c >@@ -438,6 +438,9 @@ typedef int (*__libc_getsockopt)(int sockfd, > typedef int (*__libc_ioctl)(int d, unsigned long int request, ...); > typedef int (*__libc_listen)(int sockfd, int backlog); > typedef int (*__libc_open)(const char *pathname, int flags, mode_t mode); >+#ifdef HAVE_OPEN64 >+typedef int (*__libc_open64)(const char *pathname, int flags, mode_t mode); >+#endif /* HAVE_OPEN64 */ > typedef int (*__libc_openat)(int dirfd, const char *path, int flags, ...); > typedef int (*__libc_pipe)(int pipefd[2]); > typedef int (*__libc_read)(int fd, void *buf, size_t count); >@@ -502,6 +505,9 @@ struct swrap_libc_symbols { > SWRAP_SYMBOL_ENTRY(ioctl); > SWRAP_SYMBOL_ENTRY(listen); > SWRAP_SYMBOL_ENTRY(open); >+#ifdef HAVE_OPEN64 >+ SWRAP_SYMBOL_ENTRY(open64); >+#endif > SWRAP_SYMBOL_ENTRY(openat); > SWRAP_SYMBOL_ENTRY(pipe); > SWRAP_SYMBOL_ENTRY(read); >@@ -878,6 +884,22 @@ static int libc_open(const char *pathname, int flags, ...) > return fd; > } > >+#ifdef HAVE_OPEN64 >+static int libc_vopen64(const char *pathname, int flags, va_list ap) >+{ >+ long int mode = 0; >+ int fd; >+ >+ swrap_bind_symbol_libc(open64); >+ >+ mode = va_arg(ap, long int); >+ >+ fd = swrap.libc.symbols._libc_open64.f(pathname, flags, (mode_t)mode); >+ >+ return fd; >+} >+#endif /* HAVE_OPEN64 */ >+ > static int libc_vopenat(int dirfd, const char *path, int flags, va_list ap) > { > long int mode = 0; >@@ -3609,6 +3631,41 @@ int open(const char *pathname, int flags, ...) > } > > /**************************************************************************** >+ * OPEN64 >+ ***************************************************************************/ >+ >+#ifdef HAVE_OPEN64 >+static int swrap_vopen64(const char *pathname, int flags, va_list ap) >+{ >+ int ret; >+ >+ ret = libc_vopen64(pathname, flags, ap); >+ if (ret != -1) { >+ /* >+ * There are methods for closing descriptors (libc-internal code >+ * paths, direct syscalls) which close descriptors in ways that >+ * we can't intercept, so try to recover when we notice that >+ * that's happened >+ */ >+ swrap_remove_stale(ret); >+ } >+ return ret; >+} >+ >+int open64(const char *pathname, int flags, ...) >+{ >+ va_list ap; >+ int fd; >+ >+ va_start(ap, flags); >+ fd = swrap_vopen64(pathname, flags, ap); >+ va_end(ap); >+ >+ return fd; >+} >+#endif /* HAVE_OPEN64 */ >+ >+/**************************************************************************** > * OPENAT > ***************************************************************************/ > >-- >2.12.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 12694
:
13068
| 13119