From 3c7ee3c11cfff4f87713c37ae4bfa69f719744b7 Mon Sep 17 00:00:00 2001 From: purplerain Date: Sun, 3 Mar 2024 22:28:10 +0000 Subject: [PATCH] sync with OpenBSD -current --- etc/root/root.mail | 2 +- .../lib/Target/PowerPC/PPCFrameLowering.cpp | 6 --- regress/lib/libm/msun/Makefile | 13 ++++- regress/usr.bin/openssl/appstest.sh | 8 +++- sys/arch/armv7/stand/efiboot/conf.c | 4 +- sys/arch/armv7/stand/efiboot/exec.c | 46 +++++++++++++++++- usr.bin/mktemp/mktemp.1 | 48 +++++++++---------- 7 files changed, 90 insertions(+), 37 deletions(-) diff --git a/etc/root/root.mail b/etc/root/root.mail index 63637435e..f07dfb044 100644 --- a/etc/root/root.mail +++ b/etc/root/root.mail @@ -1,4 +1,4 @@ -From purplerain@secbsd.org Sat Apr 20 00:00:00 UTC 2024 +From purplerain@secbsd.org Wed Apr 20 00:00:00 UTC 2024 Return-Path: root Date: Apr 20 00:00:00 UTC 2024 From: purplerain@secbsd.org (Purple Rain) diff --git a/gnu/llvm/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp b/gnu/llvm/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp index bb6a46b50..7e547789b 100644 --- a/gnu/llvm/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp +++ b/gnu/llvm/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp @@ -1193,12 +1193,6 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF, if ((Reg == PPC::X2 || Reg == PPC::R2) && MustSaveTOC) continue; - // For SVR4, don't emit a move for the CR spill slot if we haven't - // spilled CRs. - if (isSVR4ABI && (PPC::CR2 <= Reg && Reg <= PPC::CR4) - && !MustSaveCR) - continue; - // For 64-bit SVR4 when we have spilled CRs, the spill location // is SP+8, not a frame-relative slot. if (isSVR4ABI && isPPC64 && (PPC::CR2 <= Reg && Reg <= PPC::CR4)) { diff --git a/regress/lib/libm/msun/Makefile b/regress/lib/libm/msun/Makefile index 1405ad8c4..45c3f0dc3 100644 --- a/regress/lib/libm/msun/Makefile +++ b/regress/lib/libm/msun/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.14 2023/10/02 16:11:09 bluhm Exp $ +# $OpenBSD: Makefile,v 1.15 2024/03/03 11:15:38 miod Exp $ # Copyright (c) 2021 Moritz Buhl # @@ -87,6 +87,17 @@ FAILING+= run-logarithm_test-3 FAILING+= run-lrint_test-1 FAILING+= run-nearbyint_test-1 FAILING+= run-next_test-{1,2,4} +. elif ${MACHINE_ARCH} == m88k +FAILING+= run-cexp_test-7 +FAILING+= run-ctrig_test-{1,5} +FAILING+= run-exponential_test-1 +FAILING+= run-fma_test-{1,3,6} +FAILING+= run-fmaxmin_test-{1,12} +FAILING+= run-invtrig_test-7 +FAILING+= run-logarithm_test-3 +FAILING+= run-lrint_test-1 +FAILING+= run-nearbyint_test-1 +FAILING+= run-next_test-4 . elif ${MACHINE} == powerpc64 FAILING+= run-cexp_test-7 FAILING+= run-ctrig_test-{1,5} diff --git a/regress/usr.bin/openssl/appstest.sh b/regress/usr.bin/openssl/appstest.sh index 26ba92004..84004df94 100755 --- a/regress/usr.bin/openssl/appstest.sh +++ b/regress/usr.bin/openssl/appstest.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $OpenBSD: appstest.sh,v 1.62 2024/03/02 11:53:55 tb Exp $ +# $OpenBSD: appstest.sh,v 1.63 2024/03/03 13:29:19 tb Exp $ # # Copyright (c) 2016 Kinichiro Inoguchi # @@ -1747,6 +1747,12 @@ function test_server_client { test_sc_verify $sc tls1_2 test_sc_verify $sc tls1_3 + # s_time + start_message "s_time ... connect to TLS/SSL test server" + $c_bin s_time -connect $host:$port -CApath $ca_dir -time 1 \ + > $server_dir/s_time_${sc}.log + check_exit_status $? + stop_s_server } diff --git a/sys/arch/armv7/stand/efiboot/conf.c b/sys/arch/armv7/stand/efiboot/conf.c index 78a416f81..e7ffa3d7a 100644 --- a/sys/arch/armv7/stand/efiboot/conf.c +++ b/sys/arch/armv7/stand/efiboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.33 2022/12/22 15:44:02 kettenis Exp $ */ +/* $OpenBSD: conf.c,v 1.34 2024/03/03 17:00:14 kettenis Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -42,7 +42,7 @@ #include "efidev.h" #include "efipxe.h" -const char version[] = "1.20"; +const char version[] = "1.21"; int debug = 0; struct fs_ops file_system[] = { diff --git a/sys/arch/armv7/stand/efiboot/exec.c b/sys/arch/armv7/stand/efiboot/exec.c index d8ae40082..4cd1f89be 100644 --- a/sys/arch/armv7/stand/efiboot/exec.c +++ b/sys/arch/armv7/stand/efiboot/exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.c,v 1.16 2020/05/17 14:32:12 kettenis Exp $ */ +/* $OpenBSD: exec.c,v 1.17 2024/03/03 17:00:14 kettenis Exp $ */ /* * Copyright (c) 2006, 2016 Mark Kettenis @@ -86,6 +86,47 @@ dcache_wbinv_all(void) __asm volatile("dsb"); } +void +dcache_inv_all(void) +{ + uint32_t clidr; + uint32_t ccsidr; + uint32_t val; + int nways, nsets; + int wshift, sshift; + int way, set; + int level; + + __asm volatile("mrc p15, 1, %0, c0, c0, 1" : "=r"(clidr)); + for (level = 0; level < CLIDR_LOC(clidr); level++) { + if (CLIDR_CTYPE(clidr, level) == CLIDR_CTYPE_NOCACHE) + break; + if (CLIDR_CTYPE(clidr, level) == CLIDR_CTYPE_ICACHE) + continue; + + __asm volatile("mcr p15, 2, %0, c0, c0, 0" :: "r"(level << 1)); + __asm volatile("isb"); + __asm volatile("mrc p15, 1, %0, c0, c0, 0" : "=r"(ccsidr)); + + nways = CCSIDR_ASSOCIATIVITY(ccsidr) + 1; + nsets = CCSIDR_NUMSETS(ccsidr) + 1; + + sshift = CCSIDR_LINESZ(ccsidr) + 4; + wshift = __builtin_clz(CCSIDR_ASSOCIATIVITY(ccsidr)); + + for (way = 0; way < nways; way++) { + for (set = 0; set < nsets; set++) { + val = (way << wshift) | (set << sshift) | + (level << 1); + __asm volatile("mcr p15, 0, %0, c7, c6, 2" + :: "r"(val)); + } + } + } + + __asm volatile("dsb"); +} + void icache_inv_all(void) { @@ -182,8 +223,9 @@ run_loadfile(uint64_t *marks, int howto) efi_cleanup(); - dcache_disable(); dcache_wbinv_all(); + dcache_disable(); + dcache_inv_all(); icache_disable(); icache_inv_all(); mmu_disable(); diff --git a/usr.bin/mktemp/mktemp.1 b/usr.bin/mktemp/mktemp.1 index e5095b5d2..f542c882b 100644 --- a/usr.bin/mktemp/mktemp.1 +++ b/usr.bin/mktemp/mktemp.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mktemp.1,v 1.33 2024/03/01 23:37:42 millert Exp $ +.\" $OpenBSD: mktemp.1,v 1.34 2024/03/03 15:24:45 millert Exp $ .\" .\" Copyright (c) 1996, 2000, 2001, 2003, 2010, 2013, 2024 .\" Todd C. Miller @@ -15,12 +15,12 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: March 1 2024 $ +.Dd $Mdocdate: March 3 2024 $ .Dt MKTEMP 1 .Os .Sh NAME .Nm mktemp -.Nd make temporary filename (unique) +.Nd make temporary file or directory (unique) .Sh SYNOPSIS .Nm mktemp .Op Fl dqtu @@ -29,14 +29,14 @@ .Sh DESCRIPTION The .Nm mktemp -utility takes the given filename +utility takes the specified file name .Ar template -and overwrites a portion of it to create a unique filename. +and overwrites a portion of it to create a unique file name. The .Ar template -may be any filename with at least six +may be any file name containing at least six .Ql X Ns s -in the last component of the filename, for example +in the last component of the path, for example .Pa /tmp/tfile.XXXXXXXXXX or .Pa /tmp/editor.XXXXXXXXXX.txt . @@ -47,7 +47,7 @@ in the only the last one will be considered. If no .Ar template -is specified, a default of +is specified, a default value of .Pa tmp.XXXXXXXXXX is used and the .Fl t @@ -60,8 +60,8 @@ The name chosen depends both on the number of .Ql X Ns s in the .Ar template -and the number of collisions with pre-existing files. -The number of unique filenames +and the number of collisions with pre-existing entries. +The number of unique names .Nm can return depends on the number of .Ql X Ns s @@ -74,19 +74,19 @@ testing roughly 26 ** 10 combinations. .Pp If .Nm -can successfully generate a unique filename, the file (or directory) -is created with file permissions such that it is only readable and writable +successfully generates a unique name, the file (or directory) +is created with permissions such that it is only readable and writable by its owner (unless the .Fl u -flag is given) and the filename is printed to standard output. +flag is given) and the name is printed to the standard output. .Pp .Nm mktemp is provided to allow shell scripts to safely use temporary files. Traditionally, many shell scripts take the name of the program with -the PID as a suffix and use that as a temporary filename. +the PID as a suffix and use that as a temporary file name. This kind of naming scheme is predictable and the race condition it creates is easy for an attacker to win. -A safer, though still inferior approach +A safer, though still inferior approach, is to make a temporary directory using the same naming scheme. While this does allow one to guarantee that a temporary file will not be subverted, it still allows a simple denial of service attack. @@ -101,7 +101,7 @@ Make a directory instead of a file. .It Fl p Ar directory Use the specified .Ar directory -as a prefix when generating the temporary filename. +as a prefix when generating the temporary name. The .Ar directory will be overridden by the user's @@ -163,7 +163,7 @@ The following fragment illustrates a simple use of .Nm where the script should quit if it cannot get a safe -temporary file. +temporary file: .Bd -literal -offset indent TMPFILE=`mktemp /tmp/example.XXXXXXXXXX` || exit 1 echo "program output" >> $TMPFILE @@ -171,7 +171,7 @@ echo "program output" >> $TMPFILE .Pp The same fragment with support for a user's .Ev TMPDIR -environment variable can be written as follows. +environment variable can be written as follows: .Bd -literal -offset indent TMPFILE=`mktemp -t example.XXXXXXXXXX` || exit 1 echo "program output" >> $TMPFILE @@ -181,7 +181,7 @@ This can be further simplified if we don't care about the actual name of the temporary file. In this case the .Fl t -flag is implied. +flag is implied: .Bd -literal -offset indent TMPFILE=`mktemp` || exit 1 echo "program output" >> $TMPFILE @@ -194,7 +194,7 @@ In this example the temporary file will be created in .Pa /extra/tmp unless the user's .Ev TMPDIR -environment variable specifies otherwise. +environment variable specifies otherwise: .Bd -literal -offset indent TMPFILE=`mktemp -p /extra/tmp example.XXXXXXXXXX` || exit 1 echo "program output" >> $TMPFILE @@ -202,10 +202,10 @@ echo "program output" >> $TMPFILE .Pp In other cases, we want the script to catch the error. For instance, if we attempt to create two temporary files and -the second one fails we need to remove the first before exiting. +the second one fails we need to remove the first before exiting: .Bd -literal -offset indent -TMP1=`mktemp -t example.1.XXXXXXXXXX` || exit 1 -TMP2=`mktemp -t example.2.XXXXXXXXXX` +TMP1=`mktemp -t example.XXXXXXXXXX.1` || exit 1 +TMP2=`mktemp -t example.XXXXXXXXXX.2` if [ $? -ne 0 ]; then rm -f $TMP1 exit 1 @@ -215,7 +215,7 @@ fi Or perhaps you don't want to exit if .Nm is unable to create the file. -In this case you can protect that part of the script thusly. +In this case you can protect that part of the script thusly: .Bd -literal -offset indent TMPFILE=`mktemp -q -t example.XXXXXXXXXX` && { # Safe to use $TMPFILE in this block