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
b4733289
Unverified
Commit
b4733289
authored
Mar 26, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confile: fix setting prlimits
Fixes:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32532
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
2896136e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
17 deletions
+19
-17
conf.h
src/lxc/conf.h
+1
-1
confile.c
src/lxc/confile.c
+18
-16
No files found.
src/lxc/conf.h
View file @
b4733289
...
@@ -104,7 +104,7 @@ struct lxc_limit {
...
@@ -104,7 +104,7 @@ struct lxc_limit {
static
void
free_lxc_limit
(
struct
lxc_limit
*
ptr
)
static
void
free_lxc_limit
(
struct
lxc_limit
*
ptr
)
{
{
if
(
ptr
)
{
if
(
ptr
)
{
free
(
ptr
->
resource
);
free
_disarm
(
ptr
->
resource
);
free_disarm
(
ptr
);
free_disarm
(
ptr
);
}
}
}
}
...
...
src/lxc/confile.c
View file @
b4733289
...
@@ -1727,8 +1727,8 @@ static bool parse_limit_value(const char **value, rlim_t *res)
...
@@ -1727,8 +1727,8 @@ static bool parse_limit_value(const char **value, rlim_t *res)
static
int
set_config_prlimit
(
const
char
*
key
,
const
char
*
value
,
static
int
set_config_prlimit
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
{
__do_free
struct
lxc_list
*
li
mli
st
=
NULL
;
__do_free
struct
lxc_list
*
list
=
NULL
;
call_cleaner
(
free_lxc_limit
)
struct
lxc_limit
*
lim
elem
=
NULL
;
call_cleaner
(
free_lxc_limit
)
struct
lxc_limit
*
elem
=
NULL
;
struct
lxc_list
*
iter
;
struct
lxc_list
*
iter
;
struct
rlimit
limit
;
struct
rlimit
limit
;
rlim_t
limit_value
;
rlim_t
limit_value
;
...
@@ -1779,29 +1779,31 @@ static int set_config_prlimit(const char *key, const char *value,
...
@@ -1779,29 +1779,31 @@ static int set_config_prlimit(const char *key, const char *value,
/* find existing list element */
/* find existing list element */
lxc_list_for_each
(
iter
,
&
lxc_conf
->
limits
)
{
lxc_list_for_each
(
iter
,
&
lxc_conf
->
limits
)
{
limelem
=
iter
->
elem
;
struct
lxc_limit
*
cur
=
iter
->
elem
;
if
(
strequal
(
key
,
limelem
->
resource
))
{
limelem
->
limit
=
limit
;
if
(
!
strequal
(
key
,
cur
->
resource
))
return
0
;
continue
;
}
cur
->
limit
=
limit
;
return
0
;
}
}
/* allocate list element */
/* allocate list element */
li
mli
st
=
lxc_list_new
();
list
=
lxc_list_new
();
if
(
!
li
mli
st
)
if
(
!
list
)
return
ret_errno
(
ENOMEM
);
return
ret_errno
(
ENOMEM
);
limelem
=
zalloc
(
sizeof
(
*
lim
elem
));
elem
=
zalloc
(
sizeof
(
*
elem
));
if
(
!
lim
elem
)
if
(
!
elem
)
return
ret_errno
(
ENOMEM
);
return
ret_errno
(
ENOMEM
);
lim
elem
->
resource
=
strdup
(
key
);
elem
->
resource
=
strdup
(
key
);
if
(
!
lim
elem
->
resource
)
if
(
!
elem
->
resource
)
return
ret_errno
(
ENOMEM
);
return
ret_errno
(
ENOMEM
);
lim
elem
->
limit
=
limit
;
elem
->
limit
=
limit
;
lxc_list_add_elem
(
li
mlist
,
move_ptr
(
lim
elem
));;
lxc_list_add_elem
(
li
st
,
move_ptr
(
elem
));;
lxc_list_add_tail
(
&
lxc_conf
->
limits
,
move_ptr
(
li
mli
st
));
lxc_list_add_tail
(
&
lxc_conf
->
limits
,
move_ptr
(
list
));
return
0
;
return
0
;
}
}
...
...
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