From nobody Wed Jun 22 11:41:02 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 8649587137D; Wed, 22 Jun 2022 11:41:02 +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 4LShKV227bz4shC; Wed, 22 Jun 2022 11:41:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655898062; 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=KO/IKFMg/oNDz1T7TNsgvRZ30Qvh+qnXugs0V8u1ErY=; b=g1RB1ncCnwDg7cZzX8h6smXoD9Bn0hQQM8zrLAZRr0eNzupR//tlmPVZGh1j+vKWOUy1ui Teu1bg/BKcJ+WdAjlrG2OkaL19PLR16s6efcsVKU0FWcSlkoG+KdNTwSQT2xTFHaLdhdku w5Nr5iYraiiYuX0w3iggURqZoKud+MJiLqxKCfnNuTHD3934rXkRzbFvfsKP60YcHSdjie SUJyHGXJ3V6aeyT2WYXnMXHevJwV7V/NjtrXR/58B7WwF80GOM9UfnZwji8caLQ1AtHdxX 0/4wRutx0veFntd6L5IEMBH8eytVTmJc1BaRpZkRN8JAsWSSoFFYVVcVjxMP6g== 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 227A12578D; Wed, 22 Jun 2022 11:41:02 +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 25MBf2xC023708; Wed, 22 Jun 2022 11:41:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25MBf2JP023707; Wed, 22 Jun 2022 11:41:02 GMT (envelope-from git) Date: Wed, 22 Jun 2022 11:41:02 GMT Message-Id: <202206221141.25MBf2JP023707@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: 9310737333eb - main - linux(4): Trace Linux l_sigset_t. 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/main X-Git-Reftype: branch X-Git-Commit: 9310737333eb9e1a15340c10ea3fd68e0ccdcfa9 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655898062; 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=KO/IKFMg/oNDz1T7TNsgvRZ30Qvh+qnXugs0V8u1ErY=; b=q94m1yl5B5lS0XGMnSvmhqBDNLvXiwpnAhu40KooFKAcBuHalbr7f73FUC305NowtxXYKU ueSfBp1p0kHmpyWZENJhPxdscJqhQ/rKMr9bDVh1/EiE8DK5ELJO+pc64dBscZPyeRnp1u HaW9u70imJslI7bfSysp+80yVo13pIUiGMbmt9ZmlCCiJqDzN8t4pevIdWeIT0j+z0vLmL f+V3jp2CM6jFyzqfZnSr/Ot3GFfS1xd+JQUi+DrI2Z2kzJVF9qdJB+ynJIGi5R0Lzxz0ao 0h+9OqSX0Ja8zXDAtYoRAgEk0AzllbpkQn0lTfjsiPMmPrWWrrhpFRHrF44HrA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655898062; a=rsa-sha256; cv=none; b=C0F12DA+S4FdqG3IETDZqd869FdvgADutpeUHpl9fmxVVNWgqWB80xAMtJWX3Ztz2gttmb 4fMGxi0WVhApIxmoKROggHGtAgsFxM5uGoPzGVV8SnEgakWlMdhas4RP0qiV+3fg8Yehn2 Jgh6lvrWw/ETjJvZL69UhZj9rrtjwr8vFG6KgTnMQBzjN11c897+RplEH6fJC89OYgr9ZQ 1dKl6NJlSOg8WOLp+Ww1TnV5ywhehlEY64jRHLMJckgte0CjGKBU2rTWFClsSkayEy6suF PHZ83UYo2x8i1GVFiobpKw6DVQ8DzwdGQVO0RHnDRzozqNo6Otdo40Opqq6txw== 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=9310737333eb9e1a15340c10ea3fd68e0ccdcfa9 commit 9310737333eb9e1a15340c10ea3fd68e0ccdcfa9 Author: Dmitry Chagin AuthorDate: 2022-06-22 11:09:54 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-22 11:09:54 +0000 linux(4): Trace Linux l_sigset_t. MFC after: 2 weeks --- sys/compat/linux/linux.h | 5 ++++ sys/compat/linux/linux_event.c | 6 ++-- sys/compat/linux/linux_misc.c | 4 +-- sys/compat/linux/linux_signal.c | 64 +++++++++++++++++++++++++++++++++++------ sys/compat/linux/linux_signal.h | 3 +- 5 files changed, 68 insertions(+), 14 deletions(-) diff --git a/sys/compat/linux/linux.h b/sys/compat/linux/linux.h index cf250e29d278..72bcb25bd05a 100644 --- a/sys/compat/linux/linux.h +++ b/sys/compat/linux/linux.h @@ -266,4 +266,9 @@ struct l_statx { #define lower_32_bits(n) ((uint32_t)((n) & 0xffffffff)) +#ifdef KTRACE +#define linux_ktrsigset(s, l) \ + ktrstruct("l_sigset_t", (s), l) +#endif + #endif /* _LINUX_MI_H_ */ diff --git a/sys/compat/linux/linux_event.c b/sys/compat/linux/linux_event.c index e03335a87ec4..e4279b3418c2 100644 --- a/sys/compat/linux/linux_event.c +++ b/sys/compat/linux/linux_event.c @@ -526,7 +526,7 @@ linux_epoll_pwait(struct thread *td, struct linux_epoll_pwait_args *args) sigset_t mask, *pmask; int error; - error = linux_copyin_sigset(args->mask, sizeof(l_sigset_t), + error = linux_copyin_sigset(td, args->mask, sizeof(l_sigset_t), &mask, &pmask); if (error != 0) return (error); @@ -543,7 +543,7 @@ linux_epoll_pwait2_64(struct thread *td, struct linux_epoll_pwait2_64_args *args sigset_t mask, *pmask; int error; - error = linux_copyin_sigset(args->mask, sizeof(l_sigset_t), + error = linux_copyin_sigset(td, args->mask, sizeof(l_sigset_t), &mask, &pmask); if (error != 0) return (error); @@ -567,7 +567,7 @@ linux_epoll_pwait2(struct thread *td, struct linux_epoll_pwait2_args *args) sigset_t mask, *pmask; int error; - error = linux_copyin_sigset(args->mask, sizeof(l_sigset_t), + error = linux_copyin_sigset(td, args->mask, sizeof(l_sigset_t), &mask, &pmask); if (error != 0) return (error); diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index a46e16e26199..9c4aa1c26f9c 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -2429,7 +2429,7 @@ linux_common_pselect6(struct thread *td, l_int nfds, l_fd_set *readfds, error = copyin(sig, &lpse6, sizeof(lpse6)); if (error != 0) return (error); - error = linux_copyin_sigset(PTRIN(lpse6.ss), + error = linux_copyin_sigset(td, PTRIN(lpse6.ss), lpse6.ss_len, &ss, &ssp); if (error != 0) return (error); @@ -2530,7 +2530,7 @@ linux_common_ppoll(struct thread *td, struct pollfd *fds, uint32_t nfds, if (kern_poll_maxfds(nfds)) return (EINVAL); if (sset != NULL) { - error = linux_copyin_sigset(sset, ssize, &ss, &ssp); + error = linux_copyin_sigset(td, sset, ssize, &ss, &ssp); if (error != 0) return (error); } else diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c index bb20c6211e9b..a1bbfa2cfa07 100644 --- a/sys/compat/linux/linux_signal.c +++ b/sys/compat/linux/linux_signal.c @@ -29,6 +29,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_ktrace.h" + #include #include #include @@ -39,6 +41,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef KTRACE +#include +#endif #include @@ -176,6 +181,11 @@ linux_do_sigaction(struct thread *td, int linux_sig, l_sigaction_t *linux_nsa, if (linux_nsa != NULL) { nsa = &act; linux_to_bsd_sigaction(linux_nsa, nsa); +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + linux_ktrsigset(&linux_nsa->lsa_mask, + sizeof(linux_nsa->lsa_mask)); +#endif } else nsa = NULL; sig = linux_to_bsd_signal(linux_sig); @@ -184,9 +194,14 @@ linux_do_sigaction(struct thread *td, int linux_sig, l_sigaction_t *linux_nsa, if (error != 0) return (error); - if (linux_osa != NULL) + if (linux_osa != NULL) { bsd_to_linux_sigaction(osa, linux_osa); - +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + linux_ktrsigset(&linux_osa->lsa_mask, + sizeof(linux_osa->lsa_mask)); +#endif + } return (0); } @@ -308,6 +323,10 @@ linux_sigprocmask(struct thread *td, struct linux_sigprocmask_args *args) return (error); LINUX_SIGEMPTYSET(lset); lset.__mask = mask; +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + linux_ktrsigset(&lset, sizeof(lset)); +#endif linux_to_bsd_sigset(&lset, &set); } @@ -316,6 +335,10 @@ linux_sigprocmask(struct thread *td, struct linux_sigprocmask_args *args) args->omask ? &oset : NULL); if (args->omask != NULL && error == 0) { +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + linux_ktrsigset(&oset, sizeof(oset)); +#endif mask = oset.__mask; error = copyout(&mask, args->omask, sizeof(mask)); } @@ -331,7 +354,7 @@ linux_rt_sigprocmask(struct thread *td, struct linux_rt_sigprocmask_args *args) sigset_t set, *pset; int error; - error = linux_copyin_sigset(args->mask, args->sigsetsize, + error = linux_copyin_sigset(td, args->mask, args->sigsetsize, &set, &pset); if (error != 0) return (EINVAL); @@ -339,8 +362,13 @@ linux_rt_sigprocmask(struct thread *td, struct linux_rt_sigprocmask_args *args) error = linux_do_sigprocmask(td, args->how, pset, args->omask ? &oset : NULL); - if (args->omask != NULL && error == 0) + if (args->omask != NULL && error == 0) { +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + linux_ktrsigset(&oset, sizeof(oset)); +#endif error = copyout(&oset, args->omask, sizeof(oset)); + } return (error); } @@ -356,6 +384,10 @@ linux_sgetmask(struct thread *td, struct linux_sgetmask_args *args) bsd_to_linux_sigset(&td->td_sigmask, &mask); PROC_UNLOCK(p); td->td_retval[0] = mask.__mask; +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + linux_ktrsigset(&mask, sizeof(mask)); +#endif return (0); } @@ -372,6 +404,10 @@ linux_ssetmask(struct thread *td, struct linux_ssetmask_args *args) LINUX_SIGEMPTYSET(lset); lset.__mask = args->mask; linux_to_bsd_sigset(&lset, &bset); +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + linux_ktrsigset(&lset, sizeof(lset)); +#endif td->td_sigmask = bset; SIG_CANTMASK(td->td_sigmask); signotify(td); @@ -393,6 +429,10 @@ linux_sigpending(struct thread *td, struct linux_sigpending_args *args) SIGSETAND(bset, td->td_sigmask); PROC_UNLOCK(p); bsd_to_linux_sigset(&bset, &lset); +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + linux_ktrsigset(&lset, sizeof(lset)); +#endif mask = lset.__mask; return (copyout(&mask, args->mask, sizeof(mask))); } @@ -418,6 +458,10 @@ linux_rt_sigpending(struct thread *td, struct linux_rt_sigpending_args *args) SIGSETAND(bset, td->td_sigmask); PROC_UNLOCK(p); bsd_to_linux_sigset(&bset, &lset); +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + linux_ktrsigset(&lset, sizeof(lset)); +#endif return (copyout(&lset, args->set, args->sigsetsize)); } @@ -449,7 +493,7 @@ linux_common_rt_sigtimedwait(struct thread *td, l_sigset_t *mask, l_siginfo_t lsi; ksiginfo_t ksi; - error = linux_copyin_sigset(mask, sigsetsize, &bset, NULL); + error = linux_copyin_sigset(td, mask, sigsetsize, &bset, NULL); if (error != 0) return (error); @@ -825,7 +869,7 @@ linux_rt_sigsuspend(struct thread *td, struct linux_rt_sigsuspend_args *uap) sigset_t sigmask; int error; - error = linux_copyin_sigset(uap->newset, uap->sigsetsize, + error = linux_copyin_sigset(td, uap->newset, uap->sigsetsize, &sigmask, NULL); if (error != 0) return (error); @@ -915,8 +959,8 @@ linux_psignal(struct thread *td, int pid, int sig) } int -linux_copyin_sigset(l_sigset_t *lset, l_size_t sigsetsize, sigset_t *set, - sigset_t **pset) +linux_copyin_sigset(struct thread *td, l_sigset_t *lset, + l_size_t sigsetsize, sigset_t *set, sigset_t **pset) { l_sigset_t lmask; int error; @@ -930,6 +974,10 @@ linux_copyin_sigset(l_sigset_t *lset, l_size_t sigsetsize, sigset_t *set, linux_to_bsd_sigset(&lmask, set); if (pset != NULL) *pset = set; +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + linux_ktrsigset(&lmask, sizeof(lmask)); +#endif } else if (pset != NULL) *pset = NULL; return (0); diff --git a/sys/compat/linux/linux_signal.h b/sys/compat/linux/linux_signal.h index 75fe0b24e592..aa385728efa6 100644 --- a/sys/compat/linux/linux_signal.h +++ b/sys/compat/linux/linux_signal.h @@ -35,6 +35,7 @@ int linux_do_sigaction(struct thread *, int, l_sigaction_t *, l_sigaction_t *); void siginfo_to_lsiginfo(const siginfo_t *si, l_siginfo_t *lsi, l_int sig); int lsiginfo_to_siginfo(struct thread *td, const l_siginfo_t *lsi, siginfo_t *si, int sig); -int linux_copyin_sigset(l_sigset_t *, l_size_t, sigset_t *, sigset_t **); +int linux_copyin_sigset(struct thread *td, l_sigset_t *, l_size_t, sigset_t *, + sigset_t **); #endif /* _LINUX_SIGNAL_H_ */