Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174791930
D60394.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D60394.diff
View Options
diff --git a/sys/amd64/linux/linux_proto.h b/sys/amd64/linux/linux_proto.h
--- a/sys/amd64/linux/linux_proto.h
+++ b/sys/amd64/linux/linux_proto.h
@@ -1436,7 +1436,10 @@
syscallarg_t dummy;
};
struct linux_fchmodat2_args {
- syscallarg_t dummy;
+ char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)];
+ char filename_l_[PADL_(const char *)]; const char * filename; char filename_r_[PADR_(const char *)];
+ char mode_l_[PADL_(l_mode_t)]; l_mode_t mode; char mode_r_[PADR_(l_mode_t)];
+ char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
};
struct linux_map_shadow_stack_args {
syscallarg_t dummy;
@@ -2059,7 +2062,7 @@
#define LINUX_SYS_AUE_linux_futex_waitv AUE_NULL
#define LINUX_SYS_AUE_linux_set_mempolicy_home_node AUE_NULL
#define LINUX_SYS_AUE_linux_cachestat AUE_NULL
-#define LINUX_SYS_AUE_linux_fchmodat2 AUE_NULL
+#define LINUX_SYS_AUE_linux_fchmodat2 AUE_FCHMODAT2
#define LINUX_SYS_AUE_linux_map_shadow_stack AUE_NULL
#undef PAD_
diff --git a/sys/amd64/linux/linux_sysent.c b/sys/amd64/linux/linux_sysent.c
--- a/sys/amd64/linux/linux_sysent.c
+++ b/sys/amd64/linux/linux_sysent.c
@@ -466,6 +466,6 @@
{ .sy_narg = 0, .sy_call = (sy_call_t *)linux_futex_waitv, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 449 = linux_futex_waitv */
{ .sy_narg = 0, .sy_call = (sy_call_t *)linux_set_mempolicy_home_node, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 450 = linux_set_mempolicy_home_node */
{ .sy_narg = 0, .sy_call = (sy_call_t *)linux_cachestat, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 451 = linux_cachestat */
- { .sy_narg = 0, .sy_call = (sy_call_t *)linux_fchmodat2, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 452 = linux_fchmodat2 */
+ { .sy_narg = AS(linux_fchmodat2_args), .sy_call = (sy_call_t *)linux_fchmodat2, .sy_auevent = AUE_FCHMODAT2, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 452 = linux_fchmodat2 */
{ .sy_narg = 0, .sy_call = (sy_call_t *)linux_map_shadow_stack, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 453 = linux_map_shadow_stack */
};
diff --git a/sys/amd64/linux/linux_systrace_args.c b/sys/amd64/linux/linux_systrace_args.c
--- a/sys/amd64/linux/linux_systrace_args.c
+++ b/sys/amd64/linux/linux_systrace_args.c
@@ -2806,7 +2806,12 @@
}
/* linux_fchmodat2 */
case 452: {
- *n_args = 0;
+ struct linux_fchmodat2_args *p = params;
+ iarg[a++] = p->dfd; /* l_int */
+ uarg[a++] = (intptr_t)p->filename; /* const char * */
+ iarg[a++] = p->mode; /* l_mode_t */
+ iarg[a++] = p->flags; /* l_int */
+ *n_args = 4;
break;
}
/* linux_map_shadow_stack */
@@ -7298,6 +7303,22 @@
break;
/* linux_fchmodat2 */
case 452:
+ switch (ndx) {
+ case 0:
+ p = "l_int";
+ break;
+ case 1:
+ p = "userland const char *";
+ break;
+ case 2:
+ p = "l_mode_t";
+ break;
+ case 3:
+ p = "l_int";
+ break;
+ default:
+ break;
+ };
break;
/* linux_map_shadow_stack */
case 453:
@@ -8827,6 +8848,9 @@
case 451:
/* linux_fchmodat2 */
case 452:
+ if (ndx == 0 || ndx == 1)
+ p = "int";
+ break;
/* linux_map_shadow_stack */
case 453:
default:
diff --git a/sys/amd64/linux/syscalls.master b/sys/amd64/linux/syscalls.master
--- a/sys/amd64/linux/syscalls.master
+++ b/sys/amd64/linux/syscalls.master
@@ -2188,8 +2188,13 @@
int linux_cachestat(void);
}
; Linux 6.6:
-452 AUE_NULL STD {
- int linux_fchmodat2(void);
+452 AUE_FCHMODAT2 STD {
+ int linux_fchmodat2(
+ l_int dfd,
+ const char *filename,
+ l_mode_t mode,
+ l_int flags
+ );
}
453 AUE_NULL STD {
int linux_map_shadow_stack(void);
diff --git a/sys/compat/linux/linux_dummy.c b/sys/compat/linux/linux_dummy.c
--- a/sys/compat/linux/linux_dummy.c
+++ b/sys/compat/linux/linux_dummy.c
@@ -146,5 +146,3 @@
DUMMY(set_mempolicy_home_node);
/* Linux 6.5: */
DUMMY(cachestat);
-/* Linux 6.6: */
-DUMMY(fchmodat2);
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.c
@@ -779,6 +779,28 @@
args->mode, 0));
}
+int
+linux_fchmodat2(struct thread *td, struct linux_fchmodat2_args *args)
+{
+ int bsdflags, dfd, lflags;
+
+ bsdflags = 0;
+ lflags = args->flags;
+
+ if ((lflags & ~(LINUX_AT_EMPTY_PATH | LINUX_AT_SYMLINK_NOFOLLOW)) != 0)
+ return (EINVAL);
+
+ if ((lflags & LINUX_AT_EMPTY_PATH) != 0)
+ bsdflags |= AT_EMPTY_PATH;
+
+ if ((lflags & LINUX_AT_SYMLINK_NOFOLLOW) != 0)
+ bsdflags |= AT_SYMLINK_NOFOLLOW;
+
+ dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd;
+ return (kern_fchmodat(td, dfd, args->filename, UIO_USERSPACE,
+ args->mode, bsdflags));
+}
+
#ifdef LINUX_LEGACY_SYSCALLS
int
linux_mkdir(struct thread *td, struct linux_mkdir_args *args)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Oct 7, 12:43 AM (19 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40325482
Default Alt Text
D60394.diff (4 KB)
Attached To
Mode
D60394: linux: implement fchmodat2 syscall
Attached
Detach File
Event Timeline
Log In to Comment