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
9f39b9e2
Unverified
Commit
9f39b9e2
authored
Nov 02, 2020
by
Stéphane Graber
Committed by
GitHub
Nov 02, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3572 from brauner/2020-11-02/seccomp_nonblocking
seccomp: fixes
parents
7fde74f3
0d724ab4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletion
+20
-1
file_utils.c
src/lxc/file_utils.c
+12
-0
file_utils.h
src/lxc/file_utils.h
+1
-0
seccomp.c
src/lxc/seccomp.c
+7
-1
No files found.
src/lxc/file_utils.c
View file @
9f39b9e2
...
@@ -577,3 +577,15 @@ int open_beneath(int dir_fd, const char *path, unsigned int flags)
...
@@ -577,3 +577,15 @@ int open_beneath(int dir_fd, const char *path, unsigned int flags)
return
openat
(
dir_fd
,
path
,
O_NOFOLLOW
|
flags
);
return
openat
(
dir_fd
,
path
,
O_NOFOLLOW
|
flags
);
}
}
int
fd_make_nonblocking
(
int
fd
)
{
int
flags
;
flags
=
fcntl
(
fd
,
F_GETFL
);
if
(
flags
<
0
)
return
-
1
;
flags
&=
~
O_NONBLOCK
;
return
fcntl
(
fd
,
F_SETFL
,
flags
);
}
src/lxc/file_utils.h
View file @
9f39b9e2
...
@@ -76,5 +76,6 @@ __hidden extern int timens_offset_write(clockid_t clk_id, int64_t s_offset, int6
...
@@ -76,5 +76,6 @@ __hidden extern int timens_offset_write(clockid_t clk_id, int64_t s_offset, int6
__hidden
extern
bool
exists_dir_at
(
int
dir_fd
,
const
char
*
path
);
__hidden
extern
bool
exists_dir_at
(
int
dir_fd
,
const
char
*
path
);
__hidden
extern
bool
exists_file_at
(
int
dir_fd
,
const
char
*
path
);
__hidden
extern
bool
exists_file_at
(
int
dir_fd
,
const
char
*
path
);
__hidden
extern
int
open_beneath
(
int
dir_fd
,
const
char
*
path
,
unsigned
int
flags
);
__hidden
extern
int
open_beneath
(
int
dir_fd
,
const
char
*
path
,
unsigned
int
flags
);
__hidden
int
fd_make_nonblocking
(
int
fd
);
#endif
/* __LXC_FILE_UTILS_H */
#endif
/* __LXC_FILE_UTILS_H */
src/lxc/seccomp.c
View file @
9f39b9e2
...
@@ -1280,6 +1280,9 @@ int lxc_seccomp_load(struct lxc_conf *conf)
...
@@ -1280,6 +1280,9 @@ int lxc_seccomp_load(struct lxc_conf *conf)
return
-
1
;
return
-
1
;
}
}
if
(
fd_make_nonblocking
(
ret
))
return
log_error_errno
(
-
1
,
errno
,
"Failed to make seccomp listener fd non-blocking"
);;
conf
->
seccomp
.
notifier
.
notify_fd
=
ret
;
conf
->
seccomp
.
notifier
.
notify_fd
=
ret
;
TRACE
(
"Retrieved new seccomp listener fd %d"
,
ret
);
TRACE
(
"Retrieved new seccomp listener fd %d"
,
ret
);
}
}
...
@@ -1387,7 +1390,10 @@ int seccomp_notify_handler(int fd, uint32_t events, void *data,
...
@@ -1387,7 +1390,10 @@ int seccomp_notify_handler(int fd, uint32_t events, void *data,
memset
(
req
,
0
,
conf
->
seccomp
.
notifier
.
sizes
.
seccomp_notif
);
memset
(
req
,
0
,
conf
->
seccomp
.
notifier
.
sizes
.
seccomp_notif
);
ret
=
seccomp_notify_receive
(
fd
,
req
);
ret
=
seccomp_notify_receive
(
fd
,
req
);
if
(
ret
)
{
if
(
ret
)
{
SYSERROR
(
"Failed to read seccomp notification"
);
if
(
errno
==
ENOENT
)
TRACE
(
"Intercepted system call aborted"
);
else
SYSERROR
(
"Failed to read seccomp notification"
);
goto
out
;
goto
out
;
}
}
...
...
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