diff options
Diffstat (limited to 'executor/common_linux.h')
| -rw-r--r-- | executor/common_linux.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h index d7e3726a3..4c525760a 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -2860,13 +2860,13 @@ error_clear_loop: #include <string.h> #include <sys/mount.h> -// 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]]) fd_dir +// 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]], chdir bool8) fd_dir // fs_image_segment { // data ptr[in, array[int8]] // size len[data, intptr] // offset intptr // } -static long syz_mount_image(volatile long fsarg, volatile long dir, volatile unsigned long size, volatile unsigned long nsegs, volatile long segments, volatile long flags, volatile long optsarg) +static long syz_mount_image(volatile long fsarg, volatile long dir, volatile unsigned long size, volatile unsigned long nsegs, volatile long segments, volatile long flags, volatile long optsarg, volatile long change_dir) { struct fs_image_segment* segs = (struct fs_image_segment*)segments; int res = -1, err = 0, loopfd = -1, memfd = -1, need_loop_device = !!segs; @@ -2920,6 +2920,14 @@ static long syz_mount_image(volatile long fsarg, volatile long dir, volatile uns if (res == -1) { debug("syz_mount_image > open error: %d\n", errno); err = errno; + goto error_clear_loop; + } + if (change_dir) { + res = chdir(target); + if (res == -1) { + debug("syz_mount_image > chdir error: %d\n", errno); + err = errno; + } } error_clear_loop: |
