From nobody Fri Jun 17 19:29:04 2022 X-Original-To: dev-commits-src-all@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 6DE2B847515; Fri, 17 Jun 2022 19:29:06 +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 4LPpxs1sPFz3GpM; Fri, 17 Jun 2022 19:29:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494145; 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=/4ubbk6qJdqJLRrg5fnfyX30qd6bWR4ehp8H+6GwlZ8=; b=uygU4lpFWWa+SPBZlsxDxtb/sK4KStpkCk7bniFec15ZbvuEvtCtuIW00h6XqUGD0C51jk 2sNPV+4bSA8mwoJrtUhtzZaYZGuxoNrlfAn9z5efxxxbyMUk6716Gpck8MggoUVMtm/hu5 grkHaczWWA2JoqTtVgprPoqDPBXS56FbiWQT/Bbx1JAT82ShZc/a9VYGwO+b+9t5cj4w30 AHsqUTcZIKJ0//eGa6u9t8UTmiQpAR/tH69H6r56sPskt+XAaDK1rLq9mIHLnPHar7+LfE Bf888OdNyqxb1AFcvz8fu3toe1pHtR64qAiT1SJBFmFr7anM3xjRSSfImdpZxA== 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 66BD6255E8; Fri, 17 Jun 2022 19:29:04 +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 25HJT43M096914; Fri, 17 Jun 2022 19:29:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJT4vh096913; Fri, 17 Jun 2022 19:29:04 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:29:04 GMT Message-Id: <202206171929.25HJT4vh096913@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 77935ceb59fe - stable/13 - linux(4): Fix timeout parameter of rt_sigtimedwait syscall, which is timespec not a timeval. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 77935ceb59fea7756ca1a66066f99c5e14bef114 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494145; 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=/4ubbk6qJdqJLRrg5fnfyX30qd6bWR4ehp8H+6GwlZ8=; b=dfgQhAssZ0p5c4xiXeFMszPfWssC8smBrqiMarCetOXwQDCwj/66piIpfH3drOpq7+/c8W +aKy2vuiP+yqR7ThBZHKD4g0ULg0R/KhxrvbubELNf9At9RRZtXilTgevuasW+Hjg0YV/t pi1n6iXFWQoFiNmkJEQsZXPYwUYG6mfM2HpnTfYJiSqj40xRIcYPPgXplnf18p631wtuGO lbbXYDGvB4kNu3ZjRFr7qVJ/GQhP7R/OFoUTTqr1tS/L/AkVe4+cILL//Tubs7+vv6KYry jVzp/3jNA/9xbsXXz+BVq0hVDayLW+ZUatUuRWQRVgL9ih9UsIHQ/dLStHxTzg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494145; a=rsa-sha256; cv=none; b=HHdBkrijaP/4eHJFuAmafqYm5PUrGL0xLniepScNessDP5AI4apWVNOX6TDozcn92l96ZN uhbPtUhOwMJuX/3LP1ubUsDA8cnKC2tWgZtml/4vDlYLpERl9N4zwTFw6JAiB1GnOF8/j7 6I4mVEHH/bwNSRBvyVvvw5NaQGtOWWIr/9A6EYROnPljCciQ+yvBmIC8LVQYTf1jkqP/j1 61wpX7A7toJy25wOZaaKssc1NgrLRnW6IOvMy3NOIqqBlxroYAaPgYYllxH9Evs5HK3qoY u9q9IizGVk0SOtFtWtSZwkD6f/OxlUk+J08VJg7Oet+D1NNXi7Lftb/2gszAXA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=77935ceb59fea7756ca1a66066f99c5e14bef114 commit 77935ceb59fea7756ca1a66066f99c5e14bef114 Author: Dmitry Chagin AuthorDate: 2021-06-07 02:35:35 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:27:59 +0000 linux(4): Fix timeout parameter of rt_sigtimedwait syscall, which is timespec not a timeval. MFC after: 2 weeks (cherry picked from commit 0f8dab45404f347752470579feccc6d2739b9570) --- sys/amd64/linux/syscalls.master | 2 +- sys/amd64/linux32/syscalls.master | 2 +- sys/arm/linux/syscalls.master | 2 +- sys/arm64/linux/syscalls.master | 2 +- sys/compat/linux/linux_signal.c | 30 +++++++++--------------------- sys/i386/linux/syscalls.master | 2 +- 6 files changed, 14 insertions(+), 26 deletions(-) diff --git a/sys/amd64/linux/syscalls.master b/sys/amd64/linux/syscalls.master index d99aaa019111..51f9fe00eb7d 100644 --- a/sys/amd64/linux/syscalls.master +++ b/sys/amd64/linux/syscalls.master @@ -839,7 +839,7 @@ int linux_rt_sigtimedwait( l_sigset_t *mask, l_siginfo_t *ptr, - struct l_timeval *timeout, + struct l_timespec *timeout, l_size_t sigsetsize ); } diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master index d3a124c6e8c2..79ee1f30a00d 100644 --- a/sys/amd64/linux32/syscalls.master +++ b/sys/amd64/linux32/syscalls.master @@ -949,7 +949,7 @@ int linux_rt_sigtimedwait( l_sigset_t *mask, l_siginfo_t *ptr, - struct l_timeval *timeout, + struct l_timespec *timeout, l_size_t sigsetsize ); } diff --git a/sys/arm/linux/syscalls.master b/sys/arm/linux/syscalls.master index 02a504459760..d67f9c3b2069 100644 --- a/sys/arm/linux/syscalls.master +++ b/sys/arm/linux/syscalls.master @@ -804,7 +804,7 @@ int linux_rt_sigtimedwait( l_sigset_t *mask, l_siginfo_t *ptr, - struct l_timeval *timeout, + struct l_timespec *timeout, l_size_t sigsetsize ); } diff --git a/sys/arm64/linux/syscalls.master b/sys/arm64/linux/syscalls.master index 9342a0913d6e..3d27ed496278 100644 --- a/sys/arm64/linux/syscalls.master +++ b/sys/arm64/linux/syscalls.master @@ -829,7 +829,7 @@ int linux_rt_sigtimedwait( l_sigset_t *mask, l_siginfo_t *ptr, - struct l_timeval *timeout, + struct l_timespec *timeout, l_size_t sigsetsize ); } diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c index f2c458a1c42c..50dae4d90d43 100644 --- a/sys/compat/linux/linux_signal.c +++ b/sys/compat/linux/linux_signal.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #endif #include +#include #include #include #include @@ -397,9 +398,8 @@ linux_rt_sigtimedwait(struct thread *td, struct linux_rt_sigtimedwait_args *args) { int error, sig; - l_timeval ltv; - struct timeval tv; struct timespec ts, *tsa; + struct l_timespec lts; l_sigset_t lset; sigset_t bset; l_siginfo_t linfo; @@ -414,27 +414,15 @@ linux_rt_sigtimedwait(struct thread *td, tsa = NULL; if (args->timeout) { - if ((error = copyin(args->timeout, <v, sizeof(ltv)))) + if ((error = copyin(args->timeout, <s, sizeof(lts)))) + return (error); + error = linux_to_native_timespec(&ts, <s); + if (error != 0) return (error); - tv.tv_sec = (long)ltv.tv_sec; - tv.tv_usec = (suseconds_t)ltv.tv_usec; - if (itimerfix(&tv)) { - /* - * The timeout was invalid. Convert it to something - * valid that will act as it does under Linux. - */ - tv.tv_sec += tv.tv_usec / 1000000; - tv.tv_usec %= 1000000; - if (tv.tv_usec < 0) { - tv.tv_sec -= 1; - tv.tv_usec += 1000000; - } - if (tv.tv_sec < 0) - timevalclear(&tv); - } - TIMEVAL_TO_TIMESPEC(&tv, &ts); tsa = &ts; - } + } else + tsa = NULL; + error = kern_sigtimedwait(td, bset, &info, tsa); if (error) return (error); diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index 7e1ab24e9f75..aa6eb7c1c46f 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -974,7 +974,7 @@ int linux_rt_sigtimedwait( l_sigset_t *mask, l_siginfo_t *ptr, - struct l_timeval *timeout, + struct l_timespec *timeout, l_size_t sigsetsize ); }