return c->set_config_item(c, "lxc.no_new_privs", val);
}
-struct attach_clone_payload {
+struct attach_payload {
int ipc_socket;
int terminal_pts_fd;
lxc_attach_options_t *options;
void *exec_payload;
};
-static void lxc_put_attach_clone_payload(struct attach_clone_payload *p)
+static void put_attach_payload(struct attach_payload *p)
{
close_prot_errno_disarm(p->ipc_socket);
close_prot_errno_disarm(p->terminal_pts_fd);
}
}
-__noreturn static void do_attach(struct attach_clone_payload *payload)
+__noreturn static void do_attach(struct attach_payload *ap)
{
int lsm_fd, ret;
uid_t new_uid;
gid_t new_gid;
uid_t ns_root_uid = 0;
gid_t ns_root_gid = 0;
- lxc_attach_options_t* options = payload->options;
- struct attach_context *ctx = payload->ctx;
+ lxc_attach_options_t* options = ap->options;
+ struct attach_context *ctx = ap->ctx;
struct lxc_conf *conf = ctx->container->lxc_conf;
bool needs_lsm = (options->namespaces & CLONE_NEWNS) &&
(options->attach_flags & LXC_ATTACH_LSM) &&
* set{g,u}id().
*/
if (needs_lsm) {
- ret = lxc_abstract_unix_recv_fds(payload->ipc_socket, &lsm_fd, 1, NULL, 0);
+ ret = lxc_abstract_unix_recv_fds(ap->ipc_socket, &lsm_fd, 1, NULL, 0);
if (ret <= 0) {
if (ret < 0)
SYSERROR("Failed to receive lsm label fd");
TRACE("Loaded seccomp profile");
- ret = lxc_seccomp_send_notifier_fd(&conf->seccomp, payload->ipc_socket);
+ ret = lxc_seccomp_send_notifier_fd(&conf->seccomp, ap->ipc_socket);
if (ret < 0)
goto on_error;
}
- close_prot_errno_disarm(payload->ipc_socket);
+ close_prot_errno_disarm(ap->ipc_socket);
put_attach_context(ctx);
- payload->ctx = NULL;
+ ap->ctx = NULL;
/* The following is done after the communication socket is shut down.
* That way, all errors that might (though unlikely) occur up until this
}
if (options->attach_flags & LXC_ATTACH_TERMINAL) {
- ret = lxc_terminal_prepare_login(payload->terminal_pts_fd);
+ ret = lxc_terminal_prepare_login(ap->terminal_pts_fd);
if (ret < 0) {
- SYSERROR("Failed to prepare terminal file descriptor %d", payload->terminal_pts_fd);
+ SYSERROR("Failed to prepare terminal file descriptor %d", ap->terminal_pts_fd);
goto on_error;
}
- TRACE("Prepared terminal file descriptor %d", payload->terminal_pts_fd);
+ TRACE("Prepared terminal file descriptor %d", ap->terminal_pts_fd);
}
/* Avoid unnecessary syscalls. */
goto on_error;
/* We're done, so we can now do whatever the user intended us to do. */
- _exit(payload->exec_function(payload->exec_payload));
+ _exit(ap->exec_function(ap->exec_payload));
on_error:
- lxc_put_attach_clone_payload(payload);
+ put_attach_payload(ap);
ERROR("Failed to attach to container");
_exit(EXIT_FAILURE);
}
}
if (pid == 0) {
- struct attach_clone_payload payload = {
+ struct attach_payload ap = {
.ipc_socket = ipc_sockets[1],
.options = options,
.ctx = ctx,
}
/* Does not return. */
- do_attach(&payload);
+ do_attach(&ap);
}
if (options->attach_flags & LXC_ATTACH_TERMINAL)