9pfs: assume utimensat() and futimens() are present
authorGreg Kurz <groug@kaod.org>
Thu, 25 May 2017 08:30:14 +0000 (10:30 +0200)
committerGreg Kurz <groug@kaod.org>
Thu, 25 May 2017 08:30:14 +0000 (10:30 +0200)
The utimensat() and futimens() syscalls have been around for ages (ie,
glibc 2.6 and linux 2.6.22), and the decision was already taken to
switch to utimensat() anyway when fixing CVE-2016-9602 in 2.9.

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
fsdev/virtfs-proxy-helper.c
hw/9pfs/9p-handle.c

index 4c4238f62e53157278f33436b77784e8b8ad98b4..6c066ec9a0cee9cf4b7567d1c70c81727098ec66 100644 (file)
@@ -945,7 +945,8 @@ static int process_requests(int sock)
                                      &spec[0].tv_sec, &spec[0].tv_nsec,
                                      &spec[1].tv_sec, &spec[1].tv_nsec);
             if (retval > 0) {
-                retval = qemu_utimens(path.data, spec);
+                retval = utimensat(AT_FDCWD, path.data, spec,
+                                   AT_SYMLINK_NOFOLLOW);
                 if (retval < 0) {
                     retval = -errno;
                 }
index 1687661bc95aeb7c583a35283d27e51572af50dc..9875f1894cc5ee2508784d8b4390d406e6c4c204 100644 (file)
@@ -378,7 +378,6 @@ static int handle_utimensat(FsContext *ctx, V9fsPath *fs_path,
                             const struct timespec *buf)
 {
     int ret;
-#ifdef CONFIG_UTIMENSAT
     int fd;
     struct handle_data *data = (struct handle_data *)ctx->private;
 
@@ -388,10 +387,6 @@ static int handle_utimensat(FsContext *ctx, V9fsPath *fs_path,
     }
     ret = futimens(fd, buf);
     close(fd);
-#else
-    ret = -1;
-    errno = ENOSYS;
-#endif
     return ret;
 }