FreeBSD Bugzilla – Attachment 210715 Details for
Bug 243155
Linuxulator: broken fadvise64 for 32-bit applications on amd64
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch
diff (text/plain), 3.43 KB, created by
Mark Johnston
on 2020-01-13 19:42:42 UTC
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Mark Johnston
Created:
2020-01-13 19:42:42 UTC
Size:
3.43 KB
patch
obsolete
>diff --git a/sys/amd64/linux32/linux32_proto.h b/sys/amd64/linux32/linux32_proto.h >index 47cd33e9b360..9d0c3306285d 100644 >--- a/sys/amd64/linux32/linux32_proto.h >+++ b/sys/amd64/linux32/linux32_proto.h >@@ -756,7 +756,8 @@ struct linux_set_thread_area_args { > }; > struct linux_fadvise64_args { > char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; >- char offset_l_[PADL_(l_loff_t)]; l_loff_t offset; char offset_r_[PADR_(l_loff_t)]; >+ char offset1_l_[PADL_(uint32_t)]; uint32_t offset1; char offset1_r_[PADR_(uint32_t)]; >+ char offset2_l_[PADL_(uint32_t)]; uint32_t offset2; char offset2_r_[PADR_(uint32_t)]; > char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)]; > char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)]; > }; >diff --git a/sys/amd64/linux32/linux32_systrace_args.c b/sys/amd64/linux32/linux32_systrace_args.c >index 93bea63ca38d..2c1dbb849fb7 100644 >--- a/sys/amd64/linux32/linux32_systrace_args.c >+++ b/sys/amd64/linux32/linux32_systrace_args.c >@@ -1657,10 +1657,11 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) > case 250: { > struct linux_fadvise64_args *p = params; > iarg[0] = p->fd; /* int */ >- iarg[1] = p->offset; /* l_loff_t */ >- iarg[2] = p->len; /* l_size_t */ >- iarg[3] = p->advice; /* int */ >- *n_args = 4; >+ uarg[1] = p->offset1; /* uint32_t */ >+ uarg[2] = p->offset2; /* uint32_t */ >+ iarg[3] = p->len; /* l_size_t */ >+ iarg[4] = p->advice; /* int */ >+ *n_args = 5; > break; > } > /* linux_exit_group */ >@@ -5483,12 +5484,15 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) > p = "int"; > break; > case 1: >- p = "l_loff_t"; >+ p = "uint32_t"; > break; > case 2: >- p = "l_size_t"; >+ p = "uint32_t"; > break; > case 3: >+ p = "l_size_t"; >+ break; >+ case 4: > p = "int"; > break; > default: >diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master >index b923b7e25ad5..97b88969594d 100644 >--- a/sys/amd64/linux32/syscalls.master >+++ b/sys/amd64/linux32/syscalls.master >@@ -426,7 +426,7 @@ > 247 AUE_NULL UNIMPL linux_io_getevents > 248 AUE_NULL UNIMPL linux_io_submit > 249 AUE_NULL UNIMPL linux_io_cancel >-250 AUE_NULL STD { int linux_fadvise64(int fd, l_loff_t offset, \ >+250 AUE_NULL STD { int linux_fadvise64(int fd, uint32_t offset1, uint32_t offset2, \ > l_size_t len, int advice); } > 251 AUE_NULL UNIMPL > 252 AUE_EXIT STD { int linux_exit_group(int error_code); } >diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c >index 565fc562fdf8..244985bd22c5 100644 >--- a/sys/compat/linux/linux_file.c >+++ b/sys/compat/linux/linux_file.c >@@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); > static int linux_common_open(struct thread *, int, char *, int, int); > static int linux_getdents_error(struct thread *, int, int); > >+#define PAIR32TO64(type, name) ((name ## 1) | ((type)(name ## 2) << 32)) > > #ifdef LINUX_LEGACY_SYSCALLS > int >@@ -1461,13 +1462,19 @@ convert_fadvice(int advice) > int > linux_fadvise64(struct thread *td, struct linux_fadvise64_args *args) > { >+ off_t offset; > int advice; > >+#ifdef COMPAT_LINUX32 >+ offset = PAIR32TO64(off_t, args->offset); >+#else >+ offset = args->offset; >+#endif >+ > advice = convert_fadvice(args->advice); > if (advice == -1) > return (EINVAL); >- return (kern_posix_fadvise(td, args->fd, args->offset, args->len, >- advice)); >+ return (kern_posix_fadvise(td, args->fd, offset, args->len, advice)); > } > > #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 243155
: 210715 |
210799