Commit Graph

10959 Commits

Author SHA1 Message Date
Stéphane Graber
ace51ce88d
Merge pull request #3772 from merlin1991/master
templates/*.in: fixed PATH handling with spaces
2021-04-06 10:43:59 -04:00
Christian Ratzenhofer
655d10ed7f templates/*.in: fixed PATH handling with spaces
if $PATH already contains a path with a space the append of the
default directories in all template scripts fails with an error
like the following:

/usr/share/lxc/templates/lxc-download: 69: export: (x86)/NVIDIA: bad
variable name

Signed-off-by: Christian Ratzenhofer <christian.ratzenhofer@cdnm.at>
2021-04-06 14:43:11 +02:00
Stéphane Graber
093bfcc83c
Merge pull request #3771 from brauner/2021-04-06/fixes
conf: fix setups where /dev is outside of LXC's control
2021-04-06 08:18:32 -04:00
Christian Brauner
e2c8dbd8bc
log: ensure we always return negative errno
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-04-06 10:34:31 +02:00
Christian Brauner
1f0a3b6e48
conf: fix setups where /dev is outside of LXC's control
Fixes: #3770
Suggested-by: Ruben Jenster <r.jenster@drachenfels.de>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-04-06 10:30:38 +02:00
Stéphane Graber
d75ddd9b1b
Merge pull request #3766 from brauner/2021-04-02/fixes_2
lsm: fixes
2021-04-02 12:03:41 -04:00
Christian Brauner
8f899a4a12
confile: complain when LXC is built without AppArmor support
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-04-02 16:32:54 +02:00
Christian Brauner
d6df2b8fdf
confile: complain when LXC is built without selinux support
Link: https://github.com/lxc/lxc/issues/3765
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-04-02 16:18:29 +02:00
Stéphane Graber
6fde9fb187
Merge pull request #3764 from brauner/2021-04-02/fixes
confile: fix lxc.namespace.share.[identifier]
2021-04-02 08:47:53 -04:00
Christian Brauner
057d2caecb
confile: fix lxc.namespace.share.[identifier]
Link: https://github.com/lxc/lxc/pull/3763/files#r606089660
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-04-02 12:05:58 +02:00
Stéphane Graber
8aa602556a
Merge pull request #3762 from brauner/2021-03-31/fixes
fixes: Makefile, lxc-user-nic, simplify get_network_config_ops()
2021-04-01 08:39:43 -04:00
Christian Brauner
7707b0e06e
confile: simplify get_network_config_ops()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-04-01 11:08:13 +02:00
Christian Brauner
59f5a10311
string_utils: use restrict for lxc_safe_int64_residual()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-04-01 11:08:13 +02:00
Christian Brauner
90e69d7178
string_utils: ensure that errno is set on return
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-04-01 11:08:11 +02:00
Christian Brauner
5fba37a134
string_utils: move to lxc-copy() sources
It's the only place where it is still used.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-04-01 10:27:40 +02:00
Christian Brauner
68dd0ea545
lxc_user_nic: cleanup get_alloted()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-04-01 10:27:40 +02:00
Christian Brauner
4c7de7c5ee
lxc_user_nic: cleanup append_alloted()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-04-01 10:27:38 +02:00
Christian Brauner
b405dec645
Merge pull request #3760 from evverx/reject-giant-configs
oss-fuzz: reject giant configs early
2021-04-01 08:01:59 +02:00
Evgeny Vereshchagin
55376ebd14 cifuzz: fuzz longer
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2021-04-01 01:25:26 +00:00
Evgeny Vereshchagin
1a46f8537e confile: fix a memory leak lxc_config_define_add
```
2021-04-02T05:45:54.9410345Z ==13==ERROR: LeakSanitizer: detected memory leaks
2021-04-02T05:45:54.9410737Z
2021-04-02T05:45:54.9411488Z Direct leak of 16 byte(s) in 1 object(s) allocated from:
2021-04-02T05:45:54.9412556Z     #0 0x54d752 in calloc /src/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:154:3
2021-04-02T05:45:54.9413360Z     #1 0x583795 in parse_new_conf_line /src/lxc/src/lxc/confile.c:3048:8
2021-04-02T05:45:54.9414057Z     #2 0x582f1a in lxc_config_define_add /src/lxc/src/lxc/confile.c:3090:15
2021-04-02T05:45:54.9415352Z     #3 0x5810fa in LLVMFuzzerTestOneInput /src/lxc/src/tests/fuzz-lxc-define-load.c:30:6
2021-04-02T05:45:54.9419212Z     #4 0x483b93 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:599:15
2021-04-02T05:45:54.9421819Z     #5 0x48309a in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:505:3
2021-04-02T05:45:54.9424205Z     #6 0x485474 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:814:7
2021-04-02T05:45:54.9426658Z     #7 0x485689 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:845:3
2021-04-02T05:45:54.9428616Z     #8 0x473717 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:906:6
2021-04-02T05:45:54.9429989Z     #9 0x49f572 in main /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
2021-04-02T05:45:54.9433312Z     #10 0x7fa96041b83f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2083f)
2021-04-02T05:45:54.9433795Z
2021-04-02T05:45:54.9434661Z DEDUP_TOKEN: calloc--parse_new_conf_line--lxc_config_define_add
2021-04-02T05:45:54.9435483Z SUMMARY: AddressSanitizer: 16 byte(s) leaked in 1 allocation(s).
2021-04-02T05:45:54.9435958Z
2021-04-02T05:45:54.9436404Z INFO: a leak has been found in the initial corpus.
```

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2021-04-01 01:25:26 +00:00
Evgeny Vereshchagin
e8694d9a22 oss-fuzz: fuzz lxc_config_define_add and lxc_config_define_load
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2021-04-01 01:25:09 +00:00
Christian Brauner
f5312e35d3
Merge pull request #3759 from evverx/san-compatible
build-system: make it compatible with ASan/UBsan/Msan
2021-03-31 22:03:07 +02:00
Stéphane Graber
6dcd23e2bd
Merge pull request #3758 from brauner/2021-03-31/fixes
confile: cap to last bit in set_config_net_ipv4_address()
2021-03-31 13:36:04 -04:00
Christian Brauner
365136359f
confile: cap to last bit in set_config_net_ipv4_address()
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32708
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-03-31 10:54:28 +02:00
Christian Brauner
ea35e2ccda
Merge pull request #3755 from evverx/lxc-net
oss-fuzz.sh: put the "lxc.net" keys to the seed corpus as well
2021-03-30 20:50:52 +02:00
Stéphane Graber
21e9bead12
Merge pull request #3756 from brauner/2021-03-30/fixes_3
string_utils: switch to path_simplify()
2021-03-30 12:58:28 -04:00
Christian Brauner
28e54be15f
string_utils: switch to path_simplify()
Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32689
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-03-30 17:20:51 +02:00
Stéphane Graber
ec6de2c3e7
Merge pull request #3754 from brauner/2021-03-30/fixes_2
confile: don't jump into the global table twice
2021-03-30 08:31:41 -04:00
Christian Brauner
0abcc213e2
confile: don't jump into the global table twice
instead move networking keys into a subtable. This avoids even just the
remote danger of recursion and also speeds up config parsing.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-03-30 12:51:54 +02:00
Evgeny Vereshchagin
e7e0343fd9 oss-fuzz: reject giant configs early
It should help the fuzzer to avoid running into timeouts
like https://oss-fuzz.com/testcase-detail/5132999948632064.
Hopefully, once this is merged OSS-Fuzz will report only
infinite loops as timeouts.

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2021-03-30 07:26:39 +00:00
Evgeny Vereshchagin
792a48b180 build-system: make it compatible with ASan/UBsan/MSan
Closes: https://github.com/lxc/lxc/issues/3727

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2021-03-30 06:09:35 +00:00
Evgeny Vereshchagin
b31484bd1b ci: enable PAM
to make sure pam_cgfs is buildable with ASan/UBsan too

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2021-03-30 04:22:46 +00:00
Evgeny Vereshchagin
7bf9dc49e7 ci: also build with ASan/UBsan
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2021-03-30 04:22:46 +00:00
Evgeny Vereshchagin
49ffe5da49 oss-fuzz.sh: get rid of the sed "no-undefined" kludge
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2021-03-30 04:22:46 +00:00
Evgeny Vereshchagin
85d70be752 ci: stop passing --enable-ubsan
It's just a follow-up to 5f40423627 (where --enable-ubsan
was removed).

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2021-03-30 03:35:50 +00:00
Stéphane Graber
dce56ec228
Merge pull request #3750 from brauner/2021-03-29/fixes_2
autotools: remove --enable-{asan,ubsan} in favor of --enable-sanitizers
2021-03-29 13:11:25 -04:00
Christian Brauner
fb33b35c88
Merge pull request #3751 from tomponline/tp-nic-ordering
doc: Documented that net type field must come before other options on the net device
2021-03-29 18:29:57 +02:00
Thomas Parrott
320061b34f doc: Documented that net type field must come before other options on the net device
Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
2021-03-29 17:20:42 +01:00
Christian Brauner
73c852f7d6
README: remove Travis and add Github actions badge
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-03-29 18:05:39 +02:00
Christian Brauner
5f40423627
autotools: remove --enable-{asan,ubsan} in favor of --enable-sanitizers
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-03-29 17:35:59 +02:00
Stéphane Graber
d96134fa74
Merge pull request #3749 from brauner/2021-03-29/fixes
compiler: fix thread_local detection
2021-03-29 10:45:46 -04:00
Christian Brauner
86624ee4a5
Merge pull request #3746 from evverx/CIFuzz-unblock-msan
CIFuzz: turn on MSan
2021-03-29 16:06:16 +02:00
Christian Brauner
448439729d
compiler: fix thread_local detection
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-03-29 16:03:57 +02:00
Stéphane Graber
be43adcda9
Merge pull request #3748 from brauner/2021-03-29/fixes
fixes & config key validation
2021-03-29 08:13:08 -04:00
Evgeny Vereshchagin
593f13bf0a oss-fuzz.sh: put the "lxc.net" keys in the seed corpus as well
It's just a follow-up to 0abcc213e2 (where the "lxc.net" keys
were moved from config_jump_table to config_jump_table_net)

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2021-03-29 11:49:01 +00:00
Christian Brauner
ea60ca9565
lxccontainer: ensure second parameter to bsearch is never NULL
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-03-29 13:32:00 +02:00
Christian Brauner
52ce85046b
conf: fix thread_local support detection
Our detection for TLS wasn't working. Fix it.

Fixes: https://github.com/lxc/lxd/issues/8327
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-03-29 13:32:00 +02:00
Christian Brauner
2d676c005c
tests: add another test for garbage config key
where a valid key has trailing garbage at the end before the "=".

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-03-29 12:34:33 +02:00
Christian Brauner
cea88c47ac
tests: fix two false negatives in parse_config_file()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-03-29 12:33:33 +02:00
Christian Brauner
f0383b96e0
confile: cleanup set_config_net_script_down()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-03-29 12:26:12 +02:00