From nobody Tue Jan 24 22:10:52 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P1h4Y1trDz3bf9H; Tue, 24 Jan 2023 22:10:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P1h4Y0t8Hz4Ly5; Tue, 24 Jan 2023 22:10:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598253; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZdCMERZijsdMOQHA/RSLd198Vx2vwi1pxl14fN3mlQ0=; b=ATKM8Abh3VQnYRaIij4x2VBsYWIxnalzl3q/9BTidQU+nRv9jFN+RE3kL0NT8RvtmHJxaM wGaIJr4s//mjQdhOSuMZ4to53ojjzgtbt7hi16CZkNImDflu+dKXWYVtuAiQW8cLg/QmY0 yPU28sH+yej8B/fjQgvYFD0ENjNLEbJPR+5bjGI3SdiDCjABDgsbYG/I0iWrYZ9c17/9Y+ FcJ9Q83vmx/Jhs1jS8ynhc0mCzhYxr6pz4KIVExQPtbScvDrfa4N+de1h01Rr4JA5tjMD+ Hexp3ikMHGbsulhl/z1U1cqZXZ1uZzkAQ4oi5+S0V8yO7LXtMLJunOeYyQMU8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674598253; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ZdCMERZijsdMOQHA/RSLd198Vx2vwi1pxl14fN3mlQ0=; b=L10TKOffpEGpDt6lQmKEG8Dk9N6ntVz7L7TgNNKZLi2Q3N8/JkZez6Tgibds83Hm14zllF BurlKIOFlSuhaUZMwb2GZboVR5ma1AZ0UWBb01Zql0ATs59eJSKBz8M8EnZKQxXJDJqo8A qws3dEP9DrijZFXeHSnA+Ig+tarpoLwWgNPcMrycQk2X4g2CYjlzTeDfkIHrKNjTAWiw96 ADR1tR3yrSnCvO1fPzfOhTy1+iOFT8KPHRrkv3oZJLU50+qZVy5f7uNxOTz3kcMUfbre7Q +remh2J4bgtayH0Xw+kssgXw1/wOl+F836dU8X7tfuc23tPIm1HHYcJCXLzFAg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674598253; a=rsa-sha256; cv=none; b=Pmsw0WKqCgQpJtuP4SeCvTFDJR3BtpR3CEaMKQIIqTvdKeM9IZJHVvkxwSaVUEq0sh3pbC Xy/A+/Wpm8t+a8dv7BMGUBNxYRTVZdERCgEy4rF77JSOgNNwFj5dTt+WgHzz/vU5WbzdBJ sg60S1BUzFbTCKy8wPZeQYRTc6PU16q1C6gthUyV/XqXvyqHboEotJYWs6eXeBjWIffoKV ungJuQixSqhkXbL0WcQ9/uq0GpRbQ/e5MaOUsYMBx3DW0yJhERJEwEb5fWzMdQZoEq+ctK BBF/BQ39cOeAocHb1a7EUmrKZB5JVFqY059yRWqA3riYJkYyTnpbzL38drbCoA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4P1h4X6S5dzQ1R; Tue, 24 Jan 2023 22:10:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30OMAq33082730; Tue, 24 Jan 2023 22:10:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30OMAqQi082717; Tue, 24 Jan 2023 22:10:52 GMT (envelope-from git) Date: Tue, 24 Jan 2023 22:10:52 GMT Message-Id: <202301242210.30OMAqQi082717@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 4bae1d08388f - stable/13 - kboot: Reimplement older system calls in terms of newer ones List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4bae1d08388f806e0b875eb8693e4e45582f326c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4bae1d08388f806e0b875eb8693e4e45582f326c commit 4bae1d08388f806e0b875eb8693e4e45582f326c Author: Warner Losh AuthorDate: 2022-07-07 22:58:27 +0000 Commit: Warner Losh CommitDate: 2023-01-24 21:49:23 +0000 kboot: Reimplement older system calls in terms of newer ones aarch64 doesn't have open, just openat, etc. Cope. Sponsored by: Netflix (cherry picked from commit edc23ddf9cf35d7ea9baf72d14449e04508d2314) --- stand/kboot/arch/amd64/syscall_nr.h | 6 +++--- stand/kboot/arch/powerpc64/syscall_nr.h | 4 ++-- stand/kboot/host_syscall.h | 2 ++ stand/kboot/host_syscalls.c | 12 ++++++++++-- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/stand/kboot/arch/amd64/syscall_nr.h b/stand/kboot/arch/amd64/syscall_nr.h index 9c4fb1024319..506f85b3e731 100644 --- a/stand/kboot/arch/amd64/syscall_nr.h +++ b/stand/kboot/arch/amd64/syscall_nr.h @@ -1,13 +1,13 @@ #define SYS_close 3 #define SYS_getdents 78 #define SYS_gettimeofday 96 -#define SYS_lseek 8 #define SYS_kexec_load 246 +#define SYS_lseek 8 #define SYS_mmap 9 -#define SYS_open 2 +#define SYS_openat 257 +#define SYS_pselect6 270 #define SYS_read 0 #define SYS_reboot 169 -#define SYS_select 23 #define SYS_uname 63 #define SYS_write 1 diff --git a/stand/kboot/arch/powerpc64/syscall_nr.h b/stand/kboot/arch/powerpc64/syscall_nr.h index 187c434a13d7..592f3d6a7631 100644 --- a/stand/kboot/arch/powerpc64/syscall_nr.h +++ b/stand/kboot/arch/powerpc64/syscall_nr.h @@ -4,10 +4,10 @@ #define SYS_kexec_load 268 #define SYS_llseek 140 #define SYS_mmap 90 -#define SYS_open 5 +#define SYS_openat 286 +#define SYS_pselect6 280 #define SYS_read 3 #define SYS_reboot 88 -#define SYS_select 142 #define SYS_uname 120 #define SYS_write 4 diff --git a/stand/kboot/host_syscall.h b/stand/kboot/host_syscall.h index 3a640af30565..b13829e4d05b 100644 --- a/stand/kboot/host_syscall.h +++ b/stand/kboot/host_syscall.h @@ -48,6 +48,8 @@ struct host_timeval { long tv_usec; }; +#define HOST_AT_FDCWD -100 /* Relative to current directory */ + /* * System Calls */ diff --git a/stand/kboot/host_syscalls.c b/stand/kboot/host_syscalls.c index 66014462ccdd..3db066acb781 100644 --- a/stand/kboot/host_syscalls.c +++ b/stand/kboot/host_syscalls.c @@ -54,7 +54,7 @@ host_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t off) int host_open(const char *path, int flags, int mode) { - return host_syscall(SYS_open, (uintptr_t)path, flags, mode); + return host_syscall(SYS_openat, HOST_AT_FDCWD, (uintptr_t)path, flags, mode); /* XXX original overrode errors */ } @@ -75,7 +75,15 @@ int host_select(int nfds, long *readfds, long *writefds, long *exceptfds, struct host_timeval *timeout) { - return host_syscall(SYS_select, nfds, (uintptr_t)readfds, (uintptr_t)writefds, (uintptr_t)exceptfds, (uintptr_t)timeout, 0); + struct timespec ts = { .tv_sec = timeout->tv_sec, .tv_nsec = timeout->tv_usec * 1000 }; + + /* + * Note, final arg is a sigset_argpack since most arch can only have 6 + * syscall args. Since we're not masking signals, though, we can just + * pass a NULL. + */ + return host_syscall(SYS_pselect6, nfds, (uintptr_t)readfds, (uintptr_t)writefds, + (uintptr_t)exceptfds, (uintptr_t)&ts, (uintptr_t)NULL); } int