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
3721e645
Unverified
Commit
3721e645
authored
Feb 13, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
seccomp: convert to strequal()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
1b1e50db
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
seccomp.c
src/lxc/seccomp.c
+16
-16
No files found.
src/lxc/seccomp.c
View file @
3721e645
...
...
@@ -101,9 +101,9 @@ static uint32_t get_v2_default_action(char *line)
line
++
;
/* After 'allowlist' or 'denylist' comes default behavior. */
if
(
strn
cmp
(
line
,
"kill"
,
4
)
==
0
)
{
if
(
strn
equal
(
line
,
"kill"
,
4
)
)
{
ret_action
=
SCMP_ACT_KILL
;
}
else
if
(
strn
cmp
(
line
,
"errno"
,
5
)
==
0
)
{
}
else
if
(
strn
equal
(
line
,
"errno"
,
5
)
)
{
int
e
,
ret
;
ret
=
sscanf
(
line
+
5
,
"%d"
,
&
e
);
...
...
@@ -113,12 +113,12 @@ static uint32_t get_v2_default_action(char *line)
}
ret_action
=
SCMP_ACT_ERRNO
(
e
);
}
else
if
(
strn
cmp
(
line
,
"allow"
,
5
)
==
0
)
{
}
else
if
(
strn
equal
(
line
,
"allow"
,
5
)
)
{
ret_action
=
SCMP_ACT_ALLOW
;
}
else
if
(
strn
cmp
(
line
,
"trap"
,
4
)
==
0
)
{
}
else
if
(
strn
equal
(
line
,
"trap"
,
4
)
)
{
ret_action
=
SCMP_ACT_TRAP
;
#if HAVE_DECL_SECCOMP_NOTIFY_FD
}
else
if
(
strn
cmp
(
line
,
"notify"
,
6
)
==
0
)
{
}
else
if
(
strn
equal
(
line
,
"notify"
,
6
)
)
{
ret_action
=
SCMP_ACT_NOTIFY
;
#endif
}
else
if
(
line
[
0
])
{
...
...
@@ -331,23 +331,23 @@ static int get_hostarch(void)
/* no x32 kernels */
else
if
(
strequal
(
uts
.
machine
,
"x86_64"
))
return
lxc_seccomp_arch_amd64
;
else
if
(
strn
cmp
(
uts
.
machine
,
"armv7"
,
5
)
==
0
)
else
if
(
strn
equal
(
uts
.
machine
,
"armv7"
,
5
)
)
return
lxc_seccomp_arch_arm
;
else
if
(
strn
cmp
(
uts
.
machine
,
"aarch64"
,
7
)
==
0
)
else
if
(
strn
equal
(
uts
.
machine
,
"aarch64"
,
7
)
)
return
lxc_seccomp_arch_arm64
;
else
if
(
strn
cmp
(
uts
.
machine
,
"ppc64le"
,
7
)
==
0
)
else
if
(
strn
equal
(
uts
.
machine
,
"ppc64le"
,
7
)
)
return
lxc_seccomp_arch_ppc64le
;
else
if
(
strn
cmp
(
uts
.
machine
,
"ppc64"
,
5
)
==
0
)
else
if
(
strn
equal
(
uts
.
machine
,
"ppc64"
,
5
)
)
return
lxc_seccomp_arch_ppc64
;
else
if
(
strn
cmp
(
uts
.
machine
,
"ppc"
,
3
)
==
0
)
else
if
(
strn
equal
(
uts
.
machine
,
"ppc"
,
3
)
)
return
lxc_seccomp_arch_ppc
;
else
if
(
strn
cmp
(
uts
.
machine
,
"mips64"
,
6
)
==
0
)
else
if
(
strn
equal
(
uts
.
machine
,
"mips64"
,
6
)
)
return
MIPS_ARCH_N64
;
else
if
(
strn
cmp
(
uts
.
machine
,
"mips"
,
4
)
==
0
)
else
if
(
strn
equal
(
uts
.
machine
,
"mips"
,
4
)
)
return
MIPS_ARCH_O32
;
else
if
(
strn
cmp
(
uts
.
machine
,
"s390x"
,
5
)
==
0
)
else
if
(
strn
equal
(
uts
.
machine
,
"s390x"
,
5
)
)
return
lxc_seccomp_arch_s390x
;
else
if
(
strn
cmp
(
uts
.
machine
,
"s390"
,
4
)
==
0
)
else
if
(
strn
equal
(
uts
.
machine
,
"s390"
,
4
)
)
return
lxc_seccomp_arch_s390
;
return
lxc_seccomp_arch_unknown
;
}
...
...
@@ -511,7 +511,7 @@ static enum lxc_seccomp_rule_status_t do_resolve_add_rule(uint32_t arch, char *l
if
(
p
)
*
p
=
'\0'
;
if
(
strn
cmp
(
line
,
"reject_force_umount"
,
19
)
==
0
)
{
if
(
strn
equal
(
line
,
"reject_force_umount"
,
19
)
)
{
ret
=
seccomp_rule_add_exact
(
ctx
,
SCMP_ACT_ERRNO
(
EACCES
),
SCMP_SYS
(
umount2
),
1
,
SCMP_A1
(
SCMP_CMP_MASKED_EQ
,
MNT_FORCE
,
MNT_FORCE
));
...
...
@@ -1159,7 +1159,7 @@ static bool use_seccomp(const struct lxc_conf *conf)
return
true
;
while
(
getline
(
&
line
,
&
line_bufsz
,
f
)
!=
-
1
)
{
if
(
strn
cmp
(
line
,
"Seccomp:"
,
8
)
==
0
)
{
if
(
strn
equal
(
line
,
"Seccomp:"
,
8
)
)
{
found
=
true
;
ret
=
sscanf
(
line
+
8
,
"%d"
,
&
v
);
...
...
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