qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 664441: linux-user: Fix "print_fdset()" in "s


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 664441: linux-user: Fix "print_fdset()" in "strace.c" to n...
Date: Sun, 23 Aug 2020 10:00:24 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 664441ea0111ef4dc68510d87b89b983ef838500
      
https://github.com/qemu/qemu/commit/664441ea0111ef4dc68510d87b89b983ef838500
  Author: Filip Bozuta <Filip.Bozuta@syrmia.com>
  Date:   2020-08-23 (Sun, 23 Aug 2020)

  Changed paths:
    M linux-user/strace.c

  Log Message:
  -----------
  linux-user: Fix "print_fdset()" in "strace.c" to not print ", " after last 
value

Function "print_fdset()" in "strace.c" is used to print the file descriptor
values in "print__newselect()" which prints arguments of syscall _newselect().
Until changes from this patch, this function was printing "," even after the
last value of the fd_set argument. This was changed in this patch by removing
this unnecessary "," after the last fd value and thus improving the estetics of
the _newselect() "-strace" print.

Implementation notes:

   The printing fix was made possible by using an existing function 
"get_comma()"
   which returns a "," or an empty string "" based on its argument (0 for "," 
and
   other for "").

Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200702160915.9517-1-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: 9dba3ca5af80a7d4b5269685ceaa27ca04199cf4
      
https://github.com/qemu/qemu/commit/9dba3ca5af80a7d4b5269685ceaa27ca04199cf4
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2020-08-23 (Sun, 23 Aug 2020)

  Changed paths:
    M linux-user/mmap.c

  Log Message:
  -----------
  linux-user: Validate mmap/mprotect prot value

The kernel will return -EINVAL for bits set in the prot argument
that are unknown or invalid.  Previously we were simply cropping
out the bits that we care about.

Introduce validate_prot_to_pageflags to perform this check in a
single place between the two syscalls.  Differentiate between
the target and host versions of prot.  Compute the qemu internal
page_flags value at the same time.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200519185645.3915-2-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: 4eaa960dbcd3fbd51047eacbbc20a9882a0eca63
      
https://github.com/qemu/qemu/commit/4eaa960dbcd3fbd51047eacbbc20a9882a0eca63
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2020-08-23 (Sun, 23 Aug 2020)

  Changed paths:
    M linux-user/mmap.c

  Log Message:
  -----------
  linux-user: Adjust guest page protection for the host

Executable guest pages are never directly executed by
the host, but do need to be readable for translation.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20200519185645.3915-3-richard.henderson@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: 2c86c90fe802502893e1f5a2462f58a0b05e9274
      
https://github.com/qemu/qemu/commit/2c86c90fe802502893e1f5a2462f58a0b05e9274
  Author: Filip Bozuta <Filip.Bozuta@syrmia.com>
  Date:   2020-08-23 (Sun, 23 Aug 2020)

  Changed paths:
    M linux-user/syscall.c

  Log Message:
  -----------
  linux-user: Modify 'target_to_host/host_to_target_itimerspec()'

Functions 'target_to_host_itimerspec()' and 'host_to_target_itimerspec()'
are used to convert values of type 'struct itimerspec' between target and
host. This type has 'struct timespec' as its fields. That is the reason
why this patch introduces a little modification to the converting functions
to be implemented using already existing functions that convert 'struct 
timespec':
'target_to_host_timespec()' and 'host_to_target_timespec()'. This makes the
code of 'target_to_host_itimerspec()' and 'host_to_target_itimerspec()' more
clean and readable.

Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200722153421.295411-2-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: 828cb3a1a89e3ed4b1284c085eeabff39313ddfc
      
https://github.com/qemu/qemu/commit/828cb3a1a89e3ed4b1284c085eeabff39313ddfc
  Author: Filip Bozuta <Filip.Bozuta@syrmia.com>
  Date:   2020-08-23 (Sun, 23 Aug 2020)

  Changed paths:
    M linux-user/syscall.c
    M linux-user/syscall_defs.h

  Log Message:
  -----------
  linux-user: Add support for a group of 2038 safe syscalls

This patch implements functionality for following time64 syscalls:

*clock_getres_time64

     This a year 2038 safe variant of syscall:

     int clock_getres(clockid_t clockid, struct timespec *res)
     --finding the resoultion of a specified clock--
     man page: https://man7.org/linux/man-pages/man2/clock_getres.2.html

*timer_gettime64
*timer_settime64

     These are year 2038 safe variants of syscalls:

     int timer_settime(timer_t timerid, int flags,
                       const struct itimerspec *new_value,
                       struct itimerspec *old_value)
     int timer_gettime(timer_t timerid, struct itimerspec *curr_value)
     --arming/dissarming and fetching state of POSIX per-process timer--
     man page: https://man7.org/linux/man-pages/man2/timer_settime.2.html

*timerfd_gettime64
*timerfd_settime64

     These are year 2038 safe variants of syscalls:

     int timerfd_settime(int fd, int flags,
                         const struct itimerspec *new_value,
                         struct itimerspec *old_value)
     int timerfd_gettime(int fd, struct itimerspec *curr_value)
     --timers that notify via file descriptor--
     man page: https://man7.org/linux/man-pages/man2/timerfd_settime.2.html

Implementation notes:

     Syscall 'clock_getres_time64' was implemented similarly to 
'clock_getres()'.
     The only difference was that for the conversion of 'struct timespec' from
     host to target, function 'host_to_target_timespec64()' was used instead of
     'host_to_target_timespec()'.

     For other syscalls, new functions 'host_to_target_itimerspec64()' and
     'target_to_host_itimerspec64()' were added to convert the value of the
     'struct itimerspec' from host to target and vice versa. A new type
     'struct target__kernel_itimerspec' was added in 'syscall_defs.h'. This
     type was defined with fields which are of the already defined type
     'struct target_timespec'. This new 'struct target__kernel_itimerspec'
     type is used in these new converting functions. These new functions were
     defined similarly to 'host_to_target_itimerspec()' and 
'target_to_host_itimerspec()'
     the only difference being that 'target_to_host_timespec64()' and
     'host_to_target_timespec64()' were used.

Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200722153421.295411-3-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: b3a3af70c377a3e67d43f3be39a333228487b50c
      
https://github.com/qemu/qemu/commit/b3a3af70c377a3e67d43f3be39a333228487b50c
  Author: Filip Bozuta <Filip.Bozuta@syrmia.com>
  Date:   2020-08-23 (Sun, 23 Aug 2020)

  Changed paths:
    M linux-user/syscall.c

  Log Message:
  -----------
  linux-user: Fix 'utimensat()' implementation

Implementation of syscall 'utimensat()' in 'syscall.c' uses functions
target_to_host/host_to_target_timespec() to convert values of
'struct timespec' between host and target. However, the implementation
doesn't check whether the conversion succeeds and thus can cause an
inappropriate error or succeed unappropriately instead of setting errno
EFAULT ('Bad address') which is supposed to be set in these cases.

This was confirmed with the LTP test for utimensat ('testcases/utimensat')
which fails for test cases when the errno EFAULT is expected. After changes
from this patch, the test passes for all test cases.

Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200811113101.6636-1-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>


  Commit: 8367a77c4d3f6e1e60890f5510304feb2c621611
      
https://github.com/qemu/qemu/commit/8367a77c4d3f6e1e60890f5510304feb2c621611
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2020-08-23 (Sun, 23 Aug 2020)

  Changed paths:
    M linux-user/mmap.c
    M linux-user/strace.c
    M linux-user/syscall.c
    M linux-user/syscall_defs.h

  Log Message:
  -----------
  Merge remote-tracking branch 
'remotes/vivier2/tags/linux-user-for-5.2-pull-request' into staging

Add clock_getres_time64, timer_gettime64, timer_settime64,
    timerfd_gettime64, timerfd_settime64
Some fixes (page protection, print_fdset, timerspec, itimerspec)

# gpg: Signature made Sun 23 Aug 2020 15:58:53 BST
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" 
[full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/linux-user-for-5.2-pull-request:
  linux-user: Fix 'utimensat()' implementation
  linux-user: Add support for a group of 2038 safe syscalls
  linux-user: Modify 'target_to_host/host_to_target_itimerspec()'
  linux-user: Adjust guest page protection for the host
  linux-user: Validate mmap/mprotect prot value
  linux-user: Fix "print_fdset()" in "strace.c" to not print ", " after last 
value

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/152be6de9100...8367a77c4d3f



reply via email to

[Prev in Thread] Current Thread [Next in Thread]