Christian Brauner
2ec47d5149
tools: s/strncpy()/strlcpy()/g
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-05-11 15:28:41 +02:00
Stéphane Graber
acb1bd4aed
Merge pull request #2316 from brauner/2018-05-11/compiler_fixes
...
tree-wide: s/strncpy()/strlcpy()/g
2018-05-11 09:07:41 -04:00
Christian Brauner
a3759c1b25
CODING_STYLE: add section about using strlcpy()
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-05-11 13:32:01 +02:00
Christian Brauner
9de31d5a13
tree-wide: s/strncpy()/strlcpy()/g
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-05-11 13:32:01 +02:00
Christian Brauner
91c272a571
strlcpy: add strlcpy() implementation
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-05-11 13:32:01 +02:00
Christian Brauner
55f4cc1e81
Merge pull request #2315 from duguhaotian/master
...
support case ignored suffix for sizes
2018-05-11 13:22:16 +02:00
Christian Brauner
6d276edc1d
utils: fix parse_byte_size_string() coding style
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-05-11 13:08:20 +02:00
l00355512
39ebeb725b
support case ignored suffix for sizes
...
suffix of console max size and console buffer max size
Signed-off-by: l00355512 <liuhao27@huawei.com>
2018-05-11 09:47:49 +08:00
Stéphane Graber
503c783780
Merge pull request #2314 from brauner/2018-05-11/compiler_fixes
...
gcc-8: silence
2018-05-10 19:44:44 -04:00
Christian Brauner
095ead8051
network: adhere to IFNAMSIZ limit
...
The additional \0-byte space added is not needed since IFNAMSIZ needs to
include the \0-byte.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-05-11 00:55:39 +02:00
Christian Brauner
def4def6fd
network: silence gcc-8
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-05-11 00:55:39 +02:00
Stéphane Graber
3d36e44ad3
Merge pull request #2313 from brauner/2018-05-11/compiler_fixes
...
confile: satisfy gcc-8
2018-05-10 18:38:54 -04:00
Christian Brauner
d3bdf12cf0
confile: satisfy gcc-8
...
Apparently -Werror=stringop-overflow will trigger an error here even though
this is completely valid since we now that we're definitely copying a \0-byte.
Work around this gcc-8 quirk by using memcpy(). This shouldn't trigger the
warning.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-05-11 00:16:41 +02:00
Stéphane Graber
d975008115
Merge pull request #2299 from brauner/2018-05-01/bugfixes
...
coverity + code removal
2018-05-10 17:51:15 -04:00
Christian Brauner
ccd42a3144
utils: account for terminating \0 byte
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-05-10 20:25:08 +02:00
Christian Brauner
2b2655a8c5
coverity: #1425744
...
Dereference after null check
userns_exec_{1,full} are called from functions that might not have a conf.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-05-10 20:24:49 +02:00
Christian Brauner
023e2a307a
coverity: #1248105
...
Time of check time of use
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-05-10 20:24:49 +02:00
Christian Brauner
0382c0da7b
coverity: #1248104
...
Argument cannot be negative
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-05-10 20:24:48 +02:00
Christian Brauner
13733a6c73
genl: remove
...
These files have never been used and as such have no dependencies in the
codebase whatsoever. So remove them. If we need them we can simply pull them
out of the git history.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-05-10 20:24:36 +02:00
Serge Hallyn
0f1b40e259
Merge pull request #2308 from tych0/add-logging
...
fix execute when init in the container already exists
2018-05-09 09:50:31 -05:00
Tycho Andersen
410898489f
execute: set init_path when existing init is found
...
I'm not really sure we should be looking in the rootfs for an existing
init, but I'll send a much more invasive patch to correct that. For now,
let's just make sure we set init_path when we find one, so that later in
execute_start() we don't bail.
Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-05-09 14:36:02 +00:00
Tycho Andersen
9c40b2d978
execute: account for -o path option count
...
This always works fine... until your exec() fails and you try to go and
free it, you've overwritten the allocator's metadata (and potentially other
stuff) and it fails.
Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-05-09 14:36:02 +00:00
Tycho Andersen
b2efeb0bb9
add some TRACE/ERROR reporting
...
The errors in execute_start are important because nothing actually prints
out what error if any there was in these cases, so you're left with an
empty log.
The TRACE logs are simply to tell you which version of start lxc chose to
invoke: exec or start.
Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-05-09 14:36:02 +00:00
Serge Hallyn
f52624fa56
Merge pull request #2309 from brauner/2018-05-08/fix_execute
...
execute: do not check inherited fds again
2018-05-09 08:49:07 -05:00
Christian Brauner
c7a2deb2dc
execute: do not check inherited fds again
...
This is already done in do_lxcapi_start{l}() so a) no need to do it again here
and b) this would close the state socket pair sockets, corrup the fd, and lead
to EBADF.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-05-08 18:10:13 +02:00
Christian Brauner
7101cb035b
Merge pull request #2305 from brauner/2018-05-04/fix_execute_logging
...
fix logic for execute log file
2018-05-04 12:35:23 +02:00
Christian Brauner
321614a5da
execute: use static buffer
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-05-04 11:59:27 +02:00
Christian Brauner
aa769a272f
utils: add LXC_PROC_PID_FD_LEN
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-05-04 11:59:11 +02:00
Tycho Andersen
cd90db2c0e
fix logic for execute log file
...
The problem here is that lxc-init runs *inside* the container. So if a
person has the log file set to /home/$USER/foo, lxc-init ends up making a
directory /home/$USER/foo inside the container to put the log file in. What
we really want are the logs to be propagated from inside the container to
the outside. We accomplish this by passing an fd without O_CLOEXEC, and
telling lxc-init to log to that file.
Signed-off-by: Tycho Andersen <tycho@tycho.ws>
2018-05-03 18:32:19 +00:00
Christian Brauner
cef701ede3
coverity: #1435263
...
Use after free
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-30 12:18:23 +02:00
Stéphane Graber
ff62067703
Merge pull request #2297 from brauner/2018-04-29/bugfixes
...
coverity
2018-04-30 05:29:41 -04:00
Christian Brauner
e62fd16fff
lxccontainer: non-functional changes
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 16:58:06 +02:00
Christian Brauner
630ac7c61b
lxccontainer: non-functional changes
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 16:56:58 +02:00
Christian Brauner
9640c6a767
lxccontainer: non-functional changes
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 16:45:43 +02:00
Christian Brauner
7cea590585
lxccontainer: use thread-safe open() + write()
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 16:42:44 +02:00
Christian Brauner
d630991d8f
lxccontainer: non-functional changes
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 15:08:46 +02:00
Christian Brauner
e898947399
lxccontainer: do_lxcapi_unfreeze()
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 14:53:12 +02:00
Christian Brauner
5df46fad0c
lxccontainer: do_lxcapi_freeze()
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 14:52:40 +02:00
Christian Brauner
9e6304187b
lxccontainer: do_lxcapi_is_running()
...
There's no need to do string comparisons.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 14:49:36 +02:00
Christian Brauner
44619b6cd2
lxccontainer: non-functional changes
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 14:48:08 +02:00
Christian Brauner
5647455516
lxccontainer: use thread-safe *_OFD_* locks
...
If they aren't available fallback to BSD flock()s.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 13:56:15 +02:00
Christian Brauner
0e14584db8
lxccontainer: non-functional changes
...
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 13:39:16 +02:00
Christian Brauner
d2b5acecea
coverity: #1426734
...
Argument cannot be negative
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 01:10:54 +02:00
Christian Brauner
ba1de6dbfe
coverity: #1435198
...
Unchecked return value
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 00:50:50 +02:00
Christian Brauner
205fc0103b
coverity: #1435200
...
Resource leak
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 00:49:30 +02:00
Christian Brauner
c1768f3f25
coverity: #1435203
...
Resource leak
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 00:43:34 +02:00
Christian Brauner
dbdf8cf420
coverity: #1435205
...
Unchecked return value
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 00:38:29 +02:00
Christian Brauner
46768cced9
coverity: #1435206
...
Time of check time of use
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 00:36:24 +02:00
Christian Brauner
91ae555c99
coverity: #1435207
...
Unchecked return value
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 00:22:54 +02:00
Christian Brauner
8186c5c7c3
coverity: #1435208
...
Unused value
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-04-29 00:21:33 +02:00