2
0
mirror of git://github.com/lxc/lxc synced 2025-08-30 20:19:33 +00:00
Commit Graph

7659 Commits

Author SHA1 Message Date
2xsec
a8eed52c17 add compile flags for dlog
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-09-13 11:37:54 +09:00
Christian Brauner
fd73418875 Merge pull request #2609 from 2xsec/bugfix
remove unused variables & function
2018-09-12 13:34:36 +02:00
2xsec
8b7421f2e5 file_utils: remove unused function
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-09-12 17:31:40 +09:00
2xsec
01c8b1cd9d remove unused variables
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-09-12 17:29:09 +09:00
Wolfgang Bumiller
aec2500592 Merge pull request #2604 from brauner/2018-09-09/fix_pid_file
lxccontainer: use correct pid_t type
2018-09-11 14:18:04 +02:00
Christian Brauner
855358c801 Merge pull request #2601 from 2xsec/bugfix
log: support dlog
2018-09-11 11:39:54 +02:00
Christian Brauner
b07ea13d4a lxccontainer: use correct pid_t type
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-11 11:18:13 +02:00
Wolfgang Bumiller
88fbc01082 Merge pull request #2596 from brauner/2018-09-05/attach_id
utils: allow lxc-attach to set uid / gid
2018-09-11 11:06:42 +02:00
Christian Brauner
464c46115f utils: make lxc_switch_uid_gid() return bool
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-11 10:55:07 +02:00
Christian Brauner
8af07f821c utils: make lxc_setgroups() return bool
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-11 10:54:46 +02:00
Christian Brauner
964581c210 start: avoid unnecessary syscalls
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-11 10:54:46 +02:00
Christian Brauner
ddd51fdb8e tools/lxc-attach: add -u and -g arguments
This lets users specify uids and gids to switch to.

Closes #2591.

Signed-off-by: Disassembler disassembler@dasm.cz
[christian.brauner@ubuntu.com: adapt coding style + commit message]
2018-09-11 10:54:46 +02:00
Christian Brauner
936efc72f6 attach: handle id switching smarter
For setup, switch to the most privileged ids we can find. That is either
nsuid 0 if a mapping has been established if not switch to the ids the
init running in the container was started with.
After setup, switch to the actual requested ids.

Closes #2591.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-11 10:54:44 +02:00
2xsec
5c7bfc0231 log: support dlog
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-09-11 16:04:25 +09:00
Christian Brauner
db2d1af171 utils: improve lxc_switch_uid_gid()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-11 00:44:57 +02:00
Christian Brauner
b962868f4c utils: improve get_ns_uid() and add get_ns_gid()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-11 00:44:56 +02:00
Christian Brauner
1ea1496dfd Merge pull request #2594 from ffontaine/master
lxc: fix build with --disable-werror
2018-09-08 20:39:05 +01:00
Fabrice Fontaine
218e814412 lxc: fix build with --disable-werror
Fix #2592 by defining -Wvla -std=gnu11 even if --disable-werror is set
As -std=gnu11 is always set, bump requirement on gcc from 4.6 to 4.7
(see https://gcc.gnu.org/projects/cxx-status.html#cxx11)

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2018-09-08 21:09:20 +02:00
Christian Brauner
0b26d75e62 Merge pull request #2589 from 2xsec/bugfix
lxccontainer: fix dereferenced pointer
2018-09-07 13:54:09 +01:00
2xsec
5106ecd032 lxccontainer: fix dereferenced pointer
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-09-06 16:55:10 +09:00
Wolfgang Bumiller
a21ed5555d Merge pull request #2584 from brauner/2018-09-03/bugfixes
commands: switch to setting errno and returning -1
2018-09-04 14:45:55 +02:00
Christian Brauner
a9d4137983 log: log_append_logfile() add new error path
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-04 14:05:28 +02:00
Christian Brauner
bfcedc7ea0 nl: save errno on lxc_netns_set_nsid()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-04 14:05:28 +02:00
Christian Brauner
7fbb15ec9c tree-wide: s/send()/lxc_send_nointr()/g
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-04 14:05:28 +02:00
Christian Brauner
28143f8862 file_utils: add lxc_send_nointr()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-04 13:59:13 +02:00
Christian Brauner
e3233f26ce tree-wide: s/recv()/lxc_recv_nointr()/g
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-04 13:59:13 +02:00
Christian Brauner
a285b30814 log: save errno on strerror_r()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-04 13:57:35 +02:00
Christian Brauner
b7051eb7e6 log: do not clobber errno
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-04 13:57:19 +02:00
Christian Brauner
2a850b2ca6 commands: switch to setting errno and returning -1
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-09-04 10:35:30 +02:00
Christian Brauner
de69edd15e file_utils: add lxc_recv_nointr()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-04 10:35:30 +02:00
Christian Brauner
a8007512f7 commands: better error message
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-04 10:35:25 +02:00
Christian Brauner
593010238b Merge pull request #2585 from 2xsec/bugfix
caps: fix illegal access to array bound
2018-09-04 10:34:46 +02:00
2xsec
b8bcbe9b06 syntax error: mismatch brace
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-09-04 14:58:59 +09:00
2xsec
aa599d1f48 nl: remove duplicated define
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-09-04 14:24:22 +09:00
2xsec
91d9cab6de utils: defensive programming
If caller passed the size of array not string length, it is possible to be accessed out of bounds.

Reorder conditions can prevent access invalid index of array.

Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-09-04 11:10:18 +09:00
2xsec
22b67bfa96 caps: fix illegal access to array bound
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
2018-09-03 15:10:35 +09:00
Wolfgang Bumiller
d3aba1db25 Merge pull request #2581 from brauner/2018-09-02/macro
macro: move MS_* macros
2018-09-02 10:03:16 +02:00
Christian Brauner
6e5655e0db macro: move MS_* macros
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-02 07:32:23 +02:00
Wolfgang Bumiller
04a49be674 Merge pull request #2580 from brauner/2018-09-01/revert_blub_revert
Revert "Revert "tree-wide: use sizeof on static arrays""
2018-09-01 20:53:32 +02:00
Christian Brauner
979a0d9354 Revert "Revert "tree-wide: use sizeof on static arrays""
This reverts commit 2fb7cf0b32.

The problem wasn't caused by the reverted commit and was fixed in

commit 0c9b1f826d ("macro: calculate buffer lengths correctly")

The full explanation can be taken from the following irc excerpt from
the #lxc-dev channel:

│19:54:47 brauner | there was a bug in one of the standard macros we used
│19:55:01 brauner | and the changes by INTTYPE_TO_STRLEN() caused the issue to surface
│19:55:03 brauner | which is good
│19:55:16 brauner | i sent a branch and stgraber merged it that fixes it
│19:57:56  Blub\0 | so...
│19:58:31  Blub\0 | still doesn't explain how it was the sizeof() patch
│20:07:14 brauner | Blub\0: so here's the long explanation
│20:07:35 brauner | Blub\0: stgraber bumped pid_max on our jenkins test builders
│20:07:53 brauner | Blub\0: because we're running *a lot* of containers
│20:07:56 brauner | in any case
│20:08:06 brauner | there was a buffer
│20:08:12 brauner | LXC_LSMATTRLEN
│20:08:59 brauner | it used to be
│20:09:03 brauner | -/* /proc/pid-to-str/attr/current = (5 + INTTYPE_TO_STRLEN(pid_t) + 7 + 1) */
│20:09:03 brauner | -#define LXC_LSMATTRLEN (5 + INTTYPE_TO_STRLEN(pid_t) + 7 + 1)
│20:09:14 brauner | which one can see is wrong
│20:09:21 brauner | before the INTTYPE patchset
│20:09:40 brauner | INTTYPE_TO_STRLEN(pid_t) was LXC_NUMSTRLEN64
│20:09:45 brauner | which gave you 21 chars
│20:09:57 brauner | so it accounted for the missing parts
│20:10:03 brauner | because the correct macro should've been
│20:10:17 brauner | +/* /proc/        = 6
│20:10:17 brauner | + *               +
│20:10:17 brauner | + * <pid-as-str>  = INTTYPE_TO_STRLEN(pid_t)
│20:10:17 brauner | + *               +
│20:10:17 brauner | + * /attr/        = 6
│20:10:17 brauner | + *               +
│20:10:17 brauner | + * /current      = 8
│20:10:17 brauner | + *               +
│20:10:17 brauner | + * \0            = 1
│20:10:17 brauner | + */
│20:10:17 brauner | +#define LXC_LSMATTRLEN (6 + INTTYPE_TO_STRLEN(pid_t) + 6 + 8 + 1)
│20:10:24  Blub\0 | still
│20:10:31 brauner | the issue was only seen
│20:10:39 brauner | when the pid number hit a specific maximum
│20:10:50  Blub\0 | the sizeof patch only changed instances of actual char buf[A_FIXED_NUMBER] + snprintf(buf, A_FIXED_NUMBER, ...)
│20:10:54 brauner | aka exceeded the newly shortened buffer
│20:11:42 brauner | your patch was a red herring
│20:12:03  Blub\0 | I guess
│20:12:06 brauner | it didn't cause it
│20:12:14 brauner | it just surfaced at the same time it was merged
│20:12:25  Blub\0 | so we can revert the revert then? :)
│20:12:35 brauner | yes, that was th eplan all along

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-01 20:25:07 +02:00
Stéphane Graber
b0f3050884 Merge pull request #2579 from brauner/2018-08-31/int64_t_pids
macro: calculate buffer lengths correctly
2018-08-31 16:52:23 -07:00
Christian Brauner
0c9b1f826d macro: calculate buffer lengths correctly
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-01 01:08:30 +02:00
Christian Brauner
54dcfd8160 commands: assign before converting to pointer
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-09-01 00:29:30 +02:00
Stéphane Graber
f8db64b867 Merge pull request #2578 from brauner/2018-08-31/int64_t_pids
commands: pass around intmax_t
2018-08-31 14:30:21 -07:00
Christian Brauner
9234406bb1 commands: pass around intmax_t
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-08-31 21:44:49 +02:00
Stéphane Graber
2fb7cf0b32 Revert "tree-wide: use sizeof on static arrays"
This reverts commit 81a3bb64b4.

This commit broke all builders running with pid_max > 32768.

Reverting for now so we can bring the build farm back online.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2018-08-31 11:58:17 -07:00
Wolfgang Bumiller
6b28940591 Merge pull request #2435 from brauner/2018-06-27/storage_managed
[RFC] conf: introduce lxc.rootfs.managed
2018-08-30 08:28:08 +02:00
Christian Brauner
7cba1a2729 Merge pull request #2577 from Blub/inttype-lengths
tree-wide: use sizeof on static arrays
2018-08-29 22:26:46 +02:00
Wolfgang Bumiller
81a3bb64b4 tree-wide: use sizeof on static arrays
Instead of duplicating their lengths in read/snprintf/...
calls.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-08-29 21:46:39 +02:00
Wolfgang Bumiller
f288e10a59 Merge pull request #2572 from brauner/2018-08-24/musl_fixes
build: fix musl + add compiler.h
2018-08-29 21:39:05 +02:00