diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-03-30 20:04:20 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-03-30 20:08:05 +0200 |
| commit | 8fbce0e4423f701145e111531f6f41cc02e086cf (patch) | |
| tree | 5843ecc545550778645e1b4e32a80b2e0000a196 /executor | |
| parent | 7c923cf8d45b650c4251503c11e74653779c74c4 (diff) | |
executor: fix compilation warnings
SYS_memfd_create define produces warning in scource
if system headers already contain the definition (we strip all ifdefs!).
The same is true for CLONE_NEWCGROUP but we just never hit it yet.
Also fix format string for 32 bits.
Also fix potential uninit var in csource, and a missing new line.
Diffstat (limited to 'executor')
| -rw-r--r-- | executor/common_linux.h | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h index dbe75f10f..ef4c5ce1a 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -814,18 +814,16 @@ struct fs_image_segment { #define IMAGE_MAX_SEGMENTS 4096 #define IMAGE_MAX_SIZE (32 << 20) -#ifndef SYS_memfd_create #if defined(__i386__) -#define SYS_memfd_create 356 +#define SYZ_memfd_create 356 #elif defined(__x86_64__) -#define SYS_memfd_create 319 +#define SYZ_memfd_create 319 #elif defined(__arm__) -#define SYS_memfd_create 385 +#define SYZ_memfd_create 385 #elif defined(__aarch64__) -#define SYS_memfd_create 279 +#define SYZ_memfd_create 279 #elif defined(__ppc64__) || defined(__PPC64__) || defined(__powerpc64__) -#define SYS_memfd_create 360 -#endif +#define SYZ_memfd_create 360 #endif //syz_mount_image(fs ptr[in, string[disk_filesystems]], dir ptr[in, filename], size intptr, nsegs len[segments], segments ptr[in, array[fs_image_segment]], flags flags[mount_flags], opts ptr[in, fs_options[vfat_options]]) @@ -858,7 +856,7 @@ static uintptr_t syz_mount_image(uintptr_t fs, uintptr_t dir, uintptr_t size, ui } if (size > IMAGE_MAX_SIZE) size = IMAGE_MAX_SIZE; - int memfd = syscall(SYS_memfd_create, "syz_mount_image", 0); + int memfd = syscall(SYZ_memfd_create, "syz_mount_image", 0); if (memfd == -1) { err = errno; goto error; @@ -869,7 +867,7 @@ static uintptr_t syz_mount_image(uintptr_t fs, uintptr_t dir, uintptr_t size, ui } for (i = 0; i < nsegs; i++) { if (pwrite(memfd, segs[i].data, segs[i].size, segs[i].offset) < 0) { - debug("syz_mount_image: pwrite[%lu] failed: %d\n", i, errno); + debug("syz_mount_image: pwrite[%u] failed: %d\n", (int)i, errno); } } snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid); @@ -1024,10 +1022,6 @@ static void sandbox_common() rlim.rlim_cur = rlim.rlim_max = 0; setrlimit(RLIMIT_CORE, &rlim); -#ifndef CLONE_NEWCGROUP -#define CLONE_NEWCGROUP 0x02000000 -#endif - // CLONE_NEWNS/NEWCGROUP cause EINVAL on some systems, // so we do them separately of clone in do_sandbox_namespace. if (unshare(CLONE_NEWNS)) { @@ -1036,7 +1030,7 @@ static void sandbox_common() if (unshare(CLONE_NEWIPC)) { debug("unshare(CLONE_NEWIPC): %d\n", errno); } - if (unshare(CLONE_NEWCGROUP)) { + if (unshare(0x02000000)) { debug("unshare(CLONE_NEWCGROUP): %d\n", errno); } if (unshare(CLONE_NEWUTS)) { |
