The Samba-Bugzilla – Attachment 17879 Details for
Bug 15367
socket_wrapper wraps fcntl64 into fcntl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Partial patch (needs cmake)
0001-third_party-socket_wrapper-Call-fcntl64-if-possible-.patch (text/plain), 2.78 KB, created by
Andrew Bartlett
on 2023-05-04 05:56:25 UTC
(
hide
)
Description:
Partial patch (needs cmake)
Filename:
MIME Type:
Creator:
Andrew Bartlett
Created:
2023-05-04 05:56:25 UTC
Size:
2.78 KB
patch
obsolete
>From 5cfbea0631f888595d118fd088c17297dfd23f7f Mon Sep 17 00:00:00 2001 >From: Andrew Bartlett <abartlet@samba.org> >Date: Thu, 4 May 2023 17:52:58 +1200 >Subject: [PATCH] third_party/socket_wrapper: Call fcntl64() if possible for > 32-bit hosts > >Newer glibc has introduced fcntl64 and symbol renaming but >the end function call was not caught by the automatic rename >so socket_wrapper would call fcntl() in libc and this would >do a "struct flock" -> "struct flock64" translation on the >supplied argument, despite this being already a flock64 from >the caller. > >This changed the lock offset values. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=15367 > >Signed-off-by: Andrew Bartlett <abartlet@samba.org> >--- > third_party/socket_wrapper/socket_wrapper.c | 19 ++++++++++++++++++- > third_party/socket_wrapper/wscript | 1 + > 2 files changed, 19 insertions(+), 1 deletion(-) > >diff --git a/third_party/socket_wrapper/socket_wrapper.c b/third_party/socket_wrapper/socket_wrapper.c >index c077f3b120a..0e4540092c3 100644 >--- a/third_party/socket_wrapper/socket_wrapper.c >+++ b/third_party/socket_wrapper/socket_wrapper.c >@@ -615,7 +615,11 @@ struct swrap_libc_symbols { > SWRAP_SYMBOL_ENTRY(connect); > SWRAP_SYMBOL_ENTRY(dup); > SWRAP_SYMBOL_ENTRY(dup2); >+#ifdef HAVE_FCNTL64 >+ SWRAP_SYMBOL_ENTRY(fcntl64); >+#else > SWRAP_SYMBOL_ENTRY(fcntl); >+#endif > SWRAP_SYMBOL_ENTRY(fopen); > #ifdef HAVE_FOPEN64 > SWRAP_SYMBOL_ENTRY(fopen64); >@@ -982,8 +986,17 @@ static int libc_vfcntl(int fd, int cmd, va_list ap) > > arg = va_arg(ap, void *); > >+ /* We can't know if the binary under test was built with >+ * -D_FILE_OFFSET_BITS=64, but we must go to fcntl64 if it >+ * exists if that typical case as otherwise we will cause a >+ * thunk from struct flock -> flock64 that the caller had >+ * already prepared for. >+ */ >+#ifdef HAVE_FCNTL64 >+ rc = swrap.libc.symbols._libc_fcntl64.f(fd, cmd, arg); >+#else > rc = swrap.libc.symbols._libc_fcntl.f(fd, cmd, arg); >- >+#endif > return rc; > } > >@@ -1404,7 +1417,11 @@ static void __swrap_bind_symbol_all_once(void) > swrap_bind_symbol_libsocket(connect); > swrap_bind_symbol_libc(dup); > swrap_bind_symbol_libc(dup2); >+#ifdef HAVE_FCNTL64 >+ swrap_bind_symbol_libc(fcntl64); >+#else > swrap_bind_symbol_libc(fcntl); >+#endif > swrap_bind_symbol_libc(fopen); > #ifdef HAVE_FOPEN64 > swrap_bind_symbol_libc(fopen64); >diff --git a/third_party/socket_wrapper/wscript b/third_party/socket_wrapper/wscript >index af6eb303e0a..fb400962b94 100644 >--- a/third_party/socket_wrapper/wscript >+++ b/third_party/socket_wrapper/wscript >@@ -55,6 +55,7 @@ def configure(conf): > conf.CHECK_FUNCS('accept4') > conf.CHECK_FUNCS('sendmmsg recvmmsg') > conf.CHECK_FUNCS('__close_nocancel') >+ conf.CHECK_FUNCS('fcntl64') > > conf.CHECK_FUNCS_IN('bind', > 'socket', >-- >2.25.1 >
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 15367
:
17877
|
17878
| 17879