From nobody Fri Jun 17 19:41:30 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 BFF8785DD8E; Fri, 17 Jun 2022 19:41:31 +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 4LPqDC2dMhz3jMn; Fri, 17 Jun 2022 19:41:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494891; 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=wXHx1ZefHJEu+CbSPZmyckqhTPZ7RnSlpTEeB3tja5o=; b=Nmj3C1I0um5r0TphiJLDW2v15Bloh/xa/miZZsSXSYNTjIIxtbcDW1UekaSzSIBGlHweHn UDDzTgZUBWLFNa+18uDBTAwPyJAeTeLjSEFBgAeZg0mePDHP2X84A8xXkTrUhZRRfE+GhJ 5QoYaTAJBdixjSfhmxfErzsbgA+oCpfA9Q/CfR0FwjGqAjZOUPgKzyFpEpWj23TbGOCbu9 oKjCaSBD3tWokS6MJsNEK/KZ9hoiV9Dn5aAX/wtdPZgZ8gmR2kgcIOHtSjOnFv6hSXlSkI qJaDI6WE67E8iEEJYuaVzogCGwUIYIW2ocKCzywHs8k2fUDXXGyb3DnZ6I5FCQ== 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 BEF9825CA7; Fri, 17 Jun 2022 19:41:30 +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 25HJfUoB030563; Fri, 17 Jun 2022 19:41:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJfUSF030562; Fri, 17 Jun 2022 19:41:30 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:41:30 GMT Message-Id: <202206171941.25HJfUSF030562@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: 50fe2c32d568 - stable/13 - linux(4): Use the copyin_sigset() in the remaining places 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: 50fe2c32d568f9e8db081327303e839769ae9c31 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494891; 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=wXHx1ZefHJEu+CbSPZmyckqhTPZ7RnSlpTEeB3tja5o=; b=eijlFzi1Kog3M0U7lHrvzDCDsqcbvl/kDsoNrbgQmBL+QIsXRZ5bqL8D+Fs4ynuHpKCTyW UCGUqALIALInpOuzbJbSRfjhGDcHsNrzruNjcfWl37has2JBs5iuiR2JmJLluu7Yii8EoI ws9rgJYqrTCqpQ1W51VKrrh0KrEcmJdE3UwhZ1ndYwf5gBi9SKQEmFycRh7MiRO6AQNDV3 zJ3+klUrZSMU7DjVw4OLDur+muCEw7hookWZyl2exKKGs9jO1/oBSi707LvJtgwEaPlXi9 xTKOZEa0RSYTch4Lm3jmHhLQ2s+La4ZNVptQ36+gBtwdOOA3XZpTGRWth6SyKg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494891; a=rsa-sha256; cv=none; b=rvBPtHr7oI1sUqHZic1EjGKnZsmL4PF2LZiCpvXIPWEOUynSvlbNX8b9YrCQ5tG+0cTau+ hSWevD6rmAgRE3riJh8IQmiL4u5WXVhICIfEOYZyAdUBBMraEoRpeCdpHFQfIyNUhPfh7s 74BdGhTg+jeJuVVd5q2A8/PxE7/WZUeZFSZ79fExcEZHrbnGnSSx5EYsdY1GNBu4x1ihkU B9iJ1fu8meJR436o8mC1Qvtq2m+I9hKu+OcepB6ByYKRPxKYTWKeBK92auftG/lOnYavOX KbhbYu3S/xQE0jvwGRtdE62v0j6lyq07KzBx4J6+v6OSB1ydIkMeayl3jFiuqg== 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=50fe2c32d568f9e8db081327303e839769ae9c31 commit 50fe2c32d568f9e8db081327303e839769ae9c31 Author: Dmitry Chagin AuthorDate: 2022-05-30 16:59:45 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:35:39 +0000 linux(4): Use the copyin_sigset() in the remaining places MFC after: 2 weeks (cherry picked from commit 5e872c279aecd169df34602669ee9c86ae9e9f18) --- 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 64e6b03c5451..b041c0467345 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) {