Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
1633166b
Unverified
Commit
1633166b
authored
Mar 17, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mount_utils: add support for mount_setattr() syscall
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
4c51f614
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
1 deletion
+44
-1
configure.ac
configure.ac
+2
-1
mount_utils.h
src/lxc/mount_utils.h
+4
-0
syscall_numbers.h
src/lxc/syscall_numbers.h
+20
-0
syscall_wrappers.h
src/lxc/syscall_wrappers.h
+18
-0
No files found.
configure.ac
View file @
1633166b
...
@@ -652,8 +652,9 @@ AC_CHECK_HEADER([ifaddrs.h],
...
@@ -652,8 +652,9 @@ AC_CHECK_HEADER([ifaddrs.h],
AC_HEADER_MAJOR
AC_HEADER_MAJOR
# Check for some syscalls functions
# Check for some syscalls functions
AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat gettid memfd_create move_mount open_tree execveat clone3 fsopen fspick fsconfig fsmount, openat2, close_range, statvfs])
AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat gettid memfd_create move_mount open_tree execveat clone3 fsopen fspick fsconfig fsmount, openat2, close_range, statvfs
, mount_setattr
])
AC_CHECK_TYPES([__aligned_u64], [], [], [[#include <linux/types.h>]])
AC_CHECK_TYPES([__aligned_u64], [], [], [[#include <linux/types.h>]])
AC_CHECK_TYPES([struct mount_attr], [], [], [[#include <linux/mount.h>]])
AC_CHECK_TYPES([struct open_how], [], [], [[#include <linux/openat2.h>]])
AC_CHECK_TYPES([struct open_how], [], [], [[#include <linux/openat2.h>]])
AC_CHECK_TYPES([struct clone_args], [], [], [[#include <linux/sched.h>]])
AC_CHECK_TYPES([struct clone_args], [], [], [[#include <linux/sched.h>]])
AC_CHECK_MEMBERS([struct clone_args.set_tid],[],[],[[#include <linux/sched.h>]])
AC_CHECK_MEMBERS([struct clone_args.set_tid],[],[],[[#include <linux/sched.h>]])
...
...
src/lxc/mount_utils.h
View file @
1633166b
...
@@ -152,6 +152,10 @@
...
@@ -152,6 +152,10 @@
#define MOUNT_ATTR_NODIRATIME 0x00000080
/* Do not update directory access times */
#define MOUNT_ATTR_NODIRATIME 0x00000080
/* Do not update directory access times */
#endif
#endif
#ifndef MOUNT_ATTR_IDMAP
#define MOUNT_ATTR_IDMAP 0x00100000
#endif
__hidden
extern
int
mnt_attributes_new
(
unsigned
int
old_flags
,
unsigned
int
*
new_flags
);
__hidden
extern
int
mnt_attributes_new
(
unsigned
int
old_flags
,
unsigned
int
*
new_flags
);
__hidden
extern
int
mnt_attributes_old
(
unsigned
int
new_flags
,
unsigned
int
*
old_flags
);
__hidden
extern
int
mnt_attributes_old
(
unsigned
int
new_flags
,
unsigned
int
*
old_flags
);
...
...
src/lxc/syscall_numbers.h
View file @
1633166b
...
@@ -680,4 +680,24 @@
...
@@ -680,4 +680,24 @@
#endif
#endif
#endif
#endif
#ifndef __NR_mount_setattr
#if defined __alpha__
#define __NR_mount_setattr 552
#elif defined _MIPS_SIM
#if _MIPS_SIM == _MIPS_SIM_ABI32
/* o32 */
#define __NR_mount_setattr (442 + 4000)
#endif
#if _MIPS_SIM == _MIPS_SIM_NABI32
/* n32 */
#define __NR_mount_setattr (442 + 6000)
#endif
#if _MIPS_SIM == _MIPS_SIM_ABI64
/* n64 */
#define __NR_mount_setattr (442 + 5000)
#endif
#elif defined __ia64__
#define __NR_mount_setattr (442 + 1024)
#else
#define __NR_mount_setattr 442
#endif
#endif
#endif
/* __LXC_SYSCALL_NUMBERS_H */
#endif
/* __LXC_SYSCALL_NUMBERS_H */
src/lxc/syscall_wrappers.h
View file @
1633166b
...
@@ -209,6 +209,24 @@ extern int fsmount(int fs_fd, unsigned int flags, unsigned int attr_flags);
...
@@ -209,6 +209,24 @@ extern int fsmount(int fs_fd, unsigned int flags, unsigned int attr_flags);
#endif
#endif
/*
/*
* mount_setattr()
*/
struct
lxc_mount_attr
{
__u64
attr_set
;
__u64
attr_clr
;
__u64
propagation
;
__u64
userns_fd
;
};
#ifndef HAVE_MOUNT_SETATTR
static
inline
int
mount_setattr
(
int
dfd
,
const
char
*
path
,
unsigned
int
flags
,
struct
lxc_mount_attr
*
attr
,
size_t
size
)
{
return
syscall
(
__NR_mount_setattr
,
dfd
,
path
,
flags
,
attr
,
size
);
}
#endif
/*
* Arguments for how openat2(2) should open the target path. If only @flags and
* Arguments for how openat2(2) should open the target path. If only @flags and
* @mode are non-zero, then openat2(2) operates very similarly to openat(2).
* @mode are non-zero, then openat2(2) operates very similarly to openat(2).
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment