Commit Graph

6329 Commits

Author SHA1 Message Date
AustinReichert
4fd8586c37 tools/lxc_info: removed internal logging
Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
2017-11-28 03:34:42 -06:00
AustinReichert
517c768159 tools/lxc_freeze: remove internal logging
Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
2017-11-28 03:32:50 -06:00
AustinReichert
9357140cab tools/lxc_execute: removed internal logging
Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
2017-11-28 03:30:24 -06:00
AustinReichert
f132fdbdc6 tools/lxc_device: remove internal logging
Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
2017-11-28 03:26:25 -06:00
AustinReichert
525dcf890b tools/lxc_destroy: remove internal logging
Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
2017-11-28 03:19:29 -06:00
AustinReichert
72e2c30726 tools/lxc_create: remove internal logging
Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
2017-11-28 03:14:54 -06:00
AustinReichert
84cb7e2b6c tools/lxc_console: remove internal logging
Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
2017-11-28 02:52:16 -06:00
AustinReichert
fdb9aa94df tools/lxc_clone: remove internal logging
Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
2017-11-28 02:41:23 -06:00
Christian Brauner
8a0a156e7a
Merge pull request #1952 from marcosps/duplicated_sethostname
utils.h: Avoid duplicated sethostname implementation
2017-11-28 09:09:04 +01:00
Christian Brauner
7baea1c1a3
Merge pull request #1954 from AustinReichert/tools-refactor-lxc-autostart
tools/lxc_autostart: remove internal logging
2017-11-28 09:07:35 +01:00
Christian Brauner
12df65ded7
Merge pull request #1953 from AustinReichert/tools-refactor-lxc-cgroup
tools/lxc_cgroup: remove internal logging
2017-11-28 09:07:03 +01:00
AustinReichert
5f514ceea6 tools/lxc_autostart: remove internal logging
Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
2017-11-28 01:12:18 -06:00
AustinReichert
614db2e111 tools/lxc_cgroup: remove internal logging
Signed-off-by: AustinReichert <austinskyreichert@utexas.edu>
2017-11-28 00:43:46 -06:00
Marcos Paulo de Souza
ac181b5c3c utils.h: Avoid duplicated sethostname implementation
Move duplicated implementatin of sethostname from conf.c and
lxc_unshare.c to utils.h

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
2017-11-28 00:13:49 -02:00
Serge Hallyn
fd3c548d61
Merge pull request #1949 from marcosps/issue_84
Use AX_PTHREAD config script to detect pthread api
2017-11-27 17:58:35 -06:00
LiFeng
3ee26d1983
seccomp: filter syscalls based on arguments
In order to support filtering syscalls based on arguments the seccomp version 2
specification is extended to the following form:

syscall_name action [index,value,op,valueTwo] [index,value,op]...

where the arguments of the tuple [index,value,valueTwo,op] have the following
meaning:
1. index (uint32_t):
   The index of the syscall argument.
2. value (uint64_t):
   The value for the syscall argument specified by "index".
3. valueTwo (uint64_t, optional):
   The value for the syscall argument specified by "index". This optional value
   is only valid in conjunction with SCMP_CMP_MASKED_EQ.
4. op (string):
   The operator for the syscall argument. Valid operators are the constants
   - SCMP_CMP_NE        (!=)
   - SCMP_CMP_LE        (<=)
   - SCMP_CMP_EQ        (==)
   - SCMP_CMP_GE        (>=)
   - SCMP_CMP_GT        (>)
   - SCMP_CMP_MASKED_EQ (&=)
   as defined by libseccomp >= v2.3.2.
   For convenience liblxc also understands the standard operator notation
   indicated in brackets after the libseccomp constants above as an equivalent
   notation.
Note that it is legal to specify multiple entries for the same syscall.

An example for an extended seccomp version 2 profile is:

2
blacklist allow
reject_force_umount  # comment this to allow umount -f;  not recommended
[all]
kexec_load errno 1 [0,1,SCMP_CMP_LE][3,1,==][5,1,SCMP_CMP_MASKED_EQ,1]
open_by_handle_at errno 1
init_module errno 1
finit_module errno 1
delete_module errno 1
unshare errno 9 [0,0x10000000,SCMP_CMP_EQ]
unshare errno 2 [0,0x20000000,SCMP_CMP_EQ]

Closes #1564.

Signed-off-by: LiFeng <lifeng68@huawei.com>
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-27 22:07:24 +01:00
Marcos Paulo de Souza
a81c46e99a Use AX_PTHREAD config script to detect pthread api
Closes: #84

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
2017-11-26 16:45:22 -02:00
Yifeng Tan
928b1f04fc
start.c: always switch uid and gid
Signed-off-by: Yifeng Tan <tanyifeng1@huawei.com>
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-25 02:03:59 +01:00
Stéphane Graber
f55cf89e9d
Merge pull request #1947 from brauner/2017-11-24/fix_cap_sys_admin_declaration
conf: move CAP_SYS_* definitions to utils.h
2017-11-24 11:00:06 -05:00
Christian Brauner
478fb51d4e
conf: move CAP_SYS_* definitions to utils.h
Closes #1946.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-24 13:25:51 +01:00
Christian Brauner
dc3de87251
Merge pull request #1944 from dnegreira/lxc_spec_in_typo_fix
Fixed typo on lxc.spec.in
2017-11-23 21:34:51 +01:00
David Negreira
e82021215f Fixed typo on lxc.spec.in
Signed-off-by: David Negreira David@otherreality.net
2017-11-23 21:23:14 +01:00
Stéphane Graber
a122de392b
Merge pull request #1939 from brauner/2017-11-22/more_elaborate_config_update_message
doc: documents lxc.namespace.[namespace identifier] + confile: improve legacy update message
2017-11-23 12:28:08 -05:00
Christian Brauner
b151c7e532
Merge pull request #1941 from flx42/lxc-oci-improve-import
Improve lxc-oci.in
2017-11-23 13:20:33 +01:00
Christian Brauner
f3c9f12290
doc: document lxc.namespace.[namespace identifier]
Closes #1924.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-23 12:34:23 +01:00
Felix Abecassis
797f99c6c9 lxc-oci: add support for registry authentication
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2017-11-22 17:55:13 -08:00
Felix Abecassis
d7c685c6be lxc-oci: import common.conf and userns.conf
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2017-11-22 17:55:13 -08:00
Felix Abecassis
996202e74a lxc-oci: import the environment variables
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2017-11-22 17:55:03 -08:00
Felix Abecassis
ce59e4ca31 lxc-oci: add utility function to retrieve the path of the config file
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2017-11-22 17:53:57 -08:00
Christian Brauner
ece913fe14
confile: improve legacy update message
Closes #1938.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-22 23:25:38 +01:00
Felix Abecassis
b523655057 lxc-oci: write /etc/hosts
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2017-11-22 09:31:51 -08:00
Felix Abecassis
bc2c91ae99 lxc-oci: write /etc/hostname
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2017-11-22 09:31:51 -08:00
Felix Abecassis
51c80577e0 lxc-oci: support unprivileged umoci unpacking
Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2017-11-22 09:31:51 -08:00
Christian Brauner
0ad2353255
Merge pull request #1936 from Cypresslin/user-del-mute
lxc-test-unpriv: check user existence before removing it
2017-11-22 12:48:19 +01:00
Christian Brauner
27b54094d0
Merge pull request #1935 from flx42/confile-overlapping-strncpy
confile_utils: fix overlapping strncpy
2017-11-22 12:33:57 +01:00
Po-Hsu Lin
438c96e96a lxc-test-unpriv: check user existence before removing it
Check the test user (lxcunpriv) before calling deluser command,
otherwise it will print unnecessary error message:
/usr/sbin/deluser: The user 'lxcunpriv' does not exist.

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
2017-11-22 03:11:46 -05:00
Felix Abecassis
ee3e84df78 confile_utils: fix overlapping strncpy
In the case of "lxc.net.0.type", the pointers passed to strncpy were
only 2 elements apart, resulting in undefined behavior.

Signed-off-by: Felix Abecassis <fabecassis@nvidia.com>
2017-11-21 22:33:01 -08:00
Christian Brauner
ba715de0b5
Merge pull request #1933 from 3XX0/init-control-tty
lxc_init: set the control terminal in the child session
2017-11-21 13:31:01 +01:00
Jonathan Calmels
0cf42eddd2 lxc_init: set the control terminal in the child session
Signed-off-by: Jonathan Calmels <jcalmels@nvidia.com>
2017-11-20 17:30:45 -08:00
Jonathan Calmels
27234deb3a hooks: add dhclient hooks
Add new hooks leveraging dhclient from the host to automatically
configure the container interfaces. This is especially useful for
application containers which rely on an IPAM driver for network
configuration (e.g. Docker).

Signed-off-by: Jonathan Calmels <jcalmels@nvidia.com>
2017-11-20 16:54:16 -08:00
Stéphane Graber
a848f32a94
Merge pull request #1931 from brauner/2017-11-20/fix_state_socket
commands: fix state socket implementation
2017-11-20 17:21:25 -05:00
Christian Brauner
f6fc156515
commands: fix state socket implementation
Remove dead state clients from state client list. Consider the following
scenario:

01 start container
02 issue shutdown request
03 state_client_fd is added to lxc_handler
03 container doesn't respond to shutdown request
04 user aborts shutdown request
05 lxc_cmd_fd_cleanup() removes state_client_fd from lxc_mainloop
06 invalid state_client_fd is still recorded in the lxc_handler
07 user issues lxc_cmd_stop() request via SIGKILL
08 container reaches STOPPED state and sends message to state_client_fd
09 state_client_fd number has been reused by lxc_cmd_stop_callback()
10 invalid data gets dumped to lxc_cmd_stop()

Reproducer:
Set an invalid shutdown signal to which the init system does not respond with a
shutdown via lxc.signal.halt e.g. "lxc.signal.halt = SIGUSR1". Then do:

1. start container
    root@conventiont|~
    > lxc-start -n a1

2. try to shutdown container
    root@conventiont|~
    > lxc-stop -n a1

3. abort shutdown
^C

4. SIGKILL the container (lxc.signal.stop = SIGKILL)
    root@conventiont|~
    > lxc-stop -n a1 -k
    lxc-stop: a1: commands.c: lxc_cmd_rsp_recv: 165 File too large - Response data for command "stop" is too long: 12641 bytes > 8192

To not let this happen we remove the state_client_fd from the lxc_handler when
we detect a cleanup event in lxc_cmd_fd_cleanup().

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-20 22:16:40 +01:00
Christian Brauner
c1a3e54736
lxccontainer: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-20 22:16:29 +01:00
Christian Brauner
9dfa4041c7
commands: non-functional changes
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-20 22:16:27 +01:00
Christian Brauner
4671db7abf
Merge pull request #1930 from lifeng68/Fix_parse_err
Fix lxc_inherit_namespace function error
2017-11-20 11:19:08 +01:00
LiFeng
716495668b Fix namespace config parse error
Signed-off-by: LiFeng <lifeng68@huawei.com>
2017-11-20 06:42:30 -05:00
Serge Hallyn
c4e7852b3c
Merge pull request #1925 from brauner/2017-11-14/console_config_keys
console: add lxc.console.buffer.size, lxc.console.buffer.logfile, lxc.console.rotate
2017-11-17 18:04:59 -06:00
Christian Brauner
8a2404e982
test: expand console log tests
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-18 00:20:56 +01:00
Christian Brauner
966b9ecd95
commands: rotate console log file
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-18 00:20:56 +01:00
Christian Brauner
cf685555b3
commands: truncate console ringbuffer log file
When a "clear" request is sent to the console ringbuffer we should truncate the
console log file as well.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2017-11-18 00:20:56 +01:00