diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2022-09-15 09:05:13 +0000 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2022-09-27 13:07:37 +0200 |
| commit | 1856cdc9b3652a082c5bfa0e08a9f883baece8ec (patch) | |
| tree | b929711cc5e8da196a11dd85141f7d374b132eff /executor/common_linux.h | |
| parent | 87840e0023f7adfb7ff928a8a5057932ea9aeab9 (diff) | |
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.
Diffstat (limited to 'executor/common_linux.h')
| -rw-r--r-- | executor/common_linux.h | 23 |
1 files changed, 0 insertions, 23 deletions
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; |
