From 1856cdc9b3652a082c5bfa0e08a9f883baece8ec Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 15 Sep 2022 09:05:13 +0000 Subject: executor: move syz_mount_image's sanity checks to syz-fuzzer It will simplify the C code and let us extract the raw images in a more convenient way. --- executor/common_linux.h | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'executor') diff --git a/executor/common_linux.h b/executor/common_linux.h index d3f4b6ea1..e5587d1c7 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -2872,27 +2872,6 @@ struct fs_image_segment { uintptr_t offset; }; -#define IMAGE_MAX_SEGMENTS 4096 -#define IMAGE_MAX_SIZE (129 << 20) - -static unsigned long fs_image_segment_check(unsigned long size, unsigned long nsegs, struct fs_image_segment* segs) -{ - if (nsegs > IMAGE_MAX_SEGMENTS) - nsegs = IMAGE_MAX_SEGMENTS; - for (size_t i = 0; i < nsegs; i++) { - if (segs[i].size > IMAGE_MAX_SIZE) - segs[i].size = IMAGE_MAX_SIZE; - segs[i].offset %= IMAGE_MAX_SIZE; - if (segs[i].offset > IMAGE_MAX_SIZE - segs[i].size) - segs[i].offset = IMAGE_MAX_SIZE - segs[i].size; - if (size < segs[i].offset + segs[i].offset) - size = segs[i].offset + segs[i].offset; - } - if (size > IMAGE_MAX_SIZE) - size = IMAGE_MAX_SIZE; - return size; -} - // Setup the loop device needed for mounting a filesystem image. Takes care of // creating and initializing the underlying file backing the loop device and // returns the fds to the file and device. @@ -2900,8 +2879,6 @@ static unsigned long fs_image_segment_check(unsigned long size, unsigned long ns static int setup_loop_device(long unsigned size, long unsigned nsegs, struct fs_image_segment* segs, const char* loopname, int* memfd_p, int* loopfd_p) { int err = 0, loopfd = -1; - - size = fs_image_segment_check(size, nsegs, segs); int memfd = syscall(__NR_memfd_create, "syzkaller", 0); if (memfd == -1) { err = errno; -- cgit mrf-deployment