diff options
author | Andrei Vagin <avagin@virtuozzo.com> | 2017-02-05 01:35:49 +0300 |
---|---|---|
committer | Pavel Emelyanov <xemul@virtuozzo.com> | 2017-02-06 13:29:55 +0300 |
commit | a6ae38f71b6561b7c9c4a16032250b2da2d041b8 (patch) | |
tree | da1a064985dab11fc55ce07bb61c5def3a153417 /include | |
parent | 0367a1f6fec5a8d1ee2fb4cfa3004591a5510d1a (diff) |
util: zero msghdr structures
musl-libc fixed inconsistency between posix and kernl msghdr structures
by adding pad-s.
It initializes all pad-s before calling recvmsg and sendmsg syscalls.
CRIU calls raw system calls from pie code, so we need to intialize pads too.
In addition, we don't initialize msg_flags and iov_len.
https://github.com/xemul/criu/issues/276
https://travis-ci.org/kolyshkin/criu/builds/198415449
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/common/scm-code.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/common/scm-code.c b/include/common/scm-code.c index 3a88cb46d..351c405b9 100644 --- a/include/common/scm-code.c +++ b/include/common/scm-code.c @@ -50,7 +50,8 @@ static int *scm_fdset_init(struct scm_fdset *fdset, struct sockaddr_un *saddr, int send_fds(int sock, struct sockaddr_un *saddr, int len, int *fds, int nr_fds, void *data, unsigned ch_size) { - struct scm_fdset fdset; + /* In musl_libc the msghdr structure has pads which has to be zeroed */ + struct scm_fdset fdset = {}; int *cmsg_data; int i, min_fd, ret; @@ -73,7 +74,8 @@ int send_fds(int sock, struct sockaddr_un *saddr, int len, int __recv_fds(int sock, int *fds, int nr_fds, void *data, unsigned ch_size, int flags) { - struct scm_fdset fdset; + /* In musl_libc the msghdr structure has pads which has to be zeroed */ + struct scm_fdset fdset = {}; struct cmsghdr *cmsg; int *cmsg_data; int ret; |