Unverified Commit 2be31fed by Stéphane Graber Committed by GitHub

Merge pull request #3695 from brauner/2021-02-24/fixes_3

commands: array hardening
parents 2ed90529 3d971319
......@@ -376,9 +376,9 @@ static inline int rsp_one_fd(int fd, int fd_send, struct lxc_cmd_rsp *rsp)
return LXC_CMD_REAP_CLIENT_FD;
}
static inline int rsp_many_fds(int fd, __u32 fds_len,
const __s32 fds[KERNEL_SCM_MAX_FD],
struct lxc_cmd_rsp *rsp)
__access_r(3, 2) static int rsp_many_fds(int fd, __u32 fds_len,
const __s32 fds[static 2],
struct lxc_cmd_rsp *rsp)
{
ssize_t ret;
......@@ -1280,7 +1280,7 @@ static int lxc_cmd_get_lxcpath_callback(int fd, struct lxc_cmd_req *req,
}
int lxc_cmd_add_state_client(const char *name, const char *lxcpath,
lxc_state_t states[MAX_STATE],
lxc_state_t states[static MAX_STATE],
int *state_client_fd)
{
__do_close int clientfd = -EBADF;
......
......@@ -112,8 +112,10 @@ __hidden extern int lxc_cmd_stop(const char *name, const char *lxcpath);
* via socket fd
* < MAX_STATE current container state
*/
__hidden extern int lxc_cmd_add_state_client(const char *name, const char *lxcpath,
lxc_state_t states[MAX_STATE], int *state_client_fd);
__hidden __access_r_nosize(3) extern int lxc_cmd_add_state_client(const char *name,
const char *lxcpath,
lxc_state_t states[static MAX_STATE],
int *state_client_fd);
__hidden extern int lxc_cmd_serve_state_clients(const char *name, const char *lxcpath,
lxc_state_t state);
......
......@@ -60,6 +60,7 @@
#define __cgfsng_ops
/* access attribute */
#define __access_r_nosize(x)
#define __access_r(x, y)
#define __access_w(x, y)
#define __access_rw(x, y)
......@@ -69,6 +70,9 @@
#undef __access_r
#define __access_r(x, y) __attribute__((access(read_only, x, y)))
#undef __access_r_nosize
#define __access_r_nosize(x) __attribute__((access(read_only, x)))
#undef __access_w
#define __access_w(x, y) __attribute__((access(write_only, x, y)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment