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
32d40452
Unverified
Commit
32d40452
authored
Feb 25, 2021
by
Stéphane Graber
Committed by
GitHub
Feb 25, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3698 from brauner/2021-02-25/fixes
tree-wide: some more logging fixes
parents
cca31bf0
815c378b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
115 additions
and
81 deletions
+115
-81
af_unix.c
src/lxc/af_unix.c
+7
-7
attach.c
src/lxc/attach.c
+2
-2
cgfsng.c
src/lxc/cgroups/cgfsng.c
+0
-0
cgroup2_devices.c
src/lxc/cgroups/cgroup2_devices.c
+15
-15
commands.c
src/lxc/commands.c
+0
-0
conf.c
src/lxc/conf.c
+1
-1
confile.c
src/lxc/confile.c
+9
-9
confile_utils.c
src/lxc/confile_utils.c
+1
-1
log.h
src/lxc/log.h
+80
-46
No files found.
src/lxc/af_unix.c
View file @
32d40452
...
@@ -198,7 +198,7 @@ again:
...
@@ -198,7 +198,7 @@ again:
if
(
errno
==
EINTR
)
if
(
errno
==
EINTR
)
goto
again
;
goto
again
;
return
syserr
no
(
-
errno
,
"Failed to receive response"
);
return
syserr
or
(
"Failed to receive response"
);
}
}
if
(
ret
==
0
)
if
(
ret
==
0
)
return
0
;
return
0
;
...
@@ -228,14 +228,14 @@ again:
...
@@ -228,14 +228,14 @@ again:
for
(
idx
=
0
;
idx
<
num_raw
;
idx
++
)
for
(
idx
=
0
;
idx
<
num_raw
;
idx
++
)
close
(
fds_raw
[
idx
]);
close
(
fds_raw
[
idx
]);
return
syserr
no
_set
(
-
EFBIG
,
"Received excessive number of file descriptors"
);
return
syserr
or
_set
(
-
EFBIG
,
"Received excessive number of file descriptors"
);
}
}
if
(
msg
.
msg_flags
&
MSG_CTRUNC
)
{
if
(
msg
.
msg_flags
&
MSG_CTRUNC
)
{
for
(
idx
=
0
;
idx
<
num_raw
;
idx
++
)
for
(
idx
=
0
;
idx
<
num_raw
;
idx
++
)
close
(
fds_raw
[
idx
]);
close
(
fds_raw
[
idx
]);
return
syserr
no
_set
(
-
EFBIG
,
"Control message was truncated; closing all fds and rejecting incomplete message"
);
return
syserr
or
_set
(
-
EFBIG
,
"Control message was truncated; closing all fds and rejecting incomplete message"
);
}
}
if
(
ret_fds
->
fd_count_max
>
num_raw
)
{
if
(
ret_fds
->
fd_count_max
>
num_raw
)
{
...
@@ -243,7 +243,7 @@ again:
...
@@ -243,7 +243,7 @@ again:
for
(
idx
=
0
;
idx
<
num_raw
;
idx
++
)
for
(
idx
=
0
;
idx
<
num_raw
;
idx
++
)
close
(
fds_raw
[
idx
]);
close
(
fds_raw
[
idx
]);
return
syserr
no
_set
(
-
EINVAL
,
"Received fewer file descriptors than we expected %u != %u"
,
return
syserr
or
_set
(
-
EINVAL
,
"Received fewer file descriptors than we expected %u != %u"
,
ret_fds
->
fd_count_max
,
num_raw
);
ret_fds
->
fd_count_max
,
num_raw
);
}
}
...
@@ -261,7 +261,7 @@ again:
...
@@ -261,7 +261,7 @@ again:
for
(
idx
=
0
;
idx
<
num_raw
;
idx
++
)
for
(
idx
=
0
;
idx
<
num_raw
;
idx
++
)
close
(
fds_raw
[
idx
]);
close
(
fds_raw
[
idx
]);
return
syserr
no
_set
(
-
EINVAL
,
"Received more file descriptors than we expected %u != %u"
,
return
syserr
or
_set
(
-
EINVAL
,
"Received more file descriptors than we expected %u != %u"
,
ret_fds
->
fd_count_max
,
num_raw
);
ret_fds
->
fd_count_max
,
num_raw
);
}
}
...
@@ -280,7 +280,7 @@ again:
...
@@ -280,7 +280,7 @@ again:
for
(
idx
=
0
;
idx
<
num_raw
;
idx
++
)
for
(
idx
=
0
;
idx
<
num_raw
;
idx
++
)
close
(
fds_raw
[
idx
]);
close
(
fds_raw
[
idx
]);
return
syserr
no
_set
(
-
EINVAL
,
"Invalid flag combination; closing to not risk leaking fds %u != %u"
,
return
syserr
or
_set
(
-
EINVAL
,
"Invalid flag combination; closing to not risk leaking fds %u != %u"
,
ret_fds
->
fd_count_max
,
num_raw
);
ret_fds
->
fd_count_max
,
num_raw
);
}
}
...
@@ -296,7 +296,7 @@ again:
...
@@ -296,7 +296,7 @@ again:
/* We expected to receive file descriptors. */
/* We expected to receive file descriptors. */
if
((
ret_fds
->
flags
&
UNIX_FDS_ACCEPT_MASK
)
&&
if
((
ret_fds
->
flags
&
UNIX_FDS_ACCEPT_MASK
)
&&
!
(
ret_fds
->
flags
&
UNIX_FDS_ACCEPT_NONE
))
!
(
ret_fds
->
flags
&
UNIX_FDS_ACCEPT_NONE
))
return
syserr
no
_set
(
-
EINVAL
,
"Received no file descriptors"
);
return
syserr
or
_set
(
-
EINVAL
,
"Received no file descriptors"
);
}
}
return
ret
;
return
ret
;
...
...
src/lxc/attach.c
View file @
32d40452
...
@@ -512,7 +512,7 @@ static int same_ns(int dfd_pid1, int dfd_pid2, const char *ns_path)
...
@@ -512,7 +512,7 @@ static int same_ns(int dfd_pid1, int dfd_pid2, const char *ns_path)
if
(
ns_fd2
<
0
)
{
if
(
ns_fd2
<
0
)
{
if
(
errno
==
ENOENT
)
if
(
errno
==
ENOENT
)
return
-
ENOENT
;
return
-
ENOENT
;
return
syserr
no
(
-
errno
,
"Failed to open %d(%s)"
,
dfd_pid2
,
ns_path
);
return
syserr
or
(
"Failed to open %d(%s)"
,
dfd_pid2
,
ns_path
);
}
}
ret
=
same_nsfd
(
dfd_pid1
,
dfd_pid2
,
ns_path
);
ret
=
same_nsfd
(
dfd_pid1
,
dfd_pid2
,
ns_path
);
...
@@ -551,7 +551,7 @@ static int __prepare_namespaces_pidfd(struct attach_context *ctx)
...
@@ -551,7 +551,7 @@ static int __prepare_namespaces_pidfd(struct attach_context *ctx)
break
;
break
;
}
}
return
syserr
no
(
-
errno
,
"Failed to determine whether %s namespace is shared"
,
return
syserr
or
(
"Failed to determine whether %s namespace is shared"
,
ns_info
[
i
].
proc_name
);
ns_info
[
i
].
proc_name
);
}
}
...
...
src/lxc/cgroups/cgfsng.c
View file @
32d40452
This diff is collapsed.
Click to expand it.
src/lxc/cgroups/cgroup2_devices.c
View file @
32d40452
...
@@ -352,7 +352,7 @@ static int bpf_program_cgroup_attach(struct bpf_program *prog, int type,
...
@@ -352,7 +352,7 @@ static int bpf_program_cgroup_attach(struct bpf_program *prog, int type,
return
ret_errno
(
EBADF
);
return
ret_errno
(
EBADF
);
if
(
flags
&
~
(
BPF_F_ALLOW_OVERRIDE
|
BPF_F_ALLOW_MULTI
|
BPF_F_REPLACE
))
if
(
flags
&
~
(
BPF_F_ALLOW_OVERRIDE
|
BPF_F_ALLOW_MULTI
|
BPF_F_REPLACE
))
return
syserr
no
_set
(
-
EINVAL
,
"Invalid flags for bpf program"
);
return
syserr
or
_set
(
-
EINVAL
,
"Invalid flags for bpf program"
);
/*
/*
* Don't allow the bpf program to be overwritten for now. If we ever
* Don't allow the bpf program to be overwritten for now. If we ever
...
@@ -369,7 +369,7 @@ static int bpf_program_cgroup_attach(struct bpf_program *prog, int type,
...
@@ -369,7 +369,7 @@ static int bpf_program_cgroup_attach(struct bpf_program *prog, int type,
ret
=
bpf_program_load_kernel
(
prog
);
ret
=
bpf_program_load_kernel
(
prog
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
syserr
no
(
-
errno
,
"Failed to load bpf program"
);
return
syserr
or
(
"Failed to load bpf program"
);
attr
=
&
(
union
bpf_attr
){
attr
=
&
(
union
bpf_attr
){
.
attach_type
=
type
,
.
attach_type
=
type
,
...
@@ -380,7 +380,7 @@ static int bpf_program_cgroup_attach(struct bpf_program *prog, int type,
...
@@ -380,7 +380,7 @@ static int bpf_program_cgroup_attach(struct bpf_program *prog, int type,
ret
=
bpf
(
BPF_PROG_ATTACH
,
attr
,
sizeof
(
*
attr
));
ret
=
bpf
(
BPF_PROG_ATTACH
,
attr
,
sizeof
(
*
attr
));
if
(
ret
<
0
)
if
(
ret
<
0
)
return
syserr
no
(
-
errno
,
"Failed to attach bpf program"
);
return
syserr
or
(
"Failed to attach bpf program"
);
prog
->
fd_cgroup
=
move_fd
(
fd_attach
);
prog
->
fd_cgroup
=
move_fd
(
fd_attach
);
prog
->
attached_type
=
type
;
prog
->
attached_type
=
type
;
...
@@ -414,7 +414,7 @@ int bpf_program_cgroup_detach(struct bpf_program *prog)
...
@@ -414,7 +414,7 @@ int bpf_program_cgroup_detach(struct bpf_program *prog)
ret
=
bpf
(
BPF_PROG_DETACH
,
attr
,
sizeof
(
*
attr
));
ret
=
bpf
(
BPF_PROG_DETACH
,
attr
,
sizeof
(
*
attr
));
if
(
ret
<
0
)
if
(
ret
<
0
)
return
syserr
no
(
-
errno
,
"Failed to detach bpf program from cgroup %d"
,
fd_cgroup
);
return
syserr
or
(
"Failed to detach bpf program from cgroup %d"
,
fd_cgroup
);
TRACE
(
"Detached bpf program from cgroup %d"
,
fd_cgroup
);
TRACE
(
"Detached bpf program from cgroup %d"
,
fd_cgroup
);
...
@@ -513,11 +513,11 @@ int bpf_list_add_device(struct bpf_devices *bpf_devices,
...
@@ -513,11 +513,11 @@ int bpf_list_add_device(struct bpf_devices *bpf_devices,
list_elem
=
malloc
(
sizeof
(
*
list_elem
));
list_elem
=
malloc
(
sizeof
(
*
list_elem
));
if
(
!
list_elem
)
if
(
!
list_elem
)
return
syserr
no
_set
(
ENOMEM
,
"Failed to allocate new device list"
);
return
syserr
or
_set
(
ENOMEM
,
"Failed to allocate new device list"
);
new_device
=
memdup
(
device
,
sizeof
(
struct
device_item
));
new_device
=
memdup
(
device
,
sizeof
(
struct
device_item
));
if
(
!
new_device
)
if
(
!
new_device
)
return
syserr
no
_set
(
ENOMEM
,
"Failed to allocate new device item"
);
return
syserr
or
_set
(
ENOMEM
,
"Failed to allocate new device item"
);
lxc_list_add_elem
(
list_elem
,
move_ptr
(
new_device
));
lxc_list_add_elem
(
list_elem
,
move_ptr
(
new_device
));
lxc_list_add_tail
(
&
bpf_devices
->
device_item
,
move_ptr
(
list_elem
));
lxc_list_add_tail
(
&
bpf_devices
->
device_item
,
move_ptr
(
list_elem
));
...
@@ -565,11 +565,11 @@ static struct bpf_program *__bpf_cgroup_devices(struct bpf_devices *bpf_devices)
...
@@ -565,11 +565,11 @@ static struct bpf_program *__bpf_cgroup_devices(struct bpf_devices *bpf_devices)
prog
=
bpf_program_new
(
BPF_PROG_TYPE_CGROUP_DEVICE
);
prog
=
bpf_program_new
(
BPF_PROG_TYPE_CGROUP_DEVICE
);
if
(
!
prog
)
if
(
!
prog
)
return
syserr
no
(
NULL
,
"Failed to create new bpf program"
);
return
syserr
or_ret
(
NULL
,
"Failed to create new bpf program"
);
ret
=
bpf_program_init
(
prog
);
ret
=
bpf_program_init
(
prog
);
if
(
ret
)
if
(
ret
)
return
syserr
no
(
NULL
,
"Failed to initialize bpf program"
);
return
syserr
or_ret
(
NULL
,
"Failed to initialize bpf program"
);
prog
->
device_list_type
=
bpf_devices
->
list_type
;
prog
->
device_list_type
=
bpf_devices
->
list_type
;
TRACE
(
"Device cgroup %s all devices by default"
,
TRACE
(
"Device cgroup %s all devices by default"
,
...
@@ -586,14 +586,14 @@ static struct bpf_program *__bpf_cgroup_devices(struct bpf_devices *bpf_devices)
...
@@ -586,14 +586,14 @@ static struct bpf_program *__bpf_cgroup_devices(struct bpf_devices *bpf_devices)
ret
=
bpf_program_append_device
(
prog
,
cur
);
ret
=
bpf_program_append_device
(
prog
,
cur
);
if
(
ret
)
if
(
ret
)
return
syserr
no
(
NULL
,
"Failed adding new device rule"
);
return
syserr
or_ret
(
NULL
,
"Failed adding new device rule"
);
TRACE
(
"Added new device rule"
);
TRACE
(
"Added new device rule"
);
}
}
ret
=
bpf_program_finalize
(
prog
);
ret
=
bpf_program_finalize
(
prog
);
if
(
ret
)
if
(
ret
)
return
syserr
no
(
NULL
,
"Failed to finalize device program"
);
return
syserr
or_ret
(
NULL
,
"Failed to finalize device program"
);
return
move_ptr
(
prog
);
return
move_ptr
(
prog
);
}
}
...
@@ -606,13 +606,13 @@ bool bpf_cgroup_devices_attach(struct cgroup_ops *ops,
...
@@ -606,13 +606,13 @@ bool bpf_cgroup_devices_attach(struct cgroup_ops *ops,
prog
=
__bpf_cgroup_devices
(
bpf_devices
);
prog
=
__bpf_cgroup_devices
(
bpf_devices
);
if
(
!
prog
)
if
(
!
prog
)
return
syserr
no
(
false
,
"Failed to create bpf program"
);
return
syserr
or_ret
(
false
,
"Failed to create bpf program"
);
ret
=
bpf_program_cgroup_attach
(
prog
,
BPF_CGROUP_DEVICE
,
ret
=
bpf_program_cgroup_attach
(
prog
,
BPF_CGROUP_DEVICE
,
ops
->
unified
->
dfd_lim
,
ops
->
unified
->
dfd_lim
,
BPF_F_ALLOW_MULTI
);
BPF_F_ALLOW_MULTI
);
if
(
ret
)
if
(
ret
)
return
syserr
no
(
false
,
"Failed to attach bpf program"
);
return
syserr
or_ret
(
false
,
"Failed to attach bpf program"
);
/* Replace old bpf program. */
/* Replace old bpf program. */
swap
(
prog
,
ops
->
cgroup2_devices
);
swap
(
prog
,
ops
->
cgroup2_devices
);
...
@@ -657,11 +657,11 @@ bool bpf_cgroup_devices_update(struct cgroup_ops *ops,
...
@@ -657,11 +657,11 @@ bool bpf_cgroup_devices_update(struct cgroup_ops *ops,
prog
=
__bpf_cgroup_devices
(
bpf_devices
);
prog
=
__bpf_cgroup_devices
(
bpf_devices
);
if
(
!
prog
)
if
(
!
prog
)
return
syserr
no
(
false
,
"Failed to create bpf program"
);
return
syserr
or_ret
(
false
,
"Failed to create bpf program"
);
ret
=
bpf_program_load_kernel
(
prog
);
ret
=
bpf_program_load_kernel
(
prog
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
syserr
no
(
false
,
"Failed to load bpf program"
);
return
syserr
or_ret
(
false
,
"Failed to load bpf program"
);
attr
=
&
(
union
bpf_attr
){
attr
=
&
(
union
bpf_attr
){
.
attach_type
=
prog_old
->
attached_type
,
.
attach_type
=
prog_old
->
attached_type
,
...
@@ -693,7 +693,7 @@ bool bpf_cgroup_devices_update(struct cgroup_ops *ops,
...
@@ -693,7 +693,7 @@ bool bpf_cgroup_devices_update(struct cgroup_ops *ops,
break
;
break
;
}
}
if
(
ret
<
0
)
if
(
ret
<
0
)
return
syserr
no
(
false
,
"Failed to update bpf program"
);
return
syserr
or_ret
(
false
,
"Failed to update bpf program"
);
if
(
can_use_bpf_replace
>
0
)
{
if
(
can_use_bpf_replace
>
0
)
{
/* The old program was automatically detached by the kernel. */
/* The old program was automatically detached by the kernel. */
...
...
src/lxc/commands.c
View file @
32d40452
This diff is collapsed.
Click to expand it.
src/lxc/conf.c
View file @
32d40452
...
@@ -1842,7 +1842,7 @@ static int lxc_setup_console(const struct lxc_handler *handler,
...
@@ -1842,7 +1842,7 @@ static int lxc_setup_console(const struct lxc_handler *handler,
else
else
ret
=
lxc_terminal_set_stdfds
(
fd_pty
);
ret
=
lxc_terminal_set_stdfds
(
fd_pty
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
syserr
no
(
-
errno
,
"Failed to redirect std{in,out,err} to pty file descriptor %d"
,
fd_pty
);
return
syserr
or
(
"Failed to redirect std{in,out,err} to pty file descriptor %d"
,
fd_pty
);
}
}
return
ret
;
return
ret
;
...
...
src/lxc/confile.c
View file @
32d40452
...
@@ -1825,10 +1825,10 @@ static int set_config_cgroup_dir(const char *key, const char *value,
...
@@ -1825,10 +1825,10 @@ static int set_config_cgroup_dir(const char *key, const char *value,
return
clr_config_cgroup_dir
(
key
,
lxc_conf
,
NULL
);
return
clr_config_cgroup_dir
(
key
,
lxc_conf
,
NULL
);
if
(
abspath
(
value
))
if
(
abspath
(
value
))
return
syserr
no
_set
(
-
EINVAL
,
"%s paths may not be absolute"
,
key
);
return
syserr
or
_set
(
-
EINVAL
,
"%s paths may not be absolute"
,
key
);
if
(
dotdot
(
value
))
if
(
dotdot
(
value
))
return
syserr
no
_set
(
-
EINVAL
,
"%s paths may not walk upwards via
\"
../
\"
"
,
key
);
return
syserr
or
_set
(
-
EINVAL
,
"%s paths may not walk upwards via
\"
../
\"
"
,
key
);
return
set_config_path_item
(
&
lxc_conf
->
cgroup_meta
.
dir
,
value
);
return
set_config_path_item
(
&
lxc_conf
->
cgroup_meta
.
dir
,
value
);
}
}
...
@@ -1840,10 +1840,10 @@ static int set_config_cgroup_monitor_dir(const char *key, const char *value,
...
@@ -1840,10 +1840,10 @@ static int set_config_cgroup_monitor_dir(const char *key, const char *value,
return
clr_config_cgroup_monitor_dir
(
key
,
lxc_conf
,
NULL
);
return
clr_config_cgroup_monitor_dir
(
key
,
lxc_conf
,
NULL
);
if
(
abspath
(
value
))
if
(
abspath
(
value
))
return
syserr
no
_set
(
-
EINVAL
,
"%s paths may not be absolute"
,
key
);
return
syserr
or
_set
(
-
EINVAL
,
"%s paths may not be absolute"
,
key
);
if
(
dotdot
(
value
))
if
(
dotdot
(
value
))
return
syserr
no
_set
(
-
EINVAL
,
"%s paths may not walk upwards via
\"
../
\"
"
,
key
);
return
syserr
or
_set
(
-
EINVAL
,
"%s paths may not walk upwards via
\"
../
\"
"
,
key
);
return
set_config_path_item
(
&
lxc_conf
->
cgroup_meta
.
monitor_dir
,
value
);
return
set_config_path_item
(
&
lxc_conf
->
cgroup_meta
.
monitor_dir
,
value
);
}
}
...
@@ -1855,10 +1855,10 @@ static int set_config_cgroup_monitor_pivot_dir(const char *key, const char *valu
...
@@ -1855,10 +1855,10 @@ static int set_config_cgroup_monitor_pivot_dir(const char *key, const char *valu
return
clr_config_cgroup_monitor_pivot_dir
(
key
,
lxc_conf
,
NULL
);
return
clr_config_cgroup_monitor_pivot_dir
(
key
,
lxc_conf
,
NULL
);
if
(
abspath
(
value
))
if
(
abspath
(
value
))
return
syserr
no
_set
(
-
EINVAL
,
"%s paths may not be absolute"
,
key
);
return
syserr
or
_set
(
-
EINVAL
,
"%s paths may not be absolute"
,
key
);
if
(
dotdot
(
value
))
if
(
dotdot
(
value
))
return
syserr
no
_set
(
-
EINVAL
,
"%s paths may not walk upwards via
\"
../
\"
"
,
key
);
return
syserr
or
_set
(
-
EINVAL
,
"%s paths may not walk upwards via
\"
../
\"
"
,
key
);
return
set_config_path_item
(
&
lxc_conf
->
cgroup_meta
.
monitor_pivot_dir
,
value
);
return
set_config_path_item
(
&
lxc_conf
->
cgroup_meta
.
monitor_pivot_dir
,
value
);
}
}
...
@@ -1871,10 +1871,10 @@ static int set_config_cgroup_container_dir(const char *key, const char *value,
...
@@ -1871,10 +1871,10 @@ static int set_config_cgroup_container_dir(const char *key, const char *value,
return
clr_config_cgroup_container_dir
(
key
,
lxc_conf
,
NULL
);
return
clr_config_cgroup_container_dir
(
key
,
lxc_conf
,
NULL
);
if
(
abspath
(
value
))
if
(
abspath
(
value
))
return
syserr
no
_set
(
-
EINVAL
,
"%s paths may not be absolute"
,
key
);
return
syserr
or
_set
(
-
EINVAL
,
"%s paths may not be absolute"
,
key
);
if
(
dotdot
(
value
))
if
(
dotdot
(
value
))
return
syserr
no
_set
(
-
EINVAL
,
"%s paths may not walk upwards via
\"
../
\"
"
,
key
);
return
syserr
or
_set
(
-
EINVAL
,
"%s paths may not walk upwards via
\"
../
\"
"
,
key
);
return
set_config_path_item
(
&
lxc_conf
->
cgroup_meta
.
container_dir
,
value
);
return
set_config_path_item
(
&
lxc_conf
->
cgroup_meta
.
container_dir
,
value
);
}
}
...
@@ -1888,7 +1888,7 @@ static int set_config_cgroup_container_inner_dir(const char *key,
...
@@ -1888,7 +1888,7 @@ static int set_config_cgroup_container_inner_dir(const char *key,
return
clr_config_cgroup_container_inner_dir
(
key
,
lxc_conf
,
NULL
);
return
clr_config_cgroup_container_inner_dir
(
key
,
lxc_conf
,
NULL
);
if
(
abspath
(
value
))
if
(
abspath
(
value
))
return
syserr
no
_set
(
-
EINVAL
,
"%s paths may not be absolute"
,
key
);
return
syserr
or
_set
(
-
EINVAL
,
"%s paths may not be absolute"
,
key
);
if
(
strchr
(
value
,
'/'
)
||
strequal
(
value
,
"."
)
||
strequal
(
value
,
".."
))
if
(
strchr
(
value
,
'/'
)
||
strequal
(
value
,
"."
)
||
strequal
(
value
,
".."
))
return
log_error_errno
(
-
EINVAL
,
EINVAL
,
"lxc.cgroup.dir.container.inner must be a single directory name"
);
return
log_error_errno
(
-
EINVAL
,
EINVAL
,
"lxc.cgroup.dir.container.inner must be a single directory name"
);
...
...
src/lxc/confile_utils.c
View file @
32d40452
...
@@ -654,7 +654,7 @@ int set_config_path_item(char **conf_item, const char *value)
...
@@ -654,7 +654,7 @@ int set_config_path_item(char **conf_item, const char *value)
normalized
=
lxc_deslashify
(
value
);
normalized
=
lxc_deslashify
(
value
);
if
(
!
normalized
)
if
(
!
normalized
)
return
syserr
no
(
-
errno
,
"Failed to normalize path config item"
);
return
syserr
or_set
(
-
ENOMEM
,
"Failed to normalize path config item"
);
return
set_config_string_item_max
(
conf_item
,
normalized
,
PATH_MAX
);
return
set_config_string_item_max
(
conf_item
,
normalized
,
PATH_MAX
);
}
}
...
...
src/lxc/log.h
View file @
32d40452
...
@@ -494,142 +494,176 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo, \
...
@@ -494,142 +494,176 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo, \
__internal_ret__; \
__internal_ret__; \
})
})
#define
syserrno(__ret__, format, ...)
\
#define
log_error(__ret__, format, ...)
\
({ \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
SYSERROR(format, ##__VA_ARGS__);
\
ERROR(format, ##__VA_ARGS__);
\
__internal_ret__; \
__internal_ret__; \
})
})
#define
syswarn(__ret__, format, ...)
\
#define
log_trace_errno(__ret__, __errno__, format, ...)
\
({ \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
SYSWARN(format, ##__VA_ARGS__); \
errno = __errno__; \
SYSTRACE(format, ##__VA_ARGS__); \
__internal_ret__; \
__internal_ret__; \
})
})
#define
systrace(__ret__, format, ...)
\
#define
log_trace(__ret__, format, ...)
\
({ \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
SYSTRACE(format, ##__VA_ARGS__);
\
TRACE(format, ##__VA_ARGS__);
\
__internal_ret__; \
__internal_ret__; \
})
})
#define
sysinfo(__ret__, format, ...)
\
#define
log_warn_errno(__ret__, __errno__, format, ...)
\
({ \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
SYSINFO(format, ##__VA_ARGS__); \
errno = __errno__; \
SYSWARN(format, ##__VA_ARGS__); \
__internal_ret__; \
__internal_ret__; \
})
})
#define
syserrno_set(__ret__, format, ...)
\
#define
log_warn(__ret__, format, ...)
\
({ \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
errno = labs(__ret__); \
WARN(format, ##__VA_ARGS__); \
SYSERROR(format, ##__VA_ARGS__); \
__internal_ret__; \
__internal_ret__; \
})
})
#define
syswarn_set(__ret__, format, ...)
\
#define
log_debug_errno(__ret__, __errno__, format, ...)
\
({ \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
errno =
labs(__ret__);
\
errno =
__errno__;
\
SYS
WARN(format, ##__VA_ARGS__);
\
SYS
DEBUG(format, ##__VA_ARGS__);
\
__internal_ret__; \
__internal_ret__; \
})
})
#define syserror(format, ...) \
#define log_debug(__ret__, format, ...) \
({ \
({ \
SYSERROR(format, ##__VA_ARGS__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
(-errno); \
DEBUG(format, ##__VA_ARGS__); \
__internal_ret__; \
})
})
#define
syserror_set(__ret__, format, ...)
\
#define
log_info_errno(__ret__, __errno__, format, ...)
\
({ \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
errno =
labs(__ret__);
\
errno =
__errno__;
\
SYS
ERROR(format, ##__VA_ARGS__);
\
SYS
INFO(format, ##__VA_ARGS__);
\
__internal_ret__; \
__internal_ret__; \
})
})
#define sysdebug(format, ...) \
#define log_info(__ret__, format, ...) \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
INFO(format, ##__VA_ARGS__); \
__internal_ret__; \
})
/* These are the logging return helpers to be used. */
#define syserror(format, ...) \
({ \
({ \
SYS
DEBUG
(format, ##__VA_ARGS__); \
SYS
ERROR
(format, ##__VA_ARGS__); \
(-errno); \
(-errno); \
})
})
#define sys
debug
_set(__ret__, format, ...) \
#define sys
error
_set(__ret__, format, ...) \
({ \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
errno = labs(__ret__); \
errno = labs(__ret__); \
SYS
DEBUG
(format, ##__VA_ARGS__); \
SYS
ERROR
(format, ##__VA_ARGS__); \
__internal_ret__; \
__internal_ret__; \
})
})
#define
log_error(__ret__, format, ...)
\
#define
syserror_ret(__ret__, format, ...)
\
({ \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
ERROR(format, ##__VA_ARGS__);
\
SYSERROR(format, ##__VA_ARGS__);
\
__internal_ret__; \
__internal_ret__; \
})
})
#define log_trace_errno(__ret__, __errno__, format, ...) \
#define syswarn(format, ...) \
({ \
SYSWARN(format, ##__VA_ARGS__); \
(-errno); \
})
#define syswarn_set(__ret__, format, ...) \
({ \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
errno =
__errno__;
\
errno =
labs(__ret__);
\
SYS
TRACE(format, ##__VA_ARGS__);
\
SYS
WARN(format, ##__VA_ARGS__);
\
__internal_ret__; \
__internal_ret__; \
})
})
#define
log_trace(__ret__, format, ...)
\
#define
syswarn_ret(__ret__, format, ...)
\
({ \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
TRACE(format, ##__VA_ARGS__);
\
SYSWARN(format, ##__VA_ARGS__);
\
__internal_ret__; \
__internal_ret__; \
})
})
#define log_warn_errno(__ret__, __errno__, format, ...) \
#define sysinfo(format, ...) \
({ \
SYSINFO(format, ##__VA_ARGS__); \
(-errno); \
})
#define sysinfo_set(__ret__, format, ...) \
({ \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
errno =
__errno__;
\
errno =
labs(__ret__);
\
SYS
WARN(format, ##__VA_ARGS__);
\
SYS
INFO(format, ##__VA_ARGS__);
\
__internal_ret__; \
__internal_ret__; \
})
})
#define
log_warn(__ret__, format, ...)
\
#define
sysinfo_ret(__ret__, format, ...)
\
({ \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
WARN(format, ##__VA_ARGS__);
\
SYSINFO(format, ##__VA_ARGS__);
\
__internal_ret__; \
__internal_ret__; \
})
})
#define log_debug_errno(__ret__, __errno__, format, ...) \
#define sysdebug(format, ...) \
({ \
SYSDEBUG(format, ##__VA_ARGS__); \
(-errno); \
})
#define sysdebug_set(__ret__, format, ...) \
({ \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
errno =
__errno__;
\
errno =
labs(__ret__);
\
SYSDEBUG(format, ##__VA_ARGS__); \
SYSDEBUG(format, ##__VA_ARGS__); \
__internal_ret__; \
__internal_ret__; \
})
})
#define
log_debug(__ret__, format, ...)
\
#define
sysdebug_ret(__ret__, format, ...)
\
({ \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
DEBUG(format, ##__VA_ARGS__);
\
SYSDEBUG(format, ##__VA_ARGS__);
\
__internal_ret__; \
__internal_ret__; \
})
})
#define log_info_errno(__ret__, __errno__, format, ...) \
#define systrace(format, ...) \
({ \
SYSTRACE(format, ##__VA_ARGS__); \
(-errno); \
})
#define systrace_set(__ret__, format, ...) \
({ \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
errno =
__errno__;
\
errno =
labs(__ret__);
\
SYS
INFO(format, ##__VA_ARGS__);
\
SYS
TRACE(format, ##__VA_ARGS__);
\
__internal_ret__; \
__internal_ret__; \
})
})
#define
log_info(__ret__, format, ...)
\
#define
systrace_ret(__ret__, format, ...)
\
({ \
({ \
typeof(__ret__) __internal_ret__ = (__ret__); \
typeof(__ret__) __internal_ret__ = (__ret__); \
INFO(format, ##__VA_ARGS__);
\
SYSTRACE(format, ##__VA_ARGS__);
\
__internal_ret__; \
__internal_ret__; \
})
})
...
...
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