Toggle navigation
Toggle navigation
This project
Loading...
Sign in
UT
/
clsync
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
redmine
2014-08-21 11:11:38 +0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
93417506b5755e683d8c115cec86e8dd823b1314
93417506
1 parent
14a6c7ad
Fixed "Bad system call" on --thread-splitting --forbid-devices --seccomp-filter
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
7 deletions
cgroup.c
man/man1/clsync.1
privileged.c
cgroup.c
View file @
9341750
...
...
@@ -83,14 +83,10 @@ int clsync_cgroup_attach(ctx_t *ctx_p) {
int
clsync_cgroup_deinit
(
ctx_t
*
ctx_p
)
{
debug
(
2
,
""
);
setuid
(
0
);
error_on
(
cgroup_delete_cgroup_ext
(
cgroup
,
CGFLAG_DELETE_IGNORE_MIGRATION
|
CGFLAG_DELETE_RECURSIVE
));
cgroup_free
(
&
cgroup
);
if
(
ctx_p
->
uid
!=
0
)
setuid
(
ctx_p
->
uid
);
debug
(
15
,
"end"
);
return
0
;
}
...
...
man/man1/clsync.1
View file @
9341750
...
...
@@ -1292,7 +1292,9 @@ Forbid all syscalls for non-privileged thread, but
.RS
futex
inotify_init1
alarm
alert
stat
fstat
lstat
open
write
...
...
privileged.c
View file @
9341750
...
...
@@ -812,7 +812,46 @@ void *privileged_handler(void *_ctx_p)
}
# ifdef CGROUP_SUPPORT
case
PA_CLSYNC_CGROUP_DEINIT
:
{
cmd
.
ret
=
(
void
*
)(
long
)
clsync_cgroup_deinit
(
cmd
.
arg
);
/*
* That is strange, but setuid() doesn't work
* without fork() in case of enabled seccomp
* filter. So sorry for this hacky thing.
*
* TODO: fix that.
*/
int
status
;
pid_t
pid
=
fork
();
switch
(
pid
)
{
case
-
1
:
error
(
"Cannot fork()."
);
break
;
case
0
:
debug
(
4
,
"setgid(0) == %i"
,
setgid
(
0
));
debug
(
4
,
"setuid(0) == %i"
,
setuid
(
0
));
exit
(
clsync_cgroup_deinit
(
cmd
.
arg
));
}
if
(
waitpid
(
pid
,
&
status
,
0
)
!=
pid
)
{
switch
(
errno
)
{
case
ECHILD
:
debug
(
2
,
"Child %u has already died."
,
pid
);
break
;
default:
error
(
"Cannot waitid()."
);
cmd
.
_errno
=
errno
;
cmd
.
ret
=
(
void
*
)(
long
)
errno
;
}
}
#ifdef VERYPARANOID
pthread_sigmask
(
SIG_SETMASK
,
&
sigset_old
,
NULL
);
#endif
// Return
int
exitcode
=
WEXITSTATUS
(
status
);
debug
(
3
,
"execution completed with exitcode %i"
,
exitcode
);
cmd
.
_errno
=
exitcode
;
cmd
.
ret
=
(
void
*
)(
long
)
exitcode
;
break
;
}
# endif
...
...
Please
register
or
login
to post a comment