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
a76fe490
Unverified
Commit
a76fe490
authored
Oct 15, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
seccomp: log invalid seccomp notify ids
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
186ff2be
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
seccomp.c
src/lxc/seccomp.c
+11
-3
No files found.
src/lxc/seccomp.c
View file @
a76fe490
...
@@ -1377,7 +1377,7 @@ int seccomp_notify_handler(int fd, uint32_t events, void *data,
...
@@ -1377,7 +1377,7 @@ int seccomp_notify_handler(int fd, uint32_t events, void *data,
int
listener_proxy_fd
=
conf
->
seccomp
.
notifier
.
proxy_fd
;
int
listener_proxy_fd
=
conf
->
seccomp
.
notifier
.
proxy_fd
;
struct
seccomp_notify_proxy_msg
msg
=
{
0
};
struct
seccomp_notify_proxy_msg
msg
=
{
0
};
char
*
cookie
=
conf
->
seccomp
.
notifier
.
cookie
;
char
*
cookie
=
conf
->
seccomp
.
notifier
.
cookie
;
uint64_t
req_id
;
__u64
req_id
;
if
(
events
&
EPOLLHUP
)
{
if
(
events
&
EPOLLHUP
)
{
lxc_mainloop_del_handler
(
descr
,
fd
);
lxc_mainloop_del_handler
(
descr
,
fd
);
...
@@ -1409,6 +1409,7 @@ int seccomp_notify_handler(int fd, uint32_t events, void *data,
...
@@ -1409,6 +1409,7 @@ int seccomp_notify_handler(int fd, uint32_t events, void *data,
/* remember the ID in case we receive garbage from the proxy */
/* remember the ID in case we receive garbage from the proxy */
resp
->
id
=
req_id
=
req
->
id
;
resp
->
id
=
req_id
=
req
->
id
;
TRACE
(
"Received seccomp notification with id(%llu)"
,
req_id
);
snprintf
(
mem_path
,
sizeof
(
mem_path
),
"/proc/%d"
,
req
->
pid
);
snprintf
(
mem_path
,
sizeof
(
mem_path
),
"/proc/%d"
,
req
->
pid
);
fd_pid
=
open
(
mem_path
,
O_RDONLY
|
O_DIRECTORY
|
O_CLOEXEC
);
fd_pid
=
open
(
mem_path
,
O_RDONLY
|
O_DIRECTORY
|
O_CLOEXEC
);
...
@@ -1433,7 +1434,7 @@ int seccomp_notify_handler(int fd, uint32_t events, void *data,
...
@@ -1433,7 +1434,7 @@ int seccomp_notify_handler(int fd, uint32_t events, void *data,
ret
=
seccomp_notify_id_valid
(
fd
,
req
->
id
);
ret
=
seccomp_notify_id_valid
(
fd
,
req
->
id
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
seccomp_notify_default_answer
(
fd
,
req
,
resp
,
hdlr
);
seccomp_notify_default_answer
(
fd
,
req
,
resp
,
hdlr
);
SYSERROR
(
"Invalid seccomp notify request id
"
);
SYSERROR
(
"Invalid seccomp notify request id
(%llu)"
,
req
->
id
);
goto
out
;
goto
out
;
}
}
...
@@ -1492,8 +1493,8 @@ retry:
...
@@ -1492,8 +1493,8 @@ retry:
}
}
if
(
resp
->
id
!=
req_id
)
{
if
(
resp
->
id
!=
req_id
)
{
ERROR
(
"Proxy returned response with illegal id(%llu) != id(%llu)"
,
resp
->
id
,
req_id
);
resp
->
id
=
req_id
;
resp
->
id
=
req_id
;
ERROR
(
"Proxy returned response with illegal id"
);
seccomp_notify_default_answer
(
fd
,
req
,
resp
,
hdlr
);
seccomp_notify_default_answer
(
fd
,
req
,
resp
,
hdlr
);
goto
out
;
goto
out
;
}
}
...
@@ -1505,9 +1506,16 @@ retry:
...
@@ -1505,9 +1506,16 @@ retry:
goto
out
;
goto
out
;
}
}
if
(
resp
->
id
!=
req_id
)
{
ERROR
(
"Proxy returned response with illegal id(%llu) != id(%llu)"
,
resp
->
id
,
req_id
);
resp
->
id
=
req_id
;
}
ret
=
seccomp_notify_respond
(
fd
,
resp
);
ret
=
seccomp_notify_respond
(
fd
,
resp
);
if
(
ret
)
if
(
ret
)
SYSERROR
(
"Failed to send seccomp notification"
);
SYSERROR
(
"Failed to send seccomp notification"
);
else
TRACE
(
"Sent response for seccomp notification with id(%llu)"
,
resp
->
id
);
out:
out:
#endif
#endif
...
...
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