From nobody Mon May 30 17:04:24 2022 X-Original-To: dev-commits-src-main@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 530441B60B76; Mon, 30 May 2022 17:04:26 +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 4LBhbD6dNRz4khJ; Mon, 30 May 2022 17:04:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1653930265; 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=wWS9O9J11DPkwhmA48d+9uMY2ej3DQAgeBjUsLFJOGQ=; b=AmrZAqnN8/Ju0cIV2yxvm3t2MSBg6bwdEchx1hjD5yJHFNpYuSfz4gCn55hZKubxKtPPg8 ijWmH4G48X1lQzzJYdsOaFg089YdPENeeTGP0zuxL8XtrRuXLNFwNu5E5NUt5OFPyL8T8z N3MXR63QkS5autMqDVvm502wMJ8JCQFIAyQqFTl3af6CBVEVLHSWwPJO1ycI+VvUMm/Bbp MdPGMu7u5jgYrZGe+/fp9tWV+fpNL5Zh3IpIpjy+UYzHKpisBlIKFM99n20sQ3fapnyZEu hnkzwMZbVGuiqvOBNgjNKvQM5ajXXQqcO/VWPjZOhN8A1BNkMEQFR0NOSwvJ/g== 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 524A21B0D9; Mon, 30 May 2022 17:04:24 +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 24UH4Oiw067924; Mon, 30 May 2022 17:04:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24UH4OSr067923; Mon, 30 May 2022 17:04:24 GMT (envelope-from git) Date: Mon, 30 May 2022 17:04:24 GMT Message-Id: <202205301704.24UH4OSr067923@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: 5e872c279aec - main - linux(4): Use the copyin_sigset() in the remaining places List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 5e872c279aecd169df34602669ee9c86ae9e9f18 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1653930265; 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=wWS9O9J11DPkwhmA48d+9uMY2ej3DQAgeBjUsLFJOGQ=; b=r5LgR614TkCMqTrKg+wn11tr8HsaR47O/DKRvJAavnvOgprcf8HIxPHQHwlNLGMx2TrGZw Aze5EzzwMR4wAX4NW1VOJ8Aofh3NjSzCq6+bp2X629zGRWOvDTkMtb+irZMxfFiG2rR+UV 66h57J+mG4h1hUPEl9jingKZfr/Q6V46QC9s5vpAbrQnl2QyyuLjJr7J5uGy8SioARjDYI AVVMjUFU1L2FYM88lGYW4tqD+xxWBoV1tnfZhMFRVmaPXOvARurZBKTFf1Kc7uc/2A5juh 1cMRg1jUvjLdOPx0Yhkj4Ti2Hmw0T9z36zTnsOkxpSSseBeWUKPObnS18TAbow== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1653930265; a=rsa-sha256; cv=none; b=qeITvwIi1vnBuEdfW7GmHvqMEnMgYalWHdFGknUQvq/xWQ8djFXXnNv0NDrxaIlynBOHuc bzuV0swLS/2rAG77eExyXVIG0tC8st9uCleF74TzOoDpjcwcq7BQhMP2+W+nzG4BIYI+Pe IK+3QByjamSe1xNIT+zuZWsWuT5bVsCBgIQbxeGaFWjxvjPwkobI69O1W0U7W+rgFmLShh HrxvpQpiEBLDwUvEM25bjntoS13Xl7DEkV+/Jttf4ZYXLo6FO4dzsq+5XCjIKPy9MfK6bb l/7pDomJRB0Tn+E26X1oh88lDl49bsjQDLYvhASdYApkrVpRVq3cWNNFK3Gajw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=5e872c279aecd169df34602669ee9c86ae9e9f18 commit 5e872c279aecd169df34602669ee9c86ae9e9f18 Author: Dmitry Chagin AuthorDate: 2022-05-30 16:59:45 +0000 Commit: Dmitry Chagin CommitDate: 2022-05-30 16:59:45 +0000 linux(4): Use the copyin_sigset() in the remaining places MFC after: 2 weeks --- sys/compat/linux/linux_misc.c | 26 +++++++------------------- sys/compat/linux/linux_signal.c | 36 ++++++++++++++---------------------- 2 files changed, 21 insertions(+), 41 deletions(-) diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 3321c9cdd98a..a46e16e26199 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -2420,7 +2420,6 @@ linux_common_pselect6(struct thread *td, l_int nfds, l_fd_set *readfds, { struct timeval utv, tv0, tv1, *tvp; struct l_pselect6arg lpse6; - l_sigset_t l_ss; sigset_t *ssp; sigset_t ss; int error; @@ -2430,16 +2429,10 @@ linux_common_pselect6(struct thread *td, l_int nfds, l_fd_set *readfds, error = copyin(sig, &lpse6, sizeof(lpse6)); if (error != 0) return (error); - if (lpse6.ss_len != sizeof(l_ss)) - return (EINVAL); - if (lpse6.ss != 0) { - error = copyin(PTRIN(lpse6.ss), &l_ss, - sizeof(l_ss)); - if (error != 0) - return (error); - linux_to_bsd_sigset(&l_ss, &ss); - ssp = &ss; - } + error = linux_copyin_sigset(PTRIN(lpse6.ss), + lpse6.ss_len, &ss, &ssp); + if (error != 0) + return (error); } else ssp = NULL; @@ -2530,7 +2523,6 @@ linux_common_ppoll(struct thread *td, struct pollfd *fds, uint32_t nfds, struct timespec ts0, ts1; struct pollfd stackfds[32]; struct pollfd *kfds; - l_sigset_t l_ss; sigset_t *ssp; sigset_t ss; int error; @@ -2538,13 +2530,9 @@ linux_common_ppoll(struct thread *td, struct pollfd *fds, uint32_t nfds, if (kern_poll_maxfds(nfds)) return (EINVAL); if (sset != NULL) { - if (ssize != sizeof(l_ss)) - return (EINVAL); - error = copyin(sset, &l_ss, sizeof(l_ss)); - if (error) - return (error); - linux_to_bsd_sigset(&l_ss, &ss); - ssp = &ss; + error = linux_copyin_sigset(sset, ssize, &ss, &ssp); + if (error != 0) + return (error); } else ssp = NULL; if (tsp != NULL) diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c index 9aecb8497f3b..a5f5d86d8c5d 100644 --- a/sys/compat/linux/linux_signal.c +++ b/sys/compat/linux/linux_signal.c @@ -266,11 +266,10 @@ linux_rt_sigaction(struct thread *td, struct linux_rt_sigaction_args *args) } static int -linux_do_sigprocmask(struct thread *td, int how, l_sigset_t *new, +linux_do_sigprocmask(struct thread *td, int how, sigset_t *new, l_sigset_t *old) { - sigset_t omask, nmask; - sigset_t *nmaskp; + sigset_t omask; int error; td->td_retval[0] = 0; @@ -288,12 +287,7 @@ linux_do_sigprocmask(struct thread *td, int how, l_sigset_t *new, default: return (EINVAL); } - if (new != NULL) { - linux_to_bsd_sigset(new, &nmask); - nmaskp = &nmask; - } else - nmaskp = NULL; - error = kern_sigprocmask(td, how, nmaskp, &omask, 0); + error = kern_sigprocmask(td, how, new, &omask, 0); if (error == 0 && old != NULL) bsd_to_linux_sigset(&omask, old); @@ -305,15 +299,17 @@ int linux_sigprocmask(struct thread *td, struct linux_sigprocmask_args *args) { l_osigset_t mask; - l_sigset_t set, oset; + l_sigset_t lset, oset; + sigset_t set; int error; if (args->mask != NULL) { error = copyin(args->mask, &mask, sizeof(l_osigset_t)); if (error) return (error); - LINUX_SIGEMPTYSET(set); - set.__mask = mask; + LINUX_SIGEMPTYSET(lset); + lset.__mask = mask; + linux_to_bsd_sigset(&lset, &set); } error = linux_do_sigprocmask(td, args->how, @@ -332,20 +328,16 @@ linux_sigprocmask(struct thread *td, struct linux_sigprocmask_args *args) int linux_rt_sigprocmask(struct thread *td, struct linux_rt_sigprocmask_args *args) { - l_sigset_t set, oset; + l_sigset_t oset; + sigset_t set, *pset; int error; - if (args->sigsetsize != sizeof(l_sigset_t)) + error = linux_copyin_sigset(args->mask, args->sigsetsize, + &set, &pset); + if (error != 0) return (EINVAL); - if (args->mask != NULL) { - error = copyin(args->mask, &set, sizeof(l_sigset_t)); - if (error) - return (error); - } - - error = linux_do_sigprocmask(td, args->how, - args->mask ? &set : NULL, + error = linux_do_sigprocmask(td, args->how, pset, args->omask ? &oset : NULL); if (args->omask != NULL && !error) {