qemu-commits
[Top][All Lists]
Advanced

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

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


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 849102: linux-user: Fix setreuid and setregid to use direc...
Date: Sat, 16 Nov 2024 10:17:23 -0800

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 8491026a08b417b2d4070f7c373dcb43134c5312
      
https://github.com/qemu/qemu/commit/8491026a08b417b2d4070f7c373dcb43134c5312
  Author: Helge Deller <deller@kernel.org>
  Date:   2024-11-16 (Sat, 16 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: f27550804688da43c6e0d87b2f9e143adbf76271
      
https://github.com/qemu/qemu/commit/f27550804688da43c6e0d87b2f9e143adbf76271
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-11-16 (Sat, 16 Nov 2024)

  Changed paths:
    M target/arm/tcg/sve_helper.c

  Log Message:
  -----------
  target/arm: Drop user-only special case in sve_stN_r

This path is reachable with plugins enabled, and provoked
with run-plugin-catch-syscalls-with-libinline.so.

Cc: qemu-stable@nongnu.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20241112141232.321354-1-richard.henderson@linaro.org>


  Commit: 2a339fee450638b512c5122281cb5ab49331cfb8
      
https://github.com/qemu/qemu/commit/2a339fee450638b512c5122281cb5ab49331cfb8
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-11-16 (Sat, 16 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: fb7f3572b111ffb6c2dd2c7f6c5b4dc57dd8a3f5
      
https://github.com/qemu/qemu/commit/fb7f3572b111ffb6c2dd2c7f6c5b4dc57dd8a3f5
  Author: Ilya Leoshkevich <iii@linux.ibm.com>
  Date:   2024-11-16 (Sat, 16 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: ef7e76a2cdc116719ad9c67d4f44dee0016f923c
      
https://github.com/qemu/qemu/commit/ef7e76a2cdc116719ad9c67d4f44dee0016f923c
  Author: Ilya Leoshkevich <iii@linux.ibm.com>
  Date:   2024-11-16 (Sat, 16 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: 7ba055b49b74c4d2f4a338c5198485bdff373fb1
      
https://github.com/qemu/qemu/commit/7ba055b49b74c4d2f4a338c5198485bdff373fb1
  Author: Pierrick Bouvier <pierrick.bouvier@linaro.org>
  Date:   2024-11-16 (Sat, 16 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: 779f30a01af8566780cefc8639505b758950afb3
      
https://github.com/qemu/qemu/commit/779f30a01af8566780cefc8639505b758950afb3
  Author: Pierrick Bouvier <pierrick.bouvier@linaro.org>
  Date:   2024-11-16 (Sat, 16 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: c81d1fafa6233448bcc2d8fcd2ba63a4ae834f3a
      
https://github.com/qemu/qemu/commit/c81d1fafa6233448bcc2d8fcd2ba63a4ae834f3a
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-11-16 (Sat, 16 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: dff406754efdb13f401e2b39f869541286903619
      
https://github.com/qemu/qemu/commit/dff406754efdb13f401e2b39f869541286903619
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-11-16 (Sat, 16 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: f19ec28ddc383143573e828d34f190cdda7e9669
      
https://github.com/qemu/qemu/commit/f19ec28ddc383143573e828d34f190cdda7e9669
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-11-16 (Sat, 16 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: f7150b2151398c9274686d06c2c1e24618aa4cd6
      
https://github.com/qemu/qemu/commit/f7150b2151398c9274686d06c2c1e24618aa4cd6
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-11-16 (Sat, 16 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: 399c8082ca0d410a84b8367a8569cee48f1440dd
      
https://github.com/qemu/qemu/commit/399c8082ca0d410a84b8367a8569cee48f1440dd
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-11-16 (Sat, 16 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: 180692a1a15319ed71eda3346f706f6ec4bccbc0
      
https://github.com/qemu/qemu/commit/180692a1a15319ed71eda3346f706f6ec4bccbc0
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-11-16 (Sat, 16 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: 95c9e2209cc09453cfd49e91321df254ccbf466f
      
https://github.com/qemu/qemu/commit/95c9e2209cc09453cfd49e91321df254ccbf466f
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2024-11-16 (Sat, 16 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: 8377e3fb854d126ba10e61cb6b60885af8443ad4
      
https://github.com/qemu/qemu/commit/8377e3fb854d126ba10e61cb6b60885af8443ad4
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2024-11-16 (Sat, 16 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: abb1565d3d863cf210f18f70c4a42b0f39b8ccdb
      
https://github.com/qemu/qemu/commit/abb1565d3d863cf210f18f70c4a42b0f39b8ccdb
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2024-11-16 (Sat, 16 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/arm/tcg/sve_helper.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-20241116' 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+IV8FAmc4z/8dHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV/vWgf5Af8105enuWEdJ9c+
# KiyTsOWQEOKXTUSlSUxPs9FEeEr2l/mccvqUhiD7ptZq7P5/40+3tB18KXc5YuiE
# 45CZGRAr/tjALGT5LidSYzm6RgljWXYlvWVShqKlQpOD2L0GP5k8a7KEKsT3SLtS
# 9l+SVvjNOE+Jv23FWSOVYq0K0e5dPKzS1gtviCg+obA56dsiSKiEwwg+a5ca6oRe
# 9SUKoRnudpUv3fiYo8yZaHPW0ADhsITAB20ncN+cI9t4li9q5AWUbPZ+ADP113+2
# pWlco1VqR4pONK2UgbSmxDtjQf1GBi7E2MBFBjBMxTaiw/jXAZcZGIK4geZYKdHT
# NJj/0Q==
# =oKCm
# -----END PGP SIGNATURE-----
# gpg: Signature made Sat 16 Nov 2024 17:01:51 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-20241116' 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
  target/arm: Drop user-only special case in sve_stN_r
  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/47e5f2139fcb...abb1565d3d86

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]