The Samba-Bugzilla – Attachment 16728 Details for
Bug 14786
Insufficient libreplace check for SYS_copy_file_range check
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 4.15 cherry-picked from master
bug14786-v415.patch (text/plain), 4.39 KB, created by
Ralph Böhme
on 2021-08-11 15:37:58 UTC
(
hide
)
Description:
Patch for 4.15 cherry-picked from master
Filename:
MIME Type:
Creator:
Ralph Böhme
Created:
2021-08-11 15:37:58 UTC
Size:
4.39 KB
patch
obsolete
>From 08306873e04b8d1835ffe819720b59d3d915d000 Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Sat, 7 Aug 2021 17:18:08 +0200 >Subject: [PATCH 1/2] libreplace: properly give headers to conf.CHECK_CODE when > checking for copy_file_range_syscall > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=14786 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >(cherry picked from commit 22a58a51846749495613e5b572c31ba4752bc61b) >--- > lib/replace/wscript | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > >diff --git a/lib/replace/wscript b/lib/replace/wscript >index 12f995f3198..3cc0adeeb34 100644 >--- a/lib/replace/wscript >+++ b/lib/replace/wscript >@@ -456,11 +456,10 @@ samba_dist.DIST_DIRS('lib/replace buildtools:buildtools third_party/waf:third_pa > conf.CHECK_FUNCS('getprogname') > if not conf.CHECK_FUNCS('copy_file_range'): > conf.CHECK_CODE(''' >-#include <sys/syscall.h> >-#include <unistd.h> > syscall(SYS_copy_file_range,0,NULL,0,NULL,0,0); > ''', > 'HAVE_SYSCALL_COPY_FILE_RANGE', >+ headers='sys/syscall.h unistd.h', > msg='Checking whether we have copy_file_range system call') > if conf.CONFIG_SET('HAVE_COPY_FILE_RANGE') or conf.CONFIG_SET('HAVE_SYSCALL_COPY_FILE_RANGE'): > conf.DEFINE('USE_COPY_FILE_RANGE', 1) >-- >2.31.1 > > >From 87e54941ac75aacbe061b1b99cb89f1eac82cfdd Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Sat, 7 Aug 2021 17:18:25 +0200 >Subject: [PATCH 2/2] libreplace: properly execute SYS_copy_file_range check > >It seems some systems (like Centos 7) have the SYS_copy_file_range define but >fail the syscall when actually being called. The current configure check is only >compiled, not run so erroneously reports a working SYS_copy_file_range. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=14786 >RN: Insufficient libreplace check for SYS_copy_file_range check > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> > >Autobuild-User(master): Jeremy Allison <jra@samba.org> >Autobuild-Date(master): Tue Aug 10 19:37:14 UTC 2021 on sn-devel-184 > >(cherry picked from commit 4354823c5146753ef8a3791bc8562379096659b8) >--- > lib/replace/wscript | 26 ++++++++++++++++++++++++-- > 1 file changed, 24 insertions(+), 2 deletions(-) > >diff --git a/lib/replace/wscript b/lib/replace/wscript >index 3cc0adeeb34..9c23d549dab 100644 >--- a/lib/replace/wscript >+++ b/lib/replace/wscript >@@ -456,10 +456,32 @@ samba_dist.DIST_DIRS('lib/replace buildtools:buildtools third_party/waf:third_pa > conf.CHECK_FUNCS('getprogname') > if not conf.CHECK_FUNCS('copy_file_range'): > conf.CHECK_CODE(''' >-syscall(SYS_copy_file_range,0,NULL,0,NULL,0,0); >+ int src_fd = -1, dst_fd = -1, ret; >+ ssize_t written; >+ char src[]="/tmp/test.XXXXXX"; >+ char dst[]="/tmp/test.XXXXXX"; >+ src_fd = mkstemp(src); >+ if (src_fd == -1) {ret = 1; goto cleanup;} >+ dst_fd = mkstemp(dst); >+ if (dst_fd == -1) {ret = 2; goto cleanup;} >+ written = pwrite(src_fd, "x", 1, 0); >+ if (written != 1) {ret = 3; goto cleanup;} >+ written = syscall(SYS_copy_file_range,src_fd,0,dst_fd,0,1,0); >+ if (written != 1) { >+ printf("SYS_copy_file_range failed: %s", strerror(errno)); >+ ret = 4; goto cleanup; >+ } >+ ret = 0; >+ cleanup: >+ if (src_fd != -1) close(src_fd); >+ if (dst_fd != -1) close(dst_fd); >+ unlink(src); >+ unlink(dst); >+ return ret; > ''', > 'HAVE_SYSCALL_COPY_FILE_RANGE', >- headers='sys/syscall.h unistd.h', >+ headers='errno.h string.h stdio.h sys/syscall.h unistd.h sys/types.h sys/stat.h fcntl.h', >+ execute=True, > msg='Checking whether we have copy_file_range system call') > if conf.CONFIG_SET('HAVE_COPY_FILE_RANGE') or conf.CONFIG_SET('HAVE_SYSCALL_COPY_FILE_RANGE'): > conf.DEFINE('USE_COPY_FILE_RANGE', 1) >-- >2.31.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
Flags:
metze
:
review-
Actions:
View
Attachments on
bug 14786
: 16728