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
00a476d2
Unverified
Commit
00a476d2
authored
Jul 03, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroup2_devices: fix access rule parsing
Closes: #3473. Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
f3783d06
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
cgroup2_devices.c
src/lxc/cgroups/cgroup2_devices.c
+15
-9
No files found.
src/lxc/cgroups/cgroup2_devices.c
View file @
00a476d2
...
@@ -118,29 +118,32 @@ void bpf_program_free(struct bpf_program *prog)
...
@@ -118,29 +118,32 @@ void bpf_program_free(struct bpf_program *prog)
.off = 0, \
.off = 0, \
.imm = 0})
.imm = 0})
static
int
bpf_access_mask
(
const
char
*
acc
)
static
int
bpf_access_mask
(
const
char
*
acc
,
int
*
mask
)
{
{
int
mask
=
0
;
*
mask
=
0
;
if
(
!
acc
)
if
(
!
acc
)
return
mask
;
return
0
;
for
(;
*
acc
;
acc
++
)
for
(;
*
acc
;
acc
++
)
{
switch
(
*
acc
)
{
switch
(
*
acc
)
{
case
'r'
:
case
'r'
:
mask
|=
BPF_DEVCG_ACC_READ
;
*
mask
|=
BPF_DEVCG_ACC_READ
;
break
;
break
;
case
'w'
:
case
'w'
:
mask
|=
BPF_DEVCG_ACC_WRITE
;
*
mask
|=
BPF_DEVCG_ACC_WRITE
;
break
;
break
;
case
'm'
:
case
'm'
:
mask
|=
BPF_DEVCG_ACC_MKNOD
;
*
mask
|=
BPF_DEVCG_ACC_MKNOD
;
break
;
break
;
case
'\0'
:
continue
;
default:
default:
return
-
EINVAL
;
return
-
EINVAL
;
}
}
}
return
mask
;
return
0
;
}
}
static
int
bpf_device_type
(
char
type
)
static
int
bpf_device_type
(
char
type
)
...
@@ -227,7 +230,10 @@ int bpf_program_append_device(struct bpf_program *prog, struct device_item *devi
...
@@ -227,7 +230,10 @@ int bpf_program_append_device(struct bpf_program *prog, struct device_item *devi
if
(
device_type
>
0
)
if
(
device_type
>
0
)
jump_nr
++
;
jump_nr
++
;
access_mask
=
bpf_access_mask
(
device
->
access
);
ret
=
bpf_access_mask
(
device
->
access
,
&
access_mask
);
if
(
ret
<
0
)
return
log_error_errno
(
ret
,
-
ret
,
"Invalid access mask specified %s"
,
device
->
access
);
if
(
!
bpf_device_all_access
(
access_mask
))
if
(
!
bpf_device_all_access
(
access_mask
))
jump_nr
+=
3
;
jump_nr
+=
3
;
...
...
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