qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 38138f: linux-user/mmap.c: handle invalid len


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 38138f: linux-user/mmap.c: handle invalid len maps correct...
Date: Tue, 31 Jul 2018 07:01:25 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 38138fab93584ad3560ddfcd70efbd5bb6b4a6f0
      
https://github.com/qemu/qemu/commit/38138fab93584ad3560ddfcd70efbd5bb6b4a6f0
  Author: Alex Bennée <address@hidden>
  Date:   2018-07-31 (Tue, 31 Jul 2018)

  Changed paths:
    M linux-user/mmap.c

  Log Message:
  -----------
  linux-user/mmap.c: handle invalid len maps correctly

I've slightly re-organised the check to more closely match the
sequence that the kernel uses in do_mmap(). We check for both the zero
case (EINVAL) and the overflow length case (ENOMEM).

Signed-off-by: Alex Bennée <address@hidden>
Cc: umarcor <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Laurent Vivier <address@hidden>


  Commit: 28cbb997d66e4d1904a231bef1ce15c2cbb6bf73
      
https://github.com/qemu/qemu/commit/28cbb997d66e4d1904a231bef1ce15c2cbb6bf73
  Author: Alex Bennée <address@hidden>
  Date:   2018-07-31 (Tue, 31 Jul 2018)

  Changed paths:
    M tests/tcg/multiarch/test-mmap.c

  Log Message:
  -----------
  tests: add check_invalid_maps to test-mmap

This adds a test to make sure we fail properly for a 0 length mmap.
There are most likely other failure conditions we should also check.

Signed-off-by: Alex Bennée <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Cc: umarcor <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Laurent Vivier <address@hidden>


  Commit: 5d9f3ea0817215ad4baac5aa30414e9ebbaaf0d6
      
https://github.com/qemu/qemu/commit/5d9f3ea0817215ad4baac5aa30414e9ebbaaf0d6
  Author: Shivaprasad G Bhat <address@hidden>
  Date:   2018-07-31 (Tue, 31 Jul 2018)

  Changed paths:
    M linux-user/host/ppc64/safe-syscall.inc.S

  Log Message:
  -----------
  linux-user: ppc64: don't use volatile register during safe_syscall

r11 is a volatile register on PPC as per calling conventions.
The safe_syscall code uses it to check if the signal_pending
is set during the safe_syscall. When a syscall is interrupted
on return from signal handling, the r11 might be corrupted
before we retry the syscall leading to a crash. The registers
r0-r13 are not to be used here as they have
volatile/designated/reserved usages.

Change the code to use r14 which is non-volatile.
Use SP+16 which is a slot for LR, for save/restore of previous value
of r14. SP+16 can be used, as LR is preserved across the syscall.

Steps to reproduce:
On PPC host, issue `qemu-x86_64 /usr/bin/cc -E -`
Attempt Ctrl-C, the issue is reproduced.

Reference:
https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#REG
https://openpowerfoundation.org/wp-content/uploads/2016/03/ABI64BitOpenPOWERv1.1_16July2015_pub4.pdf

Signed-off-by: Shivaprasad G Bhat <address@hidden>
Tested-by: Richard Henderson <address@hidden>
Tested-by: Laurent Vivier <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Reviewed-by: Laurent Vivier <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Laurent Vivier <address@hidden>


  Commit: 42e76456cf68dc828b8dbd3c7e255197e9b5e57d
      
https://github.com/qemu/qemu/commit/42e76456cf68dc828b8dbd3c7e255197e9b5e57d
  Author: Peter Maydell <address@hidden>
  Date:   2018-07-31 (Tue, 31 Jul 2018)

  Changed paths:
    M linux-user/host/ppc64/safe-syscall.inc.S
    M linux-user/mmap.c
    M tests/tcg/multiarch/test-mmap.c

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

Fix safe_syscall() on ppc64 host
Fix mmap() 0 length error case

# gpg: Signature made Tue 31 Jul 2018 09:41:07 BST
# gpg:                using RSA key F30C38BD3F2FBE3C
# gpg: Good signature from "Laurent Vivier <address@hidden>"
# gpg:                 aka "Laurent Vivier <address@hidden>"
# gpg:                 aka "Laurent Vivier (Red Hat) <address@hidden>"
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier2/tags/linux-user-for-3.0-pull-request:
  linux-user: ppc64: don't use volatile register during safe_syscall
  tests: add check_invalid_maps to test-mmap
  linux-user/mmap.c: handle invalid len maps correctly

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/45a505d0a4b3...42e76456cf68
      **NOTE:** This service has been marked for deprecation: 
https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.

reply via email to

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