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
64a04c84
Unverified
Commit
64a04c84
authored
May 04, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: add personality_t
Catch errors in personality handling better. Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
7fd384d1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
7 deletions
+18
-7
attach.c
src/lxc/attach.c
+3
-3
conf.c
src/lxc/conf.c
+2
-2
conf.h
src/lxc/conf.h
+12
-1
confile.c
src/lxc/confile.c
+1
-1
No files found.
src/lxc/attach.c
View file @
64a04c84
...
...
@@ -95,7 +95,7 @@ struct attach_context {
uid_t
target_host_gid
;
char
*
lsm_label
;
struct
lxc_container
*
container
;
signed
long
personality
;
personality_t
personality
;
unsigned
long
long
capability_mask
;
int
ns_inherited
;
int
ns_fd
[
LXC_NS_MAX
];
...
...
@@ -197,7 +197,7 @@ static struct attach_context *alloc_attach_context(void)
}
static
int
get_personality
(
const
char
*
name
,
const
char
*
lxcpath
,
signed
long
*
personality
)
personality_t
*
personality
)
{
__do_free
char
*
p
=
NULL
;
int
ret
;
...
...
@@ -1153,7 +1153,7 @@ __noreturn static void do_attach(struct attach_payload *ap)
new_personality
=
options
->
personality
;
if
(
new_personality
!=
LXC_ARCH_UNCHANGED
)
{
ret
=
personality
(
new_personality
);
ret
=
lxc_
personality
(
new_personality
);
if
(
ret
<
0
)
goto
on_error
;
...
...
src/lxc/conf.c
View file @
64a04c84
...
...
@@ -1728,14 +1728,14 @@ static int lxc_setup_devpts_child(struct lxc_handler *handler)
return
0
;
}
static
int
setup_personality
(
signed
long
persona
)
static
int
setup_personality
(
personality_t
persona
)
{
int
ret
;
if
(
persona
==
LXC_ARCH_UNCHANGED
)
return
log_debug
(
0
,
"Retaining original personality"
);
ret
=
personality
(
persona
);
ret
=
lxc_
personality
(
persona
);
if
(
ret
<
0
)
return
syserror
(
"Failed to set personality to
\"
0lx%lx
\"
"
,
persona
);
...
...
src/lxc/conf.h
View file @
64a04c84
...
...
@@ -26,6 +26,7 @@
#include "start.h"
#include "storage/storage.h"
#include "string_utils.h"
#include "syscall_wrappers.h"
#include "terminal.h"
#if HAVE_SYS_RESOURCE_H
...
...
@@ -36,6 +37,8 @@
typedef
void
*
scmp_filter_ctx
;
#endif
typedef
signed
long
personality_t
;
/* worth moving to configure.ac? */
#define subuidfile "/etc/subuid"
#define subgidfile "/etc/subgid"
...
...
@@ -327,7 +330,7 @@ struct lxc_conf {
const
char
*
name
;
bool
is_execute
;
int
reboot
;
signed
long
personality
;
personality_t
personality
;
struct
utsname
*
utsname
;
struct
{
...
...
@@ -628,4 +631,12 @@ static inline void lxc_clear_cgroup2_devices(struct bpf_devices *bpf_devices)
lxc_list_init
(
&
bpf_devices
->
device_item
);
}
static
inline
int
lxc_personality
(
personality_t
persona
)
{
if
(
persona
<
0
)
return
ret_errno
(
EINVAL
);
return
personality
(
persona
);
}
#endif
/* __LXC_CONF_H */
src/lxc/confile.c
View file @
64a04c84
...
...
@@ -1389,7 +1389,7 @@ static int set_config_personality(const char *key, const char *value,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
int
ret
;
signed
long
personality
;
personality_t
personality
;
ret
=
lxc_config_parse_arch
(
value
,
&
personality
);
if
(
ret
<
0
)
...
...
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