process the sshd random-relink kit if it is found. sshd's text segment
authorderaadt <deraadt@openbsd.org>
Wed, 18 Jan 2023 20:44:40 +0000 (20:44 +0000)
committerderaadt <deraadt@openbsd.org>
Wed, 18 Jan 2023 20:44:40 +0000 (20:44 +0000)
is now garbled, and in the future xonly univirse you'll have poor success
downloading it or libc to know where gadgets are.
ok djm

etc/rc

diff --git a/etc/rc b/etc/rc
index d4379e5..466e84c 100644 (file)
--- a/etc/rc
+++ b/etc/rc
@@ -1,4 +1,4 @@
-#      $OpenBSD: rc,v 1.568 2022/12/28 09:53:33 kn Exp $
+#      $OpenBSD: rc,v 1.569 2023/01/18 20:44:40 deraadt Exp $
 
 # System startup script run by init on autoboot or after single-user.
 # Output and error are redirected to console by init, and the console is the
@@ -188,7 +188,7 @@ reorder_libs() {
                fi
        done
 
-       echo 'reordering libraries:'
+       echo 'reordering:'
 
        # Remount the (read-only) filesystems in _ro_list as read-write.
        for _mp in $_ro_list; do
@@ -237,6 +237,21 @@ reorder_libs() {
                ) || { _error=true; break; }
        done
 
+       for _bin in $_relink/usr/sbin/sshd; do
+               _tmpdir=$(mktemp -dq $_relink/_rebuild.XXXXXXXXXXXX) &&
+               (
+               set -o errexit
+               cd $_tmpdir
+               _binn=${_bin##*/}
+               _bint=${_bin}/${_binn}.tar
+               if [[ -f $_bint ]]; then
+                       echo " $_binn"
+                       tar xf $_bint
+                       make -f Makefile.relink relink >/dev/null 2>&1
+               fi
+               ) || { _error=true; break; }
+       done
+               
        rm -rf $_relink/_rebuild.*
 
        # Restore previous mount state if it was changed.