qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] df56cd: linux-user: Fix setreuid and setregid


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] df56cd: linux-user: Fix setreuid and setregid to use direc...
Date: Fri, 15 Nov 2024 21:27:42 +0000 (UTC)

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: df56cd31b4e820973fc050936193fb215b006798
      
https://github.com/qemu/qemu/commit/df56cd31b4e820973fc050936193fb215b006798
  Author: Helge Deller <deller@kernel.org>
  Date:   2024-11-14 (Thu, 14 Nov 2024)

  Changed paths:
    M linux-user/syscall.c

  Log Message:
  -----------
  linux-user: Fix setreuid and setregid to use direct syscalls

The commit fd6f7798ac30 ("linux-user: Use direct syscalls for setuid(),
etc") added direct syscall wrappers for setuid(), setgid(), etc since the
system calls have different semantics than the libc functions.

Add and use the corresponding wrappers for setreuid and setregid which
were missed in that commit.

This fixes the build of the debian package of the uid_wrapper library
(https://cwrap.org/uid_wrapper.html) when running linux-user.

Cc: qemu-stable@nongnu.org
Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-ID: <Zyo2jMKqq8hG8Pkz@p100>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: 4f7ead74a65e920e9ddc5cecada4c6c7078e0d7c
      
https://github.com/qemu/qemu/commit/4f7ead74a65e920e9ddc5cecada4c6c7078e0d7c
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-11-15 (Fri, 15 Nov 2024)

  Changed paths:
    M accel/tcg/user-exec.c

  Log Message:
  -----------
  accel/tcg: Fix user-only probe_access_internal plugin check

The acc_flag check for write should have been against PAGE_WRITE_ORG,
not PAGE_WRITE.  But it is better to combine two acc_flag checks
to a single check against access_type.  This matches the system code
in cputlb.c.

Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2647
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: 20241111145002.144995-1-richard.henderson@linaro.org
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>


  Commit: af63cb634c66fc4e50682fd413b51c6df16f315b
      
https://github.com/qemu/qemu/commit/af63cb634c66fc4e50682fd413b51c6df16f315b
  Author: Ilya Leoshkevich <iii@linux.ibm.com>
  Date:   2024-11-15 (Fri, 15 Nov 2024)

  Changed paths:
    M linux-user/elfload.c

  Log Message:
  -----------
  linux-user: Tolerate CONFIG_LSM_MMAP_MIN_ADDR

Running qemu-i386 on a system running with SELinux in enforcing mode
(more precisely: s390x trixie container on Fedora 40) fails with:

    qemu-i386: tests/tcg/i386-linux-user/sigreturn-sigmask: Unable to find a 
guest_base to satisfy all guest address mapping requirements
      00000000-ffffffff

The reason is that main() determines mmap_min_addr from
/proc/sys/vm/mmap_min_addr, but SELinux additionally defines
CONFIG_LSM_MMAP_MIN_ADDR, which is normally larger: 32K or 64K, but,
in general, can be anything. There is no portable way to query its
value: /boot/config, /proc/config and /proc/config.gz are distro- and
environment-specific.

Once the identity map fails, the magnitude of guest_base does not
matter, so fix by starting the search from 1M or 1G.

Cc: qemu-stable@nongnu.org
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2598
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-ID: <20241023002558.34589-1-iii@linux.ibm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: fc84d54a71435bdf4a7e903744d5c1263478d667
      
https://github.com/qemu/qemu/commit/fc84d54a71435bdf4a7e903744d5c1263478d667
  Author: Ilya Leoshkevich <iii@linux.ibm.com>
  Date:   2024-11-15 (Fri, 15 Nov 2024)

  Changed paths:
    M tests/tcg/multiarch/Makefile.target
    A tests/tcg/multiarch/sigreturn-sigmask.c

  Log Message:
  -----------
  tests/tcg: Test that sigreturn() does not corrupt the signal mask

Add a small test to prevent regressions.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-ID: <20241108145237.37377-2-iii@linux.ibm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: 6370dc94c3e47ef453f5441faca531a249a8dd75
      
https://github.com/qemu/qemu/commit/6370dc94c3e47ef453f5441faca531a249a8dd75
  Author: Pierrick Bouvier <pierrick.bouvier@linaro.org>
  Date:   2024-11-15 (Fri, 15 Nov 2024)

  Changed paths:
    M target/i386/tcg/sysemu/excp_helper.c

  Log Message:
  -----------
  target/i386: fix hang when using slow path for ptw_setl

When instrumenting memory accesses for plugin, we force memory accesses
to use the slow path for mmu [1]. This create a situation where we end
up calling ptw_setl_slow. This was fixed recently in [2] but the issue
still could appear out of plugins use case.

Since this function gets called during a cpu_exec, start_exclusive then
hangs. This exclusive section was introduced initially for security
reasons [3].

I suspect this code path was never triggered, because ptw_setl_slow
would always be called transitively from cpu_exec, resulting in a hang.

[1] 
https://gitlab.com/qemu-project/qemu/-/commit/6d03226b42247b68ab2f0b3663e0f624335a4055
[2] 
https://gitlab.com/qemu-project/qemu/-/commit/115ade42d50144c15b74368d32dc734ea277d853
[3] https://gitlab.com/qemu-project/qemu/-/issues/279

Fixes: https://gitlab.com/qemu-project/qemu/-/issues/2566
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20241025175857.2554252-2-pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: ce6faae7c0552b4e5821337b1549231cae891d1f
      
https://github.com/qemu/qemu/commit/ce6faae7c0552b4e5821337b1549231cae891d1f
  Author: Pierrick Bouvier <pierrick.bouvier@linaro.org>
  Date:   2024-11-15 (Fri, 15 Nov 2024)

  Changed paths:
    M cpu-common.c

  Log Message:
  -----------
  cpu: ensure we don't call start_exclusive from cpu_exec

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20241025175857.2554252-3-pierrick.bouvier@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: c8627958d609f8b06f4a8ed84c4fab448e3972e4
      
https://github.com/qemu/qemu/commit/c8627958d609f8b06f4a8ed84c4fab448e3972e4
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-11-15 (Fri, 15 Nov 2024)

  Changed paths:
    M linux-user/elfload.c

  Log Message:
  -----------
  linux-user: Honor elf alignment when placing images

Most binaries don't actually depend on more than page alignment,
but any binary can request it.  Not honoring this was a bug.

This became obvious when gdb reported

    Failed to read a valid object file image from memory

when examining some vdso which are marked as needing more
than page alignment.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: faa58bfbfd318476c6c3443e3492caec785e3a8e
      
https://github.com/qemu/qemu/commit/faa58bfbfd318476c6c3443e3492caec785e3a8e
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-11-15 (Fri, 15 Nov 2024)

  Changed paths:
    M linux-user/elfload.c
    M linux-user/qemu.h

  Log Message:
  -----------
  linux-user: Drop image_info.alignment

This field is write-only.  Use only the function-local
variable within load_elf_image.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: c9c247d084565d4c25e056a1b2d54b5d29aa4638
      
https://github.com/qemu/qemu/commit/c9c247d084565d4c25e056a1b2d54b5d29aa4638
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-11-15 (Fri, 15 Nov 2024)

  Changed paths:
    M linux-user/aarch64/Makefile.vdso
    M linux-user/aarch64/vdso-be.so
    M linux-user/aarch64/vdso-le.so

  Log Message:
  -----------
  linux-user/aarch64: Reduce vdso alignment to 4k

Reduce vdso alignment to minimum page size.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: 5c106718cad6fe05bf3593c4ebb2ad2cf5771192
      
https://github.com/qemu/qemu/commit/5c106718cad6fe05bf3593c4ebb2ad2cf5771192
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-11-15 (Fri, 15 Nov 2024)

  Changed paths:
    M linux-user/arm/Makefile.vdso
    M linux-user/arm/vdso-be.so
    M linux-user/arm/vdso-le.so

  Log Message:
  -----------
  linux-user/arm: Reduce vdso alignment to 4k

Reduce vdso alignment to minimum page size.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: 102c7c26124581b2bfb6cc15c57221b614dbff97
      
https://github.com/qemu/qemu/commit/102c7c26124581b2bfb6cc15c57221b614dbff97
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-11-15 (Fri, 15 Nov 2024)

  Changed paths:
    M linux-user/loongarch64/Makefile.vdso
    M linux-user/loongarch64/vdso.so

  Log Message:
  -----------
  linux-user/loongarch64: Reduce vdso alignment to 4k

Reduce vdso alignment to minimum page size.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: 6a0cc199bab2b75068a8388a7b6f3123ca4c27fe
      
https://github.com/qemu/qemu/commit/6a0cc199bab2b75068a8388a7b6f3123ca4c27fe
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-11-15 (Fri, 15 Nov 2024)

  Changed paths:
    M linux-user/ppc/Makefile.vdso
    M linux-user/ppc/vdso-32.so
    M linux-user/ppc/vdso-64.so
    M linux-user/ppc/vdso-64le.so

  Log Message:
  -----------
  linux-user/ppc: Reduce vdso alignment to 4k

Reduce vdso alignment to minimum page size.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: a2e360796bed0637ea9201f1417a421d71039e4d
      
https://github.com/qemu/qemu/commit/a2e360796bed0637ea9201f1417a421d71039e4d
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-11-15 (Fri, 15 Nov 2024)

  Changed paths:
    M linux-user/arm/Makefile.vdso
    M linux-user/arm/meson.build
    R linux-user/arm/vdso-be.so
    A linux-user/arm/vdso-be32.so
    A linux-user/arm/vdso-be8.so
    M linux-user/elfload.c

  Log Message:
  -----------
  linux-user/arm: Select vdso for be8 and be32 modes

In be8 mode, instructions are little-endian.
In be32 mode, instructions are big-endian.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2333
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: a020e0a807a6e34890d1f2ca02e49f814fd0b64f
      
https://github.com/qemu/qemu/commit/a020e0a807a6e34890d1f2ca02e49f814fd0b64f
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2024-11-15 (Fri, 15 Nov 2024)

  Changed paths:
    M tcg/tcg-op-gvec.c

  Log Message:
  -----------
  tcg: Allow top bit of SIMD_DATA_BITS to be set in simd_desc()

In simd_desc() we create a SIMD descriptor from various pieces
including an arbitrary data value from the caller.  We try to
sanitize these to make sure everything will fit: the 'data' value
needs to fit in the SIMD_DATA_BITS (== 22) sized field.  However we
do that sanitizing with:
   tcg_debug_assert(data == sextract32(data, 0, SIMD_DATA_BITS));

This works for the case where the data is supposed to be considered
as a signed integer (which can then be returned via simd_data()).
However, some callers want to treat the data value as unsigned.

Specifically, for the Arm SVE operations, make_svemte_desc()
assembles a data value as a collection of fields, and it needs to use
all 22 bits.  Currently if MTE is enabled then its MTEDESC SIZEM1
field may have the most significant bit set, and then it will trip
this assertion.

Loosen the assertion so that we only check that the data value will
fit into the field in some way, either as a signed or as an unsigned
value.  This means we will fail to detect some kinds of bug in the
callers, but we won't spuriously assert for intentional use of the
data field as unsigned.

Cc: qemu-stable@nongnu.org
Fixes: db432672dc50e ("tcg: Add generic vector expanders")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2601
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-ID: <20241115172515.1229393-1-peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: 47e5f2139fcb6d4594604abea0324f86d92ece80
      
https://github.com/qemu/qemu/commit/47e5f2139fcb6d4594604abea0324f86d92ece80
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2024-11-15 (Fri, 15 Nov 2024)

  Changed paths:
    M accel/tcg/user-exec.c
    M cpu-common.c
    M linux-user/aarch64/Makefile.vdso
    M linux-user/aarch64/vdso-be.so
    M linux-user/aarch64/vdso-le.so
    M linux-user/arm/Makefile.vdso
    M linux-user/arm/meson.build
    R linux-user/arm/vdso-be.so
    A linux-user/arm/vdso-be32.so
    A linux-user/arm/vdso-be8.so
    M linux-user/arm/vdso-le.so
    M linux-user/elfload.c
    M linux-user/loongarch64/Makefile.vdso
    M linux-user/loongarch64/vdso.so
    M linux-user/ppc/Makefile.vdso
    M linux-user/ppc/vdso-32.so
    M linux-user/ppc/vdso-64.so
    M linux-user/ppc/vdso-64le.so
    M linux-user/qemu.h
    M linux-user/syscall.c
    M target/i386/tcg/sysemu/excp_helper.c
    M tcg/tcg-op-gvec.c
    M tests/tcg/multiarch/Makefile.target
    A tests/tcg/multiarch/sigreturn-sigmask.c

  Log Message:
  -----------
  Merge tag 'pull-tcg-20241115' of https://gitlab.com/rth7680/qemu into staging

cpu: ensure we don't call start_exclusive from cpu_exec
tcg: Allow top bit of SIMD_DATA_BITS to be set in simd_desc()
accel/tcg: Fix user-only probe_access_internal plugin check
linux-user: Fix setreuid and setregid to use direct syscalls
linux-user: Tolerate CONFIG_LSM_MMAP_MIN_ADDR
linux-user: Honor elf alignment when placing images
linux-user/*: Reduce vdso alignment to 4k
linux-user/arm: Select vdso for be8 and be32 modes

# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmc3tb4dHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV+tBwf/SbP5aYQyy5UFmzyc
# Qbud+p9EXNuKr88206aq2RhkpAR5XhUWKs7RefDw7Ckg+e9zxWj0rTjsmJPfv+rD
# I5swoXkDvedXYvMqOJGia7scu3Vo1Jfo6DeJB24oERCFGlnbxVO+cu0f01b2bPyF
# 9tTwXV8Q7oChOmHJG/vjjCnPhTuHUDvjmKPL+8EMGWZfTGVdGc5PWdrZZGMsqPsK
# au3Ls72Ctf6XR1NeVAZ/WhP29diQLIijgIhhINd+iPYyRTjOF5P/u2oL+hhJgFfT
# Y2eWRBJQ0YErnDamhuzjm0S7HvIZM1N/M+y99mjR0VjPO9vL1pp8bFRCxnorYw3H
# J+IMCw==
# =sNp+
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 15 Nov 2024 20:57:34 GMT
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "richard.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" 
[full]
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* tag 'pull-tcg-20241115' of https://gitlab.com/rth7680/qemu:
  tcg: Allow top bit of SIMD_DATA_BITS to be set in simd_desc()
  linux-user/arm: Select vdso for be8 and be32 modes
  linux-user/ppc: Reduce vdso alignment to 4k
  linux-user/loongarch64: Reduce vdso alignment to 4k
  linux-user/arm: Reduce vdso alignment to 4k
  linux-user/aarch64: Reduce vdso alignment to 4k
  linux-user: Drop image_info.alignment
  linux-user: Honor elf alignment when placing images
  cpu: ensure we don't call start_exclusive from cpu_exec
  target/i386: fix hang when using slow path for ptw_setl
  tests/tcg: Test that sigreturn() does not corrupt the signal mask
  linux-user: Tolerate CONFIG_LSM_MMAP_MIN_ADDR
  accel/tcg: Fix user-only probe_access_internal plugin check
  linux-user: Fix setreuid and setregid to use direct syscalls

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


Compare: https://github.com/qemu/qemu/compare/818bbbc79e78...47e5f2139fcb

To unsubscribe from these emails, change your notification settings at 
https://github.com/qemu/qemu/settings/notifications



reply via email to

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