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
fb6991e5
Unverified
Commit
fb6991e5
authored
May 10, 2021
by
Stéphane Graber
Committed by
GitHub
May 10, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3826 from brauner/2021-05-04.fuzz.cgroup
oss-fuzz: add basic cgroup_init()/cgroup_exit() fuzzing
parents
bff268e7
74951960
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
2 deletions
+60
-2
Makefile.am
src/tests/Makefile.am
+10
-2
fuzz-lxc-cgroup-init.c
src/tests/fuzz-lxc-cgroup-init.c
+50
-0
No files found.
src/tests/Makefile.am
View file @
fb6991e5
...
@@ -815,8 +815,16 @@ fuzz_lxc_define_load_CXXFLAGS = $(AM_CFLAGS)
...
@@ -815,8 +815,16 @@ fuzz_lxc_define_load_CXXFLAGS = $(AM_CFLAGS)
fuzz_lxc_define_load_LDFLAGS
=
$(AM_LDFLAGS)
-static
fuzz_lxc_define_load_LDFLAGS
=
$(AM_LDFLAGS)
-static
fuzz_lxc_define_load_LDADD
=
$(LDADD)
$(LIB_FUZZING_ENGINE)
fuzz_lxc_define_load_LDADD
=
$(LDADD)
$(LIB_FUZZING_ENGINE)
bin_PROGRAMS
+=
fuzz-lxc-config-read
\
nodist_EXTRA_fuzz_lxc_cgroup_init_SOURCES
=
dummy.cxx
fuzz-lxc-define-load
fuzz_lxc_cgroup_init_SOURCES
=
fuzz-lxc-cgroup-init.c
fuzz_lxc_cgroup_init_CFLAGS
=
$(AM_CFLAGS)
fuzz_lxc_cgroup_init_CXXFLAGS
=
$(AM_CFLAGS)
fuzz_lxc_cgroup_init_LDFLAGS
=
$(AM_LDFLAGS)
-static
fuzz_lxc_cgroup_init_LDADD
=
$(LDADD)
$(LIB_FUZZING_ENGINE)
bin_PROGRAMS
+=
fuzz-lxc-cgroup-init
\
fuzz-lxc-config-read
\
fuzz-lxc-define-load
bin_SCRIPTS
+=
lxc-test-fuzzers
bin_SCRIPTS
+=
lxc-test-fuzzers
endif
endif
...
...
src/tests/fuzz-lxc-cgroup-init.c
0 → 100644
View file @
fb6991e5
/* SPDX-License-Identifier: LGPL-2.1+ */
#include <stddef.h>
#include <stdint.h>
#include "cgroups/cgroup.h"
#include "conf.h"
#include "confile.h"
#include "lxctest.h"
#include "utils.h"
int
LLVMFuzzerTestOneInput
(
const
uint8_t
*
data
,
size_t
size
)
{
int
fd
=
-
1
;
char
tmpf
[]
=
"/tmp/fuzz-lxc-cgroup-init-XXXXXX"
;
struct
lxc_conf
*
conf
=
NULL
;
int
ret
;
struct
cgroup_ops
*
ops
;
/*
* 100Kb should probably be enough to trigger all the issues
* we're interested in without any timeouts
*/
if
(
size
>
102400
)
return
0
;
fd
=
lxc_make_tmpfile
(
tmpf
,
false
);
lxc_test_assert_abort
(
fd
>=
0
);
lxc_write_nointr
(
fd
,
data
,
size
);
close
(
fd
);
conf
=
lxc_conf_init
();
lxc_test_assert_abort
(
conf
);
/* Test cgroup_init() with valid config. */
ops
=
cgroup_init
(
conf
);
cgroup_exit
(
ops
);
ret
=
lxc_config_read
(
tmpf
,
conf
,
false
);
if
(
ret
==
0
)
{
/* Test cgroup_init() with likely garbage config. */
ops
=
cgroup_init
(
conf
);
cgroup_exit
(
ops
);
}
lxc_conf_free
(
conf
);
(
void
)
unlink
(
tmpf
);
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