From owner-dev-commits-src-main@freebsd.org Mon May 31 00:56:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B54863B80C; Mon, 31 May 2021 00:56:36 +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 4FtcLX1Bjgz4p8v; Mon, 31 May 2021 00:56:36 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0C97626B65; Mon, 31 May 2021 00:56:36 +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 14V0uZfg065817; Mon, 31 May 2021 00:56:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14V0uZoF065816; Mon, 31 May 2021 00:56:35 GMT (envelope-from git) Date: Mon, 31 May 2021 00:56:35 GMT Message-Id: <202105310056.14V0uZoF065816@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 947bd2479ba9 - main - nfsd: Add support for the NFSv4.1/4.2 Secinfo_no_name operation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 947bd2479ba9661a99f2415038e7b5fa972ec843 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 00:56:36 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=947bd2479ba9661a99f2415038e7b5fa972ec843 commit 947bd2479ba9661a99f2415038e7b5fa972ec843 Author: Rick Macklem AuthorDate: 2021-05-31 00:52:43 +0000 Commit: Rick Macklem CommitDate: 2021-05-31 00:52:43 +0000 nfsd: Add support for the NFSv4.1/4.2 Secinfo_no_name operation The Linux client is now attempting to use the Secinfo_no_name operation for NFSv4.1/4.2 mounts. Although it does not seem to mind the NFSERR_NOTSUPP reply, adding support for it seems reasonable. I also noticed that "savflag" needed to be 64bits in nfsrvd_secinfo() since nd_flag in now 64bits, so I changed the declaration of it there. I also added code to set "vp" NULL after performing Secinfo/Secinfo_no_name, since these operations consume the current FH, which is represented by "vp" in nfsrvd_compound(). Fixing when the server replies NFSERR_WRONGSEC so that it conforms to RFC5661 Sec. 2.6 still needs to be done in a future commit. MFC after: 2 weeks --- sys/fs/nfs/nfs_commonsubs.c | 2 +- sys/fs/nfs/nfs_var.h | 2 + sys/fs/nfs/nfsproto.h | 4 ++ sys/fs/nfsserver/nfs_nfsdserv.c | 113 +++++++++++++++++++++++++++++++++++++- sys/fs/nfsserver/nfs_nfsdsocket.c | 15 ++++- sys/fs/nfsserver/nfs_nfsdsubs.c | 3 +- 6 files changed, 134 insertions(+), 5 deletions(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 7ddef0f19ddc..02416da54f01 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -168,7 +168,7 @@ struct nfsv4_opflag nfsv4_opflag[NFSV42_NOPS] = { { 0, 1, 0, 1, LK_EXCLUSIVE, 1, 1 }, /* Layout Commit */ { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Layout Get */ { 0, 1, 0, 1, LK_EXCLUSIVE, 1, 0 }, /* Layout Return */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Secinfo No name */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Secinfo No name */ { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Sequence */ { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Set SSV */ { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Test StateID */ diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index f23d56050449..c1ca7c03af39 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -232,6 +232,8 @@ int nfsrvd_renew(struct nfsrv_descript *, int, vnode_t, struct nfsexstuff *); int nfsrvd_secinfo(struct nfsrv_descript *, int, vnode_t, struct nfsexstuff *); +int nfsrvd_secinfononame(struct nfsrv_descript *, int, + vnode_t, struct nfsexstuff *); int nfsrvd_setclientid(struct nfsrv_descript *, int, vnode_t, struct nfsexstuff *); int nfsrvd_setclientidcfrm(struct nfsrv_descript *, int, diff --git a/sys/fs/nfs/nfsproto.h b/sys/fs/nfs/nfsproto.h index a1a992d14cdb..62d86c3a4593 100644 --- a/sys/fs/nfs/nfsproto.h +++ b/sys/fs/nfs/nfsproto.h @@ -726,6 +726,10 @@ #define NFSCDFS4_BACK 0x2 #define NFSCDFS4_BOTH 0x3 +/* Enum values for Secinfo_no_name. */ +#define NFSSECINFONONAME_CURFH 0 +#define NFSSECINFONONAME_PARENT 1 + #if defined(_KERNEL) || defined(KERNEL) /* Conversion macros */ #define vtonfsv2_mode(t,m) \ diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index ef78f90fabfc..5d3c6f65ced0 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -3664,7 +3664,8 @@ nfsrvd_secinfo(struct nfsrv_descript *nd, int isdgram, struct nfsrvfh fh; struct nfsexstuff retnes; u_int32_t *sizp; - int error = 0, savflag, i; + int error = 0, i; + uint64_t savflag; char *bufp; u_long *hashp; struct thread *p = curthread; @@ -3754,6 +3755,116 @@ out: return (error); } +/* + * nfsv4 security info no name service + */ +int +nfsrvd_secinfononame(struct nfsrv_descript *nd, int isdgram, + vnode_t dp, struct nfsexstuff *exp) +{ + uint32_t *tl, *sizp; + struct nameidata named; + vnode_t dirp = NULL, vp; + struct nfsrvfh fh; + struct nfsexstuff retnes; + int error = 0, fhstyle, i, len; + uint64_t savflag; + char *bufp; + u_long *hashp; + struct thread *p = curthread; + + NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); + fhstyle = fxdr_unsigned(int, *tl); + switch (fhstyle) { + case NFSSECINFONONAME_PARENT: + NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, LOOKUP, + LOCKLEAF | SAVESTART); + nfsvno_setpathbuf(&named, &bufp, &hashp); + error = nfsrv_parsename(nd, bufp, hashp, &named.ni_pathlen); + if (error != 0) { + vput(dp); + nfsvno_relpathbuf(&named); + goto nfsmout; + } + if (nd->nd_repstat == 0) + nd->nd_repstat = nfsvno_namei(nd, &named, dp, 1, exp, p, &dirp); + else + vput(dp); + if (dirp != NULL) + vrele(dirp); + vrele(named.ni_startdir); + nfsvno_relpathbuf(&named); + vp = named.ni_vp; + break; + case NFSSECINFONONAME_CURFH: + vp = dp; + break; + default: + nd->nd_repstat = NFSERR_INVAL; + vput(dp); + } + if (nd->nd_repstat != 0) + goto nfsmout; + fh.nfsrvfh_len = NFSX_MYFH; + nd->nd_repstat = nfsvno_getfh(vp, (fhandle_t *)fh.nfsrvfh_data, p); + vput(vp); + savflag = nd->nd_flag; + if (nd->nd_repstat == 0) { + nfsd_fhtovp(nd, &fh, LK_SHARED, &vp, &retnes, NULL, 0); + if (vp != NULL) + vput(vp); + } + nd->nd_flag = savflag; + if (nd->nd_repstat != 0) + goto nfsmout; + + /* + * Finally have the export flags for fh/parent, so we can create + * the security info. + */ + len = 0; + NFSM_BUILD(sizp, uint32_t *, NFSX_UNSIGNED); + for (i = 0; i < retnes.nes_numsecflavor; i++) { + if (retnes.nes_secflavors[i] == AUTH_SYS) { + NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(RPCAUTH_UNIX); + len++; + } else if (retnes.nes_secflavors[i] == RPCSEC_GSS_KRB5) { + NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(RPCAUTH_GSS); + nfsm_strtom(nd, nfsgss_mechlist[KERBV_MECH].str, + nfsgss_mechlist[KERBV_MECH].len); + NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(GSS_KERBV_QOP); + *tl = txdr_unsigned(RPCAUTHGSS_SVCNONE); + len++; + } else if (retnes.nes_secflavors[i] == RPCSEC_GSS_KRB5I) { + NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(RPCAUTH_GSS); + nfsm_strtom(nd, nfsgss_mechlist[KERBV_MECH].str, + nfsgss_mechlist[KERBV_MECH].len); + NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(GSS_KERBV_QOP); + *tl = txdr_unsigned(RPCAUTHGSS_SVCINTEGRITY); + len++; + } else if (retnes.nes_secflavors[i] == RPCSEC_GSS_KRB5P) { + NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); + *tl = txdr_unsigned(RPCAUTH_GSS); + nfsm_strtom(nd, nfsgss_mechlist[KERBV_MECH].str, + nfsgss_mechlist[KERBV_MECH].len); + NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(GSS_KERBV_QOP); + *tl = txdr_unsigned(RPCAUTHGSS_SVCPRIVACY); + len++; + } + } + *sizp = txdr_unsigned(len); + +nfsmout: + NFSEXITCODE2(error, nd); + return (error); +} + /* * nfsv4 set client id service */ diff --git a/sys/fs/nfsserver/nfs_nfsdsocket.c b/sys/fs/nfsserver/nfs_nfsdsocket.c index e9602c352420..a8e1757835ac 100644 --- a/sys/fs/nfsserver/nfs_nfsdsocket.c +++ b/sys/fs/nfsserver/nfs_nfsdsocket.c @@ -188,7 +188,7 @@ int (*nfsrv4_ops0[NFSV42_NOPS])(struct nfsrv_descript *, nfsrvd_layoutcommit, nfsrvd_layoutget, nfsrvd_layoutreturn, - nfsrvd_notsupp, + nfsrvd_secinfononame, nfsrvd_sequence, nfsrvd_notsupp, nfsrvd_teststateid, @@ -1175,9 +1175,20 @@ tryagain: } break; } - if (nd->nd_repstat == 0) + if (nd->nd_repstat == 0) { error = (*(nfsrv4_ops0[op]))(nd, isdgram, vp, &vpnes); + if ((op == NFSV4OP_SECINFO || + op == NFSV4OP_SECINFONONAME) && + error == 0 && nd->nd_repstat == 0) { + /* + * Secinfo and Secinfo_no_name + * consume the current FH. + */ + vrele(vp); + vp = NULL; + } + } if (nfsv4_opflag[op].modifyfs) vn_finished_write(temp_mp); } else { diff --git a/sys/fs/nfsserver/nfs_nfsdsubs.c b/sys/fs/nfsserver/nfs_nfsdsubs.c index 49c5cac999c7..2b6e17752544 100644 --- a/sys/fs/nfsserver/nfs_nfsdsubs.c +++ b/sys/fs/nfsserver/nfs_nfsdsubs.c @@ -1890,7 +1890,8 @@ nfsrv_parsename(struct nfsrv_descript *nd, char *bufp, u_long *hashp, * For V4, check for lookup parent. * Otherwise, get the component name. */ - if ((nd->nd_flag & ND_NFSV4) && nd->nd_procnum == NFSV4OP_LOOKUPP) { + if ((nd->nd_flag & ND_NFSV4) && (nd->nd_procnum == NFSV4OP_LOOKUPP || + nd->nd_procnum == NFSV4OP_SECINFONONAME)) { *tocp++ = '.'; hash += ((u_char)'.'); *tocp++ = '.'; From owner-dev-commits-src-main@freebsd.org Mon May 31 02:11:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A3D163C782; Mon, 31 May 2021 02:11:19 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ftf0l1LTkz4sgc; Mon, 31 May 2021 02:11:18 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pf1-x435.google.com with SMTP id x18so7863724pfi.9; Sun, 30 May 2021 19:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:message-id:date:mime-version:user-agent:reply-to:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=zMIHyhOgbgrCbvfJmx+31u6BjHc2zCi3QqEzsAQ1cw8=; b=SYRcsn8wxxLjnomAuty5lLC3Nqq1RPEdJWg6eGEIdNYDZ308rzeUcVpi2Y4XTD4rNJ uXVQybMqV87CaKA1D2yAwXFodTowuO3Ttu1klzMKo21A5ZDXpfUwc2hX6Ph6VyW2Saq6 4S3HCkFW2QfjugY2mVjc+igoR/8WQWVBdcMK4fxq47z69tYRryP0z9k6Yi/qzANQDq6m fcBQtqYGhVUAS6KSR3w7tenEnb1QzpAL+9RX/Rv8Qp8YzNdG3hPWL/piaRl2/T/2jfmG qR0YpzMmKmQYq67GGsn0qR5/WKxz3QoOIjys6ZpBZpDwwSWHbTUbm17JWExIeFHjBJYa 7kcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :reply-to:subject:content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=zMIHyhOgbgrCbvfJmx+31u6BjHc2zCi3QqEzsAQ1cw8=; b=G4F+3Cw9E/x4fYwe98vjpU698eWRSxpG3mZkDHUmovE/AvLaMVPmQHVJVNSXZvLniZ 1Erlh9bIB2TQSsx6uO87go/eXD7fWTWWek8gwh78N8DPqZR+fsBPP349iBybu1lO6YdU uUnbup5mQ3YXoBP5Wwy0j8842HuTE5yCBYuOTwQhDjr3HrrgDvZfugeBnfaXSoSabFZL XMaGptooRqcwr3xn3rxa13Fnsc57HH3YCkWPBYkqWilxAjXyBn3/B/jiWKeF5ts71LVi jB17vojr0qWdudC+HqjApkVdg9w+gRQrUfx50+uqKpHsa8Ahpk+dSZTAAz2qnUOS0Bws tcmQ== X-Gm-Message-State: AOAM531J1y1082S9cWxTWzZ2iZYa7QgULOyI7cz3G2eDBs90xoT+a8Mj mwsDAWqBsR15gwJIxQ8AeWiK5OqwhIV1kQ== X-Google-Smtp-Source: ABdhPJzdY9xS7gjKawKyIvLADC5r2A1W5uqpylgnEKuDX5UVMvbIZWL5FOkZC3ccFf+FXy4Vzg392g== X-Received: by 2002:a62:ee0f:0:b029:2e9:a990:5afb with SMTP id e15-20020a62ee0f0000b02902e9a9905afbmr9133239pfi.41.1622427077049; Sun, 30 May 2021 19:11:17 -0700 (PDT) Received: from ?IPV6:2403:5800:7500:3601:7d0d:18fb:cdf3:35cc? (2403-5800-7500-3601-7d0d-18fb-cdf3-35cc.ip6.aussiebb.net. [2403:5800:7500:3601:7d0d:18fb:cdf3:35cc]) by smtp.gmail.com with UTF8SMTPSA id r28sm9958420pgm.53.2021.05.30.19.11.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 30 May 2021 19:11:16 -0700 (PDT) Sender: Kubilay Kocak Message-ID: <52c0315a-ab34-6662-3760-53357b6aedaf@FreeBSD.org> Date: Mon, 31 May 2021 12:11:12 +1000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Thunderbird/90.0a1 Reply-To: koobs@FreeBSD.org Subject: Re: git: 5a20c351ea45 - main - [skip ci] add a CODEOWNERS file Content-Language: en-US To: Alan Somers , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> From: Kubilay Kocak In-Reply-To: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Ftf0l1LTkz4sgc X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 02:11:19 -0000 On 31/05/2021 8:49 am, Alan Somers wrote: > The branch main has been updated by asomers: > > URL: https://cgit.FreeBSD.org/src/commit/?id=5a20c351ea457d2beae661c197fcaa97c9ec0637 > > commit 5a20c351ea457d2beae661c197fcaa97c9ec0637 > Author: Alan Somers > AuthorDate: 2021-05-30 21:54:46 +0000 > Commit: Alan Somers > CommitDate: 2021-05-30 22:49:07 +0000 > > [skip ci] add a CODEOWNERS file > > Summary: > Convert MAINTAINERS into a Github CODEOWNERS file. This will > automatically assign reviewers to some GH pull requests. The conversion > is not 1:1; some committers don't have Github accounts (e.g. adrian), > some functional areas don't neatly correspond to a set of files (e.g. > kqueue), and mailing lists can't be assigned as a reviewer (e.g. > secteam@). But it's a start. > > MFC after: 2 weeks > Reviewed by: imp > Differential Revision: https://reviews.freebsd.org/D30559 > --- > .github/CODEOWNERS | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 101 insertions(+) > > diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS > new file mode 100644 > index 000000000000..8cdb55e3b58a > --- /dev/null > +++ b/.github/CODEOWNERS > @@ -0,0 +1,101 @@ > +# Please note that the content of this file is strictly advisory. > +# No locks listed here are valid. The only strict review requirements > +# are granted by core. These are documented in head/LOCKS and enforced > +# by svnadmin/conf/approvers. > +# > +# The source tree is a community effort. However, some folks go to the > +# trouble of looking after particular areas of the tree. In return for > +# their active caretaking of the code it is polite to coordinate changes > +# with them. This is a list of people who have expressed an interest in > +# part of the code or listed their active caretaking role so that other > +# committers can easily find somebody who is familiar with it. The notes > +# should specify if there is a 3rd party source tree involved or other > +# things that should be kept in mind. > +# > +# However, this is not a 'big stick', it is an offer to help and a source > +# of guidance. It does not override the communal nature of the tree. > +# It is not a registry of 'turf' or private property. > +# > +# *** > +# This list is prone to becoming stale quickly. The best way to find the recent > +# maintainer of a sub-system is to check recent logs for that directory or > +# sub-system. > +# *** > +# > +# *** > +# Maintainers are encouraged to visit: > +# https://reviews.freebsd.org/herald > +# > +# and configure Phabricator notifications for parts of the tree which they > +# maintain. Notifications can automatically be sent when someone proposes a > +# revision or makes a commit to the specified subtree. > +# *** > + > +autofs/ @trasz > +iscsi/ @trasz > +kqueue/ @jmgurney > +libpam/ @dag-erling > +linprocfs/ @dag-erling > +opencrypto/ @jmgurney > +openssl/ @juikim > +procfs/ @dag-erling > +pseudofs/ @dag-erling > +rctl/ @trasz > +vmm/ @bsdjhb @grehan-freebsd > +/bin/sh @jillest > +/contrib/atf @ngie > +/contrib/capsicum-test @ngie > +/contrib/googletest @ngie > +/contrib/ipfilter @cschuber > +/contrib/libcxxrt @DimitryAndric @emaste > +/contrib/llvm-project @DimitryAndric > +/contrib/llvm-project/libunwind @DimitryAndric @emaste @bsdjhb > +/contrib/llvm-project/lldb @DimitryAndric @emaste > +/contrib/llvm-project/openmp @DimitryAndric @emaste > +/contrib/netbsd-tests @ngie > +/contrib/pjdfstest @ngie @asomers > +/crypto/openssh @dag-erling > +/etc/mail @gshapiro > +/etc/sendmail @gshapiro > +/lib/libc/sys/kevent.c @jmgurney > +/lib/libdpv @devinteske > +/lib/libfetch @dag-erling > +/lib/libfigpar @dag-erling > +/lib/libvmmapi @bsdjhb @grehan-freebsd > +/sbin/mount_fusefs @asomers > +/share/mk @bsdimp @bapt @bdrewery @emaste @sgerraty > +/stand/forth @devinteske > +/stand/lua @kevans91 > +/sys/amd64/pci @bsdimp @bsdjhb > +/sys/arm/allwinner @evadot > +/sys/arm64/rockchip @evadot > +/sys/compat/linuxkpi @hselasky > +/sys/contrib/dev/ice @ricera > +/sys/contrib/ipfilter @cschuber > +/sys/dev/drm2 @bsdimp > +/sys/dev/e1000 @ricera > +/sys/dev/ice @ricera > +/sys/dev/ixgbe @ricera > +/sys/dev/ixl @ricera > +/sys/dev/ofw @nwhitehorn > +/sys/dev/pci @bsdimp @bsdjhb > +/sys/dev/sound/usb @hselasky > +/sys/dev/usb @hselasky > +/sys/fs/fuse/ @asomers > +/sys/netinet/ip_carp.c @glebius > +/sys/netinet/sctp_* @tuexen > +/sys/netpfil/pf @kprovost @glebius > +/sys/x86/pci @bsdimp @bsdjhb > +/tests @ngie > +/tests/sys/fs/fusefs/ @asomers > +/tools/build @bsdimp > +/tools/tools/nanobsd @bsdimp > +/usr.bin/dpv @devinteske > +/usr.bin/top @grimreaper > +/usr.sbin/bhyve @bsdjhb @grehan-freebsd > +/usr.sbin/bhyvectl @bsdjhb @grehan-freebsd > +/usr.sbin/bhyveload @bsdjhb @grehan-freebsd > +/usr.sbin/bsdconfig @devinteske > +/usr.sbin/lpr @gbergling > +/usr.sbin/sysrc @devinteske > +/usr/bin/fetch @dag-erling > _______________________________________________ > dev-commits-src-main@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main > To unsubscribe, send any mail to "dev-commits-src-main-unsubscribe@freebsd.org" > Yay. From owner-dev-commits-src-main@freebsd.org Mon May 31 03:50:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 499B763D8E7; Mon, 31 May 2021 03:50:24 +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 4FthC413kgz3JVj; Mon, 31 May 2021 03:50:24 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 055521395; Mon, 31 May 2021 03:50: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 14V3oNsj000197; Mon, 31 May 2021 03:50:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14V3oNq2000196; Mon, 31 May 2021 03:50:23 GMT (envelope-from git) Date: Mon, 31 May 2021 03:50:23 GMT Message-Id: <202105310350.14V3oNq2000196@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: d40cd26a86a7 - main - ip_mroute: rework ip_mroute MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d40cd26a86a79342d175296b74768dd7183fc02b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 03:50:24 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=d40cd26a86a79342d175296b74768dd7183fc02b commit d40cd26a86a79342d175296b74768dd7183fc02b Author: Wojciech Macek AuthorDate: 2021-05-17 10:45:18 +0000 Commit: Wojciech Macek CommitDate: 2021-05-31 03:48:15 +0000 ip_mroute: rework ip_mroute Approved by: mw Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D30354 Changes: 1. add spinlock to bw_meter If two contexts read and modify bw_meter values it might happen that these are corrupted. Guard only code fragments which do read-and-modify. Context which only do "reads" are not done inside spinlock block. The only sideffect that can happen is an 1-p;acket outdated value reported back to userspace. 2. replace all locks with a single RWLOCK Multiple locks caused a performance issue in routing hot path, when two of them had to be taken. All locks were replaced with single RWLOCK which makes the hot path able to take only shared access to lock most of the times. All configuration routines have to take exclusive lock (as it was done before) but these operation are very rare compared to packet routing. 3. redesign MFC expire and UPCALL expire Use generic kthread and cv_wait/cv_signal for deferring work. Previously, upcalls could be sent from two contexts which complicated the design. All upcall sending is now done in a kthread which allows hot path to work more efficient in some rare cases. 4. replace mutex-guarded linked list with lock free buf_ring All message and data is now passed over lockless buf_ring. This allowed to remove some heavy locking when linked lists were used. --- sys/netinet/ip_mroute.c | 751 +++++++++++++++++++++++++++--------------------- sys/netinet/ip_mroute.h | 11 +- 2 files changed, 426 insertions(+), 336 deletions(-) diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index 5414b0e3da0e..ee0c886f9f3d 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -80,8 +80,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include @@ -136,13 +138,19 @@ static MALLOC_DEFINE(M_MRTABLE, "mroutetbl", "multicast forwarding cache"); * structures. */ -static struct mtx mrouter_mtx; -#define MROUTER_LOCK() mtx_lock(&mrouter_mtx) -#define MROUTER_UNLOCK() mtx_unlock(&mrouter_mtx) -#define MROUTER_LOCK_ASSERT() mtx_assert(&mrouter_mtx, MA_OWNED) -#define MROUTER_LOCK_INIT() \ - mtx_init(&mrouter_mtx, "IPv4 multicast forwarding", NULL, MTX_DEF) -#define MROUTER_LOCK_DESTROY() mtx_destroy(&mrouter_mtx) +static struct rwlock mrouter_mtx; +#define MRW_RLOCK() rw_rlock(&mrouter_mtx) +#define MRW_WLOCK() rw_wlock(&mrouter_mtx) +#define MRW_RUNLOCK() rw_runlock(&mrouter_mtx) +#define MRW_WUNLOCK() rw_wunlock(&mrouter_mtx) +#define MRW_UNLOCK() rw_unlock(&mrouter_mtx) +#define MRW_LOCK_ASSERT() rw_assert(&mrouter_mtx, RA_LOCKED) +#define MRW_WLOCK_ASSERT() rw_assert(&mrouter_mtx, RA_WLOCKED) +#define MRW_LOCK_TRY_UPGRADE() rw_try_upgrade(&mrouter_mtx) +#define MRW_WOWNED() rw_wowned(&mrouter_mtx) +#define MRW_LOCK_INIT() \ + rw_init(&mrouter_mtx, "IPv4 multicast forwarding") +#define MRW_LOCK_DESTROY() rw_destroy(&mrouter_mtx) static int ip_mrouter_cnt; /* # of vnets with active mrouters */ static int ip_mrouter_unloading; /* Allow no more V_ip_mrouter sockets */ @@ -167,32 +175,25 @@ VNET_DEFINE_STATIC(u_char *, nexpire); /* 0..mfchashsize-1 */ VNET_DEFINE_STATIC(LIST_HEAD(mfchashhdr, mfc)*, mfchashtbl); #define V_mfchashtbl VNET(mfchashtbl) -static struct mtx mfc_mtx; -#define MFC_LOCK() mtx_lock(&mfc_mtx) -#define MFC_UNLOCK() mtx_unlock(&mfc_mtx) -#define MFC_LOCK_ASSERT() mtx_assert(&mfc_mtx, MA_OWNED) -#define MFC_LOCK_INIT() \ - mtx_init(&mfc_mtx, "IPv4 multicast forwarding cache", NULL, MTX_DEF) -#define MFC_LOCK_DESTROY() mtx_destroy(&mfc_mtx) - VNET_DEFINE_STATIC(vifi_t, numvifs); #define V_numvifs VNET(numvifs) VNET_DEFINE_STATIC(struct vif *, viftable); #define V_viftable VNET(viftable) -static struct mtx vif_mtx; -#define VIF_LOCK() mtx_lock(&vif_mtx) -#define VIF_UNLOCK() mtx_unlock(&vif_mtx) -#define VIF_LOCK_ASSERT() mtx_assert(&vif_mtx, MA_OWNED) -#define VIF_LOCK_INIT() \ - mtx_init(&vif_mtx, "IPv4 multicast interfaces", NULL, MTX_DEF) -#define VIF_LOCK_DESTROY() mtx_destroy(&vif_mtx) - static eventhandler_tag if_detach_event_tag = NULL; VNET_DEFINE_STATIC(struct callout, expire_upcalls_ch); #define V_expire_upcalls_ch VNET(expire_upcalls_ch) +VNET_DEFINE_STATIC(struct mtx, upcall_thread_mtx); +#define V_upcall_thread_mtx VNET(upcall_thread_mtx) + +VNET_DEFINE_STATIC(struct cv, upcall_thread_cv); +#define V_upcall_thread_cv VNET(upcall_thread_cv) + +VNET_DEFINE_STATIC(struct mtx, buf_ring_mtx); +#define V_buf_ring_mtx VNET(buf_ring_mtx) + #define EXPIRE_TIMEOUT (hz / 4) /* 4x / second */ #define UPCALL_EXPIRE 6 /* number of timeouts */ @@ -202,15 +203,15 @@ VNET_DEFINE_STATIC(struct callout, expire_upcalls_ch); static MALLOC_DEFINE(M_BWMETER, "bwmeter", "multicast upcall bw meters"); /* - * Pending upcalls are stored in a vector which is flushed when + * Pending upcalls are stored in a ring which is flushed when * full, or periodically */ -VNET_DEFINE_STATIC(struct bw_upcall *, bw_upcalls); -#define V_bw_upcalls VNET(bw_upcalls) -VNET_DEFINE_STATIC(u_int, bw_upcalls_n); /* # of pending upcalls */ -#define V_bw_upcalls_n VNET(bw_upcalls_n) VNET_DEFINE_STATIC(struct callout, bw_upcalls_ch); #define V_bw_upcalls_ch VNET(bw_upcalls_ch) +VNET_DEFINE_STATIC(struct buf_ring *, bw_upcalls_ring); +#define V_bw_upcalls_ring VNET(bw_upcalls_ring) +VNET_DEFINE_STATIC(struct mtx, bw_upcalls_ring_mtx); +#define V_bw_upcalls_ring_mtx VNET(bw_upcalls_ring_mtx) #define BW_UPCALLS_PERIOD (hz) /* periodical flush of bw upcalls */ @@ -228,6 +229,8 @@ SYSCTL_ULONG(_net_inet_pim, OID_AUTO, squelch_wholepkt, CTLFLAG_RW, &pim_squelch_wholepkt, 0, "Disable IGMP_WHOLEPKT notifications if rendezvous point is unspecified"); +static volatile int upcall_thread_shutdown = 0; + static const struct encaptab *pim_encap_cookie; static int pim_encapcheck(const struct mbuf *, int, int, void *); static int pim_input(struct mbuf *, int, int, void *); @@ -367,18 +370,41 @@ mfc_find(struct in_addr *o, struct in_addr *g) { struct mfc *rt; - MFC_LOCK_ASSERT(); + /* + * Might be called both RLOCK and WLOCK. + * Check if any, it's caller responsibility + * to choose correct option. + */ + MRW_LOCK_ASSERT(); LIST_FOREACH(rt, &V_mfchashtbl[MFCHASH(*o, *g)], mfc_hash) { if (in_hosteq(rt->mfc_origin, *o) && in_hosteq(rt->mfc_mcastgrp, *g) && - TAILQ_EMPTY(&rt->mfc_stall)) + buf_ring_empty(rt->mfc_stall_ring)) break; } return (rt); } +static __inline struct mfc * +mfc_alloc(void) +{ + struct mfc *rt; + rt = (struct mfc*) malloc(sizeof(*rt), M_MRTABLE, M_NOWAIT | M_ZERO); + if (rt == NULL) + return rt; + + rt->mfc_stall_ring = buf_ring_alloc(MAX_UPQ, M_MRTABLE, + M_NOWAIT, &V_buf_ring_mtx); + if (rt->mfc_stall_ring == NULL) { + free(rt, M_MRTABLE); + return NULL; + } + + return rt; +} + /* * Handle MRT setsockopt commands to modify the multicast forwarding tables. */ @@ -552,17 +578,17 @@ get_sg_cnt(struct sioc_sg_req *req) { struct mfc *rt; - MFC_LOCK(); + MRW_RLOCK(); rt = mfc_find(&req->src, &req->grp); if (rt == NULL) { - MFC_UNLOCK(); + MRW_RUNLOCK(); req->pktcnt = req->bytecnt = req->wrong_if = 0xffffffff; return EADDRNOTAVAIL; } req->pktcnt = rt->mfc_pkt_cnt; req->bytecnt = rt->mfc_byte_cnt; req->wrong_if = rt->mfc_wrong_if; - MFC_UNLOCK(); + MRW_RUNLOCK(); return 0; } @@ -574,17 +600,19 @@ get_vif_cnt(struct sioc_vif_req *req) { vifi_t vifi = req->vifi; - VIF_LOCK(); + MRW_RLOCK(); if (vifi >= V_numvifs) { - VIF_UNLOCK(); + MRW_RUNLOCK(); return EINVAL; } + mtx_lock_spin(&V_viftable[vifi].v_spin); req->icount = V_viftable[vifi].v_pkt_in; req->ocount = V_viftable[vifi].v_pkt_out; req->ibytes = V_viftable[vifi].v_bytes_in; req->obytes = V_viftable[vifi].v_bytes_out; - VIF_UNLOCK(); + mtx_unlock_spin(&V_viftable[vifi].v_spin); + MRW_RUNLOCK(); return 0; } @@ -595,16 +623,13 @@ if_detached_event(void *arg __unused, struct ifnet *ifp) vifi_t vifi; u_long i; - MROUTER_LOCK(); + MRW_WLOCK(); if (V_ip_mrouter == NULL) { - MROUTER_UNLOCK(); + MRW_WUNLOCK(); return; } - VIF_LOCK(); - MFC_LOCK(); - /* * Tear down multicast forwarder state associated with this ifnet. * 1. Walk the vif list, matching vifs against this ifnet. @@ -628,10 +653,26 @@ if_detached_event(void *arg __unused, struct ifnet *ifp) del_vif_locked(vifi); } - MFC_UNLOCK(); - VIF_UNLOCK(); + MRW_WUNLOCK(); +} + +static void +ip_mrouter_upcall_thread(void *arg) +{ + CURVNET_SET((struct vnet *) arg); + + while (upcall_thread_shutdown == 0) { + /* START: Event loop */ + + /* END: Event loop */ + mtx_lock(&V_upcall_thread_mtx); + cv_timedwait(&V_upcall_thread_cv, &V_upcall_thread_mtx, hz); + mtx_unlock(&V_upcall_thread_mtx); + } - MROUTER_UNLOCK(); + upcall_thread_shutdown = 0; + CURVNET_RESTORE(); + kthread_exit(); } /* @@ -650,21 +691,35 @@ ip_mrouter_init(struct socket *so, int version) if (version != 1) return ENOPROTOOPT; - MROUTER_LOCK(); + MRW_WLOCK(); if (ip_mrouter_unloading) { - MROUTER_UNLOCK(); + MRW_WUNLOCK(); return ENOPROTOOPT; } if (V_ip_mrouter != NULL) { - MROUTER_UNLOCK(); + MRW_WUNLOCK(); return EADDRINUSE; } V_mfchashtbl = hashinit_flags(mfchashsize, M_MRTABLE, &V_mfchash, HASH_NOWAIT); + /* Create upcall ring */ + mtx_init(&V_bw_upcalls_ring_mtx, "mroute upcall buf_ring mtx", NULL, MTX_DEF); + V_bw_upcalls_ring = buf_ring_alloc(BW_UPCALLS_MAX, M_MRTABLE, + M_NOWAIT, &V_bw_upcalls_ring_mtx); + if (!V_bw_upcalls_ring) + return (ENOMEM); + + /* Create upcall thread */ + upcall_thread_shutdown = 0; + mtx_init(&V_upcall_thread_mtx, "ip_mroute upcall thread mtx", NULL, MTX_DEF); + cv_init(&V_upcall_thread_cv, "ip_mroute upcall cv"); + kthread_add(ip_mrouter_upcall_thread, curvnet, + NULL, NULL, 0, 0, "ip_mroute upcall thread"); + callout_reset(&V_expire_upcalls_ch, EXPIRE_TIMEOUT, expire_upcalls, curvnet); callout_reset(&V_bw_upcalls_ch, BW_UPCALLS_PERIOD, expire_bw_upcalls_send, @@ -673,7 +728,10 @@ ip_mrouter_init(struct socket *so, int version) V_ip_mrouter = so; ip_mrouter_cnt++; - MROUTER_UNLOCK(); + /* This is a mutex required by buf_ring init, but not used internally */ + mtx_init(&V_buf_ring_mtx, "mroute buf_ring mtx", NULL, MTX_DEF); + + MRW_WUNLOCK(); CTR1(KTR_IPMF, "%s: done", __func__); @@ -689,11 +747,12 @@ X_ip_mrouter_done(void) struct ifnet *ifp; u_long i; vifi_t vifi; + struct bw_upcall *bu; - MROUTER_LOCK(); + MRW_WLOCK(); if (V_ip_mrouter == NULL) { - MROUTER_UNLOCK(); + MRW_WUNLOCK(); return EINVAL; } @@ -706,7 +765,22 @@ X_ip_mrouter_done(void) MROUTER_WAIT(); - VIF_LOCK(); + upcall_thread_shutdown = 1; + mtx_lock(&V_upcall_thread_mtx); + cv_signal(&V_upcall_thread_cv); + mtx_unlock(&V_upcall_thread_mtx); + + /* Wait for thread shutdown */ + while (upcall_thread_shutdown == 1) {}; + + mtx_destroy(&V_upcall_thread_mtx); + + /* Destroy upcall ring */ + while ((bu = buf_ring_dequeue_mc(V_bw_upcalls_ring)) != NULL) { + free(bu, M_MRTABLE); + } + buf_ring_free(V_bw_upcalls_ring, M_MRTABLE); + mtx_destroy(&V_bw_upcalls_ring_mtx); /* * For each phyint in use, disable promiscuous reception of all IP @@ -723,13 +797,9 @@ X_ip_mrouter_done(void) V_numvifs = 0; V_pim_assert_enabled = 0; - VIF_UNLOCK(); - callout_stop(&V_expire_upcalls_ch); callout_stop(&V_bw_upcalls_ch); - MFC_LOCK(); - /* * Free all multicast forwarding cache entries. * Do not use hashdestroy(), as we must perform other cleanup. @@ -746,13 +816,11 @@ X_ip_mrouter_done(void) bzero(V_nexpire, sizeof(V_nexpire[0]) * mfchashsize); - V_bw_upcalls_n = 0; - - MFC_UNLOCK(); - V_reg_vif_num = VIFI_INVALID; - MROUTER_UNLOCK(); + mtx_destroy(&V_buf_ring_mtx); + + MRW_WUNLOCK(); CTR1(KTR_IPMF, "%s: done", __func__); @@ -797,17 +865,17 @@ set_api_config(uint32_t *apival) return EPERM; } - MFC_LOCK(); + MRW_RLOCK(); for (i = 0; i < mfchashsize; i++) { if (LIST_FIRST(&V_mfchashtbl[i]) != NULL) { - MFC_UNLOCK(); + MRW_RUNLOCK(); *apival = 0; return EPERM; } } - MFC_UNLOCK(); + MRW_RUNLOCK(); V_mrt_api_config = *apival & mrt_api_support; *apival = V_mrt_api_config; @@ -827,23 +895,23 @@ add_vif(struct vifctl *vifcp) struct ifnet *ifp; int error; - VIF_LOCK(); + MRW_WLOCK(); if (vifcp->vifc_vifi >= MAXVIFS) { - VIF_UNLOCK(); + MRW_WUNLOCK(); return EINVAL; } /* rate limiting is no longer supported by this code */ if (vifcp->vifc_rate_limit != 0) { log(LOG_ERR, "rate limiting is no longer supported\n"); - VIF_UNLOCK(); + MRW_WUNLOCK(); return EINVAL; } if (!in_nullhost(vifp->v_lcl_addr)) { - VIF_UNLOCK(); + MRW_WUNLOCK(); return EADDRINUSE; } if (in_nullhost(vifcp->vifc_lcl_addr)) { - VIF_UNLOCK(); + MRW_WUNLOCK(); return EADDRNOTAVAIL; } @@ -863,7 +931,7 @@ add_vif(struct vifctl *vifcp) ifa = ifa_ifwithaddr((struct sockaddr *)&sin); if (ifa == NULL) { NET_EPOCH_EXIT(et); - VIF_UNLOCK(); + MRW_WUNLOCK(); return EADDRNOTAVAIL; } ifp = ifa->ifa_ifp; @@ -873,7 +941,7 @@ add_vif(struct vifctl *vifcp) if ((vifcp->vifc_flags & VIFF_TUNNEL) != 0) { CTR1(KTR_IPMF, "%s: tunnels are no longer supported", __func__); - VIF_UNLOCK(); + MRW_WUNLOCK(); return EOPNOTSUPP; } else if (vifcp->vifc_flags & VIFF_REGISTER) { ifp = &V_multicast_register_if; @@ -885,14 +953,14 @@ add_vif(struct vifctl *vifcp) } } else { /* Make sure the interface supports multicast */ if ((ifp->if_flags & IFF_MULTICAST) == 0) { - VIF_UNLOCK(); + MRW_WUNLOCK(); return EOPNOTSUPP; } /* Enable promiscuous reception of all IP multicasts from the if */ error = if_allmulti(ifp, 1); if (error) { - VIF_UNLOCK(); + MRW_WUNLOCK(); return error; } } @@ -907,12 +975,14 @@ add_vif(struct vifctl *vifcp) vifp->v_pkt_out = 0; vifp->v_bytes_in = 0; vifp->v_bytes_out = 0; + sprintf(vifp->v_spin_name, "BM[%d] spin", vifcp->vifc_vifi); + mtx_init(&vifp->v_spin, vifp->v_spin_name, NULL, MTX_SPIN); /* Adjust numvifs up if the vifi is higher than numvifs */ if (V_numvifs <= vifcp->vifc_vifi) V_numvifs = vifcp->vifc_vifi + 1; - VIF_UNLOCK(); + MRW_WUNLOCK(); CTR4(KTR_IPMF, "%s: add vif %d laddr 0x%08x thresh %x", __func__, (int)vifcp->vifc_vifi, ntohl(vifcp->vifc_lcl_addr.s_addr), @@ -929,7 +999,7 @@ del_vif_locked(vifi_t vifi) { struct vif *vifp; - VIF_LOCK_ASSERT(); + MRW_WLOCK_ASSERT(); if (vifi >= V_numvifs) { return EINVAL; @@ -945,6 +1015,8 @@ del_vif_locked(vifi_t vifi) if (vifp->v_flags & VIFF_REGISTER) V_reg_vif_num = VIFI_INVALID; + mtx_destroy(&vifp->v_spin); + bzero((caddr_t)vifp, sizeof (*vifp)); CTR2(KTR_IPMF, "%s: delete vif %d", __func__, (int)vifi); @@ -963,9 +1035,9 @@ del_vif(vifi_t vifi) { int cc; - VIF_LOCK(); + MRW_WLOCK(); cc = del_vif_locked(vifi); - VIF_UNLOCK(); + MRW_WUNLOCK(); return cc; } @@ -1012,18 +1084,21 @@ init_mfc_params(struct mfc *rt, struct mfcctl2 *mfccp) static void expire_mfc(struct mfc *rt) { - struct rtdetq *rte, *nrte; + struct rtdetq *rte; - MFC_LOCK_ASSERT(); + MRW_WLOCK_ASSERT(); free_bw_list(rt->mfc_bw_meter_leq); free_bw_list(rt->mfc_bw_meter_geq); - TAILQ_FOREACH_SAFE(rte, &rt->mfc_stall, rte_link, nrte) { - m_freem(rte->m); - TAILQ_REMOVE(&rt->mfc_stall, rte, rte_link); - free(rte, M_MRTABLE); + while (!buf_ring_empty(rt->mfc_stall_ring)) { + rte = buf_ring_dequeue_mc(rt->mfc_stall_ring); + if (rte) { + m_freem(rte->m); + free(rte, M_MRTABLE); + } } + buf_ring_free(rt->mfc_stall_ring, M_MRTABLE); LIST_REMOVE(rt, mfc_hash); free(rt, M_MRTABLE); @@ -1036,13 +1111,11 @@ static int add_mfc(struct mfcctl2 *mfccp) { struct mfc *rt; - struct rtdetq *rte, *nrte; + struct rtdetq *rte; u_long hash = 0; u_short nstl; - VIF_LOCK(); - MFC_LOCK(); - + MRW_WLOCK(); rt = mfc_find(&mfccp->mfcc_origin, &mfccp->mfcc_mcastgrp); /* If an entry already exists, just update the fields */ @@ -1052,8 +1125,7 @@ add_mfc(struct mfcctl2 *mfccp) (u_long)ntohl(mfccp->mfcc_mcastgrp.s_addr), mfccp->mfcc_parent); update_mfc_params(rt, mfccp); - MFC_UNLOCK(); - VIF_UNLOCK(); + MRW_WUNLOCK(); return (0); } @@ -1065,13 +1137,13 @@ add_mfc(struct mfcctl2 *mfccp) LIST_FOREACH(rt, &V_mfchashtbl[hash], mfc_hash) { if (in_hosteq(rt->mfc_origin, mfccp->mfcc_origin) && in_hosteq(rt->mfc_mcastgrp, mfccp->mfcc_mcastgrp) && - !TAILQ_EMPTY(&rt->mfc_stall)) { + !buf_ring_empty(rt->mfc_stall_ring)) { CTR5(KTR_IPMF, "%s: add mfc orig 0x%08x group %lx parent %x qh %p", __func__, ntohl(mfccp->mfcc_origin.s_addr), (u_long)ntohl(mfccp->mfcc_mcastgrp.s_addr), mfccp->mfcc_parent, - TAILQ_FIRST(&rt->mfc_stall)); + rt->mfc_stall_ring); if (nstl++) CTR1(KTR_IPMF, "%s: multiple matches", __func__); @@ -1080,12 +1152,11 @@ add_mfc(struct mfcctl2 *mfccp) V_nexpire[hash]--; /* Free queued packets, but attempt to forward them first. */ - TAILQ_FOREACH_SAFE(rte, &rt->mfc_stall, rte_link, nrte) { + while (!buf_ring_empty(rt->mfc_stall_ring)) { + rte = buf_ring_dequeue_mc(rt->mfc_stall_ring); if (rte->ifp != NULL) ip_mdq(rte->m, rte->ifp, rt, -1); m_freem(rte->m); - TAILQ_REMOVE(&rt->mfc_stall, rte, rte_link); - rt->mfc_nstall--; free(rte, M_MRTABLE); } } @@ -1108,16 +1179,13 @@ add_mfc(struct mfcctl2 *mfccp) } if (rt == NULL) { /* no upcall, so make a new entry */ - rt = (struct mfc *)malloc(sizeof(*rt), M_MRTABLE, M_NOWAIT); + rt = mfc_alloc(); if (rt == NULL) { - MFC_UNLOCK(); - VIF_UNLOCK(); + MRW_WUNLOCK(); return (ENOBUFS); } init_mfc_params(rt, mfccp); - TAILQ_INIT(&rt->mfc_stall); - rt->mfc_nstall = 0; rt->mfc_expire = 0; rt->mfc_bw_meter_leq = NULL; @@ -1128,8 +1196,7 @@ add_mfc(struct mfcctl2 *mfccp) } } - MFC_UNLOCK(); - VIF_UNLOCK(); + MRW_WUNLOCK(); return (0); } @@ -1150,11 +1217,11 @@ del_mfc(struct mfcctl2 *mfccp) CTR3(KTR_IPMF, "%s: delete mfc orig 0x%08x group %lx", __func__, ntohl(origin.s_addr), (u_long)ntohl(mcastgrp.s_addr)); - MFC_LOCK(); + MRW_WLOCK(); rt = mfc_find(&origin, &mcastgrp); if (rt == NULL) { - MFC_UNLOCK(); + MRW_WUNLOCK(); return EADDRNOTAVAIL; } @@ -1169,7 +1236,7 @@ del_mfc(struct mfcctl2 *mfccp) LIST_REMOVE(rt, mfc_hash); free(rt, M_MRTABLE); - MFC_UNLOCK(); + MRW_WUNLOCK(); return (0); } @@ -1210,70 +1277,83 @@ static int X_ip_mforward(struct ip *ip, struct ifnet *ifp, struct mbuf *m, struct ip_moptions *imo) { - struct mfc *rt; - int error; - vifi_t vifi; + struct mfc *rt; + int error; + vifi_t vifi; + struct mbuf *mb0; + struct rtdetq *rte; + u_long hash; + int hlen; - CTR3(KTR_IPMF, "ip_mforward: delete mfc orig 0x%08x group %lx ifp %p", - ntohl(ip->ip_src.s_addr), (u_long)ntohl(ip->ip_dst.s_addr), ifp); + CTR3(KTR_IPMF, "ip_mforward: delete mfc orig 0x%08x group %lx ifp %p", + ntohl(ip->ip_src.s_addr), (u_long)ntohl(ip->ip_dst.s_addr), ifp); + + if (ip->ip_hl < (sizeof(struct ip) + TUNNEL_LEN) >> 2 || + ((u_char *)(ip + 1))[1] != IPOPT_LSRR) { + /* + * Packet arrived via a physical interface or + * an encapsulated tunnel or a register_vif. + */ + } else { + /* + * Packet arrived through a source-route tunnel. + * Source-route tunnels are no longer supported. + */ + return (1); + } - if (ip->ip_hl < (sizeof(struct ip) + TUNNEL_LEN) >> 2 || - ((u_char *)(ip + 1))[1] != IPOPT_LSRR ) { /* - * Packet arrived via a physical interface or - * an encapsulated tunnel or a register_vif. + * BEGIN: MCAST ROUTING HOT PATH */ - } else { + MRW_RLOCK(); + if (imo && ((vifi = imo->imo_multicast_vif) < V_numvifs)) { + if (ip->ip_ttl < MAXTTL) + ip->ip_ttl++; /* compensate for -1 in *_send routines */ + error = ip_mdq(m, ifp, NULL, vifi); + MRW_RUNLOCK(); + return error; + } + /* - * Packet arrived through a source-route tunnel. - * Source-route tunnels are no longer supported. + * Don't forward a packet with time-to-live of zero or one, + * or a packet destined to a local-only group. */ - return (1); - } + if (ip->ip_ttl <= 1 || IN_LOCAL_GROUP(ntohl(ip->ip_dst.s_addr))) { + MRW_RUNLOCK(); + return 0; + } - VIF_LOCK(); - MFC_LOCK(); - if (imo && ((vifi = imo->imo_multicast_vif) < V_numvifs)) { - if (ip->ip_ttl < MAXTTL) - ip->ip_ttl++; /* compensate for -1 in *_send routines */ - error = ip_mdq(m, ifp, NULL, vifi); - MFC_UNLOCK(); - VIF_UNLOCK(); - return error; - } + mfc_find_retry: + /* + * Determine forwarding vifs from the forwarding cache table + */ + MRTSTAT_INC(mrts_mfc_lookups); + rt = mfc_find(&ip->ip_src, &ip->ip_dst); + + /* Entry exists, so forward if necessary */ + if (rt != NULL) { + error = ip_mdq(m, ifp, rt, -1); + /* Generic unlock here as we might release R or W lock */ + MRW_UNLOCK(); + return error; + } - /* - * Don't forward a packet with time-to-live of zero or one, - * or a packet destined to a local-only group. - */ - if (ip->ip_ttl <= 1 || IN_LOCAL_GROUP(ntohl(ip->ip_dst.s_addr))) { - MFC_UNLOCK(); - VIF_UNLOCK(); - return 0; - } + /* + * END: MCAST ROUTING HOT PATH + */ + + /* Further processing must be done with WLOCK taken */ + if ((MRW_WOWNED() == 0) && (MRW_LOCK_TRY_UPGRADE() == 0)) { + MRW_RUNLOCK(); + MRW_WLOCK(); + goto mfc_find_retry; + } - /* - * Determine forwarding vifs from the forwarding cache table - */ - MRTSTAT_INC(mrts_mfc_lookups); - rt = mfc_find(&ip->ip_src, &ip->ip_dst); - - /* Entry exists, so forward if necessary */ - if (rt != NULL) { - error = ip_mdq(m, ifp, rt, -1); - MFC_UNLOCK(); - VIF_UNLOCK(); - return error; - } else { /* * If we don't have a route for packet's origin, * Make a copy of the packet & send message to routing daemon */ - - struct mbuf *mb0; - struct rtdetq *rte; - u_long hash; - int hlen = ip->ip_hl << 2; + hlen = ip->ip_hl << 2; MRTSTAT_INC(mrts_mfc_misses); MRTSTAT_INC(mrts_no_route); @@ -1285,138 +1365,123 @@ X_ip_mforward(struct ip *ip, struct ifnet *ifp, struct mbuf *m, * just going to fail anyway. Make sure to pullup the header so * that other people can't step on it. */ - rte = (struct rtdetq *)malloc((sizeof *rte), M_MRTABLE, + rte = (struct rtdetq*) malloc((sizeof *rte), M_MRTABLE, M_NOWAIT|M_ZERO); if (rte == NULL) { - MFC_UNLOCK(); - VIF_UNLOCK(); - return ENOBUFS; + MRW_WUNLOCK(); + return ENOBUFS; } mb0 = m_copypacket(m, M_NOWAIT); if (mb0 && (!M_WRITABLE(mb0) || mb0->m_len < hlen)) - mb0 = m_pullup(mb0, hlen); + mb0 = m_pullup(mb0, hlen); if (mb0 == NULL) { - free(rte, M_MRTABLE); - MFC_UNLOCK(); - VIF_UNLOCK(); - return ENOBUFS; + free(rte, M_MRTABLE); + MRW_WUNLOCK(); + return ENOBUFS; } /* is there an upcall waiting for this flow ? */ hash = MFCHASH(ip->ip_src, ip->ip_dst); - LIST_FOREACH(rt, &V_mfchashtbl[hash], mfc_hash) { + LIST_FOREACH(rt, &V_mfchashtbl[hash], mfc_hash) + { if (in_hosteq(ip->ip_src, rt->mfc_origin) && in_hosteq(ip->ip_dst, rt->mfc_mcastgrp) && - !TAILQ_EMPTY(&rt->mfc_stall)) + !buf_ring_empty(rt->mfc_stall_ring)) break; } if (rt == NULL) { - int i; - struct igmpmsg *im; - struct sockaddr_in k_igmpsrc = { sizeof k_igmpsrc, AF_INET }; - struct mbuf *mm; - - /* - * Locate the vifi for the incoming interface for this packet. - * If none found, drop packet. - */ - for (vifi = 0; vifi < V_numvifs && + int i; + struct igmpmsg *im; + struct sockaddr_in k_igmpsrc = { sizeof k_igmpsrc, AF_INET }; + struct mbuf *mm; + + /* + * Locate the vifi for the incoming interface for this packet. + * If none found, drop packet. + */ + for (vifi = 0; vifi < V_numvifs && V_viftable[vifi].v_ifp != ifp; vifi++) - ; - if (vifi >= V_numvifs) /* vif not found, drop packet */ - goto non_fatal; - - /* no upcall, so make a new entry */ - rt = (struct mfc *)malloc(sizeof(*rt), M_MRTABLE, M_NOWAIT); - if (rt == NULL) - goto fail; - - /* Make a copy of the header to send to the user level process */ - mm = m_copym(mb0, 0, hlen, M_NOWAIT); - if (mm == NULL) - goto fail1; - - /* - * Send message to routing daemon to install - * a route into the kernel table - */ - - im = mtod(mm, struct igmpmsg *); - im->im_msgtype = IGMPMSG_NOCACHE; - im->im_mbz = 0; - im->im_vif = vifi; - - MRTSTAT_INC(mrts_upcalls); - - k_igmpsrc.sin_addr = ip->ip_src; - if (socket_send(V_ip_mrouter, mm, &k_igmpsrc) < 0) { - CTR0(KTR_IPMF, "ip_mforward: socket queue full"); - MRTSTAT_INC(mrts_upq_sockfull); -fail1: - free(rt, M_MRTABLE); -fail: - free(rte, M_MRTABLE); - m_freem(mb0); - MFC_UNLOCK(); - VIF_UNLOCK(); - return ENOBUFS; - } + ; + if (vifi >= V_numvifs) /* vif not found, drop packet */ + goto non_fatal; - /* insert new entry at head of hash chain */ - rt->mfc_origin.s_addr = ip->ip_src.s_addr; - rt->mfc_mcastgrp.s_addr = ip->ip_dst.s_addr; - rt->mfc_expire = UPCALL_EXPIRE; - V_nexpire[hash]++; - for (i = 0; i < V_numvifs; i++) { - rt->mfc_ttls[i] = 0; - rt->mfc_flags[i] = 0; - } - rt->mfc_parent = -1; + /* no upcall, so make a new entry */ + rt = mfc_alloc(); + if (rt == NULL) + goto fail; - /* clear the RP address */ - rt->mfc_rp.s_addr = INADDR_ANY; - rt->mfc_bw_meter_leq = NULL; - rt->mfc_bw_meter_geq = NULL; + /* Make a copy of the header to send to the user level process */ + mm = m_copym(mb0, 0, hlen, M_NOWAIT); + if (mm == NULL) + goto fail1; - /* initialize pkt counters per src-grp */ - rt->mfc_pkt_cnt = 0; - rt->mfc_byte_cnt = 0; - rt->mfc_wrong_if = 0; - timevalclear(&rt->mfc_last_assert); + /* + * Send message to routing daemon to install + * a route into the kernel table + */ - TAILQ_INIT(&rt->mfc_stall); - rt->mfc_nstall = 0; + im = mtod(mm, struct igmpmsg*); + im->im_msgtype = IGMPMSG_NOCACHE; + im->im_mbz = 0; + im->im_vif = vifi; - /* link into table */ - LIST_INSERT_HEAD(&V_mfchashtbl[hash], rt, mfc_hash); - TAILQ_INSERT_HEAD(&rt->mfc_stall, rte, rte_link); - rt->mfc_nstall++; + MRTSTAT_INC(mrts_upcalls); + + k_igmpsrc.sin_addr = ip->ip_src; + if (socket_send(V_ip_mrouter, mm, &k_igmpsrc) < 0) { + CTR0(KTR_IPMF, "ip_mforward: socket queue full"); *** 645 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Mon May 31 10:44:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 741C164453B; Mon, 31 May 2021 10:44:00 +0000 (UTC) (envelope-from lutz@iks-jena.de) Received: from annwfn.iks-jena.de (annwfn.iks-jena.de [IPv6:2001:4bd8::19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FtsNJ0tL5z4ZT6; Mon, 31 May 2021 10:43:59 +0000 (UTC) (envelope-from lutz@iks-jena.de) X-SMTP-Sender: IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f Received: from belenus.iks-jena.de (belenus.iks-jena.de [IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f]) by annwfn.iks-jena.de (8.15.2/8.15.2) with ESMTPS id 14VAhppV017627 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 31 May 2021 12:43:52 +0200 X-MSA-Host: belenus.iks-jena.de Received: (from lutz@localhost) by belenus.iks-jena.de (8.14.3/8.14.1/Submit) id 14VAhpgi014572; Mon, 31 May 2021 12:43:51 +0200 Date: Mon, 31 May 2021 12:43:51 +0200 From: Lutz Donnerhacke To: Kubilay Kocak Cc: Alan Somers , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 5a20c351ea45 - main - [skip ci] add a CODEOWNERS file Message-ID: <20210531104351.GA14564@belenus.iks-jena.de> References: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> <52c0315a-ab34-6662-3760-53357b6aedaf@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <52c0315a-ab34-6662-3760-53357b6aedaf@FreeBSD.org> X-message-flag: Please send plain text messages only. Thank you. User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Queue-Id: 4FtsNJ0tL5z4ZT6 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 10:44:00 -0000 On Mon, May 31, 2021 at 12:11:12PM +1000, Kubilay Kocak wrote: >> +# The source tree is a community effort. However, some folks go to the >> +# trouble of looking after particular areas of the tree. In return for >> +# their active caretaking of the code it is polite to coordinate changes >> +# with them. This is a list of people who have expressed an interest in >> +# part of the code or listed their active caretaking role so that other >> +# committers can easily find somebody who is familiar with it. The notes >> +# should specify if there is a 3rd party source tree involved or other >> +# things that should be kept in mind. >> +# >> +# However, this is not a 'big stick', it is an offer to help and a source >> +# of guidance. It does not override the communal nature of the tree. >> +# It is not a registry of 'turf' or private property. Who is allowed to add to this file? From owner-dev-commits-src-main@freebsd.org Mon May 31 11:05:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22A4E644C08; Mon, 31 May 2021 11:05:12 +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 4Ftsrm0GVGz4bNr; Mon, 31 May 2021 11:05:12 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E5B8E6C7D; Mon, 31 May 2021 11:05:11 +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 14VB5Bpb076997; Mon, 31 May 2021 11:05:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VB5BQj076996; Mon, 31 May 2021 11:05:11 GMT (envelope-from git) Date: Mon, 31 May 2021 11:05:11 GMT Message-Id: <202105311105.14VB5BQj076996@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: bfd41ba1fe1d - main - libalias: Remove unused function LibAliasCheckNewLink MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bfd41ba1fe1d0e40b6a813aeb0354cac8d884f5b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 11:05:12 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=bfd41ba1fe1d0e40b6a813aeb0354cac8d884f5b commit bfd41ba1fe1d0e40b6a813aeb0354cac8d884f5b Author: Lutz Donnerhacke AuthorDate: 2021-05-15 13:24:12 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-31 10:53:57 +0000 libalias: Remove unused function LibAliasCheckNewLink The functionality to detect a newly created link after processing a single packet is decoupled from the packet processing. Every new packet is processed asynchronously and will reset the indicator, hence the function is unusable. I made a Google search for third party code, which uses the function, and failed to find one. That's why the function should be removed: It unusable and unused. A much simplified API/ABI will remain in anything below 14. Discussed with: kp Reviewed by: manpages (bcr) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30275 --- sys/netinet/libalias/alias.c | 2 -- sys/netinet/libalias/alias.h | 4 +++- sys/netinet/libalias/alias_db.c | 17 +++-------------- sys/netinet/libalias/alias_local.h | 4 ---- sys/netinet/libalias/libalias.3 | 12 +----------- 5 files changed, 7 insertions(+), 32 deletions(-) diff --git a/sys/netinet/libalias/alias.c b/sys/netinet/libalias/alias.c index 0e2756affcb4..39e9b060623d 100644 --- a/sys/netinet/libalias/alias.c +++ b/sys/netinet/libalias/alias.c @@ -1330,7 +1330,6 @@ LibAliasInLocked(struct libalias *la, struct ip *pip, int maxpacketsize) goto getout; } HouseKeeping(la); - ClearCheckNewLink(la); alias_addr = pip->ip_dst; /* Defense against mangled packets */ @@ -1461,7 +1460,6 @@ LibAliasOutLocked(struct libalias *la, goto getout; } HouseKeeping(la); - ClearCheckNewLink(la); /* Defense against mangled packets */ if (ntohs(pip->ip_len) > maxpacketsize diff --git a/sys/netinet/libalias/alias.h b/sys/netinet/libalias/alias.h index 36f1ca168823..558a750b4fd8 100644 --- a/sys/netinet/libalias/alias.h +++ b/sys/netinet/libalias/alias.h @@ -120,10 +120,12 @@ void *LibAliasGetFragment(struct libalias *, void *_ptr); int LibAliasSaveFragment(struct libalias *, void *_ptr); /* Miscellaneous functions. */ -int LibAliasCheckNewLink(struct libalias *); unsigned short LibAliasInternetChecksum(struct libalias *, unsigned short *_ptr, int _nbytes); void LibAliasSetTarget(struct libalias *, struct in_addr _target_addr); +/* never used and never worked, to be removed in FreeBSD 14 */ +int LibAliasCheckNewLink(struct libalias *); + /* Transparent proxying routines. */ int LibAliasProxyRule(struct libalias *, const char *_cmd); diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index 7a84cf310d5a..0273cc84773d 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -1675,7 +1675,6 @@ FindOriginalAddress(struct libalias *la, struct in_addr alias_addr) lnk = FindLinkIn(la, ANY_ADDR, alias_addr, 0, 0, LINK_ADDR, 0); if (lnk == NULL) { - la->newDefaultLink = 1; if (la->targetAddress.s_addr == INADDR_ANY) return (alias_addr); else if (la->targetAddress.s_addr == INADDR_NONE) @@ -2052,13 +2051,6 @@ SetExpire(struct alias_link *lnk, int expire) } } -void -ClearCheckNewLink(struct libalias *la) -{ - LIBALIAS_LOCK_ASSERT(la); - la->newDefaultLink = 0; -} - void SetProtocolFlags(struct alias_link *lnk, int pflags) { @@ -2548,15 +2540,12 @@ getout: return (res); } +/* never used and never worked, to be removed in FreeBSD 14 */ int LibAliasCheckNewLink(struct libalias *la) { - int res; - - LIBALIAS_LOCK(la); - res = la->newDefaultLink; - LIBALIAS_UNLOCK(la); - return (res); + (void)la; + return (0); } #ifndef NO_FW_PUNCH diff --git a/sys/netinet/libalias/alias_local.h b/sys/netinet/libalias/alias_local.h index 63bfd857f14f..61cd30737ce5 100644 --- a/sys/netinet/libalias/alias_local.h +++ b/sys/netinet/libalias/alias_local.h @@ -118,9 +118,6 @@ struct libalias { #else FILE *logDesc; #endif - /* Indicates if a new aliasing link has been created - * after a call to PacketAliasIn/Out(). */ - int newDefaultLink; #ifndef NO_FW_PUNCH /* File descriptor to be able to control firewall. @@ -323,7 +320,6 @@ int GetDeltaSeqOut(u_long, struct alias_link *lnk); void AddSeq(struct alias_link *lnk, int delta, u_int ip_hl, u_short ip_len, u_long th_seq, u_int th_off); void SetExpire (struct alias_link *_lnk, int _expire); -void ClearCheckNewLink(struct libalias *la); void SetProtocolFlags(struct alias_link *_lnk, int _pflags); int GetProtocolFlags(struct alias_link *_lnk); void SetDestCallId(struct alias_link *_lnk, u_int16_t _cid); diff --git a/sys/netinet/libalias/libalias.3 b/sys/netinet/libalias/libalias.3 index beef2ff7fca5..85ebe55f527c 100644 --- a/sys/netinet/libalias/libalias.3 +++ b/sys/netinet/libalias/libalias.3 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 1, 2020 +.Dd May 31, 2021 .Dt LIBALIAS 3 .Os .Sh NAME @@ -863,16 +863,6 @@ This allows external machines to talk directly to internal machines if they can route packets to the machine in question. .Ed .Pp -.Ft int -.Fn LibAliasCheckNewLink "struct libalias *" -.Bd -ragged -offset indent -This function returns a non-zero value when a new aliasing link is created. -In circumstances where incoming traffic is being sequentially sent to -different local servers, this function can be used to trigger when -.Fn LibAliasSetTarget -is called to change the default target address. -.Ed -.Pp .Ft u_short .Fn LibAliasInternetChecksum "struct libalias *" "u_short *buffer" "int nbytes" .Bd -ragged -offset indent From owner-dev-commits-src-main@freebsd.org Mon May 31 11:05:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 838B0644A07; Mon, 31 May 2021 11:05:13 +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 4Ftsrn2J8Sz4bNt; Mon, 31 May 2021 11:05:13 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2A6657182; Mon, 31 May 2021 11:05:13 +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 14VB5CDD077020; Mon, 31 May 2021 11:05:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VB5C9Z077019; Mon, 31 May 2021 11:05:12 GMT (envelope-from git) Date: Mon, 31 May 2021 11:05:12 GMT Message-Id: <202105311105.14VB5C9Z077019@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: bec0a5dca76c - main - libalias: Remove LibAliasCheckNewLink MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bec0a5dca76c783d374ba9e9417208efde86b15f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 11:05:13 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=bec0a5dca76c783d374ba9e9417208efde86b15f commit bec0a5dca76c783d374ba9e9417208efde86b15f Author: Lutz Donnerhacke AuthorDate: 2021-05-31 11:02:51 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-05-31 11:04:11 +0000 libalias: Remove LibAliasCheckNewLink Finally drop the function in 14-CURRENT. Discussed with: kp Differential Revision: https://reviews.freebsd.org/D30275 --- sys/netinet/libalias/HISTORY | 3 +++ sys/netinet/libalias/alias.h | 3 --- sys/netinet/libalias/alias_db.c | 8 -------- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/sys/netinet/libalias/HISTORY b/sys/netinet/libalias/HISTORY index c5bca59cac1f..ee18c7f70d01 100644 --- a/sys/netinet/libalias/HISTORY +++ b/sys/netinet/libalias/HISTORY @@ -143,3 +143,6 @@ Version 3.1: May, 2000 (Erik Salander, erik@whistle.com) Version 3.2: July, 2000 (Erik Salander, erik@whistle.com and Junichi Satoh, junichi@junichi.org) - Added support for streaming media (RTSP and PNA) aliasing. + +Version 3.3: May 2020 (donner) + - Dropped LibAliasCheckNewLink diff --git a/sys/netinet/libalias/alias.h b/sys/netinet/libalias/alias.h index 558a750b4fd8..58a190408210 100644 --- a/sys/netinet/libalias/alias.h +++ b/sys/netinet/libalias/alias.h @@ -123,9 +123,6 @@ int LibAliasSaveFragment(struct libalias *, void *_ptr); unsigned short LibAliasInternetChecksum(struct libalias *, unsigned short *_ptr, int _nbytes); void LibAliasSetTarget(struct libalias *, struct in_addr _target_addr); -/* never used and never worked, to be removed in FreeBSD 14 */ -int LibAliasCheckNewLink(struct libalias *); - /* Transparent proxying routines. */ int LibAliasProxyRule(struct libalias *, const char *_cmd); diff --git a/sys/netinet/libalias/alias_db.c b/sys/netinet/libalias/alias_db.c index 0273cc84773d..d7027f4e25c2 100644 --- a/sys/netinet/libalias/alias_db.c +++ b/sys/netinet/libalias/alias_db.c @@ -2540,14 +2540,6 @@ getout: return (res); } -/* never used and never worked, to be removed in FreeBSD 14 */ -int -LibAliasCheckNewLink(struct libalias *la) -{ - (void)la; - return (0); -} - #ifndef NO_FW_PUNCH /***************** From owner-dev-commits-src-main@freebsd.org Mon May 31 12:10:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F096645FAF; Mon, 31 May 2021 12:10:39 +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 4FtvJH2Hp3z4h4j; Mon, 31 May 2021 12:10:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 36CD67F02; Mon, 31 May 2021 12:10:39 +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 14VCAdcB065769; Mon, 31 May 2021 12:10:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VCAdOY065768; Mon, 31 May 2021 12:10:39 GMT (envelope-from git) Date: Mon, 31 May 2021 12:10:39 GMT Message-Id: <202105311210.14VCAdOY065768@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: ac1d7397bf33 - main - arm64: allwinner: clk: Test with the current parent freq first MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ac1d7397bf33acf8955fc0871ff124550bf50d1f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 12:10:39 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=ac1d7397bf33acf8955fc0871ff124550bf50d1f commit ac1d7397bf33acf8955fc0871ff124550bf50d1f Author: Emmanuel Vadot AuthorDate: 2021-05-31 12:06:20 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-31 12:10:24 +0000 arm64: allwinner: clk: Test with the current parent freq first Even if the clock is flagged with AW_CLK_SET_PARENT the current parent freq might be enough to get a correct divisor. So test first if we can get the expected freq before changing the parent freq. --- sys/arm/allwinner/clkng/aw_clk_m.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/arm/allwinner/clkng/aw_clk_m.c b/sys/arm/allwinner/clkng/aw_clk_m.c index 4f8189d48299..9f2dea6722bc 100644 --- a/sys/arm/allwinner/clkng/aw_clk_m.c +++ b/sys/arm/allwinner/clkng/aw_clk_m.c @@ -175,7 +175,9 @@ aw_clk_m_set_freq(struct clknode *clk, uint64_t fparent, uint64_t *fout, best = cur = 0; - if ((sc->flags & AW_CLK_SET_PARENT) != 0) { + best = aw_clk_m_find_best(sc, fparent, fout, + &best_m); + if ((best != *fout) && ((sc->flags & AW_CLK_SET_PARENT) != 0)) { p_clk = clknode_get_parent(clk); if (p_clk == NULL) { printf("%s: Cannot get parent for clock %s\n", @@ -187,9 +189,6 @@ aw_clk_m_set_freq(struct clknode *clk, uint64_t fparent, uint64_t *fout, clknode_get_freq(p_clk, &fparent); best = aw_clk_m_find_best(sc, fparent, fout, &best_m); - } else { - best = aw_clk_m_find_best(sc, fparent, fout, - &best_m); } if ((flags & CLK_SET_DRYRUN) != 0) { From owner-dev-commits-src-main@freebsd.org Mon May 31 13:38:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05298647DDE; Mon, 31 May 2021 13:38:47 +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 4FtxFy6m6Bz4qSV; Mon, 31 May 2021 13:38:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D0E101114F; Mon, 31 May 2021 13:38:46 +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 14VDckNJ078013; Mon, 31 May 2021 13:38:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VDckEf078012; Mon, 31 May 2021 13:38:46 GMT (envelope-from git) Date: Mon, 31 May 2021 13:38:46 GMT Message-Id: <202105311338.14VDckEf078012@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 6dbb729d35d5 - main - libpfctl: fix memory leak MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6dbb729d35d59cc8bc8451bd56f220f9c35a43f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 13:38:47 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6dbb729d35d59cc8bc8451bd56f220f9c35a43f3 commit 6dbb729d35d59cc8bc8451bd56f220f9c35a43f3 Author: Kristof Provost AuthorDate: 2021-05-27 09:28:36 +0000 Commit: Kristof Provost CommitDate: 2021-05-31 12:18:32 +0000 libpfctl: fix memory leak When we create an nvlist and insert it into another nvlist we must remember to destroy it. The nvlist_add_nvlist() function makes a copy, just like nvlist_add_string() makes a copy of the string. See also 4483fb47735c29408c72045469c9c4b3e549668b Reviewed by: scottl MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30492 --- lib/libpfctl/libpfctl.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index e207a55a8673..ebc026800a1b 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -130,6 +130,7 @@ pfctl_nv_add_addr(nvlist_t *nvparent, const char *name, nvlist_add_binary(nvl, "addr", addr, sizeof(*addr)); nvlist_add_nvlist(nvparent, name, nvl); + nvlist_destroy(nvl); } static void @@ -159,6 +160,7 @@ pfctl_nv_add_addr_wrap(nvlist_t *nvparent, const char *name, pfctl_nv_add_addr(nvl, "mask", &addr->v.a.mask); nvlist_add_nvlist(nvparent, name, nvl); + nvlist_destroy(nvl); } static void @@ -192,6 +194,7 @@ pfctl_nv_add_rule_addr(nvlist_t *nvparent, const char *name, nvlist_add_number(nvl, "port_op", addr->port_op); nvlist_add_nvlist(nvparent, name, nvl); + nvlist_destroy(nvl); } static void @@ -214,6 +217,7 @@ pfctl_nv_add_mape(nvlist_t *nvparent, const char *name, nvlist_add_number(nvl, "psidlen", mape->psidlen); nvlist_add_number(nvl, "psid", mape->psid); nvlist_add_nvlist(nvparent, name, nvl); + nvlist_destroy(nvl); } static void @@ -234,6 +238,7 @@ pfctl_nv_add_pool(nvlist_t *nvparent, const char *name, pfctl_nv_add_mape(nvl, "mape", &pool->mape); nvlist_add_nvlist(nvparent, name, nvl); + nvlist_destroy(nvl); } static void @@ -277,6 +282,7 @@ pfctl_nv_add_uid(nvlist_t *nvparent, const char *name, nvlist_add_number(nvl, "op", uid->op); nvlist_add_nvlist(nvparent, name, nvl); + nvlist_destroy(nvl); } static void @@ -296,6 +302,7 @@ pfctl_nv_add_divert(nvlist_t *nvparent, const char *name, nvlist_add_number(nvl, "port", r->divert.port); nvlist_add_nvlist(nvparent, name, nvl); + nvlist_destroy(nvl); } static void @@ -511,6 +518,7 @@ pfctl_add_rule(int dev, const struct pfctl_rule *r, const char *anchor, pfctl_nv_add_divert(nvlr, "divert", r); nvlist_add_nvlist(nvl, "rule", nvlr); + nvlist_destroy(nvlr); /* Now do the call. */ nv.data = nvlist_pack(nvl, &nv.len); @@ -625,6 +633,7 @@ pfctl_nv_add_state_cmp(nvlist_t *nvl, const char *name, nvlist_add_number(nv, "direction", cmp->direction); nvlist_add_nvlist(nvl, name, nv); + nvlist_destroy(nv); } static void From owner-dev-commits-src-main@freebsd.org Mon May 31 13:38:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4471C647C36; Mon, 31 May 2021 13:38:48 +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 4FtxG00Plmz4qd4; Mon, 31 May 2021 13:38:48 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E7DF6113F1; Mon, 31 May 2021 13:38:47 +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 14VDclfk078039; Mon, 31 May 2021 13:38:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VDclpZ078038; Mon, 31 May 2021 13:38:47 GMT (envelope-from git) Date: Mon, 31 May 2021 13:38:47 GMT Message-Id: <202105311338.14VDclpZ078038@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 27c77f42ae74 - main - libpfctl: Improve error handling in pfctl_get_states() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 27c77f42ae7402c313deec47aa67a8a8e0889410 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 13:38:48 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=27c77f42ae7402c313deec47aa67a8a8e0889410 commit 27c77f42ae7402c313deec47aa67a8a8e0889410 Author: Kristof Provost AuthorDate: 2021-05-27 09:43:17 +0000 Commit: Kristof Provost CommitDate: 2021-05-31 12:18:47 +0000 libpfctl: Improve error handling in pfctl_get_states() Ensure that we always free nvlists and other allocated memory. Reviewed by: scottl MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30493 --- lib/libpfctl/libpfctl.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index ebc026800a1b..52cd0ed7f36c 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -731,9 +731,10 @@ int pfctl_get_states(int dev, struct pfctl_states *states) { struct pfioc_nv nv; - nvlist_t *nvl; + nvlist_t *nvl = NULL; const nvlist_t * const *slist; size_t found_count; + int error = 0; bzero(states, sizeof(*states)); TAILQ_INIT(&states->states); @@ -744,14 +745,14 @@ pfctl_get_states(int dev, struct pfctl_states *states) for (;;) { if (ioctl(dev, DIOCGETSTATESNV, &nv)) { - free(nv.data); - return (errno); + error = errno; + goto out; } nvl = nvlist_unpack(nv.data, nv.len, 0); if (nvl == NULL) { - free(nv.data); - return (EIO); + error = EIO; + goto out; } states->count = nvlist_get_number(nvl, "count"); @@ -776,8 +777,10 @@ pfctl_get_states(int dev, struct pfctl_states *states) nv.data = realloc(nv.data, new_size); nv.size = new_size; - if (nv.data == NULL) - return (ENOMEM); + if (nv.data == NULL) { + error = ENOMEM; + goto out; + } continue; } @@ -785,9 +788,8 @@ pfctl_get_states(int dev, struct pfctl_states *states) struct pfctl_state *s = malloc(sizeof(*s)); if (s == NULL) { pfctl_free_states(states); - nvlist_destroy(nvl); - free(nv.data); - return (ENOMEM); + error = ENOMEM; + goto out; } pf_nvstate_to_state(slist[i], s); @@ -796,7 +798,11 @@ pfctl_get_states(int dev, struct pfctl_states *states) break; } - return (0); +out: + nvlist_destroy(nvl); + free(nv.data); + + return (error); } void From owner-dev-commits-src-main@freebsd.org Mon May 31 13:38:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D3F1647F2A; Mon, 31 May 2021 13:38:49 +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 4FtxG12X4Mz4qd7; Mon, 31 May 2021 13:38:49 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2BE2F1106F; Mon, 31 May 2021 13:38:49 +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 14VDcmbS078060; Mon, 31 May 2021 13:38:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VDcmw3078059; Mon, 31 May 2021 13:38:48 GMT (envelope-from git) Date: Mon, 31 May 2021 13:38:48 GMT Message-Id: <202105311338.14VDcmw3078059@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 7c4342890bf1 - main - pf: Convenience function for optional (numeric) arguments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7c4342890bf17b72f0d79ada1326d9cbf34e736c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 13:38:49 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7c4342890bf17b72f0d79ada1326d9cbf34e736c commit 7c4342890bf17b72f0d79ada1326d9cbf34e736c Author: Kristof Provost AuthorDate: 2021-05-15 11:45:55 +0000 Commit: Kristof Provost CommitDate: 2021-05-31 12:19:17 +0000 pf: Convenience function for optional (numeric) arguments Add _opt() variants for the uint* functions. These functions set the provided default value if the nvlist doesn't contain the relevant value. This is helpful for optional values (e.g. when the API is extended to add new fields). While here simplify the header by also using macros to create the prototypes for the macro-generated function implementations. Reviewed by: scottl MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30510 --- sys/netpfil/pf/pf_nv.c | 15 +++++++++++++++ sys/netpfil/pf/pf_nv.h | 35 ++++++++++++++--------------------- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index 863259dbf9aa..ae9f7d99b26a 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -40,6 +40,21 @@ __FBSDID("$FreeBSD$"); #include #define PF_NV_IMPL_UINT(fnname, type, max) \ + int \ + pf_nv ## fnname ## _opt(const nvlist_t *nvl, const char *name, \ + type *val, type dflt) \ + { \ + uint64_t raw; \ + if (! nvlist_exists_number(nvl, name)) { \ + *val = dflt; \ + return (0); \ + } \ + raw = nvlist_get_number(nvl, name); \ + if (raw > max) \ + return (ERANGE); \ + *val = (type)raw; \ + return (0); \ + } \ int \ pf_nv ## fnname(const nvlist_t *nvl, const char *name, type *val) \ { \ diff --git a/sys/netpfil/pf/pf_nv.h b/sys/netpfil/pf/pf_nv.h index 321c0425fe7f..e53d19018ffe 100644 --- a/sys/netpfil/pf/pf_nv.h +++ b/sys/netpfil/pf/pf_nv.h @@ -56,29 +56,22 @@ SDT_PROBE_DECLARE(pf, ioctl, nvchk, error); goto errout; \ } while (0) +#define PF_NV_DEF_UINT(fnname, type, max) \ + int pf_nv ## fnname ## _opt(const nvlist_t *, const char *, \ + type *, type); \ + int pf_nv ## fnname(const nvlist_t *, const char *, type *); \ + int pf_nv ## fnname ## _array(const nvlist_t *, const char *, \ + type *,size_t, size_t *); \ + void pf_ ## fnname ## _array_nv(nvlist_t *, const char *, \ + const type *, size_t); + +PF_NV_DEF_UINT(uint8, uint8_t, UINT8_MAX); +PF_NV_DEF_UINT(uint16, uint16_t, UINT16_MAX); +PF_NV_DEF_UINT(uint32, uint32_t, UINT32_MAX); +PF_NV_DEF_UINT(uint64, uint64_t, UINT64_MAX); + int pf_nvbinary(const nvlist_t *, const char *, void *, size_t); int pf_nvint(const nvlist_t *, const char *, int *); -int pf_nvuint8(const nvlist_t *, const char *, uint8_t *); -int pf_nvuint8_array(const nvlist_t *, const char *, uint8_t *, - size_t, size_t *); -void pf_uint8_array_nv(nvlist_t *, const char *, const uint8_t *, - size_t); -int pf_nvuint16(const nvlist_t *, const char *, uint16_t *); -int pf_nvuint16_array(const nvlist_t *, const char *, uint16_t *, - size_t, size_t *); -void pf_uint16_array_nv(nvlist_t *, const char *, const uint16_t *, - size_t); -int pf_nvuint32(const nvlist_t *, const char *, uint32_t *); -int pf_nvuint32_array(const nvlist_t *, const char *, uint32_t *, - size_t, size_t *); -void pf_uint32_array_nv(nvlist_t *, const char *, const uint32_t *, - size_t); -int pf_nvuint64(const nvlist_t *, const char *, uint64_t *); -int pf_nvuint64_array(const nvlist_t *, const char *, uint64_t *, - size_t, size_t *); -void pf_uint64_array_nv(nvlist_t *, const char *, const uint64_t *, - size_t); - int pf_nvstring(const nvlist_t *, const char *, char *, size_t); /* Translation functions */ From owner-dev-commits-src-main@freebsd.org Mon May 31 13:48:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52424647C77; Mon, 31 May 2021 13:48:34 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FtxTG0Ntsz4v56; Mon, 31 May 2021 13:48:33 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi1-f173.google.com with SMTP id z3so12324130oib.5; Mon, 31 May 2021 06:48:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lrYBA8DOHpVbWFcaAibDUPj//CHhx1S/geLRxZZeZgM=; b=DLFhrrDzmWTki8mhDymP2kqrWcNEuLLi3Qie/oQC6L9z0s9hd9WTRD39g4VPUjwzv6 S+s/D6PKyJJKRJE+8z2aRRF2zsUZld8TdLlZ452tJqCAAGrlP6l38g9CE2OMztccF7h1 aFdj8xVRA49MD09jcaDixp1QcBcKQ+Hzhc2Izhr7Dg3Z0zwF2ae6SoR/VrdbzztMh4oQ gHcxtWZ+aqE8t8Cw81iFmiOwY8yHSuVioJ97X5Q+e1Zjp+PdepvLgCyuFVXPJthK9lKY qtmzb982OyOm7Yt6GdXHhji6G5h324zLqdOUgpOaEHWsevPb6PlwF91oRKRHAbW5hfqo 6jHQ== X-Gm-Message-State: AOAM531EoJC5rojuhrPnvAyh45cGcndfEzQ3hUJOJpyHEX5JUo3w0xHi Kp1c8WYSR55Q7CDeLLubQluXOfugbRn9DT02GGmEFO7Pszx1kQ== X-Google-Smtp-Source: ABdhPJyr5etrPIj+WgRr4TLb9meXbzjUS2PE3wVIlxs1uyyN9ZaUULNlKKrbRpmjb2QzYNdYBQMoTA+bmyw/ymGYb6M= X-Received: by 2002:aca:e142:: with SMTP id y63mr14099997oig.57.1622468912999; Mon, 31 May 2021 06:48:32 -0700 (PDT) MIME-Version: 1.0 References: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> <52c0315a-ab34-6662-3760-53357b6aedaf@FreeBSD.org> <20210531104351.GA14564@belenus.iks-jena.de> In-Reply-To: <20210531104351.GA14564@belenus.iks-jena.de> From: Alan Somers Date: Mon, 31 May 2021 07:48:22 -0600 Message-ID: Subject: Re: git: 5a20c351ea45 - main - [skip ci] add a CODEOWNERS file To: Lutz Donnerhacke Cc: Kubilay Kocak , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4FtxTG0Ntsz4v56 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 13:48:34 -0000 On Mon, May 31, 2021 at 4:44 AM Lutz Donnerhacke wrote: > On Mon, May 31, 2021 at 12:11:12PM +1000, Kubilay Kocak wrote: > >> +# The source tree is a community effort. However, some folks go to the > >> +# trouble of looking after particular areas of the tree. In return for > >> +# their active caretaking of the code it is polite to coordinate > changes > >> +# with them. This is a list of people who have expressed an interest > in > >> +# part of the code or listed their active caretaking role so that other > >> +# committers can easily find somebody who is familiar with it. The > notes > >> +# should specify if there is a 3rd party source tree involved or other > >> +# things that should be kept in mind. > >> +# > >> +# However, this is not a 'big stick', it is an offer to help and a > source > >> +# of guidance. It does not override the communal nature of the tree. > >> +# It is not a registry of 'turf' or private property. > > Who is allowed to add to this file? > Anybody with a Github account can put themselves in there. You don't even need to be a committer , technically. From owner-dev-commits-src-main@freebsd.org Mon May 31 15:10:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D56564912B; Mon, 31 May 2021 15:10:42 +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 4FtzJ20kVfz3NrF; Mon, 31 May 2021 15:10:42 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 029E4128F3; Mon, 31 May 2021 15:10:42 +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 14VFAfMO006359; Mon, 31 May 2021 15:10:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VFAf0j006358; Mon, 31 May 2021 15:10:41 GMT (envelope-from git) Date: Mon, 31 May 2021 15:10:41 GMT Message-Id: <202105311510.14VFAf0j006358@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: e266a0f7f001 - main - kern linker: do not allow more than one kldload and kldunload syscalls simultaneously MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e266a0f7f001c7886eab56d8c058d92d87010400 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 15:10:42 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e266a0f7f001c7886eab56d8c058d92d87010400 commit e266a0f7f001c7886eab56d8c058d92d87010400 Author: Konstantin Belousov AuthorDate: 2021-05-20 14:50:43 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-31 15:09:22 +0000 kern linker: do not allow more than one kldload and kldunload syscalls simultaneously kld_sx is dropped e.g. for executing sysinits, which allows user to initiate kldunload while module is not yet fully initialized. Reviewed by: markj Differential revision: https://reviews.freebsd.org/D30456 Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/kern_linker.c | 86 +++++++++++++++++++++++++++++++++++++++----------- sys/sys/linker.h | 9 ++++++ 2 files changed, 77 insertions(+), 18 deletions(-) diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c index d30db0fb2dba..bb17c020e98a 100644 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -106,6 +106,7 @@ MALLOC_DEFINE(M_LINKER, "linker", "kernel linker"); linker_file_t linker_kernel_file; static struct sx kld_sx; /* kernel linker lock */ +static bool kld_busy; /* * Load counter used by clients to determine if a linker file has been @@ -1050,6 +1051,49 @@ linker_search_symbol_name(caddr_t value, char *buf, u_int buflen, M_WAITOK)); } +int +linker_kldload_busy(int flags) +{ + int error; + + MPASS((flags & ~(LINKER_UB_UNLOCK | LINKER_UB_LOCKED | + LINKER_UB_PCATCH)) == 0); + if ((flags & LINKER_UB_LOCKED) != 0) + sx_assert(&kld_sx, SA_XLOCKED); + + if ((flags & LINKER_UB_LOCKED) == 0) + sx_xlock(&kld_sx); + while (kld_busy) { + error = sx_sleep(&kld_busy, &kld_sx, + (flags & LINKER_UB_PCATCH) != 0 ? PCATCH : 0, + "kldbusy", 0); + if (error != 0) { + if ((flags & LINKER_UB_UNLOCK) != 0) + sx_xunlock(&kld_sx); + return (error); + } + } + kld_busy = true; + if ((flags & LINKER_UB_UNLOCK) != 0) + sx_xunlock(&kld_sx); + return (0); +} + +void +linker_kldload_unbusy(int flags) +{ + MPASS((flags & ~LINKER_UB_LOCKED) == 0); + if ((flags & LINKER_UB_LOCKED) != 0) + sx_assert(&kld_sx, SA_XLOCKED); + + if ((flags & LINKER_UB_LOCKED) == 0) + sx_xlock(&kld_sx); + MPASS(kld_busy); + kld_busy = false; + wakeup(&kld_busy); + sx_xunlock(&kld_sx); +} + /* * Syscalls. */ @@ -1066,12 +1110,6 @@ kern_kldload(struct thread *td, const char *file, int *fileid) if ((error = priv_check(td, PRIV_KLD_LOAD)) != 0) return (error); - /* - * It is possible that kldloaded module will attach a new ifnet, - * so vnet context must be set when this ocurs. - */ - CURVNET_SET(TD_TO_VNET(td)); - /* * If file does not contain a qualified name or any dot in it * (kldname.ko, or kldname.ver.ko) treat it as an interface @@ -1085,19 +1123,27 @@ kern_kldload(struct thread *td, const char *file, int *fileid) modname = file; } - sx_xlock(&kld_sx); - error = linker_load_module(kldname, modname, NULL, NULL, &lf); - if (error) { + error = linker_kldload_busy(LINKER_UB_PCATCH); + if (error != 0) { sx_xunlock(&kld_sx); - goto done; + return (error); } - lf->userrefs++; - if (fileid != NULL) - *fileid = lf->id; - sx_xunlock(&kld_sx); -done: + /* + * It is possible that kldloaded module will attach a new ifnet, + * so vnet context must be set when this ocurs. + */ + CURVNET_SET(TD_TO_VNET(td)); + + error = linker_load_module(kldname, modname, NULL, NULL, &lf); CURVNET_RESTORE(); + + if (error == 0) { + lf->userrefs++; + if (fileid != NULL) + *fileid = lf->id; + } + linker_kldload_unbusy(LINKER_UB_LOCKED); return (error); } @@ -1132,8 +1178,13 @@ kern_kldunload(struct thread *td, int fileid, int flags) if ((error = priv_check(td, PRIV_KLD_UNLOAD)) != 0) return (error); + error = linker_kldload_busy(LINKER_UB_PCATCH); + if (error != 0) { + sx_xunlock(&kld_sx); + return (error); + } + CURVNET_SET(TD_TO_VNET(td)); - sx_xlock(&kld_sx); lf = linker_find_file_by_id(fileid); if (lf) { KLD_DPF(FILE, ("kldunload: lf->userrefs=%d\n", lf->userrefs)); @@ -1153,9 +1204,8 @@ kern_kldunload(struct thread *td, int fileid, int flags) } } else error = ENOENT; - sx_xunlock(&kld_sx); - CURVNET_RESTORE(); + linker_kldload_unbusy(LINKER_UB_LOCKED); return (error); } diff --git a/sys/sys/linker.h b/sys/sys/linker.h index 73eea35dab55..a3d5eb0e72cf 100644 --- a/sys/sys/linker.h +++ b/sys/sys/linker.h @@ -196,6 +196,15 @@ int linker_search_symbol_name(caddr_t value, char *buf, u_int buflen, /* HWPMC helper */ void *linker_hwpmc_list_objects(void); +/* kldload/kldunload syscalls blocking */ +#define LINKER_UB_UNLOCK 0x0001 /* busy: unlock kld_sx locked on + return */ +#define LINKER_UB_LOCKED 0x0002 /* busy/unbusy: kld_sx locked on + entry */ +#define LINKER_UB_PCATCH 0x0004 /* busy: sleep interruptible */ +int linker_kldload_busy(int flags); +void linker_kldload_unbusy(int flags); + #endif /* _KERNEL */ /* From owner-dev-commits-src-main@freebsd.org Mon May 31 15:10:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F32B648B5F; Mon, 31 May 2021 15:10:43 +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 4FtzJ323wFz3NrJ; Mon, 31 May 2021 15:10:43 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2A0BF12715; Mon, 31 May 2021 15:10:43 +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 14VFAh3N006380; Mon, 31 May 2021 15:10:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VFAhbD006379; Mon, 31 May 2021 15:10:43 GMT (envelope-from git) Date: Mon, 31 May 2021 15:10:43 GMT Message-Id: <202105311510.14VFAhbD006379@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 845d77974b3b - main - kern_thread.c: wrap too long lines MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 845d77974b3b6ab78297836ead2d2acbcdebeba7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 15:10:43 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=845d77974b3b6ab78297836ead2d2acbcdebeba7 commit 845d77974b3b6ab78297836ead2d2acbcdebeba7 Author: Konstantin Belousov AuthorDate: 2021-05-25 18:09:33 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-31 15:09:22 +0000 kern_thread.c: wrap too long lines Reviewed by: hselasky, markj Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30468 --- sys/kern/kern_thread.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index a52d6e75fd03..935d7071e452 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -541,7 +541,8 @@ threadinit(void) TASK_INIT(&thread_reap_task, 0, thread_reap_task_cb, NULL); callout_init(&thread_reap_callout, 1); - callout_reset(&thread_reap_callout, 5 * hz, thread_reap_callout_cb, NULL); + callout_reset(&thread_reap_callout, 5 * hz, + thread_reap_callout_cb, NULL); } /* @@ -704,7 +705,8 @@ thread_reap_callout_cb(void *arg __unused) if (wantreap) taskqueue_enqueue(taskqueue_thread, &thread_reap_task); - callout_reset(&thread_reap_callout, 5 * hz, thread_reap_callout_cb, NULL); + callout_reset(&thread_reap_callout, 5 * hz, + thread_reap_callout_cb, NULL); } /* From owner-dev-commits-src-main@freebsd.org Mon May 31 15:10:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 021F2648B63; Mon, 31 May 2021 15:10:46 +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 4FtzJ55C3Qz3NXm; Mon, 31 May 2021 15:10:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4E49D12691; Mon, 31 May 2021 15:10:45 +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 14VFAjq8006426; Mon, 31 May 2021 15:10:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VFAjv3006425; Mon, 31 May 2021 15:10:45 GMT (envelope-from git) Date: Mon, 31 May 2021 15:10:45 GMT Message-Id: <202105311510.14VFAjv3006425@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: f62c7e54e9cc - main - Add thread_reap_barrier() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f62c7e54e9cc692603081328597ba0ba0d1f21cf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 15:10:46 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f62c7e54e9cc692603081328597ba0ba0d1f21cf commit f62c7e54e9cc692603081328597ba0ba0d1f21cf Author: Konstantin Belousov AuthorDate: 2021-05-25 18:51:00 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-31 15:09:22 +0000 Add thread_reap_barrier() Reviewed by: hselasky,markj Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30468 --- sys/kern/kern_thread.c | 32 ++++++++++++++++++++++++++++++++ sys/sys/proc.h | 1 + 2 files changed, 33 insertions(+) diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 935d7071e452..b5983eb4beb7 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -709,6 +709,38 @@ thread_reap_callout_cb(void *arg __unused) thread_reap_callout_cb, NULL); } +/* + * Calling this function guarantees that any thread that exited before + * the call is reaped when the function returns. By 'exited' we mean + * a thread removed from the process linkage with thread_unlink(). + * Practically this means that caller must lock/unlock corresponding + * process lock before the call, to synchronize with thread_exit(). + */ +void +thread_reap_barrier(void) +{ + struct thread *td; + struct task *t; + + td = curthread; + + /* + * First do context switches to each CPU to ensure that all + * PCPU pc_deadthreads are moved to zombie list. + */ + quiesce_all_cpus("", PDROP); + + /* + * Second, fire the task in the same thread as normal + * thread_reap() is done, to serialize reaping. + */ + t = malloc(sizeof(*t), M_TEMP, M_WAITOK); + TASK_INIT(t, 0, thread_reap_task_cb, t); + taskqueue_enqueue(taskqueue_thread, t); + taskqueue_drain(taskqueue_thread, t); + free(t, M_TEMP); +} + /* * Allocate a thread. */ diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 2630c2b5a1d0..afa0be05d33a 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1189,6 +1189,7 @@ int thread_create(struct thread *td, struct rtprio *rtp, void thread_exit(void) __dead2; void thread_free(struct thread *td); void thread_link(struct thread *td, struct proc *p); +void thread_reap_barrier(void); int thread_single(struct proc *p, int how); void thread_single_end(struct proc *p, int how); void thread_stash(struct thread *td); From owner-dev-commits-src-main@freebsd.org Mon May 31 15:10:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE70A648F34; Mon, 31 May 2021 15:10:44 +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 4FtzJ43ZMXz3Njm; Mon, 31 May 2021 15:10:44 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4012E123F3; Mon, 31 May 2021 15:10:44 +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 14VFAibb006401; Mon, 31 May 2021 15:10:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VFAiPp006400; Mon, 31 May 2021 15:10:44 GMT (envelope-from git) Date: Mon, 31 May 2021 15:10:44 GMT Message-Id: <202105311510.14VFAiPp006400@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 3a68546d2377 - main - quisce_cpus(): add special handling for PDROP MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3a68546d2377d6e9776060043372d66f07022543 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 15:10:44 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3a68546d2377d6e9776060043372d66f07022543 commit 3a68546d2377d6e9776060043372d66f07022543 Author: Konstantin Belousov AuthorDate: 2021-05-28 17:10:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-31 15:09:22 +0000 quisce_cpus(): add special handling for PDROP Currently passing PDROP to the quisce_cpus() function does not make sense. Add special meaning for it, by not waiting for the idle thread to schedule. Also avoid allocating u_int[MAXCPU] on the stack. Reviewed by: hselasky, markj Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30468 --- sys/kern/subr_smp.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c index d4f8aac9e751..935fb6ee977c 100644 --- a/sys/kern/subr_smp.c +++ b/sys/kern/subr_smp.c @@ -943,25 +943,31 @@ smp_rendezvous_cpus_done(struct smp_rendezvous_cpus_retry_arg *arg) } /* + * If (prio & PDROP) == 0: * Wait for specified idle threads to switch once. This ensures that even * preempted threads have cycled through the switch function once, * exiting their codepaths. This allows us to change global pointers * with no other synchronization. + * If (prio & PDROP) != 0: + * Force the specified CPUs to switch context at least once. */ int quiesce_cpus(cpuset_t map, const char *wmesg, int prio) { struct pcpu *pcpu; - u_int gen[MAXCPU]; + u_int *gen; int error; int cpu; error = 0; - for (cpu = 0; cpu <= mp_maxid; cpu++) { - if (!CPU_ISSET(cpu, &map) || CPU_ABSENT(cpu)) - continue; - pcpu = pcpu_find(cpu); - gen[cpu] = pcpu->pc_idlethread->td_generation; + if ((prio & PDROP) == 0) { + gen = malloc(sizeof(u_int) * MAXCPU, M_TEMP, M_WAITOK); + for (cpu = 0; cpu <= mp_maxid; cpu++) { + if (!CPU_ISSET(cpu, &map) || CPU_ABSENT(cpu)) + continue; + pcpu = pcpu_find(cpu); + gen[cpu] = pcpu->pc_idlethread->td_generation; + } } for (cpu = 0; cpu <= mp_maxid; cpu++) { if (!CPU_ISSET(cpu, &map) || CPU_ABSENT(cpu)) @@ -970,8 +976,10 @@ quiesce_cpus(cpuset_t map, const char *wmesg, int prio) thread_lock(curthread); sched_bind(curthread, cpu); thread_unlock(curthread); + if ((prio & PDROP) != 0) + continue; while (gen[cpu] == pcpu->pc_idlethread->td_generation) { - error = tsleep(quiesce_cpus, prio, wmesg, 1); + error = tsleep(quiesce_cpus, prio & ~PDROP, wmesg, 1); if (error != EWOULDBLOCK) goto out; error = 0; @@ -981,6 +989,8 @@ out: thread_lock(curthread); sched_unbind(curthread); thread_unlock(curthread); + if ((prio & PDROP) == 0) + free(gen, M_TEMP); return (error); } From owner-dev-commits-src-main@freebsd.org Mon May 31 15:43:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C9D95649673; Mon, 31 May 2021 15:43:18 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fv01f49kDz3kSF; Mon, 31 May 2021 15:43:18 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f48.google.com with SMTP id k22so12331616ioa.9; Mon, 31 May 2021 08:43:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tQKzbgHR67tJy6w579DbPg0ydFXKPD7N0PTAHM+AEPs=; b=ueOuw0NlYuTLxPpe2FfCmrLyYgqimNG5Pa7F8m8NjquuHrUJU5VME6hyn94uSnjWp+ OhC3X+qyD4xFo34g4kBzJlCV97fo494+nNs0ckYT7l16HUWpn8dzyMSxlrqA4qhEy5/g oUUQM47LF0Ws0Z5rSyUQMZ+XxtKUU3y6kXBl5YV7pc+CRZ8YPLhYqi3M1yTNj4FifPyq o5bzBHC5xfvhyc0W1es9YVEeybZV2uaQvMnLFIdAfh7eupvjPO+Hx2lam8svH8c+WMkA 9UmIItx52hz3SfkpN5Wq+zRWumcNBnk0MNjHr4WsMgA8MmOtjpfeU8eDZGz14ZN5SZou zEpg== X-Gm-Message-State: AOAM5330Tdteyi7s+vKdxG/UNJLiOx2/FwGAWtobNZdxYiY6JToL4MLd CnwItREEnnxvrccHWd+IgDhTLmOa8OEq1lTSONKvCjdt X-Google-Smtp-Source: ABdhPJw+dJcnQ/eVqIv46na8VvwwbKMXEtghZ0bwQScbot6L5f43IIFjajdsNIFcOl5fiI/aLa2Z68ND7kQ/E/wS69E= X-Received: by 2002:a05:6638:37a6:: with SMTP id w38mr21126545jal.106.1622475796785; Mon, 31 May 2021 08:43:16 -0700 (PDT) MIME-Version: 1.0 References: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> In-Reply-To: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> From: Ed Maste Date: Mon, 31 May 2021 11:43:01 -0400 Message-ID: Subject: Re: git: 5a20c351ea45 - main - [skip ci] add a CODEOWNERS file To: Alan Somers Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Fv01f49kDz3kSF X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 15:43:18 -0000 On Sun, 30 May 2021 at 18:49, Alan Somers wrote: > > The branch main has been updated by asomers: > > URL: https://cgit.FreeBSD.org/src/commit/?id=5a20c351ea457d2beae661c197fcaa97c9ec0637 > > commit 5a20c351ea457d2beae661c197fcaa97c9ec0637 > Author: Alan Somers > AuthorDate: 2021-05-30 21:54:46 +0000 > Commit: Alan Somers > CommitDate: 2021-05-30 22:49:07 +0000 ... > +# Maintainers are encouraged to visit: > +# https://reviews.freebsd.org/herald > +# > +# and configure Phabricator notifications for parts of the tree which they > +# maintain. Notifications can automatically be sent when someone proposes a > +# revision or makes a commit to the specified subtree. I think this file isn't the right place for (another copy of) this text; perhaps the CODEOWNERS file should just reference the top-level MAINTAINERS? From owner-dev-commits-src-main@freebsd.org Mon May 31 15:51:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13F3064A115; Mon, 31 May 2021 15:51:44 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fv0CM70M2z3nBm; Mon, 31 May 2021 15:51:43 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-ot1-f50.google.com with SMTP id 36-20020a9d0ba70000b02902e0a0a8fe36so11462128oth.8; Mon, 31 May 2021 08:51:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=X5ozbbUtZ7+VkHiFxBy/beZBNxDTD8HYsL4rALSmbTo=; b=LALs1xOpOrIyjpjGRuFl/ZLeA+XSIV1/+x2IIEHpQoURbEtP2JYnAKqf6OJvnYeR6+ 9BDqmg0JkQjVwGMSgQrZ+BtSKyqNwHUnFSqTYXbQs7HJxZIoNA1R0K1RKTAl0u0ZksQc cB6y5VDcTEOppQODi/Q9yqbKV/IkQty3I9ZfoEunofWmImqHQ3LwVSkL+r78yr3oWGgF IlATrMbESBIF+w8d6gHV7hDZWwjZPrPDLcvPVOg1Vqe/rhbwk38b7Hg1ylh0jyBLE6nU RlYRKsgWuFReStD1Q9mCXHrhMDAarW8ylSqQ8j1HHj8vhFIF+KL0VoezMxk8A9qv3hHq Pz9g== X-Gm-Message-State: AOAM532CiGZJP0lDllD0Nt4ACsThsz+9YBz9g7Jkf/1pBEY2LFW/EZ6N +BOwssTdgwEJLDMyc1nri1xTTguya/NyB/xGGxVzsBEyZdvpYw== X-Google-Smtp-Source: ABdhPJx5HmXMGA8o4KmsT/9KEieTneorrUuUK8fTFKVcXY6oiJQAv7WyX4/wI2G8tVxkysIjHaNXj4qIvSWqSWMmbmI= X-Received: by 2002:a9d:5e8c:: with SMTP id f12mr17609025otl.18.1622476302578; Mon, 31 May 2021 08:51:42 -0700 (PDT) MIME-Version: 1.0 References: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> In-Reply-To: From: Alan Somers Date: Mon, 31 May 2021 09:51:31 -0600 Message-ID: Subject: Re: git: 5a20c351ea45 - main - [skip ci] add a CODEOWNERS file To: Ed Maste Cc: src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4Fv0CM70M2z3nBm X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 15:51:44 -0000 On Mon, May 31, 2021 at 9:43 AM Ed Maste wrote: > On Sun, 30 May 2021 at 18:49, Alan Somers wrote: > > > > The branch main has been updated by asomers: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=5a20c351ea457d2beae661c197fcaa97c9ec0637 > > > > commit 5a20c351ea457d2beae661c197fcaa97c9ec0637 > > Author: Alan Somers > > AuthorDate: 2021-05-30 21:54:46 +0000 > > Commit: Alan Somers > > CommitDate: 2021-05-30 22:49:07 +0000 > ... > > +# Maintainers are encouraged to visit: > > +# https://reviews.freebsd.org/herald > > +# > > +# and configure Phabricator notifications for parts of the tree which > they > > +# maintain. Notifications can automatically be sent when someone > proposes a > > +# revision or makes a commit to the specified subtree. > > I think this file isn't the right place for (another copy of) this > text; perhaps the CODEOWNERS file should just reference the top-level > MAINTAINERS? > Except that CODEOWNERS is in a format that tools know how to parse. If anything, MAINTAINERS should be a symlink to CODEOWNERS. From owner-dev-commits-src-main@freebsd.org Mon May 31 16:33:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E7EE64B083; Mon, 31 May 2021 16:33:36 +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 4Fv17h1sGNz4Sx7; Mon, 31 May 2021 16:33:36 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 262D413C8E; Mon, 31 May 2021 16:33:36 +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 14VGXamV018075; Mon, 31 May 2021 16:33:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VGXafw018074; Mon, 31 May 2021 16:33:36 GMT (envelope-from git) Date: Mon, 31 May 2021 16:33:36 GMT Message-Id: <202105311633.14VGXafw018074@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 68c254426467 - main - nfs: even up value returned by nfsrv_parsename with copyinstr MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 68c254426467e3f900f9a19de4dd9a234ea75388 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 16:33:36 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=68c254426467e3f900f9a19de4dd9a234ea75388 commit 68c254426467e3f900f9a19de4dd9a234ea75388 Author: Mateusz Guzik AuthorDate: 2021-05-31 16:32:04 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-31 16:32:04 +0000 nfs: even up value returned by nfsrv_parsename with copyinstr Reported by: dim Reviewed by: rmacklem --- sys/fs/nfsserver/nfs_nfsdsubs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfsserver/nfs_nfsdsubs.c b/sys/fs/nfsserver/nfs_nfsdsubs.c index 2b6e17752544..8c7db36bbd05 100644 --- a/sys/fs/nfsserver/nfs_nfsdsubs.c +++ b/sys/fs/nfsserver/nfs_nfsdsubs.c @@ -2065,7 +2065,7 @@ nfsrv_parsename(struct nfsrv_descript *nd, char *bufp, u_long *hashp, } } *tocp = '\0'; - *outlenp = (size_t)outlen; + *outlenp = (size_t)outlen + 1; if (hashp != NULL) *hashp = hash; nfsmout: From owner-dev-commits-src-main@freebsd.org Mon May 31 17:08:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E486864B7D3; Mon, 31 May 2021 17:08:52 +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 4Fv1wN5wFWz4Ws0; Mon, 31 May 2021 17:08:52 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B32E313FB3; Mon, 31 May 2021 17:08: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 14VH8qpG059291; Mon, 31 May 2021 17:08:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VH8qLB059290; Mon, 31 May 2021 17:08:52 GMT (envelope-from git) Date: Mon, 31 May 2021 17:08:52 GMT Message-Id: <202105311708.14VH8qLB059290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 2d926ed71eb1 - main - arm: SOCFPGA: Add ext_resources driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2d926ed71eb15efc4b8ac828adfb221056c853fd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 17:08:53 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=2d926ed71eb15efc4b8ac828adfb221056c853fd commit 2d926ed71eb15efc4b8ac828adfb221056c853fd Author: Emmanuel Vadot AuthorDate: 2021-05-31 17:08:08 +0000 Commit: Emmanuel Vadot CommitDate: 2021-05-31 17:08:08 +0000 arm: SOCFPGA: Add ext_resources driver mmc_fdt_helpers needs clock and regulators. Add all the ext_resources driver to SOCFPGA conf file to fix the build Reported by: mjg --- sys/arm/conf/SOCFPGA | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/arm/conf/SOCFPGA b/sys/arm/conf/SOCFPGA index 717f7546a594..a4c5fbee5a8f 100644 --- a/sys/arm/conf/SOCFPGA +++ b/sys/arm/conf/SOCFPGA @@ -38,6 +38,15 @@ options SOC_ALTERA_CYCLONE5 #options BOOTP_NFSV3 #options BOOTP_WIRED_TO=ue0 +# EXT_RESOURCES pseudo devices +options EXT_RESOURCES +device clk +device phy +device hwreset +device nvmem +device regulator +device syscon + # Interrupt controller device gic From owner-dev-commits-src-main@freebsd.org Mon May 31 18:57:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9569264CD11; Mon, 31 May 2021 18:57:15 +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 4Fv4KR3c5Rz4g6v; Mon, 31 May 2021 18:57:15 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 60AAF154F2; Mon, 31 May 2021 18:57:15 +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 14VIvFuS004732; Mon, 31 May 2021 18:57:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VIvFrf004731; Mon, 31 May 2021 18:57:15 GMT (envelope-from git) Date: Mon, 31 May 2021 18:57:15 GMT Message-Id: <202105311857.14VIvFrf004731@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: 19593f775c23 - main - linux(4); Retire unnecessary __packed attribute from some struct's definition. 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: 19593f775c23623571cac4cf638996f5c11e91f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 18:57:15 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=19593f775c23623571cac4cf638996f5c11e91f4 commit 19593f775c23623571cac4cf638996f5c11e91f4 Author: Dmitry Chagin AuthorDate: 2021-05-31 18:56:34 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-31 18:56:34 +0000 linux(4); Retire unnecessary __packed attribute from some struct's definition. Differential Revision: https://reviews.freebsd.org/D30482 MFC after: 2 weeks --- sys/amd64/linux/linux.h | 5 +++-- sys/amd64/linux32/linux.h | 53 ++++++++++++++++++++++++----------------------- sys/arm64/linux/linux.h | 5 +++-- sys/i386/linux/linux.h | 2 +- 4 files changed, 34 insertions(+), 31 deletions(-) diff --git a/sys/amd64/linux/linux.h b/sys/amd64/linux/linux.h index 4e27fd51a72d..a9ed66689b64 100644 --- a/sys/amd64/linux/linux.h +++ b/sys/amd64/linux/linux.h @@ -369,7 +369,8 @@ struct l_ifmap { u_char irq; u_char dma; u_char port; -} __packed; + /* 3 bytes spare */ +}; struct l_ifreq { union { @@ -389,7 +390,7 @@ struct l_ifreq { char ifru_slave[LINUX_IFNAMSIZ]; l_uintptr_t ifru_data; } ifr_ifru; -} __packed; +}; #define ifr_name ifr_ifrn.ifrn_name /* Interface name */ #define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h index 286b9b52801c..6f26974a75a1 100644 --- a/sys/amd64/linux32/linux.h +++ b/sys/amd64/linux32/linux.h @@ -89,7 +89,7 @@ typedef l_ulong l_fd_mask; typedef struct { l_int val[2]; -} __packed l_fsid_t; +} l_fsid_t; typedef struct { l_time_t tv_sec; @@ -114,7 +114,7 @@ struct l___sysctl_args l_uintptr_t newval; l_size_t newlen; l_ulong __spare[4]; -} __packed; +}; /* Resource limits */ #define LINUX_RLIMIT_CPU 0 @@ -133,7 +133,7 @@ struct l___sysctl_args struct l_rlimit { l_ulong rlim_cur; l_ulong rlim_max; -} __packed; +}; struct l_rusage { l_timeval ru_utime; @@ -152,7 +152,7 @@ struct l_rusage { l_long ru_nsignals; l_long ru_nvcsw; l_long ru_nivcsw; -} __packed; +}; struct l_mmap_argv { l_uintptr_t addr; @@ -169,7 +169,7 @@ struct l_mmap_argv { struct l_timespec { l_time_t tv_sec; l_long tv_nsec; -} __packed; +}; struct l_newstat { l_ushort st_dev; @@ -189,7 +189,7 @@ struct l_newstat { struct l_timespec st_ctim; l_ulong __unused4; l_ulong __unused5; -} __packed; +}; struct l_stat { l_ushort st_dev; @@ -271,7 +271,7 @@ typedef struct { l_osigset_t lsa_mask; l_ulong lsa_flags; l_uintptr_t lsa_restorer; -} __packed l_osigaction_t; +} l_osigaction_t; typedef struct { l_handler_t lsa_handler; @@ -284,7 +284,7 @@ typedef struct { l_uintptr_t ss_sp; l_int ss_flags; l_size_t ss_size; -} __packed l_stack_t; +} l_stack_t; /* The Linux sigcontext, pretty much a standard 386 trapframe. */ struct l_sigcontext { @@ -310,7 +310,7 @@ struct l_sigcontext { l_uint sc_387; l_uint sc_mask; l_uint sc_cr2; -} __packed; +}; struct l_ucontext { l_ulong uc_flags; @@ -338,7 +338,7 @@ typedef struct l_siginfo { struct { l_pid_t _pid; l_uid_t _uid; - } __packed _kill; + } _kill; struct { l_timer_t _tid; @@ -346,13 +346,13 @@ typedef struct l_siginfo { char _pad[sizeof(l_uid_t) - sizeof(l_int)]; l_sigval_t _sigval; l_int _sys_private; - } __packed _timer; + } _timer; struct { l_pid_t _pid; /* sender's pid */ l_uid_t _uid; /* sender's uid */ l_sigval_t _sigval; - } __packed _rt; + } _rt; struct { l_pid_t _pid; /* which child */ @@ -360,18 +360,18 @@ typedef struct l_siginfo { l_int _status; /* exit code */ l_clock_t _utime; l_clock_t _stime; - } __packed _sigchld; + } _sigchld; struct { l_uintptr_t _addr; /* Faulting insn/memory ref. */ - } __packed _sigfault; + } _sigfault; struct { l_long _band; /* POLL_IN,POLL_OUT,POLL_MSG */ l_int _fd; - } __packed _sigpoll; + } _sigpoll; } _sifields; -} __packed l_siginfo_t; +} l_siginfo_t; #define lsi_pid _sifields._kill._pid #define lsi_uid _sifields._kill._uid @@ -391,17 +391,17 @@ typedef struct l_siginfo { struct l_fpreg { u_int16_t significand[4]; u_int16_t exponent; -} __packed; +}; struct l_fpxreg { u_int16_t significand[4]; u_int16_t exponent; u_int16_t padding[3]; -} __packed; +}; struct l_xmmreg { u_int32_t element[4]; -} __packed; +}; struct l_fpstate { /* Regular FPU environment */ @@ -423,7 +423,7 @@ struct l_fpstate { struct l_fpxreg _fxsr_st[8]; /* reg data is ignored. */ struct l_xmmreg _xmm[8]; u_int32_t padding[56]; -} __packed; +}; /* * We make the stack look like Linux expects it when calling a signal @@ -437,7 +437,7 @@ struct l_sigframe { struct l_fpstate sf_fpstate; l_uint sf_extramask[1]; l_handler_t sf_handler; -} __packed; +}; struct l_rt_sigframe { l_int sf_sig; @@ -461,7 +461,7 @@ union l_semun { l_uintptr_t array; l_uintptr_t __buf; l_uintptr_t __pad; -} __packed; +}; struct l_ifmap { l_ulong mem_start; @@ -470,7 +470,8 @@ struct l_ifmap { u_char irq; u_char dma; u_char port; -} __packed; + /* 3 bytes spare */ +}; struct l_ifreq { union { @@ -490,7 +491,7 @@ struct l_ifreq { char ifru_slave[LINUX_IFNAMSIZ]; l_uintptr_t ifru_data; } ifr_ifru; -} __packed; +}; #define ifr_name ifr_ifrn.ifrn_name /* Interface name */ #define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ @@ -502,7 +503,7 @@ struct l_ifconf { l_uintptr_t ifcu_buf; l_uintptr_t ifcu_req; } ifc_ifcu; -} __packed; +}; #define ifc_buf ifc_ifcu.ifcu_buf #define ifc_req ifc_ifcu.ifcu_req @@ -526,7 +527,7 @@ struct l_pollfd { l_int fd; l_short events; l_short revents; -} __packed; +}; struct l_user_desc { l_uint entry_number; diff --git a/sys/arm64/linux/linux.h b/sys/arm64/linux/linux.h index f3cf03dffd66..5d4739223275 100644 --- a/sys/arm64/linux/linux.h +++ b/sys/arm64/linux/linux.h @@ -258,7 +258,8 @@ struct l_ifmap { u_char irq; u_char dma; u_char port; -} __packed; + /* 3 bytes spare*/ +}; struct l_ifreq { union { @@ -278,7 +279,7 @@ struct l_ifreq { char ifru_slave[LINUX_IFNAMSIZ]; l_uintptr_t ifru_data; } ifr_ifru; -} __packed; +}; #define ifr_name ifr_ifrn.ifrn_name /* Interface name */ #define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h index ab78a9649511..7a8de667e176 100644 --- a/sys/i386/linux/linux.h +++ b/sys/i386/linux/linux.h @@ -132,7 +132,7 @@ struct l_mmap_argv { l_int flags; l_int fd; l_off_t pgoff; -} __packed; +}; /* * stat family of syscalls From owner-dev-commits-src-main@freebsd.org Mon May 31 19:11:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D6A164CDEC; Mon, 31 May 2021 19:11:45 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f169.google.com (mail-il1-f169.google.com [209.85.166.169]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fv4f93jctz4jgC; Mon, 31 May 2021 19:11:45 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-il1-f169.google.com with SMTP id x18so5247759ila.10; Mon, 31 May 2021 12:11:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4BL4iZMCxGP59sXt2UvKu+9ZGtnjQ1cEGBUOwUzB7eM=; b=prV8aqdERJJQEyvHfVFItqLLWr5qVOHT4uGsDnWn04lvXl5H9/FuiqgZmLUBqPsSvh /wRckK3R8QNj04etC4N9Y4MpWkZzZ/m+IP1biZ1kgGglKEV3icwF5NOVJ8EZizJLTxbF EYWFyfolclSwusQbRDvhDWH4gT/JGKcdmX3KHhW3M5R1Hx8VqFh1LJu0UUk8HBnzrMDA THmnmg2DzfJEODDVTdZl7/yokAsC+vAldQkwUK0P1oggIjpnXIUSSX3N4JrYNddUJqO6 kyR0XQK/5q3PIxyvHF/XOYwDSd8bmPmvb3+uv0GPq0K0t0V8D2LYd6RTH26DXUHPmymQ uCVg== X-Gm-Message-State: AOAM530xo/Ygogxx6XwuVaBuygiYBF/OCTF005iaH/KhUK1NX44iMnKK LkDm1s3MD54a3WN2m9fpOgfBkVfop0aFHD5FqFk7Yg3K X-Google-Smtp-Source: ABdhPJw4tPno52YcSy/ZGz9Qx9OreJzhbCP8o6P0qCRL0xmGoxneeSnRpvjNdI3rhMFiYIAQVcJ6eRYz4NYFk+Ro7ks= X-Received: by 2002:a92:ad07:: with SMTP id w7mr18128261ilh.98.1622488303326; Mon, 31 May 2021 12:11:43 -0700 (PDT) MIME-Version: 1.0 References: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> In-Reply-To: From: Ed Maste Date: Mon, 31 May 2021 15:11:26 -0400 Message-ID: Subject: Re: git: 5a20c351ea45 - main - [skip ci] add a CODEOWNERS file To: Alan Somers Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Fv4f93jctz4jgC X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 19:11:45 -0000 On Mon, 31 May 2021 at 11:51, Alan Somers wrote: > >> >> I think this file isn't the right place for (another copy of) this >> text; perhaps the CODEOWNERS file should just reference the top-level >> MAINTAINERS? > > Except that CODEOWNERS is in a format that tools know how to parse. If anything, MAINTAINERS should be a symlink to CODEOWNERS. At least the file's location and user IDs suggest that it is specific to GitHub; in any case I don't really care which one points to which. I hope we can agree though that we don't really want two different files representing code ownership in different ways that both independently refer to a third mechanism for recording code ownership that's external to the source tree? From owner-dev-commits-src-main@freebsd.org Mon May 31 19:16:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C896964CF24 for ; Mon, 31 May 2021 19:16:45 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fv4lx4rqVz4jVn for ; Mon, 31 May 2021 19:16:45 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x735.google.com with SMTP id 124so12054838qkh.10 for ; Mon, 31 May 2021 12:16:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jxXK/cA7DP3kQB6g/JxO8ma+8Wknbt1Bch3InNAfhq4=; b=E8N0bnUBU8JLHa3gFpm9FFEY8wfH2ArO6ALNT6FajZoiPNlazJZEliAuqdHQZnxi6F wuG+OdiM5GNX/eU7+8yrgQKfzUXG1c9N/tMOnNVv15omk1glnZmsBHOe2eMKxZJd8Rf6 ZGEuY7Eb0of7s3QqdVd/2Pn8ea5zMY+gy2QLK253VP3unPQVPCDeMimwGRncjSxBtb3p Z48obUUGTVqioC7tBZQrQLp1KYlCvVd+2ByMuKe24oFYnlmaxV9VSVHxu9RMo2R4bMT7 dPJQSsfI/BDrJRdwFfU2sqnGUglQv/ivrbNJ000p6LTdXsBgnAfiCdeo6USyaR+T9p6b lo0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jxXK/cA7DP3kQB6g/JxO8ma+8Wknbt1Bch3InNAfhq4=; b=uKH1V+GxOJ+2P7laImQRPUUSzSpyp0m0Nz5eAPoTqOs4DW4w0xhsm12CGWop6Wbw6M rsNs6nnuVsYWZMtoyuHbfT8rfdSTYrirjcOacZvqJtZsWK01NO5DDwm+A2JAPTkkzNIS IHeVeO7+MozvAC+sIEV52zI7zStP+SK9a64WTAFYtawRrN1l5hyEd+wtqsag0gBwTLe9 gppydxyzFEXktW8e56JSD7yLhhR+N5nclqo1ylqbe5wjim4zIaYtziJBAK7+mNXgDFti 6SoRerZCi5pfE4rFwCR5P7KMsFgf+KZ8KPhfD75GzcAHNJmegZgh+Oh2OX3xDqcn8bzA 8SNA== X-Gm-Message-State: AOAM530lf1iNBdXrOu9rMIr/pJVZ6kSUeTRsBiB+veDQaUeJd/RytPBV 0c6ptAE0vZEXoTRQs9wAMYrL5UsWfLtZGIjlIfyaCQ== X-Google-Smtp-Source: ABdhPJyQPJqFlzEWnpSWZ0UKVy4pwYRLUClAa89BbiBKDPA8ICQVFtXL7Lkw0fae7K1wYrXTkDVHSBZduKEig/ovOKY= X-Received: by 2002:a05:620a:7c2:: with SMTP id 2mr10837574qkb.206.1622488604564; Mon, 31 May 2021 12:16:44 -0700 (PDT) MIME-Version: 1.0 References: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> In-Reply-To: From: Warner Losh Date: Mon, 31 May 2021 13:16:33 -0600 Message-ID: Subject: Re: git: 5a20c351ea45 - main - [skip ci] add a CODEOWNERS file To: Ed Maste Cc: Alan Somers , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4Fv4lx4rqVz4jVn X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 19:16:45 -0000 On Mon, May 31, 2021, 1:11 PM Ed Maste wrote: > On Mon, 31 May 2021 at 11:51, Alan Somers wrote: > > > >> > >> I think this file isn't the right place for (another copy of) this > >> text; perhaps the CODEOWNERS file should just reference the top-level > >> MAINTAINERS? > > > > Except that CODEOWNERS is in a format that tools know how to parse. If > anything, MAINTAINERS should be a symlink to CODEOWNERS. > > At least the file's location and user IDs suggest that it is specific > to GitHub; in any case I don't really care which one points to which. > I hope we can agree though that we don't really want two different > files representing code ownership in different ways that both > independently refer to a third mechanism for recording code ownership > that's external to the source tree? It also works on gitlab, FWIW. The format is standard. Bummer we can't generate it based on where it is published... Warner From owner-dev-commits-src-main@freebsd.org Mon May 31 19:21:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 642D664D453; Mon, 31 May 2021 19:21:12 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fv4s42F9kz4jy9; Mon, 31 May 2021 19:21:12 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi1-f172.google.com with SMTP id a21so2320122oiw.3; Mon, 31 May 2021 12:21:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=huAGsL4frnV84rFv9vM+Aib9d8Li4G1trift9zMrNrM=; b=MDl9al9Kz9zs/j3ycZ0IqQOxw2Nv1km7JhNK7lum2JNHPU3tuKm2Rx+SIV/IEVW0U9 i5oWP4VT1/6tyuQTUij6FHaVRkEjYtoW+JdsfB+jKpFJ1wvHucRhSkk4tC9fvBnF+xId erDSRpxENhSwx+PiYXJ0c8IkS6/ef9Yk6sb1TB4Jr1Ja1WuH6sLpFQ/+KNXUP5GGOjKR wVsfdmIy+4WYI3iJn0Wo4M8K+uT0xUDGc6AvNdqK5EiyMApXLBQlwoBZGogfra8MxqTx aFaFtw3QYfrYY4OMgeYnM6PT8tOwiwCwPjnuolF2wcatIpPUvXs+v8b3EyW/P2j+o3vo Z24A== X-Gm-Message-State: AOAM533uu8OEHMYA/M/5ZCuQLeaIS8MXDrOlbdlW+sl8Ma4uYOAuE2rX C8tavDsY1U70yc6A7O8fR4fFgOW1HLdxP+3ICROtyWA/UqQKlA== X-Google-Smtp-Source: ABdhPJwd4/rfgNT7iH3sDkqmBp2ZXM1VmYC9B8VslrYA5NVjcbuKmvVMs6CPK5vFM2K2+eRBryL/tY0eT5v9m08cNxU= X-Received: by 2002:a05:6808:8c6:: with SMTP id k6mr401287oij.55.1622488870923; Mon, 31 May 2021 12:21:10 -0700 (PDT) MIME-Version: 1.0 References: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> In-Reply-To: From: Alan Somers Date: Mon, 31 May 2021 13:20:59 -0600 Message-ID: Subject: Re: git: 5a20c351ea45 - main - [skip ci] add a CODEOWNERS file To: Warner Losh Cc: Ed Maste , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4Fv4s42F9kz4jy9 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 19:21:12 -0000 On Mon, May 31, 2021 at 1:16 PM Warner Losh wrote: > > > On Mon, May 31, 2021, 1:11 PM Ed Maste wrote: > >> On Mon, 31 May 2021 at 11:51, Alan Somers wrote: >> > >> >> >> >> I think this file isn't the right place for (another copy of) this >> >> text; perhaps the CODEOWNERS file should just reference the top-level >> >> MAINTAINERS? >> > >> > Except that CODEOWNERS is in a format that tools know how to parse. If >> anything, MAINTAINERS should be a symlink to CODEOWNERS. >> >> At least the file's location and user IDs suggest that it is specific >> to GitHub; in any case I don't really care which one points to which. >> I hope we can agree though that we don't really want two different >> files representing code ownership in different ways that both >> independently refer to a third mechanism for recording code ownership >> that's external to the source tree? > > > It also works on gitlab, FWIW. The format is standard. Bummer we can't > generate it based on where it is published... > > Warner > We could move it from .github/ into the top-level directory. Github is happy with that. Is Gitlab happy too? From owner-dev-commits-src-main@freebsd.org Mon May 31 19:21:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 71C4064D329 for ; Mon, 31 May 2021 19:21:32 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fv4sS2Dq7z4jxY for ; Mon, 31 May 2021 19:21:32 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-x331.google.com with SMTP id b145-20020a1c80970000b029019c8c824054so111378wmd.5 for ; Mon, 31 May 2021 12:21:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jrtc27.com; s=gmail.jrtc27.user; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=hR1zi/xP4VEOUbZxM9J+WDCaj/p3CwRonyZiqXcTLMU=; b=HzgpapgxcpwIHCWGo9aUQFhLk3EAbbojt1k3JYU1tG+UIP6rZDgd7KW/oiwYrGPOfk 1/SxIGoZvfLtuVZNMWMTcZoLcNfWkYv5W0uQUu9Z7jEjnYVNsL4Tgtf6SE5eiE5h8HUC cxJbGJyaVVOHEYmlGmXSxD9xTqKF/iBsief7csD8DlhON//RFyd89wAfV4OKGmST3/+q irvdSip7rXR8DSzqAUFKPkeqfBzgsesZk/osBBQMWZH667qyK1EcVaG02AbQk8mUgrd8 Iun27epXSAlbKectjk748+3PDeOEmBAn/RMSaXuWZJiJ14dBjqLD2H2hJ3l5k5HbvIv1 uN2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=hR1zi/xP4VEOUbZxM9J+WDCaj/p3CwRonyZiqXcTLMU=; b=UKed0fnrz4LVngqqskdvR8ZMu1IynDlGlIqptEuCDZnhGLCIZ2Lnmd0pQqbWrIhQK0 TPagio8cb68ItR+zszqRs/BKjbESvTtEW8GTTz5hmXt9bf5tuQ3I2e9OaUuiZ/TsOlP1 AqRRveklsUXcU4U3DYRsqm/6LdJkr+L2OtVfAl5Xt/YkVwRtJDhVr/L+Vq6qwd2VYW83 3Kgk8L8iUbJqylViM5Jvj89Y/KqZF0DTsPAJlEgu0WZycBYi6gEyWFIRU2hUQeARtVQq F/Y4+gcXN55D0+yCOnIon4eBXDWvkaEv8JE1PBW4KPVbJJ9maDsbu/AUItKlY5/cX3Eu d8FQ== X-Gm-Message-State: AOAM533tHBUWIbNwLDg4uMz0GYzrl+09X5NAa5XtfmH9fUEOaV4qmGuu MQ6MpODammdriLePRq70XkKG8Q== X-Google-Smtp-Source: ABdhPJzAjnjeH0D7h6vQ1pZM9HO4DVfvjQII0Dj28T32sWSG9HAnNJGBotSuqcxgc2TUSD7AXEzCCA== X-Received: by 2002:a05:600c:896:: with SMTP id l22mr22593457wmp.164.1622488890712; Mon, 31 May 2021 12:21:30 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id l8sm832283wrf.0.2021.05.31.12.21.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 May 2021 12:21:30 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: 5a20c351ea45 - main - [skip ci] add a CODEOWNERS file From: Jessica Clarke In-Reply-To: Date: Mon, 31 May 2021 20:21:29 +0100 Cc: Ed Maste , Alan Somers , src-committers , "" , dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> To: Warner Losh X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4Fv4sS2Dq7z4jxY X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 19:21:32 -0000 On 31 May 2021, at 20:16, Warner Losh wrote: >=20 >=20 >=20 > On Mon, May 31, 2021, 1:11 PM Ed Maste wrote: > On Mon, 31 May 2021 at 11:51, Alan Somers wrote: > > > >> > >> I think this file isn't the right place for (another copy of) this > >> text; perhaps the CODEOWNERS file should just reference the = top-level > >> MAINTAINERS? > > > > Except that CODEOWNERS is in a format that tools know how to parse. = If anything, MAINTAINERS should be a symlink to CODEOWNERS. >=20 > At least the file's location and user IDs suggest that it is specific > to GitHub; in any case I don't really care which one points to which. > I hope we can agree though that we don't really want two different > files representing code ownership in different ways that both > independently refer to a third mechanism for recording code ownership > that's external to the source tree? >=20 > It also works on gitlab, FWIW. The format is standard. Bummer we can't = generate it based on where it is published=E2=80=A6 We could conceivably have a CODEOWNERS.master from which the others can = be generated via `make codeowners` whenever someone edits it. Whether = that=E2=80=99s worth the hassle of implementing though for a file that = shouldn=E2=80=99t regularly be changing is unclear. Jess From owner-dev-commits-src-main@freebsd.org Mon May 31 19:24:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 10E9864D042; Mon, 31 May 2021 19:24:10 +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 4Fv4wT74Npz4kWC; Mon, 31 May 2021 19:24:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DAEC716014; Mon, 31 May 2021 19:24:09 +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 14VJO9tg044465; Mon, 31 May 2021 19:24:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VJO9qp044464; Mon, 31 May 2021 19:24:09 GMT (envelope-from git) Date: Mon, 31 May 2021 19:24:09 GMT Message-Id: <202105311924.14VJO9qp044464@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: a06c12464bb4 - main - linux(4): Add F_GETPIPE_SZ fcntl operation which returns the capacity of the pipe referred by fd. 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: a06c12464bb49750c6b113c971e2770408ce422a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 19:24:10 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=a06c12464bb49750c6b113c971e2770408ce422a commit a06c12464bb49750c6b113c971e2770408ce422a Author: Dmitry Chagin AuthorDate: 2021-05-31 19:15:02 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-31 19:15:02 +0000 linux(4): Add F_GETPIPE_SZ fcntl operation which returns the capacity of the pipe referred by fd. Differential Revision: https://reviews.freebsd.org/D30517 MFC after: 2 weeks --- sys/compat/linux/linux_file.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c index 0549d536ba51..a6cf467d6219 100644 --- a/sys/compat/linux/linux_file.c +++ b/sys/compat/linux/linux_file.c @@ -45,6 +45,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -1524,6 +1526,7 @@ fcntl_common(struct thread *td, struct linux_fcntl_args *args) { struct l_flock linux_flock; struct flock bsd_flock; + struct pipe *fpipe; struct file *fp; long arg; int error, result; @@ -1655,6 +1658,21 @@ fcntl_common(struct thread *td, struct linux_fcntl_args *args) case LINUX_F_ADD_SEALS: return (kern_fcntl(td, args->fd, F_ADD_SEALS, linux_to_bsd_bits(args->arg, seal_bitmap, 0))); + + case LINUX_F_GETPIPE_SZ: + error = fget(td, args->fd, + &cap_fcntl_rights, &fp); + if (error != 0) + return (error); + if (fp->f_type != DTYPE_PIPE) { + fdrop(fp, td); + return (EINVAL); + } + fpipe = fp->f_data; + td->td_retval[0] = fpipe->pipe_buffer.size; + fdrop(fp, td); + return (0); + default: linux_msg(td, "unsupported fcntl cmd %d", args->cmd); return (EINVAL); From owner-dev-commits-src-main@freebsd.org Mon May 31 19:31:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7CD7764D969; Mon, 31 May 2021 19:31:09 +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 4Fv54Y2w0yz4l1B; Mon, 31 May 2021 19:31:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4CB5A15FB8; Mon, 31 May 2021 19:31:09 +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 14VJV9wJ053588; Mon, 31 May 2021 19:31:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VJV9VA053587; Mon, 31 May 2021 19:31:09 GMT (envelope-from git) Date: Mon, 31 May 2021 19:31:09 GMT Message-Id: <202105311931.14VJV9VA053587@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: 8505eb5dd8f7 - main - linux(4): Convert flags before use in utimensat. 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: 8505eb5dd8f743f29e9c93b6814a34f1890e6c41 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 19:31:09 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=8505eb5dd8f743f29e9c93b6814a34f1890e6c41 commit 8505eb5dd8f743f29e9c93b6814a34f1890e6c41 Author: Dmitry Chagin AuthorDate: 2021-05-31 19:30:37 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-31 19:30:37 +0000 linux(4): Convert flags before use in utimensat. Differential Revision: https://reviews.freebsd.org/D30487 MFC after: 2 weeks --- sys/compat/linux/linux_misc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index fc846df6689f..2be328a0d6d2 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -861,6 +861,9 @@ linux_utimensat(struct thread *td, struct linux_utimensat_args *args) return (0); } + if (args->flags & LINUX_AT_SYMLINK_NOFOLLOW) + flags |= AT_SYMLINK_NOFOLLOW; + if (!LUSECONVPATH(td)) { if (args->pathname != NULL) { return (kern_utimensat(td, dfd, args->pathname, @@ -873,9 +876,6 @@ linux_utimensat(struct thread *td, struct linux_utimensat_args *args) else if (args->flags != 0) return (EINVAL); - if (args->flags & LINUX_AT_SYMLINK_NOFOLLOW) - flags |= AT_SYMLINK_NOFOLLOW; - if (path == NULL) error = kern_futimens(td, dfd, timesp, UIO_SYSSPACE); else { From owner-dev-commits-src-main@freebsd.org Mon May 31 19:34:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E004664DED8; Mon, 31 May 2021 19:34:07 +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 4Fv57z5zy0z4lCV; Mon, 31 May 2021 19:34:07 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B5D4316294; Mon, 31 May 2021 19:34:07 +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 14VJY7MS058150; Mon, 31 May 2021 19:34:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VJY77h058149; Mon, 31 May 2021 19:34:07 GMT (envelope-from git) Date: Mon, 31 May 2021 19:34:07 GMT Message-Id: <202105311934.14VJY77h058149@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: da93a73f8346 - main - iwmbtfw(8): Improve Intel 7260/7265 adaptors handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: da93a73f834612b659b37b513c8296e1178d249b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 19:34:07 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=da93a73f834612b659b37b513c8296e1178d249b commit da93a73f834612b659b37b513c8296e1178d249b Author: Vladimir Kondratyev AuthorDate: 2021-05-31 19:32:08 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-05-31 19:32:08 +0000 iwmbtfw(8): Improve Intel 7260/7265 adaptors handling - Allow firmware downloading for hw_variant #8; - Enter manufacturer mode for setting of event mask; - Handle multi-event response on HCI commands for 7260; This allows to remove kludge with skipping of 0xfc2f opcode. - Disable patch and exit manufacturer mode on downloading failure; - Use default firmware if correct firmware file is not found; Reviewed by: Philippe Michaud-Boudreault MFC after: 1 week Tested by: arrowd Differential revision: https://reviews.freebsd.org/D30543 --- usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c | 14 ++++ usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c | 116 ++++++++++++++++++++-------------- usr.sbin/bluetooth/iwmbtfw/main.c | 9 ++- 3 files changed, 91 insertions(+), 48 deletions(-) diff --git a/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c b/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c index fc93ce094adc..963d5d5d9008 100644 --- a/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c +++ b/usr.sbin/bluetooth/iwmbtfw/iwmbt_fw.c @@ -116,10 +116,12 @@ char * iwmbt_get_fwname(struct iwmbt_version *ver, struct iwmbt_boot_params *params, const char *prefix, const char *suffix) { + struct stat sb; char *fwname; switch (ver->hw_variant) { case 0x07: /* 7260 */ + case 0x08: /* 7265 */ asprintf(&fwname, "%s/ibt-hw-%x.%x.%x-fw-%x.%x.%x.%x.%x.%s", prefix, le16toh(ver->hw_platform), @@ -131,6 +133,18 @@ iwmbt_get_fwname(struct iwmbt_version *ver, struct iwmbt_boot_params *params, le16toh(ver->fw_build_ww), le16toh(ver->fw_build_yy), suffix); + /* + * Fallback to the default firmware patch if + * the correct firmware patch file is not found. + */ + if (stat(fwname, &sb) != 0 && errno == ENOENT) { + free(fwname); + asprintf(&fwname, "%s/ibt-hw-%x.%x.%s", + prefix, + le16toh(ver->hw_platform), + le16toh(ver->hw_variant), + suffix); + } break; case 0x0b: /* 8260 */ diff --git a/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c b/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c index f4272548d560..218fd28b74a2 100644 --- a/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c +++ b/usr.sbin/bluetooth/iwmbtfw/iwmbt_hw.c @@ -134,17 +134,18 @@ iwmbt_patch_fwfile(struct libusb_device_handle *hdl, struct iwmbt_firmware fw_job = *fw; uint16_t cmd_opcode; uint8_t cmd_length; - uint8_t cmd_buf[IWMBT_HCI_MAX_CMD_SIZE]; + struct iwmbt_hci_cmd *cmd_buf; uint8_t evt_code; uint8_t evt_length; uint8_t evt_buf[IWMBT_HCI_MAX_EVENT_SIZE]; - int skip_patch = 0; + int activate_patch = 0; - for (;;) { - skip_patch = 0; - - if (fw_job.len < 4) - break; + while (fw_job.len > 0) { + if (fw_job.len < 4) { + iwmbt_err("Invalid firmware, unexpected EOF in HCI " + "command header. Remains=%d", fw_job.len); + return (-1); + } if (fw_job.buf[0] != 0x01) { iwmbt_err("Invalid firmware, expected HCI command (%d)", @@ -159,47 +160,61 @@ iwmbt_patch_fwfile(struct libusb_device_handle *hdl, /* Load in the HCI command to perform. */ cmd_opcode = le16dec(fw_job.buf); cmd_length = fw_job.buf[2]; - memcpy(cmd_buf, fw_job.buf, 3); + cmd_buf = (struct iwmbt_hci_cmd *)fw_job.buf; iwmbt_debug("opcode=%04x, len=%02x", cmd_opcode, cmd_length); - /* For some reason the command 0xfc2f hangs up my card. */ - if (cmd_opcode == 0xfc2f) - skip_patch = 1; + /* + * If there is a command that loads a patch in the + * firmware file, then activate the patch upon success, + * otherwise just disable the manufacturer mode. + */ + if (cmd_opcode == 0xfc8e) + activate_patch = 1; /* Advance by three. */ fw_job.buf += 3; fw_job.len -= 3; - if (fw_job.len < cmd_length) - cmd_length = fw_job.len; - - /* Copy data to HCI command buffer. */ - memcpy(cmd_buf + 3, fw_job.buf, - MIN(cmd_length, IWMBT_HCI_MAX_CMD_SIZE - 3)); + if (fw_job.len < cmd_length) { + iwmbt_err("Invalid firmware, unexpected EOF in HCI " + "command data. len=%d, remains=%d", + cmd_length, fw_job.len); + return (-1); + } /* Advance by data length. */ fw_job.buf += cmd_length; fw_job.len -= cmd_length; + ret = libusb_control_transfer(hdl, + LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_DEVICE, + 0, + 0, + 0, + (uint8_t *)cmd_buf, + IWMBT_HCI_CMD_SIZE(cmd_buf), + IWMBT_HCI_CMD_TIMEOUT); + + if (ret < 0) { + iwmbt_err("libusb_control_transfer() failed: err=%s", + libusb_strerror(ret)); + return (-1); + } + /* * Every command has its associated event: data must match * what is recorded in the firmware file. Perform that check * now. - * - * Some commands are mapped to more than one event sequence, - * in that case we can drop the non-patch commands, as we - * probably don't need them for operation of the card. - * */ - for (;;) { + while (fw_job.len > 0 && fw_job.buf[0] == 0x02) { /* Is this the end of the file? */ - if (fw_job.len < 3) - break; - - if (fw_job.buf[0] != 0x02) - break; + if (fw_job.len < 3) { + iwmbt_err("Invalid firmware, unexpected EOF in" + "event header. remains=%d", fw_job.len); + return (-1); + } /* Advance by one. */ fw_job.buf++; @@ -219,30 +234,39 @@ iwmbt_patch_fwfile(struct libusb_device_handle *hdl, iwmbt_debug("event=%04x, len=%02x", evt_code, evt_length); + if (fw_job.len < evt_length) { + iwmbt_err("Invalid firmware, unexpected EOF in" + " event data. len=%d, remains=%d", + evt_length, fw_job.len); + return (-1); + } + + ret = libusb_interrupt_transfer(hdl, + IWMBT_INTERRUPT_ENDPOINT_ADDR, + evt_buf, + IWMBT_HCI_MAX_EVENT_SIZE, + &transferred, + IWMBT_HCI_CMD_TIMEOUT); + + if (ret < 0) { + iwmbt_err("libusb_interrupt_transfer() failed:" + " err=%s", libusb_strerror(ret)); + return (-1); + } + + if ((int)evt_length + 2 != transferred || + memcmp(evt_buf + 2, fw_job.buf, evt_length) != 0) { + iwmbt_err("event does not match firmware"); + return (-1); + } + /* Advance by data length. */ fw_job.buf += evt_length; fw_job.len -= evt_length; - - if (skip_patch == 0) { - ret = iwmbt_hci_command(hdl, - (struct iwmbt_hci_cmd *)cmd_buf, - evt_buf, - IWMBT_HCI_MAX_EVENT_SIZE, - &transferred, - IWMBT_HCI_CMD_TIMEOUT); - - if (ret < 0) { - iwmbt_debug("Can't send patch: " - "code=%d, size=%d", - ret, - transferred); - return (-1); - } - } } } - return (0); + return (activate_patch); } int diff --git a/usr.sbin/bluetooth/iwmbtfw/main.c b/usr.sbin/bluetooth/iwmbtfw/main.c index 3476e3fcd613..202894740805 100644 --- a/usr.sbin/bluetooth/iwmbtfw/main.c +++ b/usr.sbin/bluetooth/iwmbtfw/main.c @@ -441,13 +441,15 @@ main(int argc, char *argv[]) /* Download firmware and parse it for magic Intel Reset parameter */ r = iwmbt_patch_firmware(hdl, firmware_path); free(firmware_path); - if (r < 0) + if (r < 0) { + (void)iwmbt_exit_manufacturer(hdl, 0x01); goto shutdown; + } iwmbt_info("Firmware download complete"); /* Exit manufacturer mode */ - r = iwmbt_exit_manufacturer(hdl, 0x02); + r = iwmbt_exit_manufacturer(hdl, r == 0 ? 0x00 : 0x02); if (r < 0) { iwmbt_debug("iwmbt_exit_manufacturer() failed code %d", r); goto shutdown; @@ -462,9 +464,12 @@ main(int argc, char *argv[]) iwmbt_dump_version(&ver); /* Set Intel Event mask */ + if (iwmbt_enter_manufacturer(hdl) < 0) + goto reset; r = iwmbt_set_event_mask(hdl); if (r == 0) iwmbt_info("Intel Event Mask is set"); + (void)iwmbt_exit_manufacturer(hdl, 0x00); } else { From owner-dev-commits-src-main@freebsd.org Mon May 31 19:35:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 821A364DBD9; Mon, 31 May 2021 19:35:39 +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 4Fv59l3KpCz4lFv; Mon, 31 May 2021 19:35:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5B37D15D60; Mon, 31 May 2021 19:35:39 +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 14VJZdwd058496; Mon, 31 May 2021 19:35:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VJZdjk058495; Mon, 31 May 2021 19:35:39 GMT (envelope-from git) Date: Mon, 31 May 2021 19:35:39 GMT Message-Id: <202105311935.14VJZdjk058495@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 5236888db771 - main - iichid(4): disable interrupt on suspend MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5236888db77194c194706b122675af7355fe7ceb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 19:35:39 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=5236888db77194c194706b122675af7355fe7ceb commit 5236888db77194c194706b122675af7355fe7ceb Author: J.R. Oldroyd AuthorDate: 2021-05-31 19:33:07 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-05-31 19:33:07 +0000 iichid(4): disable interrupt on suspend Commit message of the identical change in Linux driver says: "When an I2C HID device is powered off during system sleep, as a result of removing its power resources (by the ACPI core) the interrupt line might go low as well. This results inadvertent interrupts." This change fixes suspend/resume on Asus S510UQ laptops. While here add a couple of typo fixes as well as a slight change to the iichid_attach() code to have the power_on flag set properly. Submitted by: J.R. Oldroyd Reviewed by: wulf MFC after: 1 week --- sys/dev/iicbus/iichid.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/sys/dev/iicbus/iichid.c b/sys/dev/iicbus/iichid.c index 7c51a697c4c7..68d7cfd9090f 100644 --- a/sys/dev/iicbus/iichid.c +++ b/sys/dev/iicbus/iichid.c @@ -573,7 +573,7 @@ iichid_intr(void *context) * not allowed and often returns a garbage. If a HOST needs to * communicate with the DEVICE it MUST issue a SET POWER command * (to ON) before any other command. As some hardware requires reads to - * acknoledge interrupts we fetch only length header and discard it. + * acknowledge interrupts we fetch only length header and discard it. */ maxlen = sc->power_on ? sc->intr_bufsize : 0; error = iichid_cmd_read(sc, sc->intr_buf, maxlen, &actual); @@ -1069,14 +1069,16 @@ iichid_attach(device_t dev) error = iichid_reset(sc); if (error) { device_printf(dev, "failed to reset hardware: %d\n", error); - return (ENXIO); + error = ENXIO; + goto done; } - sc->power_on = false; + sc->power_on = true; + #ifdef IICHID_SAMPLING TASK_INIT(&sc->event_task, 0, iichid_event_task, sc); /* taskqueue_create can't fail with M_WAITOK mflag passed. */ - sc->taskqueue = taskqueue_create("hmt_tq", M_WAITOK | M_ZERO, + sc->taskqueue = taskqueue_create("iichid_tq", M_WAITOK | M_ZERO, taskqueue_thread_enqueue, &sc->taskqueue); TIMEOUT_TASK_INIT(sc->taskqueue, &sc->periodic_task, 0, iichid_event_task, sc); @@ -1144,8 +1146,10 @@ iichid_attach(device_t dev) device_printf(dev, "failed to attach child: error %d\n", error); iichid_detach(dev); } + done: (void)iichid_set_power(sc, I2C_HID_POWER_OFF); + sc->power_on = false; return (error); } @@ -1178,21 +1182,27 @@ iichid_suspend(device_t dev) int error; sc = device_get_softc(dev); - DPRINTF(sc, "Suspend called, setting device to power_state 1\n"); (void)bus_generic_suspend(dev); +#ifdef IICHID_SAMPLING + if (sc->sampling_rate_slow < 0) +#endif + (void)bus_generic_suspend_intr(device_get_parent(dev), dev, + sc->irq_res); + /* * 8.2 - The HOST is going into a deep power optimized state and wishes * to put all the devices into a low power state also. The HOST * is recommended to issue a HIPO command to the DEVICE to force * the DEVICE in to a lower power state. */ + DPRINTF(sc, "Suspend called, setting device to power_state 1\n"); error = iichid_set_power_state(sc, IICHID_PS_NULL, IICHID_PS_OFF); if (error != 0) DPRINTF(sc, "Could not set power_state, error: %d\n", error); else DPRINTF(sc, "Successfully set power_state\n"); - return (0); + return (0); } static int @@ -1209,6 +1219,11 @@ iichid_resume(device_t dev) else DPRINTF(sc, "Successfully set power_state\n"); (void)bus_generic_resume(dev); +#ifdef IICHID_SAMPLING + if (sc->sampling_rate_slow < 0) +#endif + (void)bus_generic_resume_intr(device_get_parent(dev), dev, + sc->irq_res); return (0); } From owner-dev-commits-src-main@freebsd.org Mon May 31 19:37:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 230BA64DFA8 for ; Mon, 31 May 2021 19:37:21 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fv5Cj00nQz4lrr for ; Mon, 31 May 2021 19:37:20 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72d.google.com with SMTP id h20so12108944qko.11 for ; Mon, 31 May 2021 12:37:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WsDzVjMaRg+rOFVMEtTwSgZvPWnjL9gbGN7d70U86Kg=; b=ShXSPBdCbwPAozxjGGhtQnoR1DguJ3dAM+e+b3n6q4/fBKhk7VtusPzqBW5JK7SvfN nnR4zseL7wCuWuU1z790+0F2LQSd/O+x1ION3JozTvMYizI04Fc+ASvWsTISiYeuEGQB NvUScs0lw309Gye18m03EiEtUcxxMPk9jSrDEFQ+rJ+gsI2A7exos5kme5i2YKTGlpyF HW3aHIQQRjZrc33BmJviVcKb3VqKiO6oZ7Krue9VLX6wpDB00kwjjqch/lk4Xfau/CdA ysn8T4EAv5ot1fkPFHu4FrW3SdC5O4416vvsfpPDngBMEHuWFZnZf2iMUD0vsSSsUZQC hvDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=WsDzVjMaRg+rOFVMEtTwSgZvPWnjL9gbGN7d70U86Kg=; b=fItKrO76ywlY0gilfdn0ETPDLUFShrs9v0b6exzDw9BHhoJKC5ObweaTU481SvL8GJ OwsQSTX2W3xLDn8PNIuM3t1FZezd7wNpGeL7sWjEsOkXPNckG81493eZVcdyMh2Nkigg SVBzFFGtpUNx+XJu1+AhneR/iOUAw0S0SZdNc5wZrZExQSSPArtpJj/5SSV/n8l2s5Wy olZoos7LU3cBCQR0lD/lsADIQUqIqQw0Yy0SiUEEb4p10ZGsm/ia/l//MWnPMf+6eMwO qs2blagfYKZs7gtns8Vg7IAzyKjRBVHvC+syc5CbQorgh2Txw37iqssB6RGTm8L73frw tLgQ== X-Gm-Message-State: AOAM531W1o0EBTYxEwFuJoQ1edWOgKnhkwyVwtQ6CrUd79KqhWMwlihM 5O6W0sHWd9cZ2wFfaoKmiAICNTFi5f3R5VgSaWMyZQ== X-Google-Smtp-Source: ABdhPJyEmAglRJyWbmD9fyej2T5XKBMRuqoBhA59TW+vQ8RTbJv0wbQJv82l8X07GBya8SRoL/NuDq7dGPwBx+MB6oo= X-Received: by 2002:a05:620a:e09:: with SMTP id y9mr17856534qkm.359.1622489840077; Mon, 31 May 2021 12:37:20 -0700 (PDT) MIME-Version: 1.0 References: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> In-Reply-To: From: Warner Losh Date: Mon, 31 May 2021 13:37:09 -0600 Message-ID: Subject: Re: git: 5a20c351ea45 - main - [skip ci] add a CODEOWNERS file To: Jessica Clarke Cc: Ed Maste , Alan Somers , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4Fv5Cj00nQz4lrr X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 19:37:21 -0000 On Mon, May 31, 2021 at 1:21 PM Jessica Clarke wrote: > On 31 May 2021, at 20:16, Warner Losh wrote: > > > > > > > > On Mon, May 31, 2021, 1:11 PM Ed Maste wrote: > > On Mon, 31 May 2021 at 11:51, Alan Somers wrote: > > > > > >> > > >> I think this file isn't the right place for (another copy of) this > > >> text; perhaps the CODEOWNERS file should just reference the top-leve= l > > >> MAINTAINERS? > > > > > > Except that CODEOWNERS is in a format that tools know how to parse. > If anything, MAINTAINERS should be a symlink to CODEOWNERS. > > > > At least the file's location and user IDs suggest that it is specific > > to GitHub; in any case I don't really care which one points to which. > > I hope we can agree though that we don't really want two different > > files representing code ownership in different ways that both > > independently refer to a third mechanism for recording code ownership > > that's external to the source tree? > > > > It also works on gitlab, FWIW. The format is standard. Bummer we can't > generate it based on where it is published=E2=80=A6 > > We could conceivably have a CODEOWNERS.master from which the others can b= e > generated via `make codeowners` whenever someone edits it. Whether that= =E2=80=99s > worth the hassle of implementing though for a file that shouldn=E2=80=99t= regularly > be changing is unclear. > Doing that's trivial... However, it would mean that the automatic flagging that this file's presence gives wouldn't work... But then again, there's no issues or pull requests at the gitlab mirror, so at the moment it's a bit of a moot point. Warner From owner-dev-commits-src-main@freebsd.org Mon May 31 19:39:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B7C764E12A for ; Mon, 31 May 2021 19:39:44 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fv5GR4S52z4mlL for ; Mon, 31 May 2021 19:39:43 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f46.google.com with SMTP id l18-20020a1c79120000b0290181c444b2d0so538098wme.5 for ; Mon, 31 May 2021 12:39:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=+CCihiJooRSOhwIxLE+J4nrg8l+qfc01d05NjbMBQyM=; b=uNWBcg7pC0Ocmw1Jd4g7DLxJOZAWc4LZOp8lQOXZJZ1xQ7/06TetqMV2NjPQdmTOwy 43UtCjQ8F1rb4lMQXXuKs9lp4E4n1hIewBH6Paoj+8P51k0WKrRXqQ1BhCU/VQxVgh33 0o++rvuvSJjkt9nFxKz10kIDa/Gci8bjZIHCtwQV0F98BLzJ/lLShZEa0z9ec91Z2x9x hpXvyN3AFDuXISoWEmeEmvhr6aCxeSFzJZSDyxW2S3OXpWn6v6uAOuI694+M+KCdCtp4 ObJ1BND+cDAfEssnO7jUDy3EWt4MZA0GIea7BAZDbpBiONGEueK5xQKBUjpsE1IU5247 7qAg== X-Gm-Message-State: AOAM531nl12wHg9wwKVfL1hSYL2qtSbPJvy2mSA2T12PZXm40vC3VwuA ipwD+/99cLN51EY3mCqCf/9xJw== X-Google-Smtp-Source: ABdhPJx+x4cPMlibM3RgAIEqSLBoJLzL1iWuK1VqN0zsK88w/K5fMq+BFcmMRrFCMOa1miseFYIH5Q== X-Received: by 2002:a7b:cb55:: with SMTP id v21mr14634407wmj.19.1622489982259; Mon, 31 May 2021 12:39:42 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id k82sm361963wmf.11.2021.05.31.12.39.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 May 2021 12:39:42 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: 5a20c351ea45 - main - [skip ci] add a CODEOWNERS file From: Jessica Clarke In-Reply-To: Date: Mon, 31 May 2021 20:39:41 +0100 Cc: Ed Maste , Alan Somers , src-committers , "" , dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <0434E9D2-B0AA-4B5E-942A-A393A83DFFD1@freebsd.org> References: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> To: Warner Losh X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4Fv5GR4S52z4mlL X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 19:39:44 -0000 On 31 May 2021, at 20:37, Warner Losh wrote: >=20 >=20 >=20 > On Mon, May 31, 2021 at 1:21 PM Jessica Clarke = wrote: > On 31 May 2021, at 20:16, Warner Losh wrote: > >=20 > >=20 > >=20 > > On Mon, May 31, 2021, 1:11 PM Ed Maste wrote: > > On Mon, 31 May 2021 at 11:51, Alan Somers = wrote: > > > > > >> > > >> I think this file isn't the right place for (another copy of) = this > > >> text; perhaps the CODEOWNERS file should just reference the = top-level > > >> MAINTAINERS? > > > > > > Except that CODEOWNERS is in a format that tools know how to = parse. If anything, MAINTAINERS should be a symlink to CODEOWNERS. > >=20 > > At least the file's location and user IDs suggest that it is = specific > > to GitHub; in any case I don't really care which one points to = which. > > I hope we can agree though that we don't really want two different > > files representing code ownership in different ways that both > > independently refer to a third mechanism for recording code = ownership > > that's external to the source tree? > >=20 > > It also works on gitlab, FWIW. The format is standard. Bummer we = can't generate it based on where it is published=E2=80=A6 >=20 > We could conceivably have a CODEOWNERS.master from which the others = can be generated via `make codeowners` whenever someone edits it. = Whether that=E2=80=99s worth the hassle of implementing though for a = file that shouldn=E2=80=99t regularly be changing is unclear. >=20 > Doing that's trivial... However, it would mean that the automatic = flagging that this file's presence gives wouldn't work... But then = again, there's no issues or pull requests at the gitlab mirror, so at = the moment it's a bit of a moot point. A hypothetical .gitlab/CODEOWNERS would be checked in as a generated = file, if that was unclear. Otherwise I=E2=80=99m not sure I understand = your first point? Jess From owner-dev-commits-src-main@freebsd.org Mon May 31 19:39:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01CC564DF60; Mon, 31 May 2021 19:39:46 +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 4Fv5GV5w0Wz4mYV; Mon, 31 May 2021 19:39:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A80B416048; Mon, 31 May 2021 19:39:46 +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 14VJdkFe059146; Mon, 31 May 2021 19:39:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VJdkmq059145; Mon, 31 May 2021 19:39:46 GMT (envelope-from git) Date: Mon, 31 May 2021 19:39:46 GMT Message-Id: <202105311939.14VJdkmq059145@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: b4f9b6eef2bb - main - linux(4): Handle AT_EMPTY_PATH in the utimensat syscall. 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: b4f9b6eef2bb30059cf1040383c88c94f4d093a5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 19:39:47 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=b4f9b6eef2bb30059cf1040383c88c94f4d093a5 commit b4f9b6eef2bb30059cf1040383c88c94f4d093a5 Author: Dmitry Chagin AuthorDate: 2021-05-31 19:37:06 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-31 19:37:06 +0000 linux(4): Handle AT_EMPTY_PATH in the utimensat syscall. Differential Revision: https://reviews.freebsd.org/D30518 MFC after: 2 weeks --- sys/compat/linux/linux_misc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 2be328a0d6d2..9676cad893c1 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -813,7 +813,7 @@ linux_utimensat(struct thread *td, struct linux_utimensat_args *args) dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; - if (args->flags & ~LINUX_AT_SYMLINK_NOFOLLOW) + if (args->flags & ~(LINUX_AT_SYMLINK_NOFOLLOW | LINUX_AT_EMPTY_PATH)) return (EINVAL); if (args->times != NULL) { @@ -863,6 +863,8 @@ linux_utimensat(struct thread *td, struct linux_utimensat_args *args) if (args->flags & LINUX_AT_SYMLINK_NOFOLLOW) flags |= AT_SYMLINK_NOFOLLOW; + if (args->flags & LINUX_AT_EMPTY_PATH) + flags |= AT_EMPTY_PATH; if (!LUSECONVPATH(td)) { if (args->pathname != NULL) { From owner-dev-commits-src-main@freebsd.org Mon May 31 19:50:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46D0864E2ED; Mon, 31 May 2021 19:50:29 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com [209.85.161.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fv5Vs1HDTz4pJD; Mon, 31 May 2021 19:50:29 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oo1-f50.google.com with SMTP id v13-20020a4aa40d0000b02902052145a469so2996791ool.3; Mon, 31 May 2021 12:50:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kcjpRp0bo3X9nlu0sHyQGtu1uGBQJnuipczdjAT7dHE=; b=qm4lSpElzYIZiPMevoBeBf8n5Ep95kIDw3DHIqBIOVURV+fXEl/DdhW8FWrBNQLAYY 2myR+kZCtHKyewKsVFwiB8HNgqKryVqvGRnTEDyEEuSqB9pF5a3PfOz/l1tgyBLQ0uTe d+niyLYumqMO3TxQvQIDOD41A7hkAJQzLbGGDLzw64UC3lbHaQ48P44DBvYVtAn3KNWs bdlUZnKu7tVmGnp5Wh5Im203Av8YqppMRI3UpnycwrW7aVPqO51A/T6zhxDgO0VHLufV hl44AiEn6Y1q4iKC04BQrtNslUUsHU2jUdqVVl49YHHnquiFy1TH71SdtMRVTJmUsYbM qkBw== X-Gm-Message-State: AOAM532kzqHWbg0RJZGZz8nZUy9tX0zDWrekY5w0Ca0c4Sslp+puWGjd k+/o9Sti40feC3T28QJIfnNgnuG6PTLo+m8CRZWNZKOrITkjfQ== X-Google-Smtp-Source: ABdhPJzqckGyq1l6fyzUI6bOeldKNeVSWCDK3GN131C9QfjF+RFcsNmt7j+bUswXUFoWMV9S0yw2TUOr39zrGLhhEY0= X-Received: by 2002:a4a:7506:: with SMTP id j6mr17545487ooc.79.1622490627808; Mon, 31 May 2021 12:50:27 -0700 (PDT) MIME-Version: 1.0 References: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> <0434E9D2-B0AA-4B5E-942A-A393A83DFFD1@freebsd.org> In-Reply-To: <0434E9D2-B0AA-4B5E-942A-A393A83DFFD1@freebsd.org> From: Alan Somers Date: Mon, 31 May 2021 13:50:16 -0600 Message-ID: Subject: Re: git: 5a20c351ea45 - main - [skip ci] add a CODEOWNERS file To: Jessica Clarke Cc: Warner Losh , Ed Maste , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4Fv5Vs1HDTz4pJD X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 19:50:29 -0000 On Mon, May 31, 2021 at 1:39 PM Jessica Clarke wrote: > On 31 May 2021, at 20:37, Warner Losh wrote: > > > > > > > > On Mon, May 31, 2021 at 1:21 PM Jessica Clarke > wrote: > > On 31 May 2021, at 20:16, Warner Losh wrote: > > > > > > > > > > > > On Mon, May 31, 2021, 1:11 PM Ed Maste wrote: > > > On Mon, 31 May 2021 at 11:51, Alan Somers wrote= : > > > > > > > >> > > > >> I think this file isn't the right place for (another copy of) this > > > >> text; perhaps the CODEOWNERS file should just reference the > top-level > > > >> MAINTAINERS? > > > > > > > > Except that CODEOWNERS is in a format that tools know how to parse. > If anything, MAINTAINERS should be a symlink to CODEOWNERS. > > > > > > At least the file's location and user IDs suggest that it is specific > > > to GitHub; in any case I don't really care which one points to which. > > > I hope we can agree though that we don't really want two different > > > files representing code ownership in different ways that both > > > independently refer to a third mechanism for recording code ownership > > > that's external to the source tree? > > > > > > It also works on gitlab, FWIW. The format is standard. Bummer we can'= t > generate it based on where it is published=E2=80=A6 > > > > We could conceivably have a CODEOWNERS.master from which the others can > be generated via `make codeowners` whenever someone edits it. Whether > that=E2=80=99s worth the hassle of implementing though for a file that sh= ouldn=E2=80=99t > regularly be changing is unclear. > > > > Doing that's trivial... However, it would mean that the automatic > flagging that this file's presence gives wouldn't work... But then again, > there's no issues or pull requests at the gitlab mirror, so at the moment > it's a bit of a moot point. > > A hypothetical .gitlab/CODEOWNERS would be checked in as a generated file= , > if that was unclear. Otherwise I=E2=80=99m not sure I understand your fir= st point? > > Jess > There's no need to generate anything. Both github and gitlab support a CODEOWNERS file in the project's root. Let's just move it there. We can delete the old MAINTAINERS, too, once all of its entries have been converted. From owner-dev-commits-src-main@freebsd.org Mon May 31 19:51:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E70F64E6BF for ; Mon, 31 May 2021 19:51:44 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fv5XJ0xwrz4pJp for ; Mon, 31 May 2021 19:51:43 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f42.google.com with SMTP id o127so6785453wmo.4 for ; Mon, 31 May 2021 12:51:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=0EOwrAVD3LMjXgEoQz+Z4A5vGzP4hrRDslYOm4DR/eI=; b=VnLR2kcEHpVZ/+3KXzpBQdsEzJXtZFJZc2Jyh+P5BRZUZCYMO5DsK2GKsA30/kIa2K xw2PASuR4crURxU5/4Z14kEwNiESEsCFw6VwR2cJXPdeiPzZS6VePTwgraAEQ1HGWsai H9j1CdBEHG4TwNjZ685dusPgN5Th+AipOC1hVWGn9NThtsnHatzW5kWZtx1gNYcdROr+ Mm5TsU+2uciQMbD0Lq7CYHmo9KgvyxUHpxwYGV1YQ9OVXWkjFWHgO675mb7puenQ4nxO +2f0W7U2MunLkiasThA7yWRtZgiVmKBiEnwPT6DBbwDM406hBg1wo4wk6W8BVs8mCrCL ZXpA== X-Gm-Message-State: AOAM532AU7/KhE290OTdqomHtLL64yzzNw6+bJrDwMaWj0fLh4KFr2bl 3su7QlV1HjROwlKTCqM03X7pCHEYiH+Eiw== X-Google-Smtp-Source: ABdhPJwJ+DW+02g8hgsuVBtSyFZbza0l2w987FecxQu1EA0Rtx02hCHszJKP/W/bbhKnkKbDHxw1ew== X-Received: by 2002:a05:600c:3586:: with SMTP id p6mr644976wmq.48.1622490702584; Mon, 31 May 2021 12:51:42 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id q20sm812369wrf.45.2021.05.31.12.51.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 May 2021 12:51:42 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: 5a20c351ea45 - main - [skip ci] add a CODEOWNERS file From: Jessica Clarke In-Reply-To: Date: Mon, 31 May 2021 20:51:41 +0100 Cc: Warner Losh , Ed Maste , src-committers , "" , dev-commits-src-main@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <2A5E1D70-53BF-45EA-A668-6AF55294F10B@freebsd.org> References: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> <0434E9D2-B0AA-4B5E-942A-A393A83DFFD1@freebsd.org> To: Alan Somers X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4Fv5XJ0xwrz4pJp X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 19:51:44 -0000 On 31 May 2021, at 20:50, Alan Somers wrote: >=20 > On Mon, May 31, 2021 at 1:39 PM Jessica Clarke = wrote: > On 31 May 2021, at 20:37, Warner Losh wrote: > >=20 > >=20 > >=20 > > On Mon, May 31, 2021 at 1:21 PM Jessica Clarke = wrote: > > On 31 May 2021, at 20:16, Warner Losh wrote: > > >=20 > > >=20 > > >=20 > > > On Mon, May 31, 2021, 1:11 PM Ed Maste wrote: > > > On Mon, 31 May 2021 at 11:51, Alan Somers = wrote: > > > > > > > >> > > > >> I think this file isn't the right place for (another copy of) = this > > > >> text; perhaps the CODEOWNERS file should just reference the = top-level > > > >> MAINTAINERS? > > > > > > > > Except that CODEOWNERS is in a format that tools know how to = parse. If anything, MAINTAINERS should be a symlink to CODEOWNERS. > > >=20 > > > At least the file's location and user IDs suggest that it is = specific > > > to GitHub; in any case I don't really care which one points to = which. > > > I hope we can agree though that we don't really want two different > > > files representing code ownership in different ways that both > > > independently refer to a third mechanism for recording code = ownership > > > that's external to the source tree? > > >=20 > > > It also works on gitlab, FWIW. The format is standard. Bummer we = can't generate it based on where it is published=E2=80=A6 > >=20 > > We could conceivably have a CODEOWNERS.master from which the others = can be generated via `make codeowners` whenever someone edits it. = Whether that=E2=80=99s worth the hassle of implementing though for a = file that shouldn=E2=80=99t regularly be changing is unclear. > >=20 > > Doing that's trivial... However, it would mean that the automatic = flagging that this file's presence gives wouldn't work... But then = again, there's no issues or pull requests at the gitlab mirror, so at = the moment it's a bit of a moot point. >=20 > A hypothetical .gitlab/CODEOWNERS would be checked in as a generated = file, if that was unclear. Otherwise I=E2=80=99m not sure I understand = your first point? >=20 > Jess >=20 > There's no need to generate anything. Both github and gitlab support = a CODEOWNERS file in the project's root. Let's just move it there. We = can delete the old MAINTAINERS, too, once all of its entries have been = converted. Not if people have different usernames between FreeBSD, GitHub and = GitLab? Or can it work off email addresses and we can rely on people = adding their @FreeBSD.org to their account? Though that still doesn=E2=80=99= t work for groups. Jess From owner-dev-commits-src-main@freebsd.org Mon May 31 19:58:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E90164E814; Mon, 31 May 2021 19:58:33 +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 4Fv5h90sLVz4qFv; Mon, 31 May 2021 19:58:33 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 015E016781; Mon, 31 May 2021 19:58:32 +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 14VJwWIN086928; Mon, 31 May 2021 19:58:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VJwW0t086927; Mon, 31 May 2021 19:58:32 GMT (envelope-from git) Date: Mon, 31 May 2021 19:58:32 GMT Message-Id: <202105311958.14VJwW0t086927@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: 2a0fa277f66b - main - linux(4): Microoptimize futimesat, utimes, utime. While here wrap long line. 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: 2a0fa277f66b0dc81a97d0f7fc6dc91ff5a7fd9c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 19:58:33 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=2a0fa277f66b0dc81a97d0f7fc6dc91ff5a7fd9c commit 2a0fa277f66b0dc81a97d0f7fc6dc91ff5a7fd9c Author: Dmitry Chagin AuthorDate: 2021-05-31 19:54:18 +0000 Commit: Dmitry Chagin CommitDate: 2021-05-31 19:54:18 +0000 linux(4): Microoptimize futimesat, utimes, utime. While here wrap long line. Differential Revision: https://reviews.freebsd.org/D30488 MFC after: 2 weeks --- sys/compat/linux/linux_misc.c | 40 +++++++++++----------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 9676cad893c1..c3f783694d84 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -722,18 +722,10 @@ linux_utime(struct thread *td, struct linux_utime_args *args) struct l_utimbuf lut; char *fname; int error; - bool convpath; - - convpath = LUSECONVPATH(td); - if (convpath) - LCONVPATHEXIST(td, args->fname, &fname); if (args->times) { - if ((error = copyin(args->times, &lut, sizeof lut))) { - if (convpath) - LFREEPATH(fname); + if ((error = copyin(args->times, &lut, sizeof lut)) != 0) return (error); - } tv[0].tv_sec = lut.l_actime; tv[0].tv_usec = 0; tv[1].tv_sec = lut.l_modtime; @@ -742,10 +734,11 @@ linux_utime(struct thread *td, struct linux_utime_args *args) } else tvp = NULL; - if (!convpath) { + if (!LUSECONVPATH(td)) { error = kern_utimesat(td, AT_FDCWD, args->fname, UIO_USERSPACE, tvp, UIO_SYSSPACE); } else { + LCONVPATHEXIST(td, args->fname, &fname); error = kern_utimesat(td, AT_FDCWD, fname, UIO_SYSSPACE, tvp, UIO_SYSSPACE); LFREEPATH(fname); @@ -762,17 +755,10 @@ linux_utimes(struct thread *td, struct linux_utimes_args *args) struct timeval tv[2], *tvp = NULL; char *fname; int error; - bool convpath; - - convpath = LUSECONVPATH(td); - if (convpath) - LCONVPATHEXIST(td, args->fname, &fname); if (args->tptr != NULL) { - if ((error = copyin(args->tptr, ltv, sizeof ltv))) { - LFREEPATH(fname); + if ((error = copyin(args->tptr, ltv, sizeof ltv)) != 0) return (error); - } tv[0].tv_sec = ltv[0].tv_sec; tv[0].tv_usec = ltv[0].tv_usec; tv[1].tv_sec = ltv[1].tv_sec; @@ -780,10 +766,11 @@ linux_utimes(struct thread *td, struct linux_utimes_args *args) tvp = tv; } - if (!convpath) { + if (!LUSECONVPATH(td)) { error = kern_utimesat(td, AT_FDCWD, args->fname, UIO_USERSPACE, tvp, UIO_SYSSPACE); } else { + LCONVPATHEXIST(td, args->fname, &fname); error = kern_utimesat(td, AT_FDCWD, fname, UIO_SYSSPACE, tvp, UIO_SYSSPACE); LFREEPATH(fname); @@ -897,19 +884,12 @@ linux_futimesat(struct thread *td, struct linux_futimesat_args *args) struct timeval tv[2], *tvp = NULL; char *fname; int error, dfd; - bool convpath; - convpath = LUSECONVPATH(td); dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; - if (convpath) - LCONVPATHEXIST_AT(td, args->filename, &fname, dfd); if (args->utimes != NULL) { - if ((error = copyin(args->utimes, ltv, sizeof ltv))) { - if (convpath) - LFREEPATH(fname); + if ((error = copyin(args->utimes, ltv, sizeof ltv)) != 0) return (error); - } tv[0].tv_sec = ltv[0].tv_sec; tv[0].tv_usec = ltv[0].tv_usec; tv[1].tv_sec = ltv[1].tv_sec; @@ -917,11 +897,13 @@ linux_futimesat(struct thread *td, struct linux_futimesat_args *args) tvp = tv; } - if (!convpath) { + if (!LUSECONVPATH(td)) { error = kern_utimesat(td, dfd, args->filename, UIO_USERSPACE, tvp, UIO_SYSSPACE); } else { - error = kern_utimesat(td, dfd, fname, UIO_SYSSPACE, tvp, UIO_SYSSPACE); + LCONVPATHEXIST_AT(td, args->filename, &fname, dfd); + error = kern_utimesat(td, dfd, fname, UIO_SYSSPACE, + tvp, UIO_SYSSPACE); LFREEPATH(fname); } return (error); From owner-dev-commits-src-main@freebsd.org Mon May 31 20:03:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCFCE64E5A6; Mon, 31 May 2021 20:03:50 +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 4Fv5pG510Qz4r8n; Mon, 31 May 2021 20:03:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9404616278; Mon, 31 May 2021 20:03:50 +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 14VK3oZA000554; Mon, 31 May 2021 20:03:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VK3ohc000553; Mon, 31 May 2021 20:03:50 GMT (envelope-from git) Date: Mon, 31 May 2021 20:03:50 GMT Message-Id: <202105312003.14VK3ohc000553@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: d3f7975fcb34 - main - thread_reap_barrier(): remove unused variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d3f7975fcb346ea28dde079a9c04cff5ef20a8d7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 20:03:50 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d3f7975fcb346ea28dde079a9c04cff5ef20a8d7 commit d3f7975fcb346ea28dde079a9c04cff5ef20a8d7 Author: Konstantin Belousov AuthorDate: 2021-05-31 20:02:00 +0000 Commit: Konstantin Belousov CommitDate: 2021-05-31 20:03:42 +0000 thread_reap_barrier(): remove unused variable Noted by: alc Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/kern/kern_thread.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index b5983eb4beb7..949095a4d34e 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -719,11 +719,8 @@ thread_reap_callout_cb(void *arg __unused) void thread_reap_barrier(void) { - struct thread *td; struct task *t; - td = curthread; - /* * First do context switches to each CPU to ensure that all * PCPU pc_deadthreads are moved to zombie list. From owner-dev-commits-src-main@freebsd.org Mon May 31 20:39:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2EC564ED59; Mon, 31 May 2021 20:39:16 +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 4Fv6b84ZlYz3CXK; Mon, 31 May 2021 20:39:16 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7D94316DC5; Mon, 31 May 2021 20:39:16 +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 14VKdG5g040566; Mon, 31 May 2021 20:39:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VKdGYv040565; Mon, 31 May 2021 20:39:16 GMT (envelope-from git) Date: Mon, 31 May 2021 20:39:16 GMT Message-Id: <202105312039.14VKdGYv040565@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: bc1a6a9d692a - main - libpmc: fix "instructions" alias on Intel MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bc1a6a9d692a1f827514144b6bce0654a8be4f4d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 20:39:16 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=bc1a6a9d692a1f827514144b6bce0654a8be4f4d commit bc1a6a9d692a1f827514144b6bce0654a8be4f4d Author: Mitchell Horne AuthorDate: 2021-05-31 14:16:16 +0000 Commit: Mitchell Horne CommitDate: 2021-05-31 20:38:19 +0000 libpmc: fix "instructions" alias on Intel The typo prevents the counter from being allocated. This fixes e.g. pmcstat -s instructions sleep 5 Reviewed by: mizhka, gnn, ray, emaste MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30527 --- lib/libpmc/libpmc_pmu_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index d652573a883f..259a2a5faa47 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -72,7 +72,7 @@ static struct pmu_alias pmu_intel_alias_table[] = { {"BRANCH-MISSES-RETIRED", "BR_MISP_RETIRED.ALL_BRANCHES"}, {"cycles", "tsc-tsc"}, {"unhalted-cycles", "CPU_CLK_UNHALTED.THREAD_P_ANY"}, - {"instructions", "inst-retired.any_p"}, + {"instructions", "inst_retired.any_p"}, {"branch-mispredicts", "br_misp_retired.all_branches"}, {"branches", "br_inst_retired.all_branches"}, {"interrupts", "hw_interrupts.received"}, From owner-dev-commits-src-main@freebsd.org Mon May 31 20:39:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1CE4C64ED66; Mon, 31 May 2021 20:39:18 +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 4Fv6b95sYRz3CVF; Mon, 31 May 2021 20:39:17 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A79E916FC4; Mon, 31 May 2021 20:39:17 +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 14VKdH4g040592; Mon, 31 May 2021 20:39:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VKdHXe040591; Mon, 31 May 2021 20:39:17 GMT (envelope-from git) Date: Mon, 31 May 2021 20:39:17 GMT Message-Id: <202105312039.14VKdHXe040591@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 0092642f8639 - main - libpmc: remove unused 'isfixed' variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0092642f863946ee1edc88fa634887d7c8a54656 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 20:39:18 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=0092642f863946ee1edc88fa634887d7c8a54656 commit 0092642f863946ee1edc88fa634887d7c8a54656 Author: Mitchell Horne AuthorDate: 2021-05-31 14:22:30 +0000 Commit: Mitchell Horne CommitDate: 2021-05-31 20:39:04 +0000 libpmc: remove unused 'isfixed' variable Reviewed by: gnn, emaste MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30529 --- lib/libpmc/libpmc_pmu_util.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index 259a2a5faa47..1b2c10e07368 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -472,9 +472,7 @@ pmc_pmu_intel_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm, struct pmu_event_desc *ped) { struct pmc_md_iap_op_pmcallocate *iap; - int isfixed; - isfixed = 0; iap = &pm->pm_md.pm_iap; if (strcasestr(event_name, "UNC_") == event_name || strcasestr(event_name, "uncore") != NULL) { From owner-dev-commits-src-main@freebsd.org Mon May 31 20:39:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E80E964EDDC; Mon, 31 May 2021 20:39:18 +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 4Fv6bB66zbz3CfL; Mon, 31 May 2021 20:39:18 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 BA44116FC5; Mon, 31 May 2021 20:39:18 +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 14VKdIoH040616; Mon, 31 May 2021 20:39:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VKdIZt040615; Mon, 31 May 2021 20:39:18 GMT (envelope-from git) Date: Mon, 31 May 2021 20:39:18 GMT Message-Id: <202105312039.14VKdIZt040615@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 167cdaa7e300 - main - pmccontrol: improve -L with pmu-events MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 167cdaa7e30093215a753d4f788d921b1f7c1474 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 20:39:19 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=167cdaa7e30093215a753d4f788d921b1f7c1474 commit 167cdaa7e30093215a753d4f788d921b1f7c1474 Author: Mitchell Horne AuthorDate: 2021-05-31 14:14:36 +0000 Commit: Mitchell Horne CommitDate: 2021-05-31 20:39:05 +0000 pmccontrol: improve -L with pmu-events Check if the pmu utils are supported rather than carrying a machine-dependent #ifdef. Reviewed by: gnn, ray, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30526 --- usr.sbin/pmccontrol/pmccontrol.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/usr.sbin/pmccontrol/pmccontrol.c b/usr.sbin/pmccontrol/pmccontrol.c index 147aab2d2ba1..9d57a2923784 100644 --- a/usr.sbin/pmccontrol/pmccontrol.c +++ b/usr.sbin/pmccontrol/pmccontrol.c @@ -282,14 +282,6 @@ pmcc_do_list_state(void) return 0; } -#if defined(__i386__) || defined(__amd64__) -static int -pmcc_do_list_events(void) -{ - pmc_pmu_print_counters(NULL); - return (0); -} -#else static int pmcc_do_list_events(void) { @@ -298,6 +290,13 @@ pmcc_do_list_events(void) const char **eventnamelist; const struct pmc_cpuinfo *ci; + /* First, try pmu events. */ + if (pmc_pmu_enabled()) { + pmc_pmu_print_counters(NULL); + return (0); + } + + /* Otherwise, use the legacy pmc(3) interfaces. */ if (pmc_cpuinfo(&ci) != 0) err(EX_OSERR, "Unable to determine CPU information"); @@ -319,7 +318,6 @@ pmcc_do_list_events(void) } return 0; } -#endif static int pmcc_show_statistics(void) From owner-dev-commits-src-main@freebsd.org Mon May 31 20:39:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5AC164F0F3; Mon, 31 May 2021 20:39:22 +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 4Fv6bG3Vn4z3Cm4; Mon, 31 May 2021 20:39:22 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2B78B16DC6; Mon, 31 May 2021 20:39:22 +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 14VKdMi6040680; Mon, 31 May 2021 20:39:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VKdMNK040679; Mon, 31 May 2021 20:39:22 GMT (envelope-from git) Date: Mon, 31 May 2021 20:39:22 GMT Message-Id: <202105312039.14VKdMNK040679@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 689c7e7975cd - main - libpmc: always generate libpmc_events.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 689c7e7975cdee38ca6fd60ad3372d55c43c948c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 20:39:22 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=689c7e7975cdee38ca6fd60ad3372d55c43c948c commit 689c7e7975cdee38ca6fd60ad3372d55c43c948c Author: Mitchell Horne AuthorDate: 2021-05-31 14:24:04 +0000 Commit: Mitchell Horne CommitDate: 2021-05-31 20:39:05 +0000 libpmc: always generate libpmc_events.c The jevents build tool will create an empty table if it doesn't find any events, so we can remove the extra $MACHINE_CPUARCH checks. Reviewed by: gnn, ray, emaste MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30531 --- Makefile.inc1 | 4 +--- Makefile.libcompat | 2 +- lib/libpmc/Makefile | 7 +++---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 5fd1fe81c2e7..d72e0ca56beb 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2535,9 +2535,7 @@ _tcsh=bin/csh _libmagic=lib/libmagic .endif -.if ${MK_PMC} != "no" && \ - (${TARGET_ARCH} == "aarch64" || ${TARGET_ARCH} == "amd64" || \ - ${TARGET_ARCH} == "i386") +.if ${MK_PMC} != "no" _jevents=lib/libpmc/pmu-events .endif diff --git a/Makefile.libcompat b/Makefile.libcompat index e4d9cd94e835..779bcb163cf7 100644 --- a/Makefile.libcompat +++ b/Makefile.libcompat @@ -51,7 +51,7 @@ _LC_INCDIRS= \ .if ${MK_FILE} != "no" _libmagic= lib/libmagic .endif -.if ${MK_PMC} != "no" && ${TARGET_ARCH} == "amd64" +.if ${MK_PMC} != "no" _jevents= lib/libpmc/pmu-events .endif diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile index 42aa14e58471..1006b6f93469 100644 --- a/lib/libpmc/Makefile +++ b/lib/libpmc/Makefile @@ -8,15 +8,15 @@ INCS= pmc.h pmclog.h pmcformat.h CFLAGS+= -I${SRCTOP}/${RELDIR:H}/libpmcstat LDADD+= -lc++ -.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_ARCH} == "amd64" || \ - ${MACHINE_ARCH} == "i386" - .if ${MACHINE_CPUARCH} == "aarch64" EVENT_ARCH="arm64" .elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" EVENT_ARCH="x86" .elif ${MACHINE_ARCH} == "powerpc" EVENT_ARCH="powerpc" +.else +# This will generate an empty events table +EVENT_ARCH="none" .endif .if ${MK_DIRDEPS_BUILD} == "yes" @@ -40,7 +40,6 @@ libpmc_events.c: ${JEVENTS} .META fi CLEANFILES+= libpmc_events.c libpmc_events.c.tmp SRCS+= libpmc_events.c -.endif WARNS?= 3 From owner-dev-commits-src-main@freebsd.org Mon May 31 20:39:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E50764EDE7; Mon, 31 May 2021 20:39: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 4Fv6bK6wf9z3CZq; Mon, 31 May 2021 20:39:25 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9A09216DC7; Mon, 31 May 2021 20:39:25 +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 14VKdPQQ040749; Mon, 31 May 2021 20:39:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VKdPTT040748; Mon, 31 May 2021 20:39:25 GMT (envelope-from git) Date: Mon, 31 May 2021 20:39:25 GMT Message-Id: <202105312039.14VKdPTT040748@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 0024f1aa7720 - main - libpmc: make libpmc_pmu_utils.c more amenable to porting MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0024f1aa7720d5f4f587a6c5911fc5238195ae49 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 20:39:26 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=0024f1aa7720d5f4f587a6c5911fc5238195ae49 commit 0024f1aa7720d5f4f587a6c5911fc5238195ae49 Author: Mitchell Horne AuthorDate: 2021-05-31 14:24:44 +0000 Commit: Mitchell Horne CommitDate: 2021-05-31 20:39:05 +0000 libpmc: make libpmc_pmu_utils.c more amenable to porting The current version has every function stubbed out for !x86. Only two functions (pmu_alias_get() and pmc_pmu_pmcallocate() are really platform dependent, so reduce the width of the ifdefs and remove some of the stubs. Reviewed by: ray MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30532 --- lib/libpmc/libpmc_pmu_util.c | 65 ++++++++------------------------------------ 1 file changed, 12 insertions(+), 53 deletions(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index 90ce0feafa52..81320a3dc954 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -43,12 +43,12 @@ #include #include "pmu-events/pmu-events.h" -#if defined(__amd64__) || defined(__i386__) struct pmu_alias { const char *pa_alias; const char *pa_name; }; +#if defined(__amd64__) || defined(__i386__) typedef enum { PMU_INVALID, PMU_INTEL, @@ -139,6 +139,16 @@ pmu_alias_get(const char *name) return (name); } +#else + +static const char * +pmu_alias_get(const char *name) +{ + + return (name); +} +#endif + struct pmu_event_desc { uint64_t ped_period; uint64_t ped_offcore_rsp; @@ -417,6 +427,7 @@ pmc_pmu_print_counter_full(const char *ev) } } +#if defined(__amd64__) || defined(__i386__) static int pmc_pmu_amd_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm, struct pmu_event_desc *ped) @@ -540,61 +551,9 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) #else -uint64_t -pmc_pmu_sample_rate_get(const char *event_name __unused) -{ - return (DEFAULT_SAMPLE_COUNT); -} - -void -pmc_pmu_print_counters(const char *event_name __unused) -{ -} - -void -pmc_pmu_print_counter_desc(const char *e __unused) -{ -} - -void -pmc_pmu_print_counter_desc_long(const char *e __unused) -{ -} - -void -pmc_pmu_print_counter_full(const char *e __unused) -{ - -} - -int -pmc_pmu_enabled(void) -{ - return (0); -} - int pmc_pmu_pmcallocate(const char *e __unused, struct pmc_op_pmcallocate *p __unused) { return (EOPNOTSUPP); } - -const char * -pmc_pmu_event_get_by_idx(const char *c __unused, int idx __unused) -{ - return (NULL); -} - -int -pmc_pmu_stat_mode(const char ***a __unused) -{ - return (EOPNOTSUPP); -} - -int -pmc_pmu_idx_get_by_event(const char *c __unused, const char *e __unused) -{ - return (-1); -} - #endif From owner-dev-commits-src-main@freebsd.org Mon May 31 20:39:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F22D64EDE1; Mon, 31 May 2021 20:39:20 +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 4Fv6bD2Fqcz3CcZ; Mon, 31 May 2021 20:39:20 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E70DA16FC6; Mon, 31 May 2021 20:39:19 +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 14VKdJgI040638; Mon, 31 May 2021 20:39:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VKdJL3040637; Mon, 31 May 2021 20:39:19 GMT (envelope-from git) Date: Mon, 31 May 2021 20:39:19 GMT Message-Id: <202105312039.14VKdJL3040637@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: ec66cc955b62 - main - libpmc: eliminate pmc_pmu_stat_mode() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ec66cc955b629e614cf493bf168048de033f6a2c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 20:39:20 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=ec66cc955b629e614cf493bf168048de033f6a2c commit ec66cc955b629e614cf493bf168048de033f6a2c Author: Mitchell Horne AuthorDate: 2021-05-31 14:21:57 +0000 Commit: Mitchell Horne CommitDate: 2021-05-31 20:39:05 +0000 libpmc: eliminate pmc_pmu_stat_mode() There is a single consumer, the pmc utility, that clearly has knowledge of which counters it is expecting. Remove this function and have it use common counter aliases instead. Reviewed by: gnn MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30528 --- lib/libpmc/libpmc_pmu_util.c | 22 ---------------------- lib/libpmc/pmc.h | 1 - usr.sbin/pmc/cmd_pmc_stat.c | 15 +++++++++++---- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index 1b2c10e07368..a525a0067822 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -542,28 +542,6 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) return (pmc_pmu_amd_pmcallocate(event_name, pm, &ped)); } -/* - * Ultimately rely on AMD calling theirs the same - */ -static const char *stat_mode_cntrs[] = { - "cpu_clk_unhalted.thread", - "inst_retired.any", - "br_inst_retired.all_branches", - "br_misp_retired.all_branches", - "longest_lat_cache.reference", - "longest_lat_cache.miss", -}; - -int -pmc_pmu_stat_mode(const char ***cntrs) -{ - if (pmc_pmu_enabled()) { - *cntrs = stat_mode_cntrs; - return (0); - } - return (EOPNOTSUPP); -} - #else uint64_t diff --git a/lib/libpmc/pmc.h b/lib/libpmc/pmc.h index 9d12085364e5..7579f93a42b1 100644 --- a/lib/libpmc/pmc.h +++ b/lib/libpmc/pmc.h @@ -122,7 +122,6 @@ uint64_t pmc_pmu_sample_rate_get(const char *); int pmc_pmu_pmcallocate(const char *, struct pmc_op_pmcallocate *); const char *pmc_pmu_event_get_by_idx(const char *, int idx); int pmc_pmu_idx_get_by_event(const char*, const char *); -int pmc_pmu_stat_mode(const char ***); __END_DECLS #endif diff --git a/usr.sbin/pmc/cmd_pmc_stat.c b/usr.sbin/pmc/cmd_pmc_stat.c index 44ca7b92dea7..55d1f1ca7a3b 100644 --- a/usr.sbin/pmc/cmd_pmc_stat.c +++ b/usr.sbin/pmc/cmd_pmc_stat.c @@ -104,6 +104,16 @@ static const char *pmc_stat_mode_names[] = { "cache-misses", }; +/* Common aliases for the desired stat counter */ +static const char *pmc_stat_mode_aliases[] = { + "unhalted-cycles", + "instructions", + "branches", + "branch-mispredicts", + "LLC-REFERENCE", + "LLC-MISSES", +}; + static int pmcstat_sockpair[NSOCKPAIRFD]; static void __dead2 @@ -153,7 +163,6 @@ static void pmc_stat_setup_stat(int system_mode, const char *arg) { const char *new_cntrs[STAT_MODE_NPMCS]; - static const char **pmc_stat_mode_cntrs; struct pmcstat_ev *ev; char *counters, *counter; int i, c, start, newcnt; @@ -164,13 +173,11 @@ pmc_stat_setup_stat(int system_mode, const char *arg) err(EX_OSERR, "ERROR: Cannot determine the root set of CPUs"); CPU_COPY(&rootmask, &cpumask); - if (pmc_pmu_stat_mode(&pmc_stat_mode_cntrs) != 0) - errx(EX_USAGE, "ERROR: hwmpc.ko not loaded or stat not supported on host."); if (system_mode && geteuid() != 0) errx(EX_USAGE, "ERROR: system mode counters can only be used as root"); counters = NULL; for (i = 0; i < STAT_MODE_NPMCS; i++) { - stat_mode_cntrs[i] = pmc_stat_mode_cntrs[i]; + stat_mode_cntrs[i] = pmc_stat_mode_aliases[i]; stat_mode_names[i] = pmc_stat_mode_names[i]; } if (arg) { From owner-dev-commits-src-main@freebsd.org Mon May 31 20:39:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7429964F04E; Mon, 31 May 2021 20:39:21 +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 4Fv6bF1qR0z3CZV; Mon, 31 May 2021 20:39:21 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1133416FC7; Mon, 31 May 2021 20:39:21 +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 14VKdKnF040659; Mon, 31 May 2021 20:39:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VKdKWN040658; Mon, 31 May 2021 20:39:20 GMT (envelope-from git) Date: Mon, 31 May 2021 20:39:20 GMT Message-Id: <202105312039.14VKdKWN040658@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 0c915023dbb7 - main - libpmc: remove pe->alias MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0c915023dbb7000cd30bb768eb84f6dc757adcc5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 20:39:22 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=0c915023dbb7000cd30bb768eb84f6dc757adcc5 commit 0c915023dbb7000cd30bb768eb84f6dc757adcc5 Author: Mitchell Horne AuthorDate: 2021-05-31 14:23:19 +0000 Commit: Mitchell Horne CommitDate: 2021-05-31 20:39:05 +0000 libpmc: remove pe->alias It has never been a part of upstream's struct pmu_event. The jevents utility will not fill this field, so remove it. Reviewed by: gnn MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30530 --- lib/libpmc/libpmc_pmu_util.c | 4 ---- lib/libpmc/pmu-events/pmu-events.h | 1 - 2 files changed, 5 deletions(-) diff --git a/lib/libpmc/libpmc_pmu_util.c b/lib/libpmc/libpmc_pmu_util.c index a525a0067822..90ce0feafa52 100644 --- a/lib/libpmc/libpmc_pmu_util.c +++ b/lib/libpmc/libpmc_pmu_util.c @@ -302,8 +302,6 @@ pmc_pmu_sample_rate_get(const char *event_name) event_name = pmu_alias_get(event_name); if ((pe = pmu_event_get(NULL, event_name, NULL)) == NULL) return (DEFAULT_SAMPLE_COUNT); - if (pe->alias && (pe = pmu_event_get(NULL, pe->alias, NULL)) == NULL) - return (DEFAULT_SAMPLE_COUNT); if (pe->event == NULL) return (DEFAULT_SAMPLE_COUNT); if (pmu_parse_event(&ped, pe->event)) @@ -526,8 +524,6 @@ pmc_pmu_pmcallocate(const char *event_name, struct pmc_op_pmcallocate *pm) event_name = pmu_alias_get(event_name); if ((pe = pmu_event_get(NULL, event_name, &idx)) == NULL) return (ENOENT); - if (pe->alias && (pe = pmu_event_get(NULL, pe->alias, &idx)) == NULL) - return (ENOENT); assert(idx >= 0); pm->pm_ev = idx; diff --git a/lib/libpmc/pmu-events/pmu-events.h b/lib/libpmc/pmu-events/pmu-events.h index c4c01e20114d..cfc82f20364c 100644 --- a/lib/libpmc/pmu-events/pmu-events.h +++ b/lib/libpmc/pmu-events/pmu-events.h @@ -10,7 +10,6 @@ */ struct pmu_event { const char *name; - const char *alias; const char *event; const char *desc; const char *topic; From owner-dev-commits-src-main@freebsd.org Mon May 31 20:39:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A078064F050; Mon, 31 May 2021 20:39:23 +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 4Fv6bH378Nz3Cfd; Mon, 31 May 2021 20:39:23 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4F14E16E21; Mon, 31 May 2021 20:39:23 +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 14VKdNoR040701; Mon, 31 May 2021 20:39:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VKdNvx040700; Mon, 31 May 2021 20:39:23 GMT (envelope-from git) Date: Mon, 31 May 2021 20:39:23 GMT Message-Id: <202105312039.14VKdNvx040700@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 3864da302af3 - main - libpmc: use $MACHINE_CPUARCH MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3864da302af34853ddb2c33a42de5668a0d68cdd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 20:39:24 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=3864da302af34853ddb2c33a42de5668a0d68cdd commit 3864da302af34853ddb2c33a42de5668a0d68cdd Author: Mitchell Horne AuthorDate: 2021-05-31 20:20:08 +0000 Commit: Mitchell Horne CommitDate: 2021-05-31 20:39:05 +0000 libpmc: use $MACHINE_CPUARCH This is preferred over $MACHINE_ARCH for these types of checks, although it makes no difference for amd64 or i386. No functional change intended. Sponsored by: The FreeBSD Foundation --- lib/libpmc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile index 1006b6f93469..da3f8a72d26b 100644 --- a/lib/libpmc/Makefile +++ b/lib/libpmc/Makefile @@ -10,7 +10,7 @@ LDADD+= -lc++ .if ${MACHINE_CPUARCH} == "aarch64" EVENT_ARCH="arm64" -.elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" +.elif ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" EVENT_ARCH="x86" .elif ${MACHINE_ARCH} == "powerpc" EVENT_ARCH="powerpc" From owner-dev-commits-src-main@freebsd.org Mon May 31 20:39:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0187164ED70; Mon, 31 May 2021 20:39:25 +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 4Fv6bJ4Kzyz3CjR; Mon, 31 May 2021 20:39:24 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 742A317004; Mon, 31 May 2021 20:39: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 14VKdOKO040728; Mon, 31 May 2021 20:39:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VKdOnq040727; Mon, 31 May 2021 20:39:24 GMT (envelope-from git) Date: Mon, 31 May 2021 20:39:24 GMT Message-Id: <202105312039.14VKdOnq040727@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 507d68984a01 - main - libpmc: limit pmu-events to 64-bit powerpc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 507d68984a010dab0c3ecc5477c36526c3a7fa48 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 20:39:25 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=507d68984a010dab0c3ecc5477c36526c3a7fa48 commit 507d68984a010dab0c3ecc5477c36526c3a7fa48 Author: Mitchell Horne AuthorDate: 2021-05-31 20:24:15 +0000 Commit: Mitchell Horne CommitDate: 2021-05-31 20:39:05 +0000 libpmc: limit pmu-events to 64-bit powerpc Although currently unused, there are only pmu event definitions for POWER8 and POWER9. There is no sense in building these on 32-bit platforms. Sponsored by: The FreeBSD Foundation --- lib/libpmc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libpmc/Makefile b/lib/libpmc/Makefile index da3f8a72d26b..285b6c539ece 100644 --- a/lib/libpmc/Makefile +++ b/lib/libpmc/Makefile @@ -12,7 +12,7 @@ LDADD+= -lc++ EVENT_ARCH="arm64" .elif ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" EVENT_ARCH="x86" -.elif ${MACHINE_ARCH} == "powerpc" +.elif ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH:Mpowerpc64*} != "" EVENT_ARCH="powerpc" .else # This will generate an empty events table From owner-dev-commits-src-main@freebsd.org Mon May 31 22:04:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D6ECF6314F5; Mon, 31 May 2021 22:04:50 +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 4Fv8Tt5nVfz3JqR; Mon, 31 May 2021 22:04:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AEBB518231; Mon, 31 May 2021 22:04:50 +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 14VM4oss060407; Mon, 31 May 2021 22:04:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VM4oVg060406; Mon, 31 May 2021 22:04:50 GMT (envelope-from git) Date: Mon, 31 May 2021 22:04:50 GMT Message-Id: <202105312204.14VM4oVg060406@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: d912068ad826 - main - Remove duplicated lines in contrib/tzcode/stdtime/private.h 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/main X-Git-Reftype: branch X-Git-Commit: d912068ad826e457f0c0203d1cad02df81c35bbc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 22:04:50 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d912068ad826e457f0c0203d1cad02df81c35bbc commit d912068ad826e457f0c0203d1cad02df81c35bbc Author: Tim McNamara AuthorDate: 2018-06-07 09:51:38 +0000 Commit: Warner Losh CommitDate: 2021-05-31 22:03:37 +0000 Remove duplicated lines in contrib/tzcode/stdtime/private.h Note by imp: this is clearly a mis-merge from the vendor branch which doesn't have this stutter in it. Reviewed by: imp@,ngie@ Pull Request: https://github.com/freebsd/freebsd-src/pull/154 --- contrib/tzcode/stdtime/private.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/contrib/tzcode/stdtime/private.h b/contrib/tzcode/stdtime/private.h index ab1397f31da2..8f8f725f8193 100644 --- a/contrib/tzcode/stdtime/private.h +++ b/contrib/tzcode/stdtime/private.h @@ -230,15 +230,6 @@ const char * scheck(const char * string, const char * format); #define TYPE_INTEGRAL(type) (((type) 0.5) != 0.5) #endif /* !defined TYPE_INTEGRAL */ -/* -** Since the definition of TYPE_INTEGRAL contains floating point numbers, -** it cannot be used in preprocessor directives. -*/ - -#ifndef TYPE_INTEGRAL -#define TYPE_INTEGRAL(type) (((type) 0.5) != 0.5) -#endif /* !defined TYPE_INTEGRAL */ - #ifndef INT_STRLEN_MAXIMUM /* ** 302 / 1000 is log10(2.0) rounded up. From owner-dev-commits-src-main@freebsd.org Mon May 31 22:14:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7631663164B; Mon, 31 May 2021 22:14:27 +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 4Fv8hz1Zhqz3KRh; Mon, 31 May 2021 22:14:27 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1A764180EB; Mon, 31 May 2021 22:14:27 +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 14VMEQDV073882; Mon, 31 May 2021 22:14:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VMEQfb073881; Mon, 31 May 2021 22:14:26 GMT (envelope-from git) Date: Mon, 31 May 2021 22:14:26 GMT Message-Id: <202105312214.14VMEQfb073881@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 8790fe3058c8 - main - Fix confusing example in paste(1) 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/main X-Git-Reftype: branch X-Git-Commit: 8790fe3058c83f624ca2155fb0dbaac23c641237 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 22:14:27 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=8790fe3058c83f624ca2155fb0dbaac23c641237 commit 8790fe3058c83f624ca2155fb0dbaac23c641237 Author: jocki84 AuthorDate: 2018-07-12 17:22:29 +0000 Commit: Warner Losh CommitDate: 2021-05-31 22:12:44 +0000 Fix confusing example in paste(1) Paste's man page contains an example for a reimplementation of nl(1). This example uses the command line sed = myfile | paste -s -d '\t\n' - - in order to concatenate consecutive lines with an intervening tab. However, the way the example uses the switches -s and -d and two `dash` input files is redundant. There are in fact two equivalent but simpler ways to achieve the desired result: sed = myfile | paste -s -d '\t\n' - uses the same style as the previous example, while sed = myfile | paste - - is arguably even simpler and illustrates the final sentence of the DESCRIPTION. Reviewed by: imp@ Pull Request: https://github.com/freebsd/freebsd-src/pull/163 --- usr.bin/paste/paste.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/paste/paste.1 b/usr.bin/paste/paste.1 index 8bd02dd47097..73b10fcd79b7 100644 --- a/usr.bin/paste/paste.1 +++ b/usr.bin/paste/paste.1 @@ -120,7 +120,7 @@ Combine pairs of lines from a file into single lines: Number the lines in a file, similar to .Xr nl 1 : .Pp -.Dl "sed = myfile | paste -s -d '\et\en' - -" +.Dl "sed = myfile | paste - -" .Pp Create a colon-separated list of directories named .Pa bin , From owner-dev-commits-src-main@freebsd.org Mon May 31 23:09:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 91B206325DE; Mon, 31 May 2021 23:09:48 +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 4Fv9wr3jsnz3PVb; Mon, 31 May 2021 23:09:48 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5CF4818E41; Mon, 31 May 2021 23:09:48 +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 14VN9m1Y040148; Mon, 31 May 2021 23:09:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VN9m67040147; Mon, 31 May 2021 23:09:48 GMT (envelope-from git) Date: Mon, 31 May 2021 23:09:48 GMT Message-Id: <202105312309.14VN9m67040147@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4a59cbc12532 - main - amd64: Avoid enabling interrupts when handling kernel mode prot faults MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4a59cbc1253266ea70d6fa43b1a7c77cc33ec6cd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 23:09:48 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4a59cbc1253266ea70d6fa43b1a7c77cc33ec6cd commit 4a59cbc1253266ea70d6fa43b1a7c77cc33ec6cd Author: Mark Johnston AuthorDate: 2021-05-31 22:49:33 +0000 Commit: Mark Johnston CommitDate: 2021-05-31 22:49:33 +0000 amd64: Avoid enabling interrupts when handling kernel mode prot faults When PTI is enabled, we may have been on the trampoline stack when iret faults. So, we have to switch back to the regular stack before re-entering trap(). trap() has the somewhat strange behaviour of re-enabling interrupts when handling certain kernel-mode execeptions. In particular, it was doing this for exceptions raised during execution of iret. When switching away from the trampoline stack, however, the thread must not be migrated to a different CPU. Fix the problem by simply leaving interrupts disabled during the window. Reported by: syzbot+6cfa544fd86ad4647ffc@syzkaller.appspotmail.com Reported by: syzbot+cfdfc9e5a8f28f11a7f5@syzkaller.appspotmail.com Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30578 --- sys/amd64/amd64/trap.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 4ce31ce47a45..cc0b8fcf6c17 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -236,25 +236,31 @@ trap(struct trapframe *frame) * interrupts disabled until they are accidentally * enabled later. */ - if (TRAPF_USERMODE(frame)) + if (TRAPF_USERMODE(frame)) { uprintf( "pid %ld (%s): trap %d with interrupts disabled\n", (long)curproc->p_pid, curthread->td_name, type); - else if (type != T_NMI && type != T_BPTFLT && - type != T_TRCTRAP) { - /* - * XXX not quite right, since this may be for a - * multiple fault in user mode. - */ - printf("kernel trap %d with interrupts disabled\n", - type); - - /* - * We shouldn't enable interrupts while holding a - * spin lock. - */ - if (td->td_md.md_spinlock_count == 0) - enable_intr(); + } else { + switch (type) { + case T_NMI: + case T_BPTFLT: + case T_TRCTRAP: + case T_PROTFLT: + case T_SEGNPFLT: + case T_STKFLT: + break; + default: + printf( + "kernel trap %d with interrupts disabled\n", + type); + + /* + * We shouldn't enable interrupts while holding a + * spin lock. + */ + if (td->td_md.md_spinlock_count == 0) + enable_intr(); + } } } @@ -444,6 +450,8 @@ trap(struct trapframe *frame) * Magic '5' is the number of qwords occupied by * the hardware trap frame. */ + KASSERT((read_rflags() & PSL_I) == 0, + ("interrupts enabled")); if (frame->tf_rip == (long)doreti_iret) { frame->tf_rip = (long)doreti_iret_fault; if ((PCPU_GET(curpmap)->pm_ucr3 != From owner-dev-commits-src-main@freebsd.org Mon May 31 23:09:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6D2C63299C; Mon, 31 May 2021 23:09:49 +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 4Fv9ws4Fswz3PKL; Mon, 31 May 2021 23:09:49 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7ABEF18762; Mon, 31 May 2021 23:09:49 +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 14VN9nUW040169; Mon, 31 May 2021 23:09:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VN9nWf040168; Mon, 31 May 2021 23:09:49 GMT (envelope-from git) Date: Mon, 31 May 2021 23:09:49 GMT Message-Id: <202105312309.14VN9nWf040168@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 18f55c67f746 - main - x86: Fix lapic_ipi_alloc() on i386 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 18f55c67f746f0ad12fe972328234d340a621df9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 23:09:49 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=18f55c67f746f0ad12fe972328234d340a621df9 commit 18f55c67f746f0ad12fe972328234d340a621df9 Author: Mark Johnston AuthorDate: 2021-05-31 22:51:14 +0000 Commit: Mark Johnston CommitDate: 2021-05-31 22:51:14 +0000 x86: Fix lapic_ipi_alloc() on i386 The loop which checks to see if "dynamic" IDT entries are allocated needs to compare with the trampoline address of the reserved ISR. Otherwise it will never succeed. Reported by: Harry Schmalzbauer Tested by: Harry Schmalzbauer Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30576 --- sys/x86/x86/local_apic.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index 5b4910d4b891..bb575d0c601d 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -2127,6 +2127,10 @@ native_lapic_ipi_vectored(u_int vector, int dest) #endif /* SMP */ +#ifdef __i386__ +extern uintptr_t setidt_disp; +#endif + /* * Since the IDT is shared by all CPUs the IPI slot update needs to be globally * visible. @@ -2155,6 +2159,9 @@ native_lapic_ipi_alloc(inthand_t *ipifunc) for (idx = IPI_DYN_FIRST; idx <= IPI_DYN_LAST; idx++) { ip = &idt[idx]; func = (ip->gd_hioffset << 16) | ip->gd_looffset; +#ifdef __i386__ + func -= setidt_disp; +#endif if ((!pti && func == (uintptr_t)&IDTVEC(rsvd)) || (pti && func == (uintptr_t)&IDTVEC(rsvd_pti))) { vector = idx; @@ -2178,6 +2185,9 @@ native_lapic_ipi_free(int vector) mtx_lock_spin(&icu_lock); ip = &idt[vector]; func = (ip->gd_hioffset << 16) | ip->gd_looffset; +#ifdef __i386__ + func -= setidt_disp; +#endif KASSERT(func != (uintptr_t)&IDTVEC(rsvd) && func != (uintptr_t)&IDTVEC(rsvd_pti), ("invalid idtfunc %#lx", func)); From owner-dev-commits-src-main@freebsd.org Mon May 31 23:09:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F3406329A1; Mon, 31 May 2021 23:09:51 +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 4Fv9wt6498z3PXP; Mon, 31 May 2021 23:09:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 918EE18BCA; Mon, 31 May 2021 23:09:50 +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 14VN9oxd040190; Mon, 31 May 2021 23:09:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VN9oR5040189; Mon, 31 May 2021 23:09:50 GMT (envelope-from git) Date: Mon, 31 May 2021 23:09:50 GMT Message-Id: <202105312309.14VN9oR5040189@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f96603b56f0f - main - tcp, udp: Permit binding with AF_UNSPEC if the address is INADDR_ANY MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f96603b56f0f74fa52d8f1ef0be869fca7305b99 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 23:09:51 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f96603b56f0f74fa52d8f1ef0be869fca7305b99 commit f96603b56f0f74fa52d8f1ef0be869fca7305b99 Author: Mark Johnston AuthorDate: 2021-05-31 22:53:34 +0000 Commit: Mark Johnston CommitDate: 2021-05-31 22:53:34 +0000 tcp, udp: Permit binding with AF_UNSPEC if the address is INADDR_ANY Prior to commit f161d294b we only checked the sockaddr length, but now we verify the address family as well. This breaks at least ttcp. Relax the check to avoid breaking compatibility too much: permit AF_UNSPEC if the address is INADDR_ANY. Fixes: f161d294b Reported by: Bakul Shah Reviewed by: tuexen MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30539 --- sys/netinet/tcp_usrreq.c | 11 +++++++++-- sys/netinet/udp_usrreq.c | 13 +++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index caef798772ea..7f1b698408e5 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -321,8 +321,15 @@ tcp_usr_bind(struct socket *so, struct sockaddr *nam, struct thread *td) struct sockaddr_in *sinp; sinp = (struct sockaddr_in *)nam; - if (nam->sa_family != AF_INET) - return (EAFNOSUPPORT); + if (nam->sa_family != AF_INET) { + /* + * Preserve compatibility with old programs. + */ + if (nam->sa_family != AF_UNSPEC || + sinp->sin_addr.s_addr != INADDR_ANY) + return (EAFNOSUPPORT); + nam->sa_family = AF_INET; + } if (nam->sa_len != sizeof(*sinp)) return (EINVAL); diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 62a07701df6c..5c9dbd36a1d6 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1622,14 +1622,23 @@ udp_bind(struct socket *so, struct sockaddr *nam, struct thread *td) { struct inpcb *inp; struct inpcbinfo *pcbinfo; + struct sockaddr_in *sinp; int error; pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); KASSERT(inp != NULL, ("udp_bind: inp == NULL")); - if (nam->sa_family != AF_INET) - return (EAFNOSUPPORT); + sinp = (struct sockaddr_in *)nam; + if (nam->sa_family != AF_INET) { + /* + * Preserve compatibility with old programs. + */ + if (nam->sa_family != AF_UNSPEC || + sinp->sin_addr.s_addr != INADDR_ANY) + return (EAFNOSUPPORT); + nam->sa_family = AF_INET; + } if (nam->sa_len != sizeof(struct sockaddr_in)) return (EINVAL); From owner-dev-commits-src-main@freebsd.org Mon May 31 23:09:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EEECD632950; Mon, 31 May 2021 23:09:51 +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 4Fv9wv6D6Lz3PVk; Mon, 31 May 2021 23:09:51 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B3BBC18F85; Mon, 31 May 2021 23:09:51 +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 14VN9pZ6040213; Mon, 31 May 2021 23:09:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VN9pIY040212; Mon, 31 May 2021 23:09:51 GMT (envelope-from git) Date: Mon, 31 May 2021 23:09:51 GMT Message-Id: <202105312309.14VN9pIY040212@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: b2f9575646f8 - main - ffs: Correct the input size check in sysctl_ffs_fsck() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b2f9575646f89cdddcad76acae3e9305535506a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 23:09:52 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b2f9575646f89cdddcad76acae3e9305535506a2 commit b2f9575646f89cdddcad76acae3e9305535506a2 Author: Mark Johnston AuthorDate: 2021-05-31 22:56:34 +0000 Commit: Mark Johnston CommitDate: 2021-05-31 22:59:18 +0000 ffs: Correct the input size check in sysctl_ffs_fsck() Make sure we return an error if no input was specified, since SYSCTL_IN() will report success in that case. Reported by: KMSAN Reviewed by: mckusick MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30586 --- sys/ufs/ffs/ffs_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index c7a1e2dec15e..c895c8c7bf07 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -3211,9 +3211,9 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS) cap_rights_t rights; int filetype, error; - if (req->newlen > sizeof cmd) + if (req->newptr == NULL || req->newlen > sizeof(cmd)) return (EBADRPC); - if ((error = SYSCTL_IN(req, &cmd, sizeof cmd)) != 0) + if ((error = SYSCTL_IN(req, &cmd, sizeof(cmd))) != 0) return (error); if (cmd.version != FFS_CMD_VERSION) return (ERPCMISMATCH); From owner-dev-commits-src-main@freebsd.org Mon May 31 23:21:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 76A13632E46; Mon, 31 May 2021 23:21:30 +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 4FvBBL2m7wz3QDx; Mon, 31 May 2021 23:21:30 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4758A19206; Mon, 31 May 2021 23:21: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 14VNLU2p065402; Mon, 31 May 2021 23:21:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14VNLUMo065401; Mon, 31 May 2021 23:21:30 GMT (envelope-from git) Date: Mon, 31 May 2021 23:21:30 GMT Message-Id: <202105312321.14VNLUMo065401@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: f4aa64528e45 - main - tmpfs: save on relocking the allnode lock in tmpfs_free_node_locked MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f4aa64528e4557cd18cdb376b0f88f4a34d69912 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 23:21:30 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f4aa64528e4557cd18cdb376b0f88f4a34d69912 commit f4aa64528e4557cd18cdb376b0f88f4a34d69912 Author: Mateusz Guzik AuthorDate: 2021-05-27 08:57:59 +0000 Commit: Mateusz Guzik CommitDate: 2021-05-31 23:21:15 +0000 tmpfs: save on relocking the allnode lock in tmpfs_free_node_locked --- sys/fs/tmpfs/tmpfs_subr.c | 51 +++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 322641b5b853..b7dae82a71b4 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -578,53 +578,66 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct tmpfs_node *node, if (!last) return (false); + TMPFS_NODE_UNLOCK(node); + #ifdef INVARIANTS MPASS(node->tn_vnode == NULL); MPASS((node->tn_vpstate & TMPFS_VNODE_ALLOCATING) == 0); -#endif - TMPFS_NODE_UNLOCK(node); - TMPFS_UNLOCK(tmp); + /* + * Make sure this is a node type we can deal with. Everything is explicitly + * enumerated without the 'default' clause so the the compiler can throw an + * error in case a new type is added. + */ switch (node->tn_type) { case VBLK: - /* FALLTHROUGH */ case VCHR: - /* FALLTHROUGH */ case VDIR: - /* FALLTHROUGH */ case VFIFO: - /* FALLTHROUGH */ case VSOCK: - break; - case VLNK: - symlink = node->tn_link_target; - atomic_store_ptr(&node->tn_link_target, NULL); - if (atomic_load_char(&node->tn_link_smr)) { - cache_symlink_free(symlink, node->tn_size + 1); - } else { - free(symlink, M_TMPFSNAME); - } + case VREG: break; + case VNON: + case VBAD: + case VMARKER: + panic("%s: bad type %d for node %p", __func__, (int)node->tn_type, node); + } +#endif + switch (node->tn_type) { case VREG: uobj = node->tn_reg.tn_aobj; if (uobj != NULL) { if (uobj->size != 0) atomic_subtract_long(&tmp->tm_pages_used, uobj->size); + } + + tmpfs_free_tmp(tmp); + + if (uobj != NULL) { KASSERT((uobj->flags & OBJ_TMPFS) == 0, ("leaked OBJ_TMPFS node %p vm_obj %p", node, uobj)); vm_object_deallocate(uobj); } break; + case VLNK: + tmpfs_free_tmp(tmp); + symlink = node->tn_link_target; + atomic_store_ptr(&node->tn_link_target, NULL); + if (atomic_load_char(&node->tn_link_smr)) { + cache_symlink_free(symlink, node->tn_size + 1); + } else { + free(symlink, M_TMPFSNAME); + } + break; default: - panic("tmpfs_free_node: type %p %d", node, (int)node->tn_type); + tmpfs_free_tmp(tmp); + break; } uma_zfree_smr(tmpfs_node_pool, node); - TMPFS_LOCK(tmp); - tmpfs_free_tmp(tmp); return (true); } From owner-dev-commits-src-main@freebsd.org Mon May 31 23:48:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7F436335D4 for ; Mon, 31 May 2021 23:48:54 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FvBny5ms5z3QcN for ; Mon, 31 May 2021 23:48:54 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f44.google.com with SMTP id l2so4861979wrw.6 for ; Mon, 31 May 2021 16:48:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=xCvDxSo7ZvkCxJ+IhtsPxBI0eiRep2ak2nmuufA1jEk=; b=AM9SMalQLSPIi30dBd0oesD+nz0FQr5VMSeDH+66pH/zdwkXd4mw+R5S8c0/oz6Pgb nix8QqtdVi6uuvRvWHs+z0NTtIY+wRA4LRwlMf5/zIY6ib/mhBg/HwvlSzqvdZ16UWc3 qwh2/CcJC80IshBZhFPlHX6ApQ2eYcYexUsbbZFa/a4+C/gjWEr8rXRK4d8NBdSeLvla jjjNW1LyOc6YdzQEQ8/WhD3ai2HbIgHzksERegjr3b2DN7DkD54op2MuNW+pSvAwNdln rhmqODGGDm/MLvn8aLUG7bw/lh8UTympVAb6DQl2fC0RS0c7foeFzqX01yCgXh44Jpab lu3A== X-Gm-Message-State: AOAM532ri2eOtTZHb9/+Sviuv2lYPsvS0IznRSQCsk+wq2sy/X7Bf1jk Nehut/MmFxqkEO/saeiqoOQuew== X-Google-Smtp-Source: ABdhPJxwxdIo+4yVyiVvZbSNv6ML5t3dfPPdNMqqwbWO+vxBWjhwkmIX4ypm6jMNx456oJMuE/S+TQ== X-Received: by 2002:adf:fa46:: with SMTP id y6mr16102369wrr.194.1622504933379; Mon, 31 May 2021 16:48:53 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id n9sm7006513wmc.20.2021.05.31.16.48.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 May 2021 16:48:52 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: 18f55c67f746 - main - x86: Fix lapic_ipi_alloc() on i386 From: Jessica Clarke In-Reply-To: <202105312309.14VN9nWf040168@gitrepo.freebsd.org> Date: Tue, 1 Jun 2021 00:48:52 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202105312309.14VN9nWf040168@gitrepo.freebsd.org> To: Mark Johnston X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4FvBny5ms5z3QcN X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 23:48:55 -0000 On 1 Jun 2021, at 00:09, Mark Johnston wrote: >=20 > The branch main has been updated by markj: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D18f55c67f746f0ad12fe972328234d34= 0a621df9 >=20 > commit 18f55c67f746f0ad12fe972328234d340a621df9 > Author: Mark Johnston > AuthorDate: 2021-05-31 22:51:14 +0000 > Commit: Mark Johnston > CommitDate: 2021-05-31 22:51:14 +0000 >=20 > x86: Fix lapic_ipi_alloc() on i386 >=20 > The loop which checks to see if "dynamic" IDT entries are allocated > needs to compare with the trampoline address of the reserved ISR. > Otherwise it will never succeed. >=20 > Reported by: Harry Schmalzbauer > Tested by: Harry Schmalzbauer > Reviewed by: kib > MFC after: 1 week > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D30576 > --- > sys/x86/x86/local_apic.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) >=20 > diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c > index 5b4910d4b891..bb575d0c601d 100644 > --- a/sys/x86/x86/local_apic.c > +++ b/sys/x86/x86/local_apic.c > @@ -2127,6 +2127,10 @@ native_lapic_ipi_vectored(u_int vector, int = dest) >=20 > #endif /* SMP */ >=20 > +#ifdef __i386__ > +extern uintptr_t setidt_disp; uintptr_t here is fishy. Should it not be size_t or ptrdiff_t? Jess From owner-dev-commits-src-main@freebsd.org Tue Jun 1 00:48:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F4EB63478E; Tue, 1 Jun 2021 00:48:33 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FvD6n1L4rz3jTG; Tue, 1 Jun 2021 00:48:33 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x730.google.com with SMTP id p66so3400020qke.7; Mon, 31 May 2021 17:48:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=rWN5iB5b03+uaC0IU9JFGh/Ub4GhNP3ZTAzA9Gi6oT4=; b=Cc8d2N93Q6LxvitEH0cL0xkCuIfChQUNEdD+JJlZyGE05tjTWn4pmzh99QbQt+IwU6 8QkKSAGDS6LuhwT+pfN6ie9CnZwGuKaSQa1111v0CiDtb22s3RGTMj6qqF+InfRDsTlv BWAb8+lp6bQ2XR2rw52jeQbbQv2MnT8d1wrj1jVDOs5pgY2TLIyXvizxYyJQT07W1miT RMTkktMEDe1mupG0q5sTiszwtKQyfQjcNey7lygtRLvm8OcOtMmWpIacIBGi69yBPGwC R3/mKySjLhIXRM94vQ/w23cGE5US+/tVtyCjaL9KJSVmHkUcXxhEVDD9Mq91VEoUzDB6 bBWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=rWN5iB5b03+uaC0IU9JFGh/Ub4GhNP3ZTAzA9Gi6oT4=; b=fs+C2SQhX3jsdJkRL9otEJjRV9NfRi3Rhl6BMDnaHj9R4lfhuts/6ybQVbkBbEiWZa /qB/blRPS/CB3mDl1YHh2ctaBp3nDkYToahi6JeBTpoxI4PhYhXzbQmHSa0PDJ3uX8Jk CLJFeuoiuoRop2qFnkifz5bdAy2p3eS6aRxEJtCcooakYyWxxYBRbMIDCK8VBF82b6DE lQ3Z8duaU8y/tYnnqSvA3F3NCuPVuTcYVTQaCFLT4YNWsBMb5KONLSTMlftDBPzlI8/I a+sU2gnCeMfoEziPx+pnmTGXzzRtbYJjKhK2+h8+TZBmJbd1+fOzzcYW24dxRNAcfwie h22g== X-Gm-Message-State: AOAM531FY5C76MoNyMD/XpNi6xz0YDALo6dnKLEQzeAZC7die7C1x8oZ okGHPJkQlTnn2Xi6dYJk9jshdyLL0f4= X-Google-Smtp-Source: ABdhPJwjei0CnYr0DR3RFyHIz2Us4EnoF2c4N0m3s6HBth+7P7ncpDYUiF4WrU+0TGevCnQWqziO8A== X-Received: by 2002:a37:45c3:: with SMTP id s186mr18825202qka.318.1622508511957; Mon, 31 May 2021 17:48:31 -0700 (PDT) Received: from nuc ([142.126.172.178]) by smtp.gmail.com with ESMTPSA id f15sm9484300qtg.25.2021.05.31.17.48.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 May 2021 17:48:31 -0700 (PDT) Sender: Mark Johnston Date: Mon, 31 May 2021 20:48:32 -0400 From: Mark Johnston To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 18f55c67f746 - main - x86: Fix lapic_ipi_alloc() on i386 Message-ID: References: <202105312309.14VN9nWf040168@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4FvD6n1L4rz3jTG X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 00:48:33 -0000 On Tue, Jun 01, 2021 at 12:48:52AM +0100, Jessica Clarke wrote: > On 1 Jun 2021, at 00:09, Mark Johnston wrote: > > > > The branch main has been updated by markj: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=18f55c67f746f0ad12fe972328234d340a621df9 > > > > commit 18f55c67f746f0ad12fe972328234d340a621df9 > > Author: Mark Johnston > > AuthorDate: 2021-05-31 22:51:14 +0000 > > Commit: Mark Johnston > > CommitDate: 2021-05-31 22:51:14 +0000 > > > > x86: Fix lapic_ipi_alloc() on i386 > > > > The loop which checks to see if "dynamic" IDT entries are allocated > > needs to compare with the trampoline address of the reserved ISR. > > Otherwise it will never succeed. > > > > Reported by: Harry Schmalzbauer > > Tested by: Harry Schmalzbauer > > Reviewed by: kib > > MFC after: 1 week > > Sponsored by: The FreeBSD Foundation > > Differential Revision: https://reviews.freebsd.org/D30576 > > --- > > sys/x86/x86/local_apic.c | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c > > index 5b4910d4b891..bb575d0c601d 100644 > > --- a/sys/x86/x86/local_apic.c > > +++ b/sys/x86/x86/local_apic.c > > @@ -2127,6 +2127,10 @@ native_lapic_ipi_vectored(u_int vector, int dest) > > > > #endif /* SMP */ > > > > +#ifdef __i386__ > > +extern uintptr_t setidt_disp; > > uintptr_t here is fishy. Should it not be size_t or ptrdiff_t? Yes, either of those seems more correct. See https://reviews.freebsd.org/D30590 From owner-dev-commits-src-main@freebsd.org Tue Jun 1 02:40:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 188CF637AA2; Tue, 1 Jun 2021 02:40:17 +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 4FvGbh70ZRz3tcH; Tue, 1 Jun 2021 02:40:16 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D8D6B1B899; Tue, 1 Jun 2021 02:40:16 +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 1512eGJ9024099; Tue, 1 Jun 2021 02:40:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1512eGgV024091; Tue, 1 Jun 2021 02:40:16 GMT (envelope-from git) Date: Tue, 1 Jun 2021 02:40:16 GMT Message-Id: <202106010240.1512eGgV024091@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 25ecdc7d5277 - main - wpa: Restructure wpa build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 25ecdc7d52770caf1c9b44b5ec11f468f6b636f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 02:40:17 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=25ecdc7d52770caf1c9b44b5ec11f468f6b636f3 commit 25ecdc7d52770caf1c9b44b5ec11f468f6b636f3 Author: Cy Schubert AuthorDate: 2021-05-20 21:28:17 +0000 Commit: Cy Schubert CommitDate: 2021-06-01 02:39:16 +0000 wpa: Restructure wpa build The current WPA build assumes a flat namespace. However the latest sources from w1.fi now have a duplicate config.c, in two separate subdirectories. The flat namespace will overwrite config.o with the output from the most recently modified config.c, of which there are two of them. This commit resolves this problem by building each component in wpa's src subdirectory tree into its own .a archive, just as the w1.fi upstream build as used by the port does. The advantages of this approach are: 1. Duplicate source file names, i.e. config.c in the wpa_supplicant direcory and another config.c in src/utils in the next wpa will result in both compiles writing to the same .o file. 2. This restructure simplifies maintanence. A develper needs only to add new files as identified by git status in the vendor branch to the appropriate Makefile within the usr.sbin/wpa tree. This also reduces time required to prepare a new import and should reduce error. 3. The new wpa build structure more closely represents the build as performed by the upstream tarball. This is in preparation for the next wpa update from w1.fi. Reviewed by: philip Tested by: philip MFC after: 2 months Differential Revision: https://reviews.freebsd.org/D30372 --- share/mk/src.libnames.mk | 62 +++++++++++++- usr.sbin/wpa/Makefile | 9 ++- usr.sbin/wpa/Makefile.crypto | 104 ------------------------ usr.sbin/wpa/Makefile.inc | 92 +++++++++++++++++---- usr.sbin/wpa/hostapd/Makefile | 153 ++--------------------------------- usr.sbin/wpa/hostapd_cli/Makefile | 10 +-- usr.sbin/wpa/src/Makefile | 19 +++++ usr.sbin/wpa/src/ap/Makefile | 59 ++++++++++++++ usr.sbin/wpa/src/common/Makefile | 27 +++++++ usr.sbin/wpa/src/crypto/Makefile | 63 +++++++++++++++ usr.sbin/wpa/src/drivers/Makefile | 21 +++++ usr.sbin/wpa/src/eap_common/Makefile | 25 ++++++ usr.sbin/wpa/src/eap_peer/Makefile | 33 ++++++++ usr.sbin/wpa/src/eap_server/Makefile | 34 ++++++++ usr.sbin/wpa/src/eapol_auth/Makefile | 18 +++++ usr.sbin/wpa/src/eapol_supp/Makefile | 19 +++++ usr.sbin/wpa/src/l2_packet/Makefile | 19 +++++ usr.sbin/wpa/src/radius/Makefile | 24 ++++++ usr.sbin/wpa/src/rsn_supp/Makefile | 26 ++++++ usr.sbin/wpa/src/tls/Makefile | 38 +++++++++ usr.sbin/wpa/src/utils/Makefile | 32 ++++++++ usr.sbin/wpa/src/wps/Makefile | 39 +++++++++ usr.sbin/wpa/wpa_cli/Makefile | 33 ++++---- usr.sbin/wpa/wpa_passphrase/Makefile | 7 +- usr.sbin/wpa/wpa_priv/Makefile | 9 +-- usr.sbin/wpa/wpa_supplicant/Makefile | 91 ++++++--------------- 26 files changed, 700 insertions(+), 366 deletions(-) diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index 75eafa374245..db76fdd0486c 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -64,7 +64,22 @@ _INTERNALLIBS= \ smdb \ smutil \ telnet \ - vers + vers \ + wpaap \ + wpacommon \ + wpacrypto \ + wpadrivers \ + wpaeap_common \ + wpaeap_peer \ + wpaeap_server \ + wpaeapol_auth \ + wpaeapol_supp \ + wpal2_packet \ + wparadius \ + wparsn_supp \ + wpatls \ + wpautils \ + wpawps _LIBRARIES= \ ${_PRIVATELIBS} \ @@ -583,6 +598,51 @@ LIBBE?= ${LIBBEDIR}/libbe${PIE_SUFFIX}.a LIBPMCSTATDIR= ${_LIB_OBJTOP}/lib/libpmcstat LIBPMCSTAT?= ${LIBPMCSTATDIR}/libpmcstat${PIE_SUFFIX}.a +LIBWPAAPDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/ap +LIBWPAAP?= ${LIBWPAAPDIR}/libwpaap${PIE_SUFFIX}.a + +LIBWPACOMMONDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/common +LIBWPACOMMON?= ${LIBWPACOMMONDIR}/libwpacommon${PIE_SUFFIX}.a + +LIBWPACRYPTODIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/crypto +LIBWPACRYPTO?= ${LIBWPACRYPTODIR}/libwpacrypto${PIE_SUFFIX}.a + +LIBWPADRIVERSDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/drivers +LIBWPADRIVERS?= ${LIBWPADRIVERSDIR}/libwpadrivers${PIE_SUFFIX}.a + +LIBWPAEAP_COMMONDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/eap_common +LIBWPAEAP_COMMON?= ${LIBWPAEAP_COMMONDIR}/libwpaeap_common${PIE_SUFFIX}.a + +LIBWPAEAP_PEERDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/eap_peer +LIBWPAEAP_PEER?= ${LIBWPAEAP_PEERDIR}/libwpaeap_peer${PIE_SUFFIX}.a + +LIBWPAEAP_SERVERDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/eap_server +LIBWPAEAP_SERVER?= ${LIBWPAEAP_SERVERDIR}/libwpaeap_server${PIE_SUFFIX}.a + +LIBWPAEAPOL_AUTHDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/eapol_auth +LIBWPAEAPOL_AUTH?= ${LIBWPAEAPOL_AUTHDIR}/libwpaeapol_auth${PIE_SUFFIX}.a + +LIBWPAEAPOL_SUPPDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/eapol_supp +LIBWPAEAPOL_SUPP?= ${LIBWPAEAPOL_SUPPDIR}/libwpaeapol_supp${PIE_SUFFIX}.a + +LIBWPAL2_PACKETDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/l2_packet +LIBWPAL2_PACKET?= ${LIBWPAL2_PACKETDIR}/libwpal2_packet${PIE_SUFFIX}.a + +LIBWPARADIUSDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/radius +LIBWPARADIUS?= ${LIBWPARADIUSDIR}/libwparadius${PIE_SUFFIX}.a + +LIBWPARSN_SUPPDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/rsn_supp +LIBWPARSN_SUPP?= ${LIBWPARSN_SUPPDIR}/libwparsn_supp${PIE_SUFFIX}.a + +LIBWPATLSDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/tls +LIBWPATLS?= ${LIBWPATLSDIR}/libwpatls${PIE_SUFFIX}.a + +LIBWPAUTILSDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/utils +LIBWPAUTILS?= ${LIBWPAUTILSDIR}/libwpautils${PIE_SUFFIX}.a + +LIBWPAWPSDIR= ${_LIB_OBJTOP}/usr.sbin/wpa/src/wps +LIBWPAWPS?= ${LIBWPAWPSDIR}/libwpawps${PIE_SUFFIX}.a + LIBC_NOSSP_PICDIR= ${_LIB_OBJTOP}/lib/libc LIBC_NOSSP_PIC?= ${LIBC_NOSSP_PICDIR}/libc_nossp_pic.a diff --git a/usr.sbin/wpa/Makefile b/usr.sbin/wpa/Makefile index 451c4c3b17a6..fe8fb60b1dc2 100644 --- a/usr.sbin/wpa/Makefile +++ b/usr.sbin/wpa/Makefile @@ -1,7 +1,12 @@ # $FreeBSD$ -SUBDIR= wpa_supplicant wpa_cli wpa_passphrase -SUBDIR+= hostapd hostapd_cli +SUBDIR= src .WAIT \ + wpa_supplicant \ + wpa_cli \ + wpa_passphrase \ + hostapd \ + hostapd_cli \ + SUBDIR_PARALLEL= .include diff --git a/usr.sbin/wpa/Makefile.crypto b/usr.sbin/wpa/Makefile.crypto index bed452bf8592..a7ddb917ac6d 100644 --- a/usr.sbin/wpa/Makefile.crypto +++ b/usr.sbin/wpa/Makefile.crypto @@ -1,13 +1,10 @@ # $FreeBSD$ .if ${MK_OPENSSL} != "no" -SRCS+= crypto_openssl.c random.c sha1-prf.c sha256-prf.c sha256-tlsprf.c \ - sha512.c LIBADD+= ssl crypto CFLAGS+= -DCONFIG_SHA256 .else CFLAGS+=-DCONFIG_CRYPTO_INTERNAL -SRCS+= crypto_internal.c random.c CONFIG_INTERNAL_AES=y CONFIG_INTERNAL_DES=y CONFIG_INTERNAL_MD4=y @@ -33,129 +30,28 @@ NEED_TLS_PRF=y .if defined(CONFIG_INTERNAL_TLS) CFLAGS+=-DCONFIG_INTERNAL_LIBTOMMATH \ -DCONFIG_TLS_INTERNAL_CLIENT -SRCS+= asn1.c \ - bignum.c \ - crypto_internal-cipher.c \ - crypto_internal-modexp.c \ - crypto_internal-rsa.c \ - pkcs1.c \ - pkcs5.c \ - pkcs8.c \ - rsa.c \ - tls_internal.c \ - tlsv1_common.c \ - tlsv1_record.c \ - tlsv1_cred.c \ - tlsv1_client.c \ - tlsv1_client_write.c \ - tlsv1_client_read.c \ - tlsv1_client_ocsp.c \ - x509v3.c NEED_DES=y NEED_MD4=y NEED_RC4=y .else CFLAGS+=-DEAP_TLS_OPENSSL -SRCS+= tls_openssl.c tls_openssl_ocsp.c .endif .endif -.if defined(CONFIG_INTERNAL_AES) -SRCS+= aes-unwrap.c aes-wrap.c \ - aes-internal.c \ - aes-internal-dec.c \ - aes-internal-enc.c -.endif - -.if defined(NEED_AES_CBC) -SRCS+= aes-cbc.c -.endif - .if defined(NEED_AES_EAX) -SRCS+= aes-eax.c NEED_AES_CTR=y .endif -.if defined(NEED_AES_CTR) -SRCS+= aes-ctr.c -.endif - -.if defined(NEED_AES_ENCBLOCK) -SRCS+= aes-encblock.c -.endif - -.if defined(NEED_AES_OMAC1) -SRCS+= aes-omac1.c -.endif - -.if defined(NEED_DES) -.if defined(CONFIG_INTERNAL_DES) -SRCS+= des-internal.c -.endif -.endif - -.if defined(NEED_MD4) -.if defined(CONFIG_INTERNAL_MD4) -SRCS+= md4-internal.c -.endif -.endif - -.if defined(CONFIG_INTERNAL_MD5) -SRCS+= md5.c md5-internal.c -.endif - -.if defined(NEED_FIPS186_2_PRF) -.if defined(CONFIG_INTERNAL_SHA1) -SRCS+= fips_prf_internal.c -.else -SRCS+= fips_prf_openssl.c -.endif -.endif - -.if defined(CONFIG_INTERNAL_RC4) -SRCS+= rc4.c -.endif - -.if defined(CONFIG_INTERNAL_SHA1) -SRCS+= sha1-internal.c sha1-pbkdf2.c sha1.c sha1-prf.c -.endif - .if defined(NEED_SHA256) CFLAGS+=-DCONFIG_SHA256 -SRCS+= sha256.c -.if defined(CONFIG_INTERNAL_SHA256) -SRCS+= sha256-internal.c sha256-prf.c -.endif .endif .if defined(NEED_SHA384) CFLAGS+=-DCONFIG_SHA384 -SRCS+= sha384.c -.if defined(CONFIG_INTERNAL_SHA384) -SRCS+= sha384-internal.c sha384-prf.c -.endif .endif .if defined(NEED_SHA512) CFLAGS+=-DCONFIG_SHA512 -SRCS+= sha512.c -.if defined(CONFIG_INTERNAL_SHA512) -SRCS+= sha512-internal.c sha512-prf.c -.endif -.endif - -.if defined(NEED_TLS_PRF) -SRCS+= sha1-tlsprf.c -.endif - -.if defined(CONFIG_INTERNAL_DH5) -.if defined(NEED_DH_GROUPS) -SRCS+= dh_group5.c -.endif -.endif - -.if defined(NEED_DH_GROUPS) -SRCS+= dh_groups.c .endif .if defined(NEED_DH_GROUPS_ALL) diff --git a/usr.sbin/wpa/Makefile.inc b/usr.sbin/wpa/Makefile.inc index 0a69ca08166b..87a1d6c23bbc 100644 --- a/usr.sbin/wpa/Makefile.inc +++ b/usr.sbin/wpa/Makefile.inc @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + BINDIR?= /usr/sbin WARNS?= 0 @@ -8,18 +10,7 @@ WPA_DISTDIR?= ${SRCTOP}/contrib/wpa/ WPA_SUPPLICANT_DISTDIR?=${WPA_DISTDIR}/wpa_supplicant HOSTAPD_DISTDIR?= ${WPA_DISTDIR}/hostapd -.PATH.c:${.CURDIR:H} \ - ${WPA_DISTDIR}/src/common \ - ${WPA_DISTDIR}/src/crypto \ - ${WPA_DISTDIR}/src/eapol_auth \ - ${WPA_DISTDIR}/src/eap_common \ - ${WPA_DISTDIR}/src/eapol_supp \ - ${WPA_DISTDIR}/src/l2_packet \ - ${WPA_DISTDIR}/src/radius \ - ${WPA_DISTDIR}/src/rsn_supp \ - ${WPA_DISTDIR}/src/tls \ - ${WPA_DISTDIR}/src/utils \ - ${WPA_DISTDIR}/src/wps +.PATH.c:${.CURDIR:H} CFLAGS+=-I${.CURDIR} CFLAGS+=-I${HOSTAPD_DISTDIR} @@ -31,9 +22,78 @@ CFLAGS+=-I${WPA_DISTDIR}/src/l2_packet CFLAGS+=-I${WPA_DISTDIR}/src/utils CFLAGS+=-I${WPA_DISTDIR}/src/wps -CFLAGS+= -DCONFIG_CTRL_IFACE -CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX -CFLAGS+= -DNEED_AP_MLME -CFLAGS+= -DTLS_DEFAULT_CIPHERS=\"DEFAULT:!EXP:!LOW\" +CFLAGS+=-DCONFIG_DRIVER_BSD +CFLAGS+=-DCONFIG_DRIVER_WIRED +CFLAGS+=-DCONFIG_DRIVER_RADIUS_ACL +CFLAGS+=-DCONFIG_CTRL_IFACE +CFLAGS+=-DCONFIG_CTRL_IFACE_UNIX +CFLAGS+=-DCONFIG_IEEE80211AC +CFLAGS+=-DCONFIG_IEEE80211N +CFLAGS+=-DCONFIG_IEEE80211R +CFLAGS+=-DCONFIG_IEEE80211W +CFLAGS+=-DCONFIG_IEEE80211AX +CFLAGS+=-DNEED_AP_MLME +CFLAGS+=-DTLS_DEFAULT_CIPHERS=\"DEFAULT:!EXP:!LOW\" +CFLAGS+=-DCONFIG_DEBUG_SYSLOG +CFLAGS+=-DCONFIG_WPS +CFLAGS+=-DCONFIG_WPS2 +CFLAGS+=-DCONFIG_WPS_UPNP +CFLAGS+=-DCONFIG_WPS_OOB +CFLAGS+=-DCONFIG_INTERWORKING +CFLAGS+=-DPKCS12_FUNCS +CFLAGS+=-DCONFIG_GAS +CFLAGS+=-DCONFIG_PEERKEY +CFLAGS+=-DCONFIG_PRIVSEP +CFLAGS+=-DCONFIG_SMARTCARD +CFLAGS+=-DCONFIG_TERMINATE_ONLASTIF +CFLAGS+=-DCONFIG_TLS=openssl +CFLAGS+=-DCONFIG_MATCH_IFACE +CFLAGS+=-DEAP_SERVER +CFLAGS+=-DEAP_SERVER_GTC +CFLAGS+=-DEAP_SERVER_IDENTITY +CFLAGS+=-DEAP_SERVER_MD5 +CFLAGS+=-DEAP_SERVER_MSCHAPV2 +CFLAGS+=-DEAP_SERVER_PEAP +CFLAGS+=-DEAP_SERVER_TLS +CFLAGS+=-DEAP_SERVER_TTLS +CFLAGS+=-DEAP_SERVER_WSC +CFLAGS+=-DEAP_TLS_FUNCS + +.if ${MK_WPA_SUPPLICANT_EAPOL} != "no" +CFLAGS+=-DCONFIG_HS20 \ + -DEAP_GTC \ + -DEAP_LEAP \ + -DEAP_MD5 \ + -DEAP_MSCHAPv2 \ + -DEAP_OTP \ + -DEAP_PEAP \ + -DEAP_PSK \ + -DEAP_TLS \ + -DEAP_TTLS \ + -DEAP_WSC \ + -DIEEE8021X_EAPOL +NEED_AES_EAX=y +NEED_AES_ENCBLOCK=y +NEED_AES_OMAC1=y +.endif + +.if !empty(CFLAGS:M*-DEAP_AKA) +NEED_SIM_COMMON=y +NEED_AES_CBC=y +.endif + +.if !empty(CFLAGS:M*-DEAP_SIM) +NEED_SIM_COMMON=y +NEED_AES_CBC=y +.endif + +.if defined(NEED_SIM_COMMON) +NEED_FIPS186_2_PRF=y +.endif + +.if !empty(CFLAGS:M*-DEAP_GPSK) +CFLAGS+=-DEAP_GPSK_SHA256 +NEED_AES_OMAC1=y +.endif .include diff --git a/usr.sbin/wpa/hostapd/Makefile b/usr.sbin/wpa/hostapd/Makefile index 579694046989..6e026babae1a 100644 --- a/usr.sbin/wpa/hostapd/Makefile +++ b/usr.sbin/wpa/hostapd/Makefile @@ -3,96 +3,14 @@ .include .include "../Makefile.inc" -.PATH.c:${HOSTAPD_DISTDIR} \ - ${WPA_DISTDIR}/src/ap \ - ${WPA_DISTDIR}/src/eap_server \ - ${WPA_DISTDIR}/src/eap_peer \ - ${WPA_DISTDIR}/src/drivers \ - ${WPA_DISTDIR}/wpa_supplicant +.PATH.c:${HOSTAPD_DISTDIR} PACKAGE= hostapd PROG= hostapd -SRCS= accounting.c \ - ap_config.c \ - ap_drv_ops.c \ - ap_list.c \ - ap_mlme.c \ - authsrv.c \ - base64.c \ - beacon.c \ - bss_load.c \ - chap.c \ - common.c \ - config_file.c \ +SRCS= config_file.c \ ctrl_iface.c \ - ctrl_iface_ap.c \ - ctrl_iface_common.c \ - dfs.c \ - driver_bsd.c \ - driver_common.c \ - drivers.c \ - drv_callbacks.c \ - eloop.c \ - gas.c \ - gas_serv.c \ - http_client.c \ - http_server.c \ - httpread.c \ - hostapd.c \ - hs20.c \ - hw_features.c \ - hw_features_common.c \ - ieee802_11.c \ - ieee802_11_auth.c \ - ieee802_11_common.c \ - ieee802_11_he.c \ - ieee802_11_ht.c \ - ieee802_11_shared.c \ - ieee802_11_vht.c \ - ieee802_1x.c \ - ip_addr.c \ - l2_packet_freebsd.c \ - main.c \ - mbo_ap.c \ - ms_funcs.c \ - neighbor_db.c \ - os_unix.c \ - pmksa_cache_auth.c \ - preauth_auth.c \ - radius.c \ - radius_client.c \ - radius_das.c \ - rrm.c \ - sta_info.c \ - tkip_countermeasures.c \ - upnp_xml.c \ - utils.c \ - uuid.c \ - vlan.c \ - vlan_ifconfig.c \ - vlan_init.c \ - wmm.c \ - wpa_auth.c \ - wpa_auth_glue.c \ - wpa_auth_ie.c \ - wpa_common.c \ - wpa_ctrl.c \ - wpa_debug.c \ - wpabuf.c \ - wps.c \ - wps_attr_build.c \ - wps_attr_process.c \ - wps_attr_parse.c \ - wps_common.c \ - wps_dev_attr.c \ - wps_enrollee.c \ - wps_hostapd.c \ - wps_registrar.c \ - wps_upnp.c \ - wps_upnp_ap.c \ - wps_upnp_event.c \ - wps_upnp_ssdp.c \ - wps_upnp_web.c + eap_register.c \ + main.c MAN= hostapd.8 hostapd.conf.5 @@ -104,26 +22,17 @@ FILES= hostapd.conf hostapd.eap_user hostapd.wpa_psk CFLAGS+=-I${.CURDIR:H}/wpa_supplicant \ -I${WPA_DISTDIR}/src/eap_peer \ - -DCONFIG_DRIVER_BSD \ - -DCONFIG_DRIVER_RADIUS_ACL \ - -DCONFIG_HS20 \ -DCONFIG_MBO \ - -DCONFIG_IEEE80211N \ - -DCONFIG_IEEE80211W \ - -DCONFIG_IEEE80211AC \ - -DCONFIG_IEEE80211AX \ - -DCONFIG_INTERWORKING \ - -DCONFIG_PEERKEY \ -DCONFIG_RSN_PREAUTH \ - -DCONFIG_WPS \ - -DCONFIG_WPS2 \ - -DCONFIG_WPS_UPNP \ -DHOSTAPD .if ${MK_INET6} != "no" CFLAGS+= -DCONFIG_IPV6 .endif #CFLAGS+= -g -LIBADD+= pcap util +LIBADD+= pcap util wpaap wpacommon wpacrypto \ + wpadrivers wpal2_packet wpaeap_common wpaeap_server \ + wpaeapol_auth \ + wparadius wpatls wpautils wpawps # User customizations for wpa_supplicant/hostapd build environment CFLAGS+=${HOSTAPD_CFLAGS} @@ -131,36 +40,6 @@ CFLAGS+=${HOSTAPD_CFLAGS} LDADD+=${HOSTAPD_LDADD} #LDFLAGS+=${HOSTAPD_LDFLAGS} -CFLAGS+=-DDPKCS12_FUNCS \ - -DEAP_SERVER \ - -DEAP_SERVER_GTC \ - -DEAP_SERVER_IDENTITY \ - -DEAP_SERVER_MD5 \ - -DEAP_SERVER_MSCHAPV2 \ - -DEAP_SERVER_PEAP \ - -DEAP_SERVER_TLS \ - -DEAP_SERVER_TTLS \ - -DEAP_SERVER_WSC \ - -DEAP_TLS_FUNCS - -SRCS+= eap_server_gtc.c \ - eap_common.c \ - eap_peap_common.c \ - eap_register.c \ - eap_server.c \ - eap_server_identity.c \ - eap_server_md5.c \ - eap_server_methods.c \ - eap_server_mschapv2.c \ - eap_server_peap.c \ - eap_server_tls.c \ - eap_server_tls_common.c \ - eap_server_ttls.c \ - eap_server_wsc.c \ - eap_user_db.c \ - eap_wsc_common.c \ - eapol_auth_dump.c \ - eapol_auth_sm.c TLS_FUNCS=y # For WPS, EAP modes, etc @@ -172,38 +51,22 @@ NEED_SIM_COMMON=y .endif .if !empty(CFLAGS:M*-DEAP_SERVER_AKA) -SRCS+= eap_server_aka.c NEED_SIM_COMMON=y .endif .if !empty(CFLAGS:M*-DEAP_SERVER_SIM) -SRCS+= eap_server_sim.c NEED_SIM_COMMON=y .endif .if defined(NEED_SIM_COMMON) -SRCS+= eap_sim_common.c \ - eap_sim_db.c NEED_FIPS186_2_PRF=y .endif .if !empty(CFLAGS:M*-DEAP_SERVER_GPSK) CFLAGS+=-DEAP_GPSK_SHA256 -SRCS+= eap_server_gpsk.c \ - eap_gpsk_common.c NEED_AES_OMAC1=y .endif -.if !empty(CFLAGS:M*-DEAP_SERVER_PAX) -SRCS+= eap_server_pax.c \ - eap_pax_common.c -.endif - -.if !empty(CFLAGS:M*-DEAP_SERVER_SAKE) -SRCS+= eap_server_sake.c \ - eap_sake_common.c -.endif - .include "../Makefile.crypto" .include diff --git a/usr.sbin/wpa/hostapd_cli/Makefile b/usr.sbin/wpa/hostapd_cli/Makefile index eda50e222d2e..276e25058298 100644 --- a/usr.sbin/wpa/hostapd_cli/Makefile +++ b/usr.sbin/wpa/hostapd_cli/Makefile @@ -6,14 +6,12 @@ PACKAGE= hostapd PROG= hostapd_cli -SRCS= cli.c common.c edit.c eloop.c hostapd_cli.c os_unix.c \ - wpa_ctrl.c wpa_debug.c +SRCS= hostapd_cli.c -CFLAGS+= -DCONFIG_CTRL_IFACE -CFLAGS+= -DCONFIG_CTRL_IFACE_UNIX - -LIBADD+= util +LIBADD+= util wpacommon wpautils MAN= hostapd_cli.8 +.include "../Makefile.crypto" + .include diff --git a/usr.sbin/wpa/src/Makefile b/usr.sbin/wpa/src/Makefile new file mode 100644 index 000000000000..f21856ad23a2 --- /dev/null +++ b/usr.sbin/wpa/src/Makefile @@ -0,0 +1,19 @@ +SUBDIR= ap \ + common \ + crypto \ + drivers \ + eap_common \ + eap_peer \ + eap_server \ + eapol_auth \ + eapol_supp \ + l2_packet \ + radius \ + rsn_supp \ + tls \ + utils \ + wps + +SUBDIR_PARALLEL= + +.include diff --git a/usr.sbin/wpa/src/ap/Makefile b/usr.sbin/wpa/src/ap/Makefile new file mode 100644 index 000000000000..edb2f1e9d089 --- /dev/null +++ b/usr.sbin/wpa/src/ap/Makefile @@ -0,0 +1,59 @@ +.include + +.include "../../Makefile.inc" + +LIB= wpaap +INTERNALLIB= + +.PATH: ${WPA_DISTDIR}/src/ap + +SRCS= accounting.c \ + ap_config.c \ + ap_drv_ops.c \ + ap_list.c \ + ap_mlme.c \ + authsrv.c \ + beacon.c \ + bss_load.c \ + ctrl_iface_ap.c \ + dfs.c \ + drv_callbacks.c \ + eap_user_db.c \ + gas_serv.c \ + hostapd.c \ + hs20.c \ + hw_features.c \ + ieee802_11.c \ + ieee802_11_auth.c \ + ieee802_11_he.c \ + ieee802_11_ht.c \ + ieee802_11_shared.c \ + ieee802_11_vht.c \ + ieee802_1x.c \ + mbo_ap.c \ + neighbor_db.c \ + pmksa_cache_auth.c \ + preauth_auth.c \ + rrm.c \ + sta_info.c \ + tkip_countermeasures.c \ + utils.c \ + vlan.c \ + vlan_ifconfig.c \ + vlan_init.c \ + wmm.c \ + wpa_auth.c \ + wpa_auth_glue.c \ + wpa_auth_ie.c \ + wps_hostapd.c + +CFLAGS+=-DCONFIG_MBO \ + -DCONFIG_RSN_PREAUTH \ + -DHOSTAPD + +.include "../../Makefile.crypto" + +# We are only interested in includes at this point. Not libraries. +LIBADD= + +.include diff --git a/usr.sbin/wpa/src/common/Makefile b/usr.sbin/wpa/src/common/Makefile new file mode 100644 index 000000000000..28c16ff9d31a --- /dev/null +++ b/usr.sbin/wpa/src/common/Makefile @@ -0,0 +1,27 @@ +.include + +.include "../../Makefile.inc" + +LIB= wpacommon +INTERNALLIB= + +.PATH: ${WPA_DISTDIR}/src/common + +SRCS= cli.c \ + ctrl_iface_common.c \ + gas.c \ + hw_features_common.c \ + ieee802_11_common.c \ + wpa_common.c \ + wpa_ctrl.c + +CFLAGS+=-DCONFIG_SAE \ + -DCONFIG_SUITE \ + -DCONFIG_SUITEB + +.include "../../Makefile.crypto" + +# We are only interested in includes at this point. Not libraries. +LIBADD= + +.include diff --git a/usr.sbin/wpa/src/crypto/Makefile b/usr.sbin/wpa/src/crypto/Makefile new file mode 100644 index 000000000000..d7e1304dc95e --- /dev/null +++ b/usr.sbin/wpa/src/crypto/Makefile @@ -0,0 +1,63 @@ +.include + +.include "../../Makefile.inc" + +LIB= wpacrypto +INTERNALLIB= + +.PATH: ${WPA_DISTDIR}/src/crypto + +SRCS= aes-cbc.c \ + aes-ctr.c \ + aes-eax.c \ + aes-encblock.c \ + aes-internal.c \ + aes-internal-dec.c \ + aes-internal-enc.c \ + aes-omac1.c \ + aes-unwrap.c \ + aes-wrap.c \ + crypto_internal.c \ + crypto_internal-cipher.c \ + crypto_internal-modexp.c \ + crypto_internal-rsa.c \ + des-internal.c \ + dh_group5.c \ + dh_groups.c \ + fips_prf_internal.c \ + md4-internal.c \ + md5.c \ + md5-internal.c \ + ms_funcs.c \ + random.c \ + rc4.c \ + sha1.c \ + sha1-internal.c \ + sha1-pbkdf2.c \ + sha1-prf.c \ + sha1-tlsprf.c \ + sha256.c \ + sha256-prf.c \ + sha256-tlsprf.c \ + sha256-internal.c \ + sha384.c \ + sha384-prf.c \ + sha384-internal.c \ + sha512-internal.c \ + tls_internal.c + +CFLAGS+=-DCONFIG_CRYPTO_INTERNAL \ + -DCONFIG_TLS_INTERNAL_CLIENT \ + -DCONFIG_TLS_INTERNAL_SERVER \ + -DCONFIG_SHA256 \ + -DCONFIG_SHA384 \ + -DCONFIG_HMAC_SHA384_KDF \ + -DCONFIG_INTERNAL_SHA384 +#CFLAGS+=-DALL_DH_GROUPS + +.include "../../Makefile.crypto" + +# We are only interested in includes at this point. Not libraries. +LIBADD= + +.include diff --git a/usr.sbin/wpa/src/drivers/Makefile b/usr.sbin/wpa/src/drivers/Makefile new file mode 100644 index 000000000000..1800b651885f --- /dev/null +++ b/usr.sbin/wpa/src/drivers/Makefile @@ -0,0 +1,21 @@ +.include + +.include "../../Makefile.inc" + +LIB= wpadrivers +INTERNALLIB= + +.PATH: ${WPA_DISTDIR}/src/drivers + +SRCS= drivers.c \ + driver_bsd.c \ + driver_common.c \ + driver_wired.c \ + driver_wired_common.c + +.include "../../Makefile.crypto" + +# We are only interested in includes at this point. Not libraries. +LIBADD= + +.include diff --git a/usr.sbin/wpa/src/eap_common/Makefile b/usr.sbin/wpa/src/eap_common/Makefile new file mode 100644 index 000000000000..4da89b221b36 --- /dev/null +++ b/usr.sbin/wpa/src/eap_common/Makefile @@ -0,0 +1,25 @@ +.include + +.include "../../Makefile.inc" + +LIB= wpaeap_common +INTERNALLIB= + +.PATH: ${WPA_DISTDIR}/src/eap_common + +SRCS= chap.c \ + eap_common.c \ + eap_gpsk_common.c \ + eap_pax_common.c \ + eap_peap_common.c \ + eap_psk_common.c \ + eap_sake_common.c \ + eap_sim_common.c \ + eap_wsc_common.c + +.include "../../Makefile.crypto" + +# We are only interested in includes at this point. Not libraries. +LIBADD= + +.include diff --git a/usr.sbin/wpa/src/eap_peer/Makefile b/usr.sbin/wpa/src/eap_peer/Makefile new file mode 100644 index 000000000000..524c7cf6c6f1 --- /dev/null +++ b/usr.sbin/wpa/src/eap_peer/Makefile @@ -0,0 +1,33 @@ +.include + +.include "../../Makefile.inc" + +LIB= wpaeap_peer +INTERNALLIB= + +.PATH: ${WPA_DISTDIR}/src/eap_peer + +SRCS= eap.c \ + eap_gtc.c \ + eap_leap.c \ + eap_md5.c \ + eap_methods.c \ + eap_mschapv2.c \ + eap_otp.c \ + eap_peap.c \ + eap_psk.c \ + eap_tls.c \ + eap_tls_common.c \ + eap_ttls.c \ + eap_wsc.c \ + eap_methods.c \ + mschapv2.c + +CFLAGS+=-DIEEE8021X_EAPOL + +.include "../../Makefile.crypto" + +# We are only interested in includes at this point. Not libraries. +LIBADD= + +.include diff --git a/usr.sbin/wpa/src/eap_server/Makefile b/usr.sbin/wpa/src/eap_server/Makefile new file mode 100644 index 000000000000..c5a4566bb444 --- /dev/null +++ b/usr.sbin/wpa/src/eap_server/Makefile @@ -0,0 +1,34 @@ +.include + +.include "../../Makefile.inc" + +LIB= wpaeap_server +INTERNALLIB= + +.PATH: ${WPA_DISTDIR}/src/eap_server + +SRCS= eap_server.c \ + eap_server_aka.c \ + eap_server_gpsk.c \ + eap_server_gtc.c \ + eap_server_identity.c \ + eap_server_md5.c \ + eap_server_methods.c \ + eap_server_mschapv2.c \ + eap_server_pax.c \ + eap_server_peap.c \ + eap_server_pwd.c \ + eap_server_sake.c \ + eap_server_sim.c \ + eap_server_tls.c \ + eap_server_tls_common.c \ + eap_server_ttls.c \ + eap_server_wsc.c \ *** 502 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Tue Jun 1 02:44:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1FAC2637A41; Tue, 1 Jun 2021 02:44:43 +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 4FvGhp5Nm7z3vPW; Tue, 1 Jun 2021 02:44:42 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A0C7A1B9F0; Tue, 1 Jun 2021 02:44:42 +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 1512igNG031465; Tue, 1 Jun 2021 02:44:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1512ig7W031464; Tue, 1 Jun 2021 02:44:42 GMT (envelope-from git) Date: Tue, 1 Jun 2021 02:44:42 GMT Message-Id: <202106010244.1512ig7W031464@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 1d4afcaca282 - main - nfsd: Delete extraneous NFSv4 root checks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1d4afcaca282f4ba249d8508f4149d9c0b058492 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 02:44:43 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=1d4afcaca282f4ba249d8508f4149d9c0b058492 commit 1d4afcaca282f4ba249d8508f4149d9c0b058492 Author: Rick Macklem AuthorDate: 2021-06-01 02:41:17 +0000 Commit: Rick Macklem CommitDate: 2021-06-01 02:41:17 +0000 nfsd: Delete extraneous NFSv4 root checks There are several NFSv4.1/4.2 server operation functions which have unneeded checks for the NFSv4 root being set up. The checks are not needed because the operations always follow a Sequence operation, which performs the check. This patch deletes these checks, simplifying the code so that a future patch that fixes the checks to conform with RFC5661 Sec. 2.6 will be less extension. MFC after: 2 weeks --- sys/fs/nfsserver/nfs_nfsdserv.c | 68 ----------------------------------------- 1 file changed, 68 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 5d3c6f65ced0..329c096c7570 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -4523,10 +4523,6 @@ nfsrvd_reclaimcomplete(struct nfsrv_descript *nd, __unused int isdgram, uint32_t *tl; int error = 0, onefs; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); /* * I believe that a ReclaimComplete with rca_one_fs == TRUE is only @@ -4644,10 +4640,6 @@ nfsrvd_freestateid(struct nfsrv_descript *nd, __unused int isdgram, int error = 0; struct thread *p = curthread; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_STATEID); stateid.seqid = fxdr_unsigned(uint32_t, *tl++); NFSBCOPY(tl, stateid.other, NFSX_STATEIDOTHER); @@ -4694,10 +4686,6 @@ nfsrvd_layoutget(struct nfsrv_descript *nd, __unused int isdgram, char *layp; struct thread *p = curthread; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, 4 * NFSX_UNSIGNED + 3 * NFSX_HYPER + NFSX_STATEID); tl++; /* Signal layout available. Ignore for now. */ @@ -4795,10 +4783,6 @@ nfsrvd_layoutcommit(struct nfsrv_descript *nd, __unused int isdgram, struct thread *p = curthread; layp = NULL; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED + 2 * NFSX_HYPER + NFSX_STATEID); offset = fxdr_hyper(tl); tl += 2; @@ -4878,10 +4862,6 @@ nfsrvd_layoutreturn(struct nfsrv_descript *nd, __unused int isdgram, struct thread *p = curthread; layp = NULL; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, 4 * NFSX_UNSIGNED); reclaim = *tl++; layouttype = fxdr_unsigned(int, *tl++); @@ -4964,10 +4944,6 @@ nfsrvd_layouterror(struct nfsrv_descript *nd, __unused int isdgram, char devid[NFSX_V4DEVICEID]; uint64_t offset, len; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_HYPER + NFSX_STATEID + NFSX_UNSIGNED); offset = fxdr_hyper(tl); tl += 2; @@ -5032,10 +5008,6 @@ nfsrvd_layoutstats(struct nfsrv_descript *nd, __unused int isdgram, uint64_t offset, len, readcount, readbytes, writecount, writebytes __unused; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, 6 * NFSX_HYPER + NFSX_STATEID + NFSX_V4DEVICEID + 2 * NFSX_UNSIGNED); offset = fxdr_hyper(tl); tl += 2; @@ -5092,10 +5064,6 @@ nfsrvd_ioadvise(struct nfsrv_descript *nd, __unused int isdgram, int error = 0, ret; off_t offset, len; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_STATEID + 2 * NFSX_HYPER); stateid.seqid = fxdr_unsigned(uint32_t, *tl++); NFSBCOPY(tl, stateid.other, NFSX_STATEIDOTHER); @@ -5185,10 +5153,6 @@ nfsrvd_getdevinfo(struct nfsrv_descript *nd, __unused int isdgram, char devid[NFSX_V4DEVICEID], *devaddr; time_t dev_time; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, 3 * NFSX_UNSIGNED + NFSX_V4DEVICEID); NFSBCOPY(tl, devid, NFSX_V4DEVICEID); tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED); @@ -5257,10 +5221,6 @@ nfsrvd_teststateid(struct nfsrv_descript *nd, __unused int isdgram, int cnt, error = 0, i, ret; struct thread *p = curthread; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); cnt = fxdr_unsigned(int, *tl); if (cnt <= 0 || cnt > 1024) { @@ -5307,10 +5267,6 @@ nfsrvd_allocate(struct nfsrv_descript *nd, __unused int isdgram, nfsquad_t clientid; nfsattrbit_t attrbits; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } gotproxystateid = 0; NFSM_DISSECT(tl, uint32_t *, NFSX_STATEID + 2 * NFSX_HYPER); stp->ls_flags = (NFSLCK_CHECK | NFSLCK_WRITEACCESS); @@ -5404,10 +5360,6 @@ nfsrvd_copy_file_range(struct nfsrv_descript *nd, __unused int isdgram, void *rl_rcookie, *rl_wcookie; rl_rcookie = rl_wcookie = NULL; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } if (nfsrv_devidcnt > 0) { /* * For a pNFS server, reply NFSERR_NOTSUPP so that the client @@ -5634,10 +5586,6 @@ nfsrvd_seek(struct nfsrv_descript *nd, __unused int isdgram, nfsattrbit_t attrbits; bool eof; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_STATEID + NFSX_HYPER + NFSX_UNSIGNED); /* Ignore the stateid for now. */ tl += (NFSX_STATEID / NFSX_UNSIGNED); @@ -5707,10 +5655,6 @@ nfsrvd_getxattr(struct nfsrv_descript *nd, __unused int isdgram, uint16_t off; error = 0; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); len = fxdr_unsigned(int, *tl); if (len <= 0) { @@ -5779,10 +5723,6 @@ nfsrvd_setxattr(struct nfsrv_descript *nd, __unused int isdgram, error = 0; name = NULL; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED); opt = fxdr_unsigned(int, *tl++); len = fxdr_unsigned(int, *tl); @@ -5872,10 +5812,6 @@ nfsrvd_rmxattr(struct nfsrv_descript *nd, __unused int isdgram, error = 0; name = NULL; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED); len = fxdr_unsigned(int, *tl); if (len <= 0) { @@ -5942,10 +5878,6 @@ nfsrvd_listxattr(struct nfsrv_descript *nd, __unused int isdgram, error = 0; buf = NULL; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; - goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED); /* * The cookie doesn't need to be in net byte order, but FreeBSD From owner-dev-commits-src-main@freebsd.org Tue Jun 1 04:33:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DFDD76392F6; Tue, 1 Jun 2021 04:33:45 +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 4FvK6d5kl9z4YH6; Tue, 1 Jun 2021 04:33:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AD15E1CEC4; Tue, 1 Jun 2021 04:33:45 +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 1514XjnK077785; Tue, 1 Jun 2021 04:33:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1514XjOE077784; Tue, 1 Jun 2021 04:33:45 GMT (envelope-from git) Date: Tue, 1 Jun 2021 04:33:45 GMT Message-Id: <202106010433.1514XjOE077784@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: 315674fb6acc - main - Add freeze/thaw description to devctl(8) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 315674fb6acc4fa54cf82de3863c349c5a71f498 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 04:33:45 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=315674fb6acc4fa54cf82de3863c349c5a71f498 commit 315674fb6acc4fa54cf82de3863c349c5a71f498 Author: Li-Wen Hsu AuthorDate: 2021-06-01 04:33:12 +0000 Commit: Li-Wen Hsu CommitDate: 2021-06-01 04:33:12 +0000 Add freeze/thaw description to devctl(8) This is a follow-up to 5fa29797910346fc0c54829bd979856e83b9b7ea . PR: 256311 Reviewed by: imp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29867 --- usr.sbin/devctl/devctl.8 | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/usr.sbin/devctl/devctl.8 b/usr.sbin/devctl/devctl.8 index 17f480bd66ee..965c310d0868 100644 --- a/usr.sbin/devctl/devctl.8 +++ b/usr.sbin/devctl/devctl.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 4, 2019 +.Dd June 1, 2021 .Dt DEVCTL 8 .Os .Sh NAME @@ -67,6 +67,10 @@ .Op Fl f .Ar device .Nm +.Cm freeze +.Nm +.Cm thaw +.Nm .Cm reset .Op Fl d .Ar device @@ -170,6 +174,23 @@ the device will be deleted even if it is physically present. This command should be used with care as a device that is deleted but present can no longer be used unless the parent bus device rediscovers the device via a rescan request. +.It Cm freeze +Freeze probe and attach processing initiated in response to drivers being +loaded. +Drivers are placed on a +.Do +frozen list +.Dc +and processed when a later +.Do +thaw +.Dc +occurs. +.It Cm thaw +Resume (thaw the freeze) probe and attach initiated in response to drivers +being loaded. +In addition to resuming, all pending actions that were frozen during the freeze +are performed. .It Xo Cm reset .Op Fl d .Ar device From owner-dev-commits-src-main@freebsd.org Tue Jun 1 06:56:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F114064C3EA; Tue, 1 Jun 2021 06:56:07 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (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 "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FvNGv6RjPz3jPn; Tue, 1 Jun 2021 06:56:07 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1622530567; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=jjT+Tt36UBpGHw/X371etCTuJsmnOQnLUEVnhmNDpaY=; b=wJv4jZ+Mb+sYy8+crCQvs25Dt6uWwb2ZIhTp+51FoJbFAI5UzhR+O4zrPC6wVcTRyPn+k+ L2ZlsrtR+o9uvVLxCuXduEvEX67jfDe7iyFbySjrxUzpBd+HGQCKqcnp0T0ip8kIosnRRX U+hkP2py0X6hmvcD1YEmtk3i3jTZxh7w2aui9cd82qFQOHXimGODMsi/KwhopdwjVYurGm uxq+G+f4y+fPi8MuszMK8oEC6u9XSm4dZXeK93UQ3qy26Z4Epmn26yt+kZaKQ4yMtzidGf FINKeSyJo4DYUJIpdjej+gPNH509L4naninsBrGOMmflDBQqOoU8SXKoTf7NqA== Received: by freefall.freebsd.org (Postfix, from userid 1033) id C69A1D26A; Tue, 1 Jun 2021 06:56:07 +0000 (UTC) Date: Tue, 1 Jun 2021 06:56:07 +0000 From: Alexey Dokuchaev To: Alan Somers Cc: Jessica Clarke , Warner Losh , Ed Maste , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 5a20c351ea45 - main - [skip ci] add a CODEOWNERS file Message-ID: References: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> <0434E9D2-B0AA-4B5E-942A-A393A83DFFD1@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1622530567; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=jjT+Tt36UBpGHw/X371etCTuJsmnOQnLUEVnhmNDpaY=; b=qEj63/+g1fHAo6fall+xKYl6nn43Dc0pzqcfj8yu8v8jKDtfPd5qcBralD1C9OFyEyIAjo Tfu6m8c8U7DMTmRmk/fRRNyUgFkwYCWKp+p1nWdgXcUIGhXz27hc/19dB0F38oJLKfvLIS s/JuRIFBbZwpDN6D5cfWbaEZdbJ5XS6CaVEesCog96clSLWrbUPX++swc9VnkvlXpMRci7 009s6+6aKqyg6NUZDSov7HWWd65WTe/uPFXMknVTnqdadV+XOetK7/GTH9yn3RdQ/GkWzx OBTk3Du/PkAhynILY29tseLvJqcMTLHjURR61G+0juxueZQKh6XisRhQ8R66mw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1622530567; a=rsa-sha256; cv=none; b=BfxpliwTZqs5fGMjfpPGduivbc8yfOD2CVcV3au5JFbxu4fDtNKMB6nADNSwRLUPxio6ss C8rnKwc9QsnMHW1ij+X4x0eU/FDOC+Zb/pwD1sWXfYA7t3GCipBolRaYuUMUgDAU4ISrWo ASQJ5wkvzY+6UHbxLMHoabN/qoUCQx2uEK8ukbs/TBZPLiWqROzbOH+WkPozb5rJ8a5Piw fsvGHPy7D3JEfihQEfUJjiit4QQ3qJi4IZxGxxUMzh9cL5kDbkWY/yIlRiPdBd99GO6lyy cT44nkBPW+S0FvizUNZX6gdEMBzccNW6tKP+oK05gp3bd62E0+vhDsUbRpb/RQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 06:56:08 -0000 On Mon, May 31, 2021 at 01:50:16PM -0600, Alan Somers wrote: > On Mon, May 31, 2021 at 1:39 PM Jessica Clarke wrote: > > ... > > > > A hypothetical .gitlab/CODEOWNERS would be checked in as a generated > > file, if that was unclear. Otherwise I'm not sure I understand your > > first point? > > There's no need to generate anything. Both github and gitlab support a > CODEOWNERS file in the project's root. Let's just move it there. We can > delete the old MAINTAINERS, too, once all of its entries have been > converted. Why delete *our* correctly named MAINTAINERS? Tomorrow GH or GL could decide that "pwning" something bears unnecessary and potentially offending connotations and break the scheme. They want CODEOWNERS now? Fine, all it takes is a simple script to parse MAINTAINERS and generate CODEOWNERS file they want. Once/if this changes, we'd easily adapt. ./danfe From owner-dev-commits-src-main@freebsd.org Tue Jun 1 07:02:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB3D864D126; Tue, 1 Jun 2021 07:02:18 +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 4FvNQ26LGCz3kBy; Tue, 1 Jun 2021 07:02:18 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C0DE51F512; Tue, 1 Jun 2021 07:02:18 +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 15172IWM077416; Tue, 1 Jun 2021 07:02:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15172IE1077415; Tue, 1 Jun 2021 07:02:18 GMT (envelope-from git) Date: Tue, 1 Jun 2021 07:02:18 GMT Message-Id: <202106010702.15172IE1077415@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: ec7b47fc81b2 - main - pf: Move provider declaration to pf.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ec7b47fc81b22470fb177d9e03b5a76818eee65f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 07:02:19 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ec7b47fc81b22470fb177d9e03b5a76818eee65f commit ec7b47fc81b22470fb177d9e03b5a76818eee65f Author: Kristof Provost AuthorDate: 2021-05-31 16:34:37 +0000 Commit: Kristof Provost CommitDate: 2021-06-01 07:02:05 +0000 pf: Move provider declaration to pf.h This simplifies life a bit, by not requiring us to repease the declaration for every file where we want static probe points. It also makes the gcc6 build happy. --- sys/net/pfvar.h | 3 +++ sys/netpfil/pf/pf_ioctl.c | 1 - sys/netpfil/pf/pf_nv.h | 1 - 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 2202421086d2..73de877847e6 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -60,6 +61,8 @@ SYSCTL_DECL(_net_pf); MALLOC_DECLARE(M_PFHASH); +SDT_PROVIDER_DECLARE(pf); + struct pfi_dynaddr { TAILQ_ENTRY(pfi_dynaddr) entry; struct pf_addr pfid_addr4; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 2d379d66486e..42c22ef9b894 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -94,7 +94,6 @@ __FBSDID("$FreeBSD$"); #include #endif -SDT_PROVIDER_DECLARE(pf); SDT_PROBE_DEFINE3(pf, ioctl, ioctl, error, "int", "int", "int"); SDT_PROBE_DEFINE3(pf, ioctl, function, error, "char *", "int", "int"); SDT_PROBE_DEFINE2(pf, ioctl, addrule, error, "int", "int"); diff --git a/sys/netpfil/pf/pf_nv.h b/sys/netpfil/pf/pf_nv.h index e53d19018ffe..9e7bd7c3627e 100644 --- a/sys/netpfil/pf/pf_nv.h +++ b/sys/netpfil/pf/pf_nv.h @@ -37,7 +37,6 @@ #include #include -SDT_PROVIDER_DECLARE(pf); SDT_PROBE_DECLARE(pf, ioctl, function, error); SDT_PROBE_DECLARE(pf, ioctl, nvchk, error); From owner-dev-commits-src-main@freebsd.org Tue Jun 1 12:44:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D25B5653BFC; Tue, 1 Jun 2021 12:44:38 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (heemeyer.club [IPv6:2001:19f0:6400:80a1:5054:ff:fe7a:a27d]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4FvX116Z51z3BsR; Tue, 1 Jun 2021 12:44:37 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (localhost [127.0.0.1]) by heemeyer.club (8.16.1/8.16.1) with ESMTP id 151CiUaZ001621; Tue, 1 Jun 2021 12:44:30 GMT (envelope-from dchagin@heemeyer.club) Received: (from dchagin@localhost) by heemeyer.club (8.16.1/8.16.1/Submit) id 151CiU7V001620; Tue, 1 Jun 2021 12:44:30 GMT (envelope-from dchagin) Date: Tue, 1 Jun 2021 12:44:30 +0000 From: Dmitry Chagin To: Mark Johnston Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: f3851b235b23 - main - ktrace: Fix a race with fork() Message-ID: References: <202105271953.14RJrN36017670@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202105271953.14RJrN36017670@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4FvX116Z51z3BsR X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of dchagin@heemeyer.club has no SPF policy when checking 2001:19f0:6400:80a1:5054:ff:fe7a:a27d) smtp.mailfrom=dchagin@heemeyer.club X-Spamd-Result: default: False [-1.80 / 15.00]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; FREEFALL_USER(0.00)[dchagin]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; RBL_DBL_DONT_QUERY_IPS(0.00)[2001:19f0:6400:80a1:5054:ff:fe7a:a27d:from]; AUTH_NA(1.00)[]; SPAMHAUS_ZRD(0.00)[2001:19f0:6400:80a1:5054:ff:fe7a:a27d:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; R_SPF_NA(0.00)[no SPF record]; FORGED_SENDER(0.30)[dchagin@freebsd.org,dchagin@heemeyer.club]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:20473, ipnet:2001:19f0:6400::/38, country:US]; FROM_NEQ_ENVFROM(0.00)[dchagin@freebsd.org,dchagin@heemeyer.club]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 12:44:38 -0000 On Thu, May 27, 2021 at 07:53:23PM +0000, Mark Johnston wrote: > The branch main has been updated by markj: > > URL: https://cgit.FreeBSD.org/src/commit/?id=f3851b235b23d9220ace31bbc89b1fe0a78fc75c > > commit f3851b235b23d9220ace31bbc89b1fe0a78fc75c > Author: Mark Johnston > AuthorDate: 2021-05-27 19:49:59 +0000 > Commit: Mark Johnston > CommitDate: 2021-05-27 19:52:20 +0000 > > ktrace: Fix a race with fork() > > ktrace(2) may toggle trace points in any of > 1. a single process > 2. all members of a process group > 3. all descendents of the processes in 1 or 2 > > In the first two cases, we do not permit the operation if the process is > being forked or not visible. However, in case 3 we did not enforce this > restriction for descendents. As a result, the assertions about the child > in ktrprocfork() may be violated. > > Move these checks into ktrops() so that they are applied consistently. > > Allow KTROP_CLEAR for nascent processes. Otherwise, there is a window > where we cannot clear trace points for a nascent child if they are > inherited from the parent. > > Reported by: syzbot+d96676592978f137e05c@syzkaller.appspotmail.com > Reported by: syzbot+7c98fcf84a4439f2817f@syzkaller.appspotmail.com > Reviewed by: kib > MFC after: 1 week > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D30481 > --- > sys/kern/kern_ktrace.c | 43 ++++++++++++++++++++++--------------------- > 1 file changed, 22 insertions(+), 21 deletions(-) > > diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c > index dc064d9ebd67..4a2dad20b035 100644 > --- a/sys/kern/kern_ktrace.c > +++ b/sys/kern/kern_ktrace.c > @@ -1006,7 +1006,7 @@ sys_ktrace(struct thread *td, struct ktrace_args *uap) > int facs = uap->facs & ~KTRFAC_ROOT; > int ops = KTROP(uap->ops); > int descend = uap->ops & KTRFLAG_DESCEND; > - int nfound, ret = 0; > + int ret = 0; > int flags, error = 0; > struct nameidata nd; > struct ktr_io_params *kiop, *old_kiop; > @@ -1080,42 +1080,31 @@ restart: > error = ESRCH; > goto done; > } > + > /* > * ktrops() may call vrele(). Lock pg_members > * by the proctree_lock rather than pg_mtx. > */ > PGRP_UNLOCK(pg); > - nfound = 0; > + if (LIST_EMPTY(&pg->pg_members)) { > + sx_sunlock(&proctree_lock); > + error = ESRCH; > + goto done; > + } > LIST_FOREACH(p, &pg->pg_members, p_pglist) { > PROC_LOCK(p); > - if (p->p_state == PRS_NEW || > - p_cansee(td, p) != 0) { > - PROC_UNLOCK(p); > - continue; > - } > - nfound++; > if (descend) > ret |= ktrsetchildren(td, p, ops, facs, kiop); > else > ret |= ktrops(td, p, ops, facs, kiop); > } > - if (nfound == 0) { > - sx_sunlock(&proctree_lock); > - error = ESRCH; > - goto done; > - } > } else { > /* > * by pid > */ > p = pfind(uap->pid); > - if (p == NULL) > + if (p == NULL) { > error = ESRCH; > - else > - error = p_cansee(td, p); > - if (error) { > - if (p != NULL) > - PROC_UNLOCK(p); > sx_sunlock(&proctree_lock); > goto done; > } > @@ -1187,8 +1176,20 @@ ktrops(struct thread *td, struct proc *p, int ops, int facs, > PROC_UNLOCK(p); > return (0); > } > - if (p->p_flag & P_WEXIT) { > - /* If the process is exiting, just ignore it. */ > + if ((ops == KTROP_SET && p->p_state == PRS_NEW) || !p_cansee(td, p)) { ^^^^^^^^^^^^^^ seems that it broke ktrace: root@mordor:~ # ktrace ls ktrace: ktrace.out: Operation not permitted > + /* > + * Disallow setting trace points if the process is being born. > + * This avoids races with trace point inheritance in > + * ktrprocfork(). > + */ > + PROC_UNLOCK(p); > + return (0); > + } > + if ((p->p_flag & P_WEXIT) != 0) { > + /* > + * There's nothing to do if the process is exiting, but avoid > + * signaling an error. > + */ > PROC_UNLOCK(p); > return (1); > } From owner-dev-commits-src-main@freebsd.org Tue Jun 1 12:50:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82273653B67; Tue, 1 Jun 2021 12:50:41 +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 4FvX813JyRz3C01; Tue, 1 Jun 2021 12:50:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5A51823D82; Tue, 1 Jun 2021 12:50:41 +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 151CofOf039003; Tue, 1 Jun 2021 12:50:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 151Cof9P039002; Tue, 1 Jun 2021 12:50:41 GMT (envelope-from git) Date: Tue, 1 Jun 2021 12:50:41 GMT Message-Id: <202106011250.151Cof9P039002@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Edward Tomasz Napierala Subject: git: b501b2ae52f3 - main - linux: export AT_HWCAP and AT_HWCAP2 on aarch64 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b501b2ae52f3ccb384584dcbb5dc4a4568cc0096 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 12:50:41 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=b501b2ae52f3ccb384584dcbb5dc4a4568cc0096 commit b501b2ae52f3ccb384584dcbb5dc4a4568cc0096 Author: Edward Tomasz Napierala AuthorDate: 2021-06-01 12:12:25 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-06-01 12:50:20 +0000 linux: export AT_HWCAP and AT_HWCAP2 on aarch64 The flag values seem to be the same between Linux and FreeBSD. Comparing to a Linux VM on the same hardware, we're missing HWCAP_EVTSTRM, HWCAP_CPUID, HWCAP_DCPOP, HWCAP_USCAT, HWCAP_PACA, and HWCAP_PACG. Reviewed By: mhorne, emaste Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30540 --- sys/arm64/linux/linux_sysvec.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 4db319cd96fd..365cb9fc386a 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #ifdef VFP #include #endif @@ -169,9 +171,7 @@ linux_copyout_auxargs(struct image_params *imgp, uintptr_t base) issetugid = p->p_flag & P_SUGID ? 1 : 0; AUXARGS_ENTRY(pos, LINUX_AT_SYSINFO_EHDR, imgp->proc->p_sysent->sv_shared_page_base); -#if 0 /* LINUXTODO: implement arm64 LINUX_AT_HWCAP */ - AUXARGS_ENTRY(pos, LINUX_AT_HWCAP, cpu_feature); -#endif + AUXARGS_ENTRY(pos, LINUX_AT_HWCAP, *imgp->sysent->sv_hwcap); AUXARGS_ENTRY(pos, AT_PAGESZ, args->pagesz); AUXARGS_ENTRY(pos, LINUX_AT_CLKTCK, stclohz); AUXARGS_ENTRY(pos, AT_PHDR, args->phdr); @@ -186,6 +186,7 @@ linux_copyout_auxargs(struct image_params *imgp, uintptr_t base) AUXARGS_ENTRY(pos, AT_EGID, imgp->proc->p_ucred->cr_svgid); AUXARGS_ENTRY(pos, LINUX_AT_SECURE, issetugid); AUXARGS_ENTRY_PTR(pos, LINUX_AT_RANDOM, imgp->canary); + AUXARGS_ENTRY(pos, LINUX_AT_HWCAP2, *imgp->sysent->sv_hwcap2); if (imgp->execpathp != 0) AUXARGS_ENTRY_PTR(pos, LINUX_AT_EXECFN, imgp->execpathp); if (args->execfd != -1) @@ -437,6 +438,8 @@ struct sysentvec elf_linux_sysvec = { .sv_schedtail = linux_schedtail, .sv_thread_detach = linux_thread_detach, .sv_trap = linux_vsyscall, + .sv_hwcap = &elf_hwcap, + .sv_hwcap2 = &elf_hwcap2, .sv_onexec = linux_on_exec, .sv_onexit = linux_on_exit, .sv_ontdexit = linux_thread_dtor, From owner-dev-commits-src-main@freebsd.org Tue Jun 1 13:17:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E677654047; Tue, 1 Jun 2021 13:17:24 +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 4FvXkq6rjWz3DcF; Tue, 1 Jun 2021 13:17:23 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CF48A240F2; Tue, 1 Jun 2021 13:17:23 +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 151DHNjM070655; Tue, 1 Jun 2021 13:17:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 151DHNIE070654; Tue, 1 Jun 2021 13:17:23 GMT (envelope-from git) Date: Tue, 1 Jun 2021 13:17:23 GMT Message-Id: <202106011317.151DHNIE070654@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 283e60fb310a - main - ktrace: Fix an inverted comparison added in commit f3851b235 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 283e60fb310abb0f77405bab2cc431690b9b262d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 13:17:24 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=283e60fb310abb0f77405bab2cc431690b9b262d commit 283e60fb310abb0f77405bab2cc431690b9b262d Author: Mark Johnston AuthorDate: 2021-06-01 13:15:35 +0000 Commit: Mark Johnston CommitDate: 2021-06-01 13:15:35 +0000 ktrace: Fix an inverted comparison added in commit f3851b235 Fixes: f3851b235 ("ktrace: Fix a race with fork()") Reported by: dchagin, phk --- sys/kern/kern_ktrace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c index 4a2dad20b035..87cea3f269d5 100644 --- a/sys/kern/kern_ktrace.c +++ b/sys/kern/kern_ktrace.c @@ -1176,7 +1176,8 @@ ktrops(struct thread *td, struct proc *p, int ops, int facs, PROC_UNLOCK(p); return (0); } - if ((ops == KTROP_SET && p->p_state == PRS_NEW) || !p_cansee(td, p)) { + if ((ops == KTROP_SET && p->p_state == PRS_NEW) || + p_cansee(td, p) != 0) { /* * Disallow setting trace points if the process is being born. * This avoids races with trace point inheritance in From owner-dev-commits-src-main@freebsd.org Tue Jun 1 13:20:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 532866540DD; Tue, 1 Jun 2021 13:20:05 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com [IPv6:2607:f8b0:4864:20::f36]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FvXnx1g77z3Dwm; Tue, 1 Jun 2021 13:20:05 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qv1-xf36.google.com with SMTP id a7so7088805qvf.11; Tue, 01 Jun 2021 06:20:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0l6TOTW+sIc64CnwE7NMyNPD005s9lo9/WooTzDmgr0=; b=IiQ6iR54bTSEdXarzi+UIG+wujr91gyB61tc+QuTHQr/56omR5UUf9vO6RqYJJx/gK 0xMKozK1IYYTfDFar3W65vw+mlVxgVpxymfsPleSrCKryaCfHfqZBy5C/3t65VkoND7p NerlYSr8635beHcS8ruj4ZdSZo1sQBXUXIw1K5aWZuhU2DfOLn33uV1XdTeCBMrftQ9k 53JNBX+NK1I2Q0/ZNBy6dKTYNlrkeRmDZ/eUcFxLhNBwINH9l3yk7x2IBZJnS3LfuHHR olZKslp4C8GtTMzip6RNMt1VxbwjNs/QoMoz1Sbme2rFCsRaBsxcyMapqU9zA1j/ebWO eCUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=0l6TOTW+sIc64CnwE7NMyNPD005s9lo9/WooTzDmgr0=; b=ccG59RWf4BIHVsaP9p3KF/Uf1zAtRaA9Adv0tDf2e1OHD8Zw2UZ8TAlHsrB1nxYdW4 XiLX/IDCPf4ueX1gyZHpNBpVAL59QAachwclUB+yS3QqKA5ogk6/bumBNC2ILXmuwYXX Qcl7Kri3GTs4HO6iC8cVRiByRLHo22gpUnV0Ayk4mJA7/Z2UiRB+d8TKRJBO6rOEMKdD 63oAiqeambqibajl3+SAvNdEQTdHLzhGUxnUbc+KqGZp6fYMy0bT0+f1rT3iccDdlx5g yS4VfNBIgj4CzKFK76QoUZvMoJ+gnvzoUORQUI0wwjWEIoWYX4m5hnZbjpbNCrr0fgWi 2neA== X-Gm-Message-State: AOAM532IJRS/Lk2Pp5468vORQasCod1edU92V/GnUoSqZvvov5ONX9MB 6xgjyAmLj8AlkYvuRxWnK7h8BzgTzPY= X-Google-Smtp-Source: ABdhPJwTGCy7Zog1SSOI9e3durmi0tqghkF9WxugZKRX0vCh1x/JH8G1vLQYH7/mWuF342ksX1qiZw== X-Received: by 2002:a0c:9e50:: with SMTP id z16mr20605696qve.31.1622553603687; Tue, 01 Jun 2021 06:20:03 -0700 (PDT) Received: from nuc ([142.126.172.178]) by smtp.gmail.com with ESMTPSA id z1sm11081654qki.47.2021.06.01.06.20.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Jun 2021 06:20:03 -0700 (PDT) Sender: Mark Johnston Date: Tue, 1 Jun 2021 09:20:04 -0400 From: Mark Johnston To: Dmitry Chagin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: f3851b235b23 - main - ktrace: Fix a race with fork() Message-ID: References: <202105271953.14RJrN36017670@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4FvXnx1g77z3Dwm X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 13:20:05 -0000 On Tue, Jun 01, 2021 at 12:44:30PM +0000, Dmitry Chagin wrote: > On Thu, May 27, 2021 at 07:53:23PM +0000, Mark Johnston wrote: > > The branch main has been updated by markj: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=f3851b235b23d9220ace31bbc89b1fe0a78fc75c > > > > commit f3851b235b23d9220ace31bbc89b1fe0a78fc75c > > Author: Mark Johnston > > AuthorDate: 2021-05-27 19:49:59 +0000 > > Commit: Mark Johnston > > CommitDate: 2021-05-27 19:52:20 +0000 > > > > ktrace: Fix a race with fork() > > > > ktrace(2) may toggle trace points in any of > > 1. a single process > > 2. all members of a process group > > 3. all descendents of the processes in 1 or 2 > > > > In the first two cases, we do not permit the operation if the process is > > being forked or not visible. However, in case 3 we did not enforce this > > restriction for descendents. As a result, the assertions about the child > > in ktrprocfork() may be violated. > > > > Move these checks into ktrops() so that they are applied consistently. > > > > Allow KTROP_CLEAR for nascent processes. Otherwise, there is a window > > where we cannot clear trace points for a nascent child if they are > > inherited from the parent. > > > > Reported by: syzbot+d96676592978f137e05c@syzkaller.appspotmail.com > > Reported by: syzbot+7c98fcf84a4439f2817f@syzkaller.appspotmail.com > > Reviewed by: kib > > MFC after: 1 week > > Sponsored by: The FreeBSD Foundation > > Differential Revision: https://reviews.freebsd.org/D30481 > > --- > > sys/kern/kern_ktrace.c | 43 ++++++++++++++++++++++--------------------- > > 1 file changed, 22 insertions(+), 21 deletions(-) > > > > diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c > > index dc064d9ebd67..4a2dad20b035 100644 > > --- a/sys/kern/kern_ktrace.c > > +++ b/sys/kern/kern_ktrace.c > > @@ -1006,7 +1006,7 @@ sys_ktrace(struct thread *td, struct ktrace_args *uap) > > int facs = uap->facs & ~KTRFAC_ROOT; > > int ops = KTROP(uap->ops); > > int descend = uap->ops & KTRFLAG_DESCEND; > > - int nfound, ret = 0; > > + int ret = 0; > > int flags, error = 0; > > struct nameidata nd; > > struct ktr_io_params *kiop, *old_kiop; > > @@ -1080,42 +1080,31 @@ restart: > > error = ESRCH; > > goto done; > > } > > + > > /* > > * ktrops() may call vrele(). Lock pg_members > > * by the proctree_lock rather than pg_mtx. > > */ > > PGRP_UNLOCK(pg); > > - nfound = 0; > > + if (LIST_EMPTY(&pg->pg_members)) { > > + sx_sunlock(&proctree_lock); > > + error = ESRCH; > > + goto done; > > + } > > LIST_FOREACH(p, &pg->pg_members, p_pglist) { > > PROC_LOCK(p); > > - if (p->p_state == PRS_NEW || > > - p_cansee(td, p) != 0) { > > - PROC_UNLOCK(p); > > - continue; > > - } > > - nfound++; > > if (descend) > > ret |= ktrsetchildren(td, p, ops, facs, kiop); > > else > > ret |= ktrops(td, p, ops, facs, kiop); > > } > > - if (nfound == 0) { > > - sx_sunlock(&proctree_lock); > > - error = ESRCH; > > - goto done; > > - } > > } else { > > /* > > * by pid > > */ > > p = pfind(uap->pid); > > - if (p == NULL) > > + if (p == NULL) { > > error = ESRCH; > > - else > > - error = p_cansee(td, p); > > - if (error) { > > - if (p != NULL) > > - PROC_UNLOCK(p); > > sx_sunlock(&proctree_lock); > > goto done; > > } > > @@ -1187,8 +1176,20 @@ ktrops(struct thread *td, struct proc *p, int ops, int facs, > > PROC_UNLOCK(p); > > return (0); > > } > > - if (p->p_flag & P_WEXIT) { > > - /* If the process is exiting, just ignore it. */ > > + if ((ops == KTROP_SET && p->p_state == PRS_NEW) || !p_cansee(td, p)) { > > ^^^^^^^^^^^^^^ seems that it broke ktrace: > root@mordor:~ # ktrace ls > ktrace: ktrace.out: Operation not permitted Indeed, I pushed a fix to main. Sorry for the breakage. From owner-dev-commits-src-main@freebsd.org Tue Jun 1 14:39:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D12AE6556B0; Tue, 1 Jun 2021 14:39:29 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (heemeyer.club [IPv6:2001:19f0:6400:80a1:5054:ff:fe7a:a27d]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4FvZYY4txyz3Lls; Tue, 1 Jun 2021 14:39:29 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (localhost [127.0.0.1]) by heemeyer.club (8.16.1/8.16.1) with ESMTP id 151EdS5H002100; Tue, 1 Jun 2021 14:39:28 GMT (envelope-from dchagin@heemeyer.club) Received: (from dchagin@localhost) by heemeyer.club (8.16.1/8.16.1/Submit) id 151EdSN9002099; Tue, 1 Jun 2021 14:39:28 GMT (envelope-from dchagin) Date: Tue, 1 Jun 2021 14:39:28 +0000 From: Dmitry Chagin To: Mark Johnston Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: f3851b235b23 - main - ktrace: Fix a race with fork() Message-ID: References: <202105271953.14RJrN36017670@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4FvZYY4txyz3Lls X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 14:39:29 -0000 On Tue, Jun 01, 2021 at 09:20:04AM -0400, Mark Johnston wrote: > On Tue, Jun 01, 2021 at 12:44:30PM +0000, Dmitry Chagin wrote: > > On Thu, May 27, 2021 at 07:53:23PM +0000, Mark Johnston wrote: > > > The branch main has been updated by markj: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=f3851b235b23d9220ace31bbc89b1fe0a78fc75c > > > > > > commit f3851b235b23d9220ace31bbc89b1fe0a78fc75c > > > Author: Mark Johnston > > > AuthorDate: 2021-05-27 19:49:59 +0000 > > > Commit: Mark Johnston > > > CommitDate: 2021-05-27 19:52:20 +0000 > > > > > > ktrace: Fix a race with fork() > > > > > > ktrace(2) may toggle trace points in any of > > > 1. a single process > > > 2. all members of a process group > > > 3. all descendents of the processes in 1 or 2 > > > > > > In the first two cases, we do not permit the operation if the process is > > > being forked or not visible. However, in case 3 we did not enforce this > > > restriction for descendents. As a result, the assertions about the child > > > in ktrprocfork() may be violated. > > > > > > Move these checks into ktrops() so that they are applied consistently. > > > > > > Allow KTROP_CLEAR for nascent processes. Otherwise, there is a window > > > where we cannot clear trace points for a nascent child if they are > > > inherited from the parent. > > > > > > Reported by: syzbot+d96676592978f137e05c@syzkaller.appspotmail.com > > > Reported by: syzbot+7c98fcf84a4439f2817f@syzkaller.appspotmail.com > > > Reviewed by: kib > > > MFC after: 1 week > > > Sponsored by: The FreeBSD Foundation > > > Differential Revision: https://reviews.freebsd.org/D30481 > > > --- > > > sys/kern/kern_ktrace.c | 43 ++++++++++++++++++++++--------------------- > > > 1 file changed, 22 insertions(+), 21 deletions(-) > > > > > > diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c > > > index dc064d9ebd67..4a2dad20b035 100644 > > > --- a/sys/kern/kern_ktrace.c > > > +++ b/sys/kern/kern_ktrace.c > > > @@ -1006,7 +1006,7 @@ sys_ktrace(struct thread *td, struct ktrace_args *uap) > > > int facs = uap->facs & ~KTRFAC_ROOT; > > > int ops = KTROP(uap->ops); > > > int descend = uap->ops & KTRFLAG_DESCEND; > > > - int nfound, ret = 0; > > > + int ret = 0; > > > int flags, error = 0; > > > struct nameidata nd; > > > struct ktr_io_params *kiop, *old_kiop; > > > @@ -1080,42 +1080,31 @@ restart: > > > error = ESRCH; > > > goto done; > > > } > > > + > > > /* > > > * ktrops() may call vrele(). Lock pg_members > > > * by the proctree_lock rather than pg_mtx. > > > */ > > > PGRP_UNLOCK(pg); > > > - nfound = 0; > > > + if (LIST_EMPTY(&pg->pg_members)) { > > > + sx_sunlock(&proctree_lock); > > > + error = ESRCH; > > > + goto done; > > > + } > > > LIST_FOREACH(p, &pg->pg_members, p_pglist) { > > > PROC_LOCK(p); > > > - if (p->p_state == PRS_NEW || > > > - p_cansee(td, p) != 0) { > > > - PROC_UNLOCK(p); > > > - continue; > > > - } > > > - nfound++; > > > if (descend) > > > ret |= ktrsetchildren(td, p, ops, facs, kiop); > > > else > > > ret |= ktrops(td, p, ops, facs, kiop); > > > } > > > - if (nfound == 0) { > > > - sx_sunlock(&proctree_lock); > > > - error = ESRCH; > > > - goto done; > > > - } > > > } else { > > > /* > > > * by pid > > > */ > > > p = pfind(uap->pid); > > > - if (p == NULL) > > > + if (p == NULL) { > > > error = ESRCH; > > > - else > > > - error = p_cansee(td, p); > > > - if (error) { > > > - if (p != NULL) > > > - PROC_UNLOCK(p); > > > sx_sunlock(&proctree_lock); > > > goto done; > > > } > > > @@ -1187,8 +1176,20 @@ ktrops(struct thread *td, struct proc *p, int ops, int facs, > > > PROC_UNLOCK(p); > > > return (0); > > > } > > > - if (p->p_flag & P_WEXIT) { > > > - /* If the process is exiting, just ignore it. */ > > > + if ((ops == KTROP_SET && p->p_state == PRS_NEW) || !p_cansee(td, p)) { > > > > ^^^^^^^^^^^^^^ seems that it broke ktrace: > > root@mordor:~ # ktrace ls > > ktrace: ktrace.out: Operation not permitted > > Indeed, I pushed a fix to main. Sorry for the breakage. works now, thank you! From owner-dev-commits-src-main@freebsd.org Tue Jun 1 15:56:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA83665656B; Tue, 1 Jun 2021 15:56: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 4FvcFy5Pmxz3kKN; Tue, 1 Jun 2021 15:56:06 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A1A75263E3; Tue, 1 Jun 2021 15:56:06 +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 151Fu6ZL084735; Tue, 1 Jun 2021 15:56:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 151Fu6ZE084734; Tue, 1 Jun 2021 15:56:06 GMT (envelope-from git) Date: Tue, 1 Jun 2021 15:56:06 GMT Message-Id: <202106011556.151Fu6ZE084734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: David Bright Subject: git: 2f176a2b2010 - main - pciconf: Fix up pciconf -lc output MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dab X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2f176a2b20107f7a9132242223e9eef657400514 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 15:56:06 -0000 The branch main has been updated by dab: URL: https://cgit.FreeBSD.org/src/commit/?id=2f176a2b20107f7a9132242223e9eef657400514 commit 2f176a2b20107f7a9132242223e9eef657400514 Author: David Bright AuthorDate: 2021-05-24 19:02:43 +0000 Commit: David Bright CommitDate: 2021-06-01 15:55:44 +0000 pciconf: Fix up pciconf -lc output The pciconf command fails to emit newlines when particular ecap field values are seen. Fix them up. This has been seen on several systems at $JOB. The documentation for PCI capabilities says that capability type 0 should not be used once the spec for PCI capabilities was published, but that seems more wishful-thinking than reality. pciconf also chooses not to print fields related to field values that are zero, but it seems several of these fields are zero on actual hardware. Reviewed by: vangyzen, imp, Bret Ketchum (Bret.Ketchum@dell.com) Sponsored by: Dell EMC Isilon Submitted by: Robert Herndon (Robert.Herndon@dell.com) Differential Revision: https://reviews.freebsd.org/D30441 --- usr.sbin/pciconf/cap.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/usr.sbin/pciconf/cap.c b/usr.sbin/pciconf/cap.c index bd7315beb047..eae53acbd250 100644 --- a/usr.sbin/pciconf/cap.c +++ b/usr.sbin/pciconf/cap.c @@ -861,8 +861,10 @@ ecap_aer(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) uint32_t sta, mask; printf("AER %d", ver); - if (ver < 1) + if (ver < 1) { + printf("\n"); return; + } sta = read_config(fd, &p->pc_sel, ptr + PCIR_AER_UC_STATUS, 4); mask = read_config(fd, &p->pc_sel, ptr + PCIR_AER_UC_SEVERITY, 4); printf(" %d fatal", bitcount32(sta & mask)); @@ -877,8 +879,10 @@ ecap_vc(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) uint32_t cap1; printf("VC %d", ver); - if (ver < 1) + if (ver < 1) { + printf("\n"); return; + } cap1 = read_config(fd, &p->pc_sel, ptr + PCIR_VC_CAP1, 4); printf(" max VC%d", cap1 & PCIM_VC_CAP1_EXT_COUNT); if ((cap1 & PCIM_VC_CAP1_LOWPRI_EXT_COUNT) != 0) @@ -893,8 +897,10 @@ ecap_sernum(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) uint32_t high, low; printf("Serial %d", ver); - if (ver < 1) + if (ver < 1) { + printf("\n"); return; + } low = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_LOW, 4); high = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_HIGH, 4); printf(" %08x%08x\n", high, low); @@ -940,8 +946,10 @@ ecap_sec_pcie(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) uint32_t val; printf("PCIe Sec %d", ver); - if (ver < 1) + if (ver < 1) { + printf("\n"); return; + } val = read_config(fd, &p->pc_sel, ptr + 8, 4); printf(" lane errors %#x\n", val); } From owner-dev-commits-src-main@freebsd.org Tue Jun 1 16:05:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E85E656DD0; Tue, 1 Jun 2021 16:05:38 +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 4FvcSy2jVzz3l5s; Tue, 1 Jun 2021 16:05:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4588A26447; Tue, 1 Jun 2021 16:05:38 +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 151G5cG3099278; Tue, 1 Jun 2021 16:05:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 151G5c33099277; Tue, 1 Jun 2021 16:05:38 GMT (envelope-from git) Date: Tue, 1 Jun 2021 16:05:38 GMT Message-Id: <202106011605.151G5c33099277@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ceri Davies Subject: git: 33764e3fd080 - main - libexec/getty/ttys.5: document correct "dialup" flag. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ceri X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 33764e3fd080be9dc482b46403c7d0efb3402b74 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 16:05:38 -0000 The branch main has been updated by ceri (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=33764e3fd080be9dc482b46403c7d0efb3402b74 commit 33764e3fd080be9dc482b46403c7d0efb3402b74 Author: Ceri Davies AuthorDate: 2021-06-01 15:59:15 +0000 Commit: Ceri Davies CommitDate: 2021-06-01 16:05:16 +0000 libexec/getty/ttys.5: document correct "dialup" flag. This manpage has incorrectly documented the "dialup" keyword as "dialin" since it was first added. Correct that. Approved by: blackend (mentor) MFC after: 12 days --- libexec/getty/ttys.5 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libexec/getty/ttys.5 b/libexec/getty/ttys.5 index 887386071f34..3a1d07e326ca 100644 --- a/libexec/getty/ttys.5 +++ b/libexec/getty/ttys.5 @@ -28,7 +28,7 @@ .\" from: @(#)ttys.5 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" " -.Dd July 11, 2020 +.Dd June 1, 2021 .Dt TTYS 5 .Os .Sh NAME @@ -114,7 +114,7 @@ Otherwise, it is considered a path relative to The flag ``secure'' (if the console is enabled) allows users with a uid of 0 to login on this line. -The flag ``dialin'' indicates that a tty entry describes a dialin +The flag ``dialup'' indicates that a tty entry describes a dialin line, and ``network'' is obsolete and does nothing. Either of these strings may also be specified in the terminal type field. From owner-dev-commits-src-main@freebsd.org Tue Jun 1 16:08:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4882065706C; Tue, 1 Jun 2021 16:08:28 +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 4FvcXD19LWz3lGy; Tue, 1 Jun 2021 16:08:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 105B8262D9; Tue, 1 Jun 2021 16:08:28 +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 151G8RtY099581; Tue, 1 Jun 2021 16:08:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 151G8RjK099580; Tue, 1 Jun 2021 16:08:27 GMT (envelope-from git) Date: Tue, 1 Jun 2021 16:08:27 GMT Message-Id: <202106011608.151G8RjK099580@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: David Bright Subject: git: 3df4c387d2e3 - main - libsa: Fix infinite loop in bzipfs & gzipfs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dab X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3df4c387d2e3ca4c2391fb837540b048f60a11c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 16:08:28 -0000 The branch main has been updated by dab: URL: https://cgit.FreeBSD.org/src/commit/?id=3df4c387d2e3ca4c2391fb837540b048f60a11c2 commit 3df4c387d2e3ca4c2391fb837540b048f60a11c2 Author: David Bright AuthorDate: 2021-05-24 17:12:15 +0000 Commit: David Bright CommitDate: 2021-06-01 16:08:20 +0000 libsa: Fix infinite loop in bzipfs & gzipfs A bug in the loader's bzipfs & gzipfs filesystems caused compressed kernel and modules not to work on EFI systems with a veriexec-enabled loader. Since the size of files in these filesystems are not known _a priori_ `stat` would initialize the size to -1 and the loader would then hang in an infinite loop while trying to seek (read) to the end of file since the loop termination condition compares the current offset to that negative target position. Reviewers: vangyzen, imp, Bret Ketchum (Bret.Ketchum@dell.com) Differential Revision: https://reviews.freebsd.org/D30414 Sponsored by: Dell EMC Isilon MFC to: stable/12, stable/13 MFC after: 1 week --- stand/libsa/bzipfs.c | 3 +++ stand/libsa/gzipfs.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/stand/libsa/bzipfs.c b/stand/libsa/bzipfs.c index 47380ae72e5e..bb67bda2aa19 100644 --- a/stand/libsa/bzipfs.c +++ b/stand/libsa/bzipfs.c @@ -340,6 +340,9 @@ bzf_seek(struct open_file *f, off_t offset, int where) target - bzf->bzf_bzstream.total_out_lo32), NULL); if (errno) return(-1); + /* Break out of loop if end of file has been reached. */ + if (bzf->bzf_endseen) + break; } /* This is where we are (be honest if we overshot) */ return(bzf->bzf_bzstream.total_out_lo32); diff --git a/stand/libsa/gzipfs.c b/stand/libsa/gzipfs.c index 39e2f98eb1e0..8154b0f95a9a 100644 --- a/stand/libsa/gzipfs.c +++ b/stand/libsa/gzipfs.c @@ -315,6 +315,9 @@ zf_seek(struct open_file *f, off_t offset, int where) target - zf->zf_zstream.total_out), NULL); if (errno) return(-1); + /* Break out of loop if end of file has been reached. */ + if (zf->zf_endseen) + break; } /* This is where we are (be honest if we overshot) */ return(zf->zf_zstream.total_out); From owner-dev-commits-src-main@freebsd.org Tue Jun 1 17:44:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E4D765961D; Tue, 1 Jun 2021 17:44:56 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FvfgX3g10z3vCp; Tue, 1 Jun 2021 17:44:56 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id B12262BE23; Tue, 1 Jun 2021 17:44:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 2f176a2b2010 - main - pciconf: Fix up pciconf -lc output To: David Bright , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202106011556.151Fu6ZE084734@gitrepo.freebsd.org> From: John Baldwin Message-ID: <93b7adea-1980-b097-cdf1-d3426dd0d531@FreeBSD.org> Date: Tue, 1 Jun 2021 10:44:51 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <202106011556.151Fu6ZE084734@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 17:44:56 -0000 On 6/1/21 8:56 AM, David Bright wrote: > The branch main has been updated by dab: > > URL: https://cgit.FreeBSD.org/src/commit/?id=2f176a2b20107f7a9132242223e9eef657400514 > > commit 2f176a2b20107f7a9132242223e9eef657400514 > Author: David Bright > AuthorDate: 2021-05-24 19:02:43 +0000 > Commit: David Bright > CommitDate: 2021-06-01 15:55:44 +0000 > > pciconf: Fix up pciconf -lc output > > The pciconf command fails to emit newlines when particular ecap field > values are seen. Fix them up. This has been seen on several systems at > $JOB. The documentation for PCI capabilities says that capability > type 0 should not be used once the spec for PCI capabilities was > published, but that seems more wishful-thinking than reality. pciconf > also chooses not to print fields related to field values that are > zero, but it seems several of these fields are zero on actual > hardware. > > Reviewed by: vangyzen, imp, Bret Ketchum (Bret.Ketchum@dell.com) > Sponsored by: Dell EMC Isilon > Submitted by: Robert Herndon (Robert.Herndon@dell.com) > Differential Revision: https://reviews.freebsd.org/D30441 Are the ecap registers actually valid for version 1 in this case? That is, should we treat version 0 as being version 1? The current checks are just defensive coding for not parsing something unless we know it is valid. If the only version 0 caps in practice are always compatible with version 1 we could just treat 0 as if it were 1. -- John Baldwin From owner-dev-commits-src-main@freebsd.org Tue Jun 1 20:41:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F23465D630; Tue, 1 Jun 2021 20:41:47 +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 4Fvkbb42L3z4jRL; Tue, 1 Jun 2021 20:41:47 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7260F229C; Tue, 1 Jun 2021 20:41:47 +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 151Kflui067198; Tue, 1 Jun 2021 20:41:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 151Kfl1k067197; Tue, 1 Jun 2021 20:41:47 GMT (envelope-from git) Date: Tue, 1 Jun 2021 20:41:47 GMT Message-Id: <202106012041.151Kfl1k067197@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 0f86492b09ca - main - pf: Fix more ioctl memory leaks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0f86492b09ca82042166a41f6f21b2dbe4f4a464 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 20:41:47 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0f86492b09ca82042166a41f6f21b2dbe4f4a464 commit 0f86492b09ca82042166a41f6f21b2dbe4f4a464 Author: Kristof Provost AuthorDate: 2021-06-01 14:05:47 +0000 Commit: Kristof Provost CommitDate: 2021-06-01 20:41:20 +0000 pf: Fix more ioctl memory leaks We must also remember to free nvlists added to a parent nvlist with nvlist_append_nvlist_array(). More importantly, when nvlist_pack() allocates memory for us it does so in the M_NVLIST zone, so we must free it with free(.., M_NVLIST). Using free(.., M_TEMP) as we did silently failed to free the memory. MFC after: 3 days Reported by: kib@ Tested by: kib@ Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30595 --- sys/netpfil/pf/pf_ioctl.c | 27 ++++++++++++++------------- sys/netpfil/pf/pf_nv.c | 1 + 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 42c22ef9b894..766710afd1dd 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2426,7 +2426,7 @@ DIOCADDRULENV_error: ERROUT(ENOMEM); /* Copy the request in */ - nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + nvlpacked = malloc(nv->len, M_NVLIST, M_WAITOK); if (nvlpacked == NULL) ERROUT(ENOMEM); @@ -2504,7 +2504,7 @@ DIOCADDRULENV_error: ERROUT(EBUSY); } - free(nvlpacked, M_TEMP); + free(nvlpacked, M_NVLIST); nvlpacked = nvlist_pack(nvl, &nv->len); if (nvlpacked == NULL) { PF_RULES_WUNLOCK(); @@ -2534,7 +2534,7 @@ DIOCADDRULENV_error: #undef ERROUT DIOCGETRULENV_error: - free(nvlpacked, M_TEMP); + free(nvlpacked, M_NVLIST); nvlist_destroy(nvrule); nvlist_destroy(nvl); @@ -4918,7 +4918,7 @@ pf_killstates_nv(struct pfioc_nv *nv) if (nv->len > pf_ioctl_maxcount) ERROUT(ENOMEM); - nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + nvlpacked = malloc(nv->len, M_NVLIST, M_WAITOK); if (nvlpacked == NULL) ERROUT(ENOMEM); @@ -4936,7 +4936,7 @@ pf_killstates_nv(struct pfioc_nv *nv) error = pf_killstates(&kill, &killed); - free(nvlpacked, M_TEMP); + free(nvlpacked, M_NVLIST); nvlpacked = NULL; nvlist_destroy(nvl); nvl = nvlist_create(0); @@ -4958,7 +4958,7 @@ pf_killstates_nv(struct pfioc_nv *nv) on_error: nvlist_destroy(nvl); - free(nvlpacked, M_TEMP); + free(nvlpacked, M_NVLIST); return (error); } @@ -4976,7 +4976,7 @@ pf_clearstates_nv(struct pfioc_nv *nv) if (nv->len > pf_ioctl_maxcount) ERROUT(ENOMEM); - nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + nvlpacked = malloc(nv->len, M_NVLIST, M_WAITOK); if (nvlpacked == NULL) ERROUT(ENOMEM); @@ -4994,7 +4994,7 @@ pf_clearstates_nv(struct pfioc_nv *nv) killed = pf_clear_states(&kill); - free(nvlpacked, M_TEMP); + free(nvlpacked, M_NVLIST); nvlpacked = NULL; nvlist_destroy(nvl); nvl = nvlist_create(0); @@ -5017,7 +5017,7 @@ pf_clearstates_nv(struct pfioc_nv *nv) #undef ERROUT on_error: nvlist_destroy(nvl); - free(nvlpacked, M_TEMP); + free(nvlpacked, M_NVLIST); return (error); } @@ -5035,7 +5035,7 @@ pf_getstate(struct pfioc_nv *nv) if (nv->len > pf_ioctl_maxcount) ERROUT(ENOMEM); - nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + nvlpacked = malloc(nv->len, M_NVLIST, M_WAITOK); if (nvlpacked == NULL) ERROUT(ENOMEM); @@ -5054,7 +5054,7 @@ pf_getstate(struct pfioc_nv *nv) if (s == NULL) ERROUT(ENOENT); - free(nvlpacked, M_TEMP); + free(nvlpacked, M_NVLIST); nvlpacked = NULL; nvlist_destroy(nvl); nvl = nvlist_create(0); @@ -5083,7 +5083,7 @@ pf_getstate(struct pfioc_nv *nv) errout: if (s != NULL) PF_STATE_UNLOCK(s); - free(nvlpacked, M_TEMP); + free(nvlpacked, M_NVLIST); nvlist_destroy(nvl); return (error); } @@ -5125,6 +5125,7 @@ pf_getstates(struct pfioc_nv *nv) goto DIOCGETSTATESNV_full; } nvlist_append_nvlist_array(nvl, "states", nvls); + nvlist_destroy(nvls); count++; } PF_HASHROW_UNLOCK(ih); @@ -5151,7 +5152,7 @@ DIOCGETSTATESNV_full: #undef ERROUT errout: - free(nvlpacked, M_TEMP); + free(nvlpacked, M_NVLIST); nvlist_destroy(nvl); return (error); } diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index ae9f7d99b26a..31943ba69687 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -861,6 +861,7 @@ pf_state_key_to_nvstate_key(const struct pf_state_key *key) if (tmp == NULL) goto errout; nvlist_append_nvlist_array(nvl, "addr", tmp); + nvlist_destroy(tmp); nvlist_append_number_array(nvl, "port", key->port[i]); } nvlist_add_number(nvl, "af", key->af); From owner-dev-commits-src-main@freebsd.org Tue Jun 1 21:01:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E2F0865E7DD; Tue, 1 Jun 2021 21:01:52 +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 4Fvl2m5vyKz4kwn; Tue, 1 Jun 2021 21:01:52 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B407F227D; Tue, 1 Jun 2021 21:01: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 151L1qRk094607; Tue, 1 Jun 2021 21:01:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 151L1qKF094606; Tue, 1 Jun 2021 21:01:52 GMT (envelope-from git) Date: Tue, 1 Jun 2021 21:01:52 GMT Message-Id: <202106012101.151L1qKF094606@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Pedro F. Giffuni" Subject: git: a45843c8ed7f - main - fread: improve performance for unbuffered reads MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pfg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a45843c8ed7fcc10c1f10d4346cc7b3c293c894b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 21:01:53 -0000 The branch main has been updated by pfg: URL: https://cgit.FreeBSD.org/src/commit/?id=a45843c8ed7fcc10c1f10d4346cc7b3c293c894b commit a45843c8ed7fcc10c1f10d4346cc7b3c293c894b Author: Pedro F. Giffuni AuthorDate: 2021-05-31 01:48:38 +0000 Commit: Pedro F. Giffuni CommitDate: 2021-06-01 21:00:28 +0000 fread: improve performance for unbuffered reads We can use the buffer passed to fread(3) directly in the FILE *. The buffer needs to be reset before each call to __srefill(). This preserves the expected behavior in all cases. The change was found originally in OpenBSD and later adopted by NetBSD. MFC after: 2 weeks Obtained from: OpenBSD (CVS 1.18) Differential Revision: https://reviews.freebsd.org/D30548 --- lib/libc/stdio/fread.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lib/libc/stdio/fread.c b/lib/libc/stdio/fread.c index c12bcf1148b7..11f8d13f0caf 100644 --- a/lib/libc/stdio/fread.c +++ b/lib/libc/stdio/fread.c @@ -99,6 +99,35 @@ __fread(void * __restrict buf, size_t size, size_t count, FILE * __restrict fp) fp->_r = 0; total = resid; p = buf; + + /* + * If we're unbuffered we know that the buffer in fp is empty so + * we can read directly into buf. This is much faster than a + * series of one byte reads into fp->_nbuf. + */ + if ((fp->_flags & __SNBF) != 0 && buf != NULL) { + while (resid > 0) { + /* set up the buffer */ + fp->_bf._base = fp->_p = p; + fp->_bf._size = resid; + + if (__srefill(fp)) { + /* no more input: return partial result */ + count = (total - resid) / size; + break; + } + p += fp->_r; + resid -= fp->_r; + } + + /* restore the old buffer (see __smakebuf) */ + fp->_bf._base = fp->_p = fp->_nbuf; + fp->_bf._size = 1; + fp->_r = 0; + + return (count); + } + while (resid > (r = fp->_r)) { (void)memcpy((void *)p, (void *)fp->_p, (size_t)r); fp->_p += r; From owner-dev-commits-src-main@freebsd.org Tue Jun 1 22:36:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C06A56325A2; Tue, 1 Jun 2021 22:36:12 +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 4Fvn7c4qw1z4yKh; Tue, 1 Jun 2021 22:36:12 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7DDF63BD9; Tue, 1 Jun 2021 22:36:12 +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 151MaCXZ016449; Tue, 1 Jun 2021 22:36:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 151MaCFM016448; Tue, 1 Jun 2021 22:36:12 GMT (envelope-from git) Date: Tue, 1 Jun 2021 22:36:12 GMT Message-Id: <202106012236.151MaCFM016448@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 211972cfb816 - main - cxgbe/iw_cxgbe: Support for 512 SGL entries in one memory registration. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 211972cfb816f8da8b8a4c524b44dde4638c3288 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 22:36:12 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=211972cfb816f8da8b8a4c524b44dde4638c3288 commit 211972cfb816f8da8b8a4c524b44dde4638c3288 Author: Navdeep Parhar AuthorDate: 2021-06-01 19:57:53 +0000 Commit: Navdeep Parhar CommitDate: 2021-06-01 21:38:31 +0000 cxgbe/iw_cxgbe: Support for 512 SGL entries in one memory registration. Use the correct SGL limit within iw_cxgbe, firmwares >= 1.25.6.0 support upto 512 entries per MR. Obtained from: Chelsio Communications MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h | 8 ++++++++ sys/dev/cxgbe/iw_cxgbe/mem.c | 3 +-- sys/dev/cxgbe/iw_cxgbe/provider.c | 3 +-- sys/dev/cxgbe/iw_cxgbe/qp.c | 2 +- sys/dev/cxgbe/iw_cxgbe/t4.h | 7 ++----- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h index 689eb0644893..3664895200c1 100644 --- a/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h +++ b/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h @@ -178,6 +178,14 @@ static inline int c4iw_num_stags(struct c4iw_rdev *rdev) return (int)(rdev->adap->vres.stag.size >> 5); } +static inline int t4_max_fr_depth(struct c4iw_rdev *rdev, bool use_dsgl) +{ + if (rdev->adap->params.ulptx_memwrite_dsgl && use_dsgl) + return rdev->adap->params.dev_512sgl_mr ? T4_MAX_FR_FW_DSGL_DEPTH : T4_MAX_FR_DSGL_DEPTH; + else + return T4_MAX_FR_IMMD_DEPTH; +} + #define C4IW_WR_TO (60*HZ) struct c4iw_wr_wait { diff --git a/sys/dev/cxgbe/iw_cxgbe/mem.c b/sys/dev/cxgbe/iw_cxgbe/mem.c index 3f016c0cc0c1..dab812d58eec 100644 --- a/sys/dev/cxgbe/iw_cxgbe/mem.c +++ b/sys/dev/cxgbe/iw_cxgbe/mem.c @@ -624,8 +624,7 @@ struct ib_mr *c4iw_alloc_mr(struct ib_pd *pd, rhp = php->rhp; if (mr_type != IB_MR_TYPE_MEM_REG || - max_num_sg > t4_max_fr_depth( - rhp->rdev.adap->params.ulptx_memwrite_dsgl && use_dsgl)) + max_num_sg > t4_max_fr_depth(&rhp->rdev, use_dsgl)) return ERR_PTR(-EINVAL); mhp = kzalloc(sizeof(*mhp), GFP_KERNEL); diff --git a/sys/dev/cxgbe/iw_cxgbe/provider.c b/sys/dev/cxgbe/iw_cxgbe/provider.c index 53106073d101..02a32fa4c1fc 100644 --- a/sys/dev/cxgbe/iw_cxgbe/provider.c +++ b/sys/dev/cxgbe/iw_cxgbe/provider.c @@ -348,8 +348,7 @@ c4iw_query_device(struct ib_device *ibdev, struct ib_device_attr *props, props->max_mr = c4iw_num_stags(&dev->rdev); props->max_pd = T4_MAX_NUM_PD; props->local_ca_ack_delay = 0; - props->max_fast_reg_page_list_len = - t4_max_fr_depth(sc->params.ulptx_memwrite_dsgl && use_dsgl); + props->max_fast_reg_page_list_len = t4_max_fr_depth(&dev->rdev, use_dsgl); return (0); } diff --git a/sys/dev/cxgbe/iw_cxgbe/qp.c b/sys/dev/cxgbe/iw_cxgbe/qp.c index f999254a748c..8a7f7b9ba88b 100644 --- a/sys/dev/cxgbe/iw_cxgbe/qp.c +++ b/sys/dev/cxgbe/iw_cxgbe/qp.c @@ -714,7 +714,7 @@ static int build_memreg(struct t4_sq *sq, union t4_wr *wqe, int pbllen = roundup(mhp->mpl_len * sizeof(u64), 32); int rem; - if (mhp->mpl_len > t4_max_fr_depth(use_dsgl && dsgl_supported)) + if (mhp->mpl_len > t4_max_fr_depth(&mhp->rhp->rdev, use_dsgl)) return -EINVAL; if (wr->mr->page_size > C4IW_MAX_PAGE_SIZE) return -EINVAL; diff --git a/sys/dev/cxgbe/iw_cxgbe/t4.h b/sys/dev/cxgbe/iw_cxgbe/t4.h index 70385b4ff6b6..88e7d6418615 100644 --- a/sys/dev/cxgbe/iw_cxgbe/t4.h +++ b/sys/dev/cxgbe/iw_cxgbe/t4.h @@ -103,11 +103,8 @@ struct t4_status_page { #define T4_MAX_FR_IMMD_DEPTH (T4_MAX_FR_IMMD / sizeof(u64)) #define T4_MAX_FR_DSGL 1024 #define T4_MAX_FR_DSGL_DEPTH (T4_MAX_FR_DSGL / sizeof(u64)) - -static inline int t4_max_fr_depth(int use_dsgl) -{ - return use_dsgl ? T4_MAX_FR_DSGL_DEPTH : T4_MAX_FR_IMMD_DEPTH; -} +#define T4_MAX_FR_FW_DSGL 4096 +#define T4_MAX_FR_FW_DSGL_DEPTH (T4_MAX_FR_FW_DSGL / sizeof(u64)) #define T4_RQ_NUM_SLOTS 2 #define T4_RQ_NUM_BYTES (T4_EQ_ENTRY_SIZE * T4_RQ_NUM_SLOTS) From owner-dev-commits-src-main@freebsd.org Tue Jun 1 22:36:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8464663247F; Tue, 1 Jun 2021 22:36:11 +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 4Fvn7b368Wz4yKf; Tue, 1 Jun 2021 22:36:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 52D273BD8; Tue, 1 Jun 2021 22:36:11 +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 151MaBmj016428; Tue, 1 Jun 2021 22:36:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 151MaBNL016427; Tue, 1 Jun 2021 22:36:11 GMT (envelope-from git) Date: Tue, 1 Jun 2021 22:36:11 GMT Message-Id: <202106012236.151MaBNL016427@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: db15dbf88011 - main - cxgbe(4): Check if the firmware supports 512 SGL per FR MR. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: db15dbf8801120241b7bfb6461341f2cb421ef8e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 22:36:11 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=db15dbf8801120241b7bfb6461341f2cb421ef8e commit db15dbf8801120241b7bfb6461341f2cb421ef8e Author: Navdeep Parhar AuthorDate: 2021-06-01 19:14:17 +0000 Commit: Navdeep Parhar CommitDate: 2021-06-01 21:38:31 +0000 cxgbe(4): Check if the firmware supports 512 SGL per FR MR. Firmwares >= 1.25.6.0 support 512 SGL entries in a single memory registration request. Obtained from: Chelsio Communications MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/common/common.h | 1 + sys/dev/cxgbe/t4_main.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h index 6264a7d6ec07..b803a7106a0c 100644 --- a/sys/dev/cxgbe/common/common.h +++ b/sys/dev/cxgbe/common/common.h @@ -405,6 +405,7 @@ struct adapter_params { bool ulptx_memwrite_dsgl; /* use of T5 DSGL allowed */ bool fr_nsmr_tpte_wr_support; /* FW support for FR_NSMR_TPTE_WR */ + bool dev_512sgl_mr; /* FW support for 512 SGL per FR MR */ bool viid_smt_extn_support; /* FW returns vin, vfvld & smt index? */ unsigned int max_pkts_per_eth_tx_pkts_wr; }; diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 51fc6504e5c2..650300c805a1 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -5222,6 +5222,14 @@ get_params__post_init(struct adapter *sc) else sc->params.fr_nsmr_tpte_wr_support = false; + /* Support for 512 SGL entries per FR MR. */ + param[0] = FW_PARAM_DEV(DEV_512SGL_MR); + rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, param, val); + if (rc == 0) + sc->params.dev_512sgl_mr = val[0] != 0; + else + sc->params.dev_512sgl_mr = false; + param[0] = FW_PARAM_PFVF(MAX_PKTS_PER_ETH_TX_PKTS_WR); rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, param, val); if (rc == 0) From owner-dev-commits-src-main@freebsd.org Tue Jun 1 23:51:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C18C7634C38; Tue, 1 Jun 2021 23:51: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 4Fvpp24zpbz543v; Tue, 1 Jun 2021 23:51:06 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9380F4D90; Tue, 1 Jun 2021 23:51:06 +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 151Np6mO020526; Tue, 1 Jun 2021 23:51:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 151Np6Db020525; Tue, 1 Jun 2021 23:51:06 GMT (envelope-from git) Date: Tue, 1 Jun 2021 23:51:06 GMT Message-Id: <202106012351.151Np6Db020525@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: cbe59a6475b6 - main - i386: Make setidt_disp a size_t instead of uintptr_t MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cbe59a6475b6c36fac4073bcfc328099fc873420 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 23:51:06 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=cbe59a6475b6c36fac4073bcfc328099fc873420 commit cbe59a6475b6c36fac4073bcfc328099fc873420 Author: Mark Johnston AuthorDate: 2021-06-01 14:28:57 +0000 Commit: Mark Johnston CommitDate: 2021-06-01 23:37:50 +0000 i386: Make setidt_disp a size_t instead of uintptr_t setidt_disp is the offset of the ISR trampoline relative to the address of the routines in exception.s, so uintptr_t is not quite right. Also remove a bogus declaration I added in commit 18f55c67f7, it is not required after all. Reported by: jrtc27 Reviewed by: jrtc27, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30590 --- sys/i386/i386/machdep.c | 2 +- sys/i386/include/md_var.h | 2 +- sys/x86/x86/local_apic.c | 4 ---- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index ce4a264ede01..869ee9958d25 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -1507,7 +1507,7 @@ static struct soft_segment_descriptor ldt_segs[] = { .ssd_gran = 1 }, }; -uintptr_t setidt_disp; +size_t setidt_disp; void setidt(int idx, inthand_t *func, int typ, int dpl, int selec) diff --git a/sys/i386/include/md_var.h b/sys/i386/include/md_var.h index c41de85b9bc9..95f4907a61d0 100644 --- a/sys/i386/include/md_var.h +++ b/sys/i386/include/md_var.h @@ -48,7 +48,7 @@ extern int szosigcode; extern int sz_lcall_tramp; #endif extern vm_offset_t proc0kstack; -extern uintptr_t setidt_disp; +extern size_t setidt_disp; struct segment_descriptor; union savefpu; diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index bb575d0c601d..9708121e0829 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -2127,10 +2127,6 @@ native_lapic_ipi_vectored(u_int vector, int dest) #endif /* SMP */ -#ifdef __i386__ -extern uintptr_t setidt_disp; -#endif - /* * Since the IDT is shared by all CPUs the IPI slot update needs to be globally * visible. From owner-dev-commits-src-main@freebsd.org Tue Jun 1 23:51:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB96A634B06; Tue, 1 Jun 2021 23:51:07 +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 4Fvpp35p7Nz542C; Tue, 1 Jun 2021 23:51:07 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AFC3E4D92; Tue, 1 Jun 2021 23:51:07 +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 151Np7mY020553; Tue, 1 Jun 2021 23:51:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 151Np7WV020552; Tue, 1 Jun 2021 23:51:07 GMT (envelope-from git) Date: Tue, 1 Jun 2021 23:51:07 GMT Message-Id: <202106012351.151Np7WV020552@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 60a38abb8982 - main - pf: Avoid leaking pad bytes in struct pfr_astats when copying out MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 60a38abb8982e11ee71559057dd7128bd097043e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 23:51:08 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=60a38abb8982e11ee71559057dd7128bd097043e commit 60a38abb8982e11ee71559057dd7128bd097043e Author: Mark Johnston AuthorDate: 2021-06-01 14:56:23 +0000 Commit: Mark Johnston CommitDate: 2021-06-01 23:37:50 +0000 pf: Avoid leaking pad bytes in struct pfr_astats when copying out There is padding between pfr_astats.pfras_a and pfras_packets that was not getting initialized. Reported by: KMSAN Reviewed by: kp, imp MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30585 --- sys/netpfil/pf/pf_table.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/netpfil/pf/pf_table.c b/sys/netpfil/pf/pf_table.c index af2f614c9e8c..f643790ff620 100644 --- a/sys/netpfil/pf/pf_table.c +++ b/sys/netpfil/pf/pf_table.c @@ -1028,6 +1028,7 @@ pfr_copyout_astats(struct pfr_astats *as, const struct pfr_kentry *ke, int dir, op; const struct pfr_kcounters *kc = &ke->pfrke_counters; + bzero(as, sizeof(*as)); pfr_copyout_addr(&as->pfras_a, ke); as->pfras_tzero = kc->pfrkc_tzero; From owner-dev-commits-src-main@freebsd.org Tue Jun 1 23:51:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38B3C634C53; Tue, 1 Jun 2021 23:51:09 +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 4Fvpp50BjGz548C; Tue, 1 Jun 2021 23:51:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D2DD54BD4; Tue, 1 Jun 2021 23:51:08 +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 151Np8OS020575; Tue, 1 Jun 2021 23:51:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 151Np83P020574; Tue, 1 Jun 2021 23:51:08 GMT (envelope-from git) Date: Tue, 1 Jun 2021 23:51:08 GMT Message-Id: <202106012351.151Np83P020574@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 6cda62755612 - main - amd64: Relax the assertion added in commit 4a59cbc12 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6cda62755612d706f30a99f70ff13ffa0f3f2422 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 23:51:09 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6cda62755612d706f30a99f70ff13ffa0f3f2422 commit 6cda62755612d706f30a99f70ff13ffa0f3f2422 Author: Mark Johnston AuthorDate: 2021-06-01 23:38:09 +0000 Commit: Mark Johnston CommitDate: 2021-06-01 23:38:09 +0000 amd64: Relax the assertion added in commit 4a59cbc12 We only need to ensure that interrupts are disabled when handling a fault from iret. Otherwise it's possible to trigger the assertion legitimately, e.g., by copying in from an invalid address. Fixes: 4a59cbc12 Reported by: pho Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30594 --- sys/amd64/amd64/trap.c | 70 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 25 deletions(-) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index cc0b8fcf6c17..e67e188bb4fd 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -172,6 +172,39 @@ SYSCTL_INT(_machdep, OID_AUTO, nmi_flush_l1d_sw, CTLFLAG_RWTUN, &nmi_flush_l1d_sw, 0, "Flush L1 Data Cache on NMI exit, software bhyve L1TF mitigation assist"); +/* + * Table of handlers for various segment load faults. + */ +static const struct { + uintptr_t faddr; + uintptr_t fhandler; +} sfhandlers[] = { + { + .faddr = (uintptr_t)ld_ds, + .fhandler = (uintptr_t)ds_load_fault, + }, + { + .faddr = (uintptr_t)ld_es, + .fhandler = (uintptr_t)es_load_fault, + }, + { + .faddr = (uintptr_t)ld_fs, + .fhandler = (uintptr_t)fs_load_fault, + }, + { + .faddr = (uintptr_t)ld_gs, + .fhandler = (uintptr_t)gs_load_fault, + }, + { + .faddr = (uintptr_t)ld_gsbase, + .fhandler = (uintptr_t)gsbase_load_fault + }, + { + .faddr = (uintptr_t)ld_fsbase, + .fhandler = (uintptr_t)fsbase_load_fault, + }, +}; + /* * Exception, fault, and trap interface to the FreeBSD kernel. * This common code is called from assembly language IDT gate entry @@ -186,6 +219,7 @@ trap(struct trapframe *frame) struct thread *td; struct proc *p; register_t addr, dr6; + size_t i; int pf, signo, ucode; u_int type; @@ -450,9 +484,9 @@ trap(struct trapframe *frame) * Magic '5' is the number of qwords occupied by * the hardware trap frame. */ - KASSERT((read_rflags() & PSL_I) == 0, - ("interrupts enabled")); if (frame->tf_rip == (long)doreti_iret) { + KASSERT((read_rflags() & PSL_I) == 0, + ("interrupts enabled")); frame->tf_rip = (long)doreti_iret_fault; if ((PCPU_GET(curpmap)->pm_ucr3 != PMAP_NO_CR3) && @@ -463,30 +497,16 @@ trap(struct trapframe *frame) } return; } - if (frame->tf_rip == (long)ld_ds) { - frame->tf_rip = (long)ds_load_fault; - return; - } - if (frame->tf_rip == (long)ld_es) { - frame->tf_rip = (long)es_load_fault; - return; - } - if (frame->tf_rip == (long)ld_fs) { - frame->tf_rip = (long)fs_load_fault; - return; - } - if (frame->tf_rip == (long)ld_gs) { - frame->tf_rip = (long)gs_load_fault; - return; - } - if (frame->tf_rip == (long)ld_gsbase) { - frame->tf_rip = (long)gsbase_load_fault; - return; - } - if (frame->tf_rip == (long)ld_fsbase) { - frame->tf_rip = (long)fsbase_load_fault; - return; + + for (i = 0; i < nitems(sfhandlers); i++) { + if (frame->tf_rip == sfhandlers[i].faddr) { + KASSERT((read_rflags() & PSL_I) == 0, + ("interrupts enabled")); + frame->tf_rip = sfhandlers[i].fhandler; + return; + } } + if (curpcb->pcb_onfault != NULL) { frame->tf_rip = (long)curpcb->pcb_onfault; return; From owner-dev-commits-src-main@freebsd.org Tue Jun 1 23:51:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0226634760; Tue, 1 Jun 2021 23:51:10 +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 4Fvpp63QXFz53sR; Tue, 1 Jun 2021 23:51:10 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 048FE4E25; Tue, 1 Jun 2021 23:51:10 +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 151Np9nd020596; Tue, 1 Jun 2021 23:51:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 151Np927020595; Tue, 1 Jun 2021 23:51:09 GMT (envelope-from git) Date: Tue, 1 Jun 2021 23:51:09 GMT Message-Id: <202106012351.151Np927020595@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 8cd05b883330 - main - amd64: Clear the local TSS when creating a new thread MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8cd05b883330049d536a40e2f4c9ff92d0e6944e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Jun 2021 23:51:11 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=8cd05b883330049d536a40e2f4c9ff92d0e6944e commit 8cd05b883330049d536a40e2f4c9ff92d0e6944e Author: Mark Johnston AuthorDate: 2021-06-01 23:38:22 +0000 Commit: Mark Johnston CommitDate: 2021-06-01 23:38:22 +0000 amd64: Clear the local TSS when creating a new thread Otherwise it is copied from the creating thread. Then, if either thread exits, the other is left with a dangling pointer, typically resulting in a page fault upon the next context switch. Reported by: syzkaller Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30607 --- sys/amd64/amd64/vm_machdep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 1acc5dc55c85..7d65269410e0 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -189,6 +189,8 @@ copy_thread(struct thread *td1, struct thread *td2) * pcb2->pcb_[fg]sbase: cloned above */ + pcb2->pcb_tssp = NULL; + /* Setup to release spin count in fork_exit(). */ td2->td_md.md_spinlock_count = 1; td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; From owner-dev-commits-src-main@freebsd.org Wed Jun 2 03:59:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E3ACC639268; Wed, 2 Jun 2021 03:59:36 +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 4FvwJm5p6sz3R5r; Wed, 2 Jun 2021 03:59:36 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AFF5A7CDB; Wed, 2 Jun 2021 03:59:36 +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 1523xav6040951; Wed, 2 Jun 2021 03:59:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1523xa7L040950; Wed, 2 Jun 2021 03:59:36 GMT (envelope-from git) Date: Wed, 2 Jun 2021 03:59:36 GMT Message-Id: <202106020359.1523xa7L040950@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: e58a65ccdac3 - main - man: document ether_gen_addr(9) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e58a65ccdac352712e19a60fffa57a86afabbde9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 03:59:37 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e58a65ccdac352712e19a60fffa57a86afabbde9 commit e58a65ccdac352712e19a60fffa57a86afabbde9 Author: Kyle Evans AuthorDate: 2021-04-16 01:08:27 +0000 Commit: Kyle Evans CommitDate: 2021-06-02 03:59:10 +0000 man: document ether_gen_addr(9) This KPI is used to assign a MAC address to an interface that doesn't already have one assigned. Reviewed by: bcr, gnn, imp, kbowling, kp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29787 --- share/man/man9/Makefile | 1 + share/man/man9/ether_gen_addr.9 | 79 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 7077a286e97c..e4b4a8b5c6b1 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -136,6 +136,7 @@ MAN= accept_filter.9 \ DRIVER_MODULE.9 \ efirt.9 \ epoch.9 \ + ether_gen_addr.9 \ EVENTHANDLER.9 \ eventtimers.9 \ extattr.9 \ diff --git a/share/man/man9/ether_gen_addr.9 b/share/man/man9/ether_gen_addr.9 new file mode 100644 index 000000000000..1b98a841736d --- /dev/null +++ b/share/man/man9/ether_gen_addr.9 @@ -0,0 +1,79 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (C) 2021 Kyle Evans +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice(s), this list of conditions and the following disclaimer as +.\" the first lines of this file unmodified other than the possible +.\" addition of one or more copyright notices. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice(s), this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY +.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +.\" DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd June 1, 2021 +.Dt ETHER_GEN_ADDR 9 +.Os +.Sh NAME +.Nm ether_gen_addr +.Nd "generate an arbitrary MAC address for use" +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In net/if.h +.In net/if_var.h +.In net/ethernet.h +.Ft void +.Fn ether_gen_addr "struct ifnet *ifp" "struct ether_addr *hwaddr" +.Sh DESCRIPTION +The +.Fn ether_gen_addr +function generates an arbitrary MAC address for use by an ethernet interface +that does not have an assigned address. +.Pp +By default, +.Nm +attempts to generate a stable MAC address using the hostid of the jail that +the +.Ar ifp +is being added to. +During early boot, the hostid may not be set on machines that haven't yet +populated +.Pa /etc/hostid , +or on machines that do not use +.Xr loader 8 . +.Pp +.Nm +can fail to derive a MAC address due to memory allocation failure. +In this case, a locally-administered unicast MAC address will be randomly +generated and returned via the +.Ar hwaddr +parameter. +.Pp +If +.Nm +succeeds, then it will return a MAC address in the FreeBSD Foundation OUI, +.Dq 58:9c:fc , +via the +.Ar hwaddr +parameter. +.Sh AUTHORS +This manual page was written by +.An Kyle Evans Aq Mt kevans@FreeBSD.org . From owner-dev-commits-src-main@freebsd.org Wed Jun 2 03:59:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30A2F639269; Wed, 2 Jun 2021 03:59:38 +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 4FvwJp0PhKz3h1M; Wed, 2 Jun 2021 03:59:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D7D157F2A; Wed, 2 Jun 2021 03:59:37 +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 1523xbBp040972; Wed, 2 Jun 2021 03:59:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1523xbk3040971; Wed, 2 Jun 2021 03:59:37 GMT (envelope-from git) Date: Wed, 2 Jun 2021 03:59:37 GMT Message-Id: <202106020359.1523xbk3040971@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 2d741f33bd07 - main - kern: ether_gen_addr: randomize on default hostuuid, too MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2d741f33bd07bf94a59635db3c7b9e070a8a6e55 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 03:59:38 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=2d741f33bd07bf94a59635db3c7b9e070a8a6e55 commit 2d741f33bd07bf94a59635db3c7b9e070a8a6e55 Author: Kyle Evans AuthorDate: 2021-04-16 01:11:35 +0000 Commit: Kyle Evans CommitDate: 2021-06-02 03:59:21 +0000 kern: ether_gen_addr: randomize on default hostuuid, too Currently, this will still hash the default (all zero) hostuuid and potentially arrive at a MAC address that has a high chance of collision if another interface of the same name appears in the same broadcast domain on another host without a hostuuid, e.g., some virtual machine setups. Instead of using the default hostuuid, just treat it as a failure and generate a random LA unicast MAC address. Reviewed by: bz, gbe, imp, kbowling, kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29788 --- share/man/man9/ether_gen_addr.9 | 5 +++-- sys/kern/kern_jail.c | 1 - sys/net/if_ethersubr.c | 17 ++++++++++++++--- sys/sys/jail.h | 1 + 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/share/man/man9/ether_gen_addr.9 b/share/man/man9/ether_gen_addr.9 index 1b98a841736d..f69cb199e2c3 100644 --- a/share/man/man9/ether_gen_addr.9 +++ b/share/man/man9/ether_gen_addr.9 @@ -61,8 +61,9 @@ or on machines that do not use .Xr loader 8 . .Pp .Nm -can fail to derive a MAC address due to memory allocation failure. -In this case, a locally-administered unicast MAC address will be randomly +can fail to derive a MAC address due to memory allocation failure, or because +the hostid has not been populated. +In these cases, a locally-administered unicast MAC address will be randomly generated and returned via the .Ar hwaddr parameter. diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c index 303e31490eb1..9784f3bfc23b 100644 --- a/sys/kern/kern_jail.c +++ b/sys/kern/kern_jail.c @@ -76,7 +76,6 @@ __FBSDID("$FreeBSD$"); #include -#define DEFAULT_HOSTUUID "00000000-0000-0000-0000-000000000000" #define PRISON0_HOSTUUID_MODULE "hostuuid" MALLOC_DEFINE(M_PRISON, "prison", "Prison structures"); diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 01c2d2f7b3e8..7eb46df8281a 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1443,6 +1443,11 @@ ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr) char jailname[MAXHOSTNAMELEN]; getcredhostuuid(curthread->td_ucred, uuid, sizeof(uuid)); + if (strncmp(uuid, DEFAULT_HOSTUUID, sizeof(uuid)) == 0) { + /* Fall back to a random mac address. */ + goto rando; + } + /* If each (vnet) jail would also have a unique hostuuid this would not * be necessary. */ getjailname(curthread->td_ucred, jailname, sizeof(jailname)); @@ -1450,9 +1455,7 @@ ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr) jailname); if (sz < 0) { /* Fall back to a random mac address. */ - arc4rand(hwaddr, sizeof(*hwaddr), 0); - hwaddr->octet[0] = 0x02; - return; + goto rando; } SHA1Init(&ctx); @@ -1467,6 +1470,14 @@ ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr) hwaddr->octet[i] = addr >> ((ETHER_ADDR_LEN - i - 1) * 8) & 0xFF; } + + return; +rando: + arc4rand(hwaddr, sizeof(*hwaddr), 0); + /* Unicast */ + hwaddr->octet[0] &= 0xFE; + /* Locally administered. */ + hwaddr->octet[0] |= 0x02; } DECLARE_MODULE(ether, ether_mod, SI_SUB_INIT_IF, SI_ORDER_ANY); diff --git a/sys/sys/jail.h b/sys/sys/jail.h index c9d4c65e4d9e..76ed377e3f06 100644 --- a/sys/sys/jail.h +++ b/sys/sys/jail.h @@ -140,6 +140,7 @@ MALLOC_DECLARE(M_PRISON); #include #define HOSTUUIDLEN 64 +#define DEFAULT_HOSTUUID "00000000-0000-0000-0000-000000000000" #define OSRELEASELEN 32 struct racct; From owner-dev-commits-src-main@freebsd.org Wed Jun 2 04:14:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D1D86394EA; Wed, 2 Jun 2021 04:14: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 4Fvwdz2D6Lz3hdH; Wed, 2 Jun 2021 04:14:31 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 33D8C105CD; Wed, 2 Jun 2021 04:14:31 +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 1524EVS4067616; Wed, 2 Jun 2021 04:14:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1524EVUI067615; Wed, 2 Jun 2021 04:14:31 GMT (envelope-from git) Date: Wed, 2 Jun 2021 04:14:31 GMT Message-Id: <202106020414.1524EVUI067615@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: 847b7d505490 - main - Fix test case header function name MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 847b7d505490ae407a5c876e14e7788a4add7737 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 04:14:31 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=847b7d505490ae407a5c876e14e7788a4add7737 commit 847b7d505490ae407a5c876e14e7788a4add7737 Author: Math Ieu AuthorDate: 2021-06-02 04:09:55 +0000 Commit: Li-Wen Hsu CommitDate: 2021-06-02 04:13:57 +0000 Fix test case header function name This restores the expected behavior (skip) when running with non-root user MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D30584 --- usr.sbin/jail/tests/jail_basic_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/jail/tests/jail_basic_test.sh b/usr.sbin/jail/tests/jail_basic_test.sh index f9d52cf8a780..ba691cb9b05a 100755 --- a/usr.sbin/jail/tests/jail_basic_test.sh +++ b/usr.sbin/jail/tests/jail_basic_test.sh @@ -99,7 +99,7 @@ nested_cleanup() jail -r basejail_nochild } -commands_header() +commands_head() { atf_set descr 'Commands jail test' atf_set require.user root From owner-dev-commits-src-main@freebsd.org Wed Jun 2 05:58:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8442763B58E; Wed, 2 Jun 2021 05:58:53 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FvyyP3D1sz3rdt; Wed, 2 Jun 2021 05:58:53 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from [192.168.0.12] (unknown [181.51.107.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: pfg) by smtp.freebsd.org (Postfix) with ESMTPSA id 637BB1C1B; Wed, 2 Jun 2021 05:58:52 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Subject: Re: git: 5a20c351ea45 - main - [skip ci] add a CODEOWNERS file To: Alexey Dokuchaev , Alan Somers Cc: Jessica Clarke , Warner Losh , Ed Maste , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202105302249.14UMnbcl094541@gitrepo.freebsd.org> <0434E9D2-B0AA-4B5E-942A-A393A83DFFD1@freebsd.org> From: Pedro Giffuni Organization: FreeBSD Message-ID: Date: Wed, 2 Jun 2021 00:58:50 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 05:58:53 -0000 On 01/06/2021 01:56, Alexey Dokuchaev wrote: > On Mon, May 31, 2021 at 01:50:16PM -0600, Alan Somers wrote: >> On Mon, May 31, 2021 at 1:39 PM Jessica Clarke wrote: >>> ... >>> >>> A hypothetical .gitlab/CODEOWNERS would be checked in as a generated >>> file, if that was unclear. Otherwise I'm not sure I understand your >>> first point? >> There's no need to generate anything. Both github and gitlab support a >> CODEOWNERS file in the project's root. Let's just move it there. We can >> delete the old MAINTAINERS, too, once all of its entries have been >> converted. > Why delete *our* correctly named MAINTAINERS? Tomorrow GH or GL could > decide that "pwning" something bears unnecessary and potentially offending > connotations and break the scheme. I would argue that the list of MAINTAINERS file has basically nothing to do with building FreeBSD so it is currently misplaced. > They want CODEOWNERS now? Fine, all it takes is a simple script to parse > MAINTAINERS and generate CODEOWNERS file they want. Once/if this changes, > we'd easily adapt. CODEOWNERS became the de-facto standard, there's nothing special about MAINTAINERS that justifies the need for a script. Do we really need a bikeshed to determine the name of a file? Pedro. From owner-dev-commits-src-main@freebsd.org Wed Jun 2 07:53:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E69B063CF7F; Wed, 2 Jun 2021 07:53:05 +0000 (UTC) (envelope-from SRS0=+ZjA=K4=klop.ws=ronald-lists@realworks.nl) Received: from smtp-relay-int.realworks.nl (smtp-relay-int.realworks.nl [194.109.157.24]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4Fw1V95P4mz4WxX; Wed, 2 Jun 2021 07:53:05 +0000 (UTC) (envelope-from SRS0=+ZjA=K4=klop.ws=ronald-lists@realworks.nl) Date: Wed, 2 Jun 2021 09:53:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=klop.ws; s=rw2; t=1622620383; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VKbsHU9vbjZ/MTLmA5JJ06UmIwgWxJuw2dwiL6DirEY=; b=yIYA1zxvX9yj2IEzDupK1vLy1Z6SA+pkEu3fZW08HRmv0IB2WZRF7QKaoxq7Y6r5ODWs+3 tKCWWwg3Fu7UsB721gGlWme5+XL7pRhxSxpTgZyYqkUaB2HI5qomdBQOG2zfSkSPYRczlx BAntBqmSUga0RzuibtwXB8BFNO7GZD7xNupcZNywYXL8U7aaSN71ZvyAqjJ5lOTegwmPsL WhrHhjHqJLC6e/q4NSSBrV9a1+1d/9FY76h2BeSKwrKbTICMqzETPgvf7TTwNSMsBGHDOq 7U97dmNe6HEyjNBVMU+6k5jMHrl7AnQBkNj96h3Qc1UuStkqAt41v5ME25PEdA== From: Ronald Klop To: Kyle Evans Cc: dev-commits-src-all@FreeBSD.org, src-committers@FreeBSD.org, dev-commits-src-main@FreeBSD.org Message-ID: <2123581522.4.1622620383310@localhost> In-Reply-To: <202106020359.1523xbk3040971@gitrepo.freebsd.org> References: <202106020359.1523xbk3040971@gitrepo.freebsd.org> Subject: Re: git: 2d741f33bd07 - main - kern: ether_gen_addr: randomize on default hostuuid, too MIME-Version: 1.0 X-Mailer: Realworks (562.1116.eb0227a51c5) Importance: Normal X-Priority: 3 (Normal) X-Rspamd-Queue-Id: 4Fw1V95P4mz4WxX X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.00)[ZjA=K4=klop.ws=ronald-lists]; REPLY(-4.00)[] Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 07:53:06 -0000 Hi, Wouldn't it be user friendly to tell why the MAC is random? Something like this. if (strncmp(uuid, DEFAULT_HOSTUUID, sizeof(uuid)) == 0) { printf("No /etc/hostuuid found. Fall back to a random mac address."); goto rando; } I know it would save me a lot of time if I would encounter this case. Plus the message is only printed once on boot. Regards, Ronald. Van: Kyle Evans Datum: woensdag, 2 juni 2021 05:59 Aan: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Onderwerp: git: 2d741f33bd07 - main - kern: ether_gen_addr: randomize on default hostuuid, too > > The branch main has been updated by kevans: > > URL: https://cgit.FreeBSD.org/src/commit/?id=2d741f33bd07bf94a59635db3c7b9e070a8a6e55 > > commit 2d741f33bd07bf94a59635db3c7b9e070a8a6e55 > Author: Kyle Evans > AuthorDate: 2021-04-16 01:11:35 +0000 > Commit: Kyle Evans > CommitDate: 2021-06-02 03:59:21 +0000 > > kern: ether_gen_addr: randomize on default hostuuid, too > > Currently, this will still hash the default (all zero) hostuuid and > potentially arrive at a MAC address that has a high chance of collision > if another interface of the same name appears in the same broadcast > domain on another host without a hostuuid, e.g., some virtual machine > setups. > > Instead of using the default hostuuid, just treat it as a failure and > generate a random LA unicast MAC address. > > Reviewed by: bz, gbe, imp, kbowling, kp > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D29788 > --- > share/man/man9/ether_gen_addr.9 | 5 +++-- > sys/kern/kern_jail.c | 1 - > sys/net/if_ethersubr.c | 17 ++++++++++++++--- > sys/sys/jail.h | 1 + > 4 files changed, 18 insertions(+), 6 deletions(-) > > diff --git a/share/man/man9/ether_gen_addr.9 b/share/man/man9/ether_gen_addr.9 > index 1b98a841736d..f69cb199e2c3 100644 > --- a/share/man/man9/ether_gen_addr.9 > +++ b/share/man/man9/ether_gen_addr.9 > @@ -61,8 +61,9 @@ or on machines that do not use > .Xr loader 8 . > .Pp > .Nm > -can fail to derive a MAC address due to memory allocation failure. > -In this case, a locally-administered unicast MAC address will be randomly > +can fail to derive a MAC address due to memory allocation failure, or because > +the hostid has not been populated. > +In these cases, a locally-administered unicast MAC address will be randomly > generated and returned via the > .Ar hwaddr > parameter. > diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c > index 303e31490eb1..9784f3bfc23b 100644 > --- a/sys/kern/kern_jail.c > +++ b/sys/kern/kern_jail.c > @@ -76,7 +76,6 @@ __FBSDID("$FreeBSD$"); > > #include > > -#define DEFAULT_HOSTUUID "00000000-0000-0000-0000-000000000000" > #define PRISON0_HOSTUUID_MODULE "hostuuid" > > MALLOC_DEFINE(M_PRISON, "prison", "Prison structures"); > diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c > index 01c2d2f7b3e8..7eb46df8281a 100644 > --- a/sys/net/if_ethersubr.c > +++ b/sys/net/if_ethersubr.c > @@ -1443,6 +1443,11 @@ ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr) > char jailname[MAXHOSTNAMELEN]; > > getcredhostuuid(curthread->td_ucred, uuid, sizeof(uuid)); > + if (strncmp(uuid, DEFAULT_HOSTUUID, sizeof(uuid)) == 0) { > + /* Fall back to a random mac address. */ > + goto rando; > + } > + > /* If each (vnet) jail would also have a unique hostuuid this would not > * be necessary. */ > getjailname(curthread->td_ucred, jailname, sizeof(jailname)); > @@ -1450,9 +1455,7 @@ ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr) > jailname); > if (sz < 0) { > /* Fall back to a random mac address. */ > - arc4rand(hwaddr, sizeof(*hwaddr), 0); > - hwaddr->octet[0] = 0x02; > - return; > + goto rando; > } > > SHA1Init(&ctx); > @@ -1467,6 +1470,14 @@ ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr) > hwaddr->octet[i] = addr >> ((ETHER_ADDR_LEN - i - 1) * 8) & > 0xFF; > } > + > + return; > +rando: > + arc4rand(hwaddr, sizeof(*hwaddr), 0); > + /* Unicast */ > + hwaddr->octet[0] &= 0xFE; > + /* Locally administered. */ > + hwaddr->octet[0] |= 0x02; > } > > DECLARE_MODULE(ether, ether_mod, SI_SUB_INIT_IF, SI_ORDER_ANY); > diff --git a/sys/sys/jail.h b/sys/sys/jail.h > index c9d4c65e4d9e..76ed377e3f06 100644 > --- a/sys/sys/jail.h > +++ b/sys/sys/jail.h > @@ -140,6 +140,7 @@ MALLOC_DECLARE(M_PRISON); > #include > > #define HOSTUUIDLEN 64 > +#define DEFAULT_HOSTUUID "00000000-0000-0000-0000-000000000000" > #define OSRELEASELEN 32 > > struct racct; > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all > To unsubscribe, send any mail to "dev-commits-src-all-unsubscribe@freebsd.org" > > > From owner-dev-commits-src-main@freebsd.org Wed Jun 2 08:05:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 75D7A63D66C; Wed, 2 Jun 2021 08:05:04 +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 4Fw1m01z7Fz4YLc; Wed, 2 Jun 2021 08:05:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 212E8137A1; Wed, 2 Jun 2021 08:05: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 152854Cq072931; Wed, 2 Jun 2021 08:05:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152854kD072930; Wed, 2 Jun 2021 08:05:04 GMT (envelope-from git) Date: Wed, 2 Jun 2021 08:05:04 GMT Message-Id: <202106020805.152854kD072930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 9cf66a0458f4 - main - uart_dev_ns8250: Switch ACPI UART subtype for Marvell SoCs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9cf66a0458f4913d34cb3c5f6b653c78f70de8a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 08:05:04 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=9cf66a0458f4913d34cb3c5f6b653c78f70de8a8 commit 9cf66a0458f4913d34cb3c5f6b653c78f70de8a8 Author: Marcin Wojtas AuthorDate: 2021-05-20 21:37:02 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-02 07:55:19 +0000 uart_dev_ns8250: Switch ACPI UART subtype for Marvell SoCs DBG2 ACPI table description [1] specifies three subtypes related to 16550 UART: 0x0 - 16550 compatible 0x1 - 16550 subset 0x12 - 16550 compatible with parameters defined in Generic Address Structure (GAS) It turned out however, that the Windows OS treats 0x0 subtype as legacy x86 UART with 8-bit access. ARM SoCs can use types 0x1 (16550 with fixed mmio32 access) or 0x12 (16550 with fully respected GAS contents). Switch Marvell SoCs ACPI UART subtype to 0x1 - thanks to that the same firmware can run properly with UART output in FreeBSD, Windows 10, Linux and ESXI hypervisor. Tests showed the older firmware versions that use 0x0 UART subtype in SPCR table continue to display output properly. [1] https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/acpi-debug-port-table Obtained from: Semihalf Sponsored by: ARM Differential revision: https://reviews.freebsd.org/D30386 MFC after: 2 weeks --- sys/dev/uart/uart_dev_ns8250.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index 45b4d315c3d5..859fb352a194 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef DEV_ACPI #include +#include #endif #include @@ -415,7 +416,7 @@ struct uart_class uart_ns8250_class = { static struct acpi_uart_compat_data acpi_compat_data[] = { {"AMD0020", &uart_ns8250_class, 0, 2, 0, 48000000, UART_F_BUSY_DETECT, "AMD / Synopsys Designware UART"}, {"AMDI0020", &uart_ns8250_class, 0, 2, 0, 48000000, UART_F_BUSY_DETECT, "AMD / Synopsys Designware UART"}, - {"MRVL0001", &uart_ns8250_class, 0, 2, 0, 200000000, UART_F_BUSY_DETECT, "Marvell / Synopsys Designware UART"}, + {"MRVL0001", &uart_ns8250_class, ACPI_DBG2_16550_SUBSET, 2, 0, 200000000, UART_F_BUSY_DETECT, "Marvell / Synopsys Designware UART"}, {"SCX0006", &uart_ns8250_class, 0, 2, 0, 62500000, UART_F_BUSY_DETECT, "SynQuacer / Synopsys Designware UART"}, {"HISI0031", &uart_ns8250_class, 0, 2, 0, 200000000, UART_F_BUSY_DETECT, "HiSilicon / Synopsys Designware UART"}, {"PNP0500", &uart_ns8250_class, 0, 0, 0, 0, 0, "Standard PC COM port"}, From owner-dev-commits-src-main@freebsd.org Wed Jun 2 08:05:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7497663D959; Wed, 2 Jun 2021 08:05:05 +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 4Fw1m12W2Vz4Y3M; Wed, 2 Jun 2021 08:05:05 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3B9321394D; Wed, 2 Jun 2021 08:05:05 +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 152855dK072952; Wed, 2 Jun 2021 08:05:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152855ha072951; Wed, 2 Jun 2021 08:05:05 GMT (envelope-from git) Date: Wed, 2 Jun 2021 08:05:05 GMT Message-Id: <202106020805.152855ha072951@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 7d8700bc291b - main - sdhci: extend bus_dma_tag boundary to 64-bit space MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7d8700bc291b4b3be1a592cae539f9e682592d9d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 08:05:05 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=7d8700bc291b4b3be1a592cae539f9e682592d9d commit 7d8700bc291b4b3be1a592cae539f9e682592d9d Author: Marcin Wojtas AuthorDate: 2021-04-28 08:55:40 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-02 07:55:19 +0000 sdhci: extend bus_dma_tag boundary to 64-bit space This patch adds support for the SDHCI_CAN_DO_64BIT capability, so that to allow 64-bit DMA operation for the controllers which support this feature. Reviewed by: manu Obtained from: Semihalf Sponsored by: Marvell Differential Revision: https://reviews.freebsd.org/D30560 MFC after: 2 weeks --- sys/dev/sdhci/sdhci.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c index 0441320d4b35..68a3cf9ab4d3 100644 --- a/sys/dev/sdhci/sdhci.c +++ b/sys/dev/sdhci/sdhci.c @@ -132,7 +132,7 @@ static int sdhci_cam_update_ios(struct sdhci_slot *slot); #endif /* helper routines */ -static int sdhci_dma_alloc(struct sdhci_slot *slot); +static int sdhci_dma_alloc(struct sdhci_slot *slot, uint32_t caps); static void sdhci_dma_free(struct sdhci_slot *slot); static void sdhci_dumpregs(struct sdhci_slot *slot); static void sdhci_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, @@ -717,7 +717,7 @@ sdhci_card_poll(void *arg) } static int -sdhci_dma_alloc(struct sdhci_slot *slot) +sdhci_dma_alloc(struct sdhci_slot *slot, uint32_t caps) { int err; @@ -750,7 +750,8 @@ sdhci_dma_alloc(struct sdhci_slot *slot) * be aligned to the SDMA boundary. */ err = bus_dma_tag_create(bus_get_dma_tag(slot->bus), slot->sdma_bbufsz, - 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + 0, (caps & SDHCI_CAN_DO_64BIT) ? BUS_SPACE_MAXADDR : + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, slot->sdma_bbufsz, 1, slot->sdma_bbufsz, BUS_DMA_ALLOCNOW, NULL, NULL, &slot->dmatag); if (err != 0) { @@ -1032,7 +1033,7 @@ no_tuning: slot->opt &= ~SDHCI_HAVE_DMA; if (slot->opt & SDHCI_HAVE_DMA) { - err = sdhci_dma_alloc(slot); + err = sdhci_dma_alloc(slot, caps); if (err != 0) { if (slot->opt & SDHCI_TUNING_SUPPORTED) { free(slot->tune_req, M_DEVBUF); From owner-dev-commits-src-main@freebsd.org Wed Jun 2 08:05:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ADC7363D506; Wed, 2 Jun 2021 08:05: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 4Fw1m24KWRz4YJV; Wed, 2 Jun 2021 08:05:06 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6D74D1356D; Wed, 2 Jun 2021 08:05:06 +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 1528561l072973; Wed, 2 Jun 2021 08:05:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152856Cl072972; Wed, 2 Jun 2021 08:05:06 GMT (envelope-from git) Date: Wed, 2 Jun 2021 08:05:06 GMT Message-Id: <202106020805.152856Cl072972@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 5652be30a322 - main - sdhci: allow setting MMC capabilities before sdhci_init_slot MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5652be30a322f2543bc1e3bcc135abc56b3eb268 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 08:05:06 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=5652be30a322f2543bc1e3bcc135abc56b3eb268 commit 5652be30a322f2543bc1e3bcc135abc56b3eb268 Author: Marcin Wojtas AuthorDate: 2021-05-04 22:57:50 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-02 07:55:19 +0000 sdhci: allow setting MMC capabilities before sdhci_init_slot With this change the host controller drivers can set the MMC capabilities (e.g. using mmc_fdt_parse() helper) before calling sdhci_init_slot(). This way the configuration dump (eg. in bootverbose) can include the possible additional information. Reviewed by: manu Obtained from: Semihalf Sponsored by: Marvell Differential Revision: https://reviews.freebsd.org/D30561 MFC after: 2 weeks --- sys/dev/sdhci/sdhci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c index 68a3cf9ab4d3..22df56672c4b 100644 --- a/sys/dev/sdhci/sdhci.c +++ b/sys/dev/sdhci/sdhci.c @@ -891,7 +891,8 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num) "support voltages.\n"); } - host_caps = MMC_CAP_4_BIT_DATA; + host_caps = slot->host.caps; + host_caps |= MMC_CAP_4_BIT_DATA; if (caps & SDHCI_CAN_DO_8BITBUS) host_caps |= MMC_CAP_8_BIT_DATA; if (caps & SDHCI_CAN_DO_HISPD) From owner-dev-commits-src-main@freebsd.org Wed Jun 2 08:05:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A42E963DA11; Wed, 2 Jun 2021 08:05:07 +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 4Fw1m349M7z4YF9; Wed, 2 Jun 2021 08:05:07 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 75CC4133D2; Wed, 2 Jun 2021 08:05:07 +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 152857l0072998; Wed, 2 Jun 2021 08:05:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152857dD072997; Wed, 2 Jun 2021 08:05:07 GMT (envelope-from git) Date: Wed, 2 Jun 2021 08:05:07 GMT Message-Id: <202106020805.152857dD072997@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 43e31350f8f6 - main - sdhci_xenon: enable MMC FDT parsing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 43e31350f8f67087b641d85520e20176e152dda7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 08:05:07 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=43e31350f8f67087b641d85520e20176e152dda7 commit 43e31350f8f67087b641d85520e20176e152dda7 Author: Marcin Wojtas AuthorDate: 2021-05-01 07:55:06 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-02 07:55:19 +0000 sdhci_xenon: enable MMC FDT parsing The mmc_fdt_parse allows to parse more MMC-related FDT properties. Start using it. "wp-inverted" property, VQMMC and newly added VMMC power supply parsing is now done in a generic code. Reviewed by: manu Obtained from: Semihalf Sponsored by: Marvell Differential Revision: https://reviews.freebsd.org/D30562 MFC after: 2 weeks --- sys/dev/sdhci/sdhci_xenon.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/sys/dev/sdhci/sdhci_xenon.c b/sys/dev/sdhci/sdhci_xenon.c index 5afbe7afefd3..c230f0ef9752 100644 --- a/sys/dev/sdhci/sdhci_xenon.c +++ b/sys/dev/sdhci/sdhci_xenon.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -91,12 +92,12 @@ struct sdhci_xenon_softc { struct sdhci_slot *slot; /* SDHCI internal data */ struct resource *mem_res; /* Memory resource */ - regulator_t reg_vqmmc; /* vqmmc-supply regulator */ uint8_t znr; /* PHY ZNR */ uint8_t zpr; /* PHY ZPR */ bool no_18v; /* No 1.8V support */ bool slow_mode; /* PHY slow mode */ - bool wp_inverted; /* WP pin is inverted */ + + struct mmc_fdt_helper mmc_helper; /* MMC helper for parsing FDT */ }; static uint8_t @@ -189,7 +190,8 @@ sdhci_xenon_get_ro(device_t bus, device_t dev) { struct sdhci_xenon_softc *sc = device_get_softc(bus); - return (sdhci_generic_get_ro(bus, dev) ^ sc->wp_inverted); + return (sdhci_generic_get_ro(bus, dev) ^ + (sc->mmc_helper.props & MMC_PROP_WP_INVERTED)); } static bool @@ -356,15 +358,19 @@ sdhci_xenon_update_ios(device_t brdev, device_t reqdev) if (bootverbose) device_printf(sc->dev, "Powering down sd/mmc\n"); - if (sc->reg_vqmmc) - regulator_disable(sc->reg_vqmmc); + if (sc->mmc_helper.vmmc_supply) + regulator_disable(sc->mmc_helper.vmmc_supply); + if (sc->mmc_helper.vqmmc_supply) + regulator_disable(sc->mmc_helper.vqmmc_supply); break; case power_up: if (bootverbose) device_printf(sc->dev, "Powering up sd/mmc\n"); - if (sc->reg_vqmmc) - regulator_enable(sc->reg_vqmmc); + if (sc->mmc_helper.vmmc_supply) + regulator_enable(sc->mmc_helper.vmmc_supply); + if (sc->mmc_helper.vqmmc_supply) + regulator_enable(sc->mmc_helper.vqmmc_supply); break; }; @@ -391,7 +397,7 @@ sdhci_xenon_switch_vccq(device_t brdev, device_t reqdev) sc = device_get_softc(brdev); - if (sc->reg_vqmmc == NULL) + if (sc->mmc_helper.vqmmc_supply == NULL) return EOPNOTSUPP; slot = device_get_ivars(reqdev); @@ -406,7 +412,7 @@ sdhci_xenon_switch_vccq(device_t brdev, device_t reqdev) return EINVAL; } - err = regulator_set_voltage(sc->reg_vqmmc, uvolt, uvolt); + err = regulator_set_voltage(sc->mmc_helper.vqmmc_supply, uvolt, uvolt); if (err != 0) { device_printf(sc->dev, "Cannot set vqmmc to %d<->%d\n", @@ -444,8 +450,6 @@ sdhci_xenon_probe(device_t dev) sc->max_clk = cid; if (OF_hasprop(sc->node, "no-1-8-v")) sc->no_18v = true; - if (OF_hasprop(sc->node, "wp-inverted")) - sc->wp_inverted = true; if (OF_hasprop(sc->node, "marvell,xenon-phy-slow-mode")) sc->slow_mode = true; sc->znr = XENON_ZNR_DEF_VALUE; @@ -456,11 +460,6 @@ sdhci_xenon_probe(device_t dev) if ((OF_getencprop(sc->node, "marvell,xenon-phy-zpr", &cid, sizeof(cid))) > 0) sc->zpr = cid & XENON_ZPR_MASK; - if (regulator_get_by_ofw_property(dev, 0, "vqmmc-supply", - &sc->reg_vqmmc) == 0 && bootverbose) { - if (bootverbose) - device_printf(dev, "vqmmc-supply regulator found\n"); - } return (0); } @@ -515,6 +514,8 @@ sdhci_xenon_attach(device_t dev) */ sc->gpio = sdhci_fdt_gpio_setup(dev, slot); + mmc_fdt_parse(dev, 0, &sc->mmc_helper, &sc->slot->host); + if (sdhci_init_slot(dev, sc->slot, 0)) goto fail; From owner-dev-commits-src-main@freebsd.org Wed Jun 2 08:05:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 337CC63D527; Wed, 2 Jun 2021 08:05:09 +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 4Fw1m46sn2z4YV5; Wed, 2 Jun 2021 08:05:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 95C20137A2; Wed, 2 Jun 2021 08:05:08 +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 152858eT073022; Wed, 2 Jun 2021 08:05:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152858E3073021; Wed, 2 Jun 2021 08:05:08 GMT (envelope-from git) Date: Wed, 2 Jun 2021 08:05:08 GMT Message-Id: <202106020805.152858E3073021@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: df868762841b - main - sdhci_xenon: allow to properly disable the UHS signaling MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: df868762841b93d934413651818e510ea443def8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 08:05:09 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=df868762841b93d934413651818e510ea443def8 commit df868762841b93d934413651818e510ea443def8 Author: Marcin Wojtas AuthorDate: 2021-05-27 17:48:17 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-02 07:55:19 +0000 sdhci_xenon: allow to properly disable the UHS signaling Until now the "no-1-8-v" DT flag wrongly disabled the SDHCI_CAN_VDD_180 - slot 1.8V power supply capability, whereas it refers to the signaling voltage. Fix the sdhci_xenon_read_4 and allow to disable the UHS modes depending on the DT property or PHY slow mode. While at it - make sure the unsupported 1.2V signaling is always disabled and not reported in the bootverbose log. Reviewed by: manu Obtained from: Semihalf Sponsored by: Marvell Differential Revision: https://reviews.freebsd.org/D30563 MFC after: 2 weeks --- sys/dev/sdhci/sdhci_xenon.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/dev/sdhci/sdhci_xenon.c b/sys/dev/sdhci/sdhci_xenon.c index c230f0ef9752..f92d02608abb 100644 --- a/sys/dev/sdhci/sdhci_xenon.c +++ b/sys/dev/sdhci/sdhci_xenon.c @@ -141,13 +141,8 @@ sdhci_xenon_read_4(device_t dev, struct sdhci_slot *slot __unused, bus_size_t off) { struct sdhci_xenon_softc *sc = device_get_softc(dev); - uint32_t val32; - val32 = bus_read_4(sc->mem_res, off); - if (off == SDHCI_CAPABILITIES && sc->no_18v) - val32 &= ~SDHCI_CAN_VDD_180; - - return (val32); + return bus_read_4(sc->mem_res, off); } static void @@ -519,6 +514,13 @@ sdhci_xenon_attach(device_t dev) if (sdhci_init_slot(dev, sc->slot, 0)) goto fail; + /* 1.2V signaling is not supported. */ + sc->slot->host.caps &= ~MMC_CAP_SIGNALING_120; + + /* Disable UHS in case of lack of 1.8V VCCQ or the PHY slow mode. */ + if (sc->no_18v || sc->slow_mode) + sc->slot->host.caps &= ~MMC_CAP_SIGNALING_180; + /* Activate the interrupt */ err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, sdhci_xenon_intr, sc, &sc->intrhand); From owner-dev-commits-src-main@freebsd.org Wed Jun 2 08:05:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B626D63D98B; Wed, 2 Jun 2021 08:05:10 +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 4Fw1m56h2Bz4YM1; Wed, 2 Jun 2021 08:05:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B84561326A; Wed, 2 Jun 2021 08:05:09 +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 1528590p073043; Wed, 2 Jun 2021 08:05:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152859GX073042; Wed, 2 Jun 2021 08:05:09 GMT (envelope-from git) Date: Wed, 2 Jun 2021 08:05:09 GMT Message-Id: <202106020805.152859GX073042@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: c80e2ca57e0c - main - sdhci_xenon: improve the VCCQ voltage switch sequence MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c80e2ca57e0c1b3647b55471584c6d32214232ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 08:05:11 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=c80e2ca57e0c1b3647b55471584c6d32214232ea commit c80e2ca57e0c1b3647b55471584c6d32214232ea Author: Marcin Wojtas AuthorDate: 2021-05-27 18:39:12 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-02 07:55:20 +0000 sdhci_xenon: improve the VCCQ voltage switch sequence Improve the VCCQ voltage switch, so that to properly handle the SDHCI_HOST_CONTROL2 register signaling flags and along with manipulating the regulator. Reviewed by: manu Obtained from: Semihalf Sponsored by: Marvell Differential Revision: https://reviews.freebsd.org/D30564 MFC after: 2 weeks --- sys/dev/sdhci/sdhci_xenon.c | 84 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 68 insertions(+), 16 deletions(-) diff --git a/sys/dev/sdhci/sdhci_xenon.c b/sys/dev/sdhci/sdhci_xenon.c index f92d02608abb..42f36b619b36 100644 --- a/sys/dev/sdhci/sdhci_xenon.c +++ b/sys/dev/sdhci/sdhci_xenon.c @@ -388,35 +388,87 @@ sdhci_xenon_switch_vccq(device_t brdev, device_t reqdev) { struct sdhci_xenon_softc *sc; struct sdhci_slot *slot; + uint16_t hostctrl2; int uvolt, err; + slot = device_get_ivars(reqdev); + + if (slot->version < SDHCI_SPEC_300) + return (0); + sc = device_get_softc(brdev); if (sc->mmc_helper.vqmmc_supply == NULL) return EOPNOTSUPP; - slot = device_get_ivars(reqdev); + err = 0; + + hostctrl2 = bus_read_2(sc->mem_res, SDHCI_HOST_CONTROL2); switch (slot->host.ios.vccq) { - case vccq_180: - uvolt = 1800000; - break; case vccq_330: + if (!(hostctrl2 & SDHCI_CTRL2_S18_ENABLE)) + return (0); + hostctrl2 &= ~SDHCI_CTRL2_S18_ENABLE; + bus_write_2(sc->mem_res, SDHCI_HOST_CONTROL2, hostctrl2); + uvolt = 3300000; - break; + err = regulator_set_voltage(sc->mmc_helper.vqmmc_supply, + uvolt, uvolt); + if (err != 0) { + device_printf(sc->dev, + "Cannot set vqmmc to %d<->%d\n", + uvolt, + uvolt); + return (err); + } + + /* + * According to the 'SD Host Controller Simplified + * Specification 4.20 the host driver should take more + * than 5ms for stable time of host voltage regulator + * from changing 1.8V Signaling Enable. + */ + DELAY(5000); + hostctrl2 = bus_read_2(sc->mem_res, SDHCI_HOST_CONTROL2); + if (!(hostctrl2 & SDHCI_CTRL2_S18_ENABLE)) + return (0); + return EAGAIN; + case vccq_180: + if (!(slot->host.caps & MMC_CAP_SIGNALING_180)) { + return EINVAL; + } + if (hostctrl2 & SDHCI_CTRL2_S18_ENABLE) + return (0); + hostctrl2 |= SDHCI_CTRL2_S18_ENABLE; + bus_write_2(sc->mem_res, SDHCI_HOST_CONTROL2, hostctrl2); + + uvolt = 1800000; + err = regulator_set_voltage(sc->mmc_helper.vqmmc_supply, + uvolt, uvolt); + if (err != 0) { + device_printf(sc->dev, + "Cannot set vqmmc to %d<->%d\n", + uvolt, + uvolt); + return (err); + } + + /* + * According to the 'SD Host Controller Simplified + * Specification 4.20 the host driver should take more + * than 5ms for stable time of host voltage regulator + * from changing 1.8V Signaling Enable. + */ + DELAY(5000); + hostctrl2 = bus_read_2(sc->mem_res, SDHCI_HOST_CONTROL2); + if (hostctrl2 & SDHCI_CTRL2_S18_ENABLE) + return (0); + return EAGAIN; default: + device_printf(brdev, + "Attempt to set unsupported signaling voltage\n"); return EINVAL; } - - err = regulator_set_voltage(sc->mmc_helper.vqmmc_supply, uvolt, uvolt); - if (err != 0) { - device_printf(sc->dev, - "Cannot set vqmmc to %d<->%d\n", - uvolt, - uvolt); - return (err); - } - - return (0); } static int From owner-dev-commits-src-main@freebsd.org Wed Jun 2 08:05:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D93663DA14; Wed, 2 Jun 2021 08:05:11 +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 4Fw1m70NM5z4YJp; Wed, 2 Jun 2021 08:05:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D763F1356E; Wed, 2 Jun 2021 08:05:10 +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 15285AjU073064; Wed, 2 Jun 2021 08:05:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15285Alf073063; Wed, 2 Jun 2021 08:05:10 GMT (envelope-from git) Date: Wed, 2 Jun 2021 08:05:10 GMT Message-Id: <202106020805.15285Alf073063@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 4fa977f854e2 - main - sdhci_xenon: add UHS support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4fa977f854e27c93c22acfa6a3ba38f5c4959e15 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 08:05:11 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=4fa977f854e27c93c22acfa6a3ba38f5c4959e15 commit 4fa977f854e27c93c22acfa6a3ba38f5c4959e15 Author: Marcin Wojtas AuthorDate: 2021-05-04 23:47:37 +0000 Commit: Marcin Wojtas CommitDate: 2021-06-02 07:55:20 +0000 sdhci_xenon: add UHS support This patch adds the necessary methods resolution to the sdhci_xenon driver which are required to configure UHS modes for SD/MMC devices. Apart from the two generic routines, the custom sdhci_xenon_set_uhs_timing function is responsible for setting the SDHCI_HOST_CONTROL2 register with appropriate mode select values - in case of HS200 and HS400 they are non-standard. Reviewed by: manu Obtained from: Semihalf Sponsored by: Marvell Differential Revision: https://reviews.freebsd.org/D30565 MFC after: 2 weeks --- sys/dev/sdhci/sdhci_xenon.c | 40 ++++++++++++++++++++++++++++++++++++++++ sys/dev/sdhci/sdhci_xenon.h | 4 ++++ 2 files changed, 44 insertions(+) diff --git a/sys/dev/sdhci/sdhci_xenon.c b/sys/dev/sdhci/sdhci_xenon.c index 42f36b619b36..3f312921154f 100644 --- a/sys/dev/sdhci/sdhci_xenon.c +++ b/sys/dev/sdhci/sdhci_xenon.c @@ -197,6 +197,43 @@ sdhci_xenon_get_card_present(device_t dev, struct sdhci_slot *slot) return (sdhci_fdt_gpio_get_present(sc->gpio)); } +static void +sdhci_xenon_set_uhs_timing(device_t brdev, struct sdhci_slot *slot) +{ + const struct mmc_ios *ios; + uint16_t hostctrl2; + + if (slot->version < SDHCI_SPEC_300) + return; + + mtx_assert(&slot->mtx, MA_OWNED); + ios = &slot->host.ios; + + /* Update timing parameteres in SDHCI_HOST_CONTROL2 register. */ + hostctrl2 = sdhci_xenon_read_2(brdev, slot, SDHCI_HOST_CONTROL2); + hostctrl2 &= ~SDHCI_CTRL2_UHS_MASK; + if (ios->clock > SD_SDR50_MAX) { + if (ios->timing == bus_timing_mmc_hs400 || + ios->timing == bus_timing_mmc_hs400es) + hostctrl2 |= XENON_CTRL2_MMC_HS400; + else if (ios->timing == bus_timing_mmc_hs200) + hostctrl2 |= XENON_CTRL2_MMC_HS200; + else + hostctrl2 |= SDHCI_CTRL2_UHS_SDR104; + } + else if (ios->clock > SD_SDR25_MAX) + hostctrl2 |= SDHCI_CTRL2_UHS_SDR50; + else if (ios->clock > SD_SDR12_MAX) { + if (ios->timing == bus_timing_uhs_ddr50 || + ios->timing == bus_timing_mmc_ddr52) + hostctrl2 |= SDHCI_CTRL2_UHS_DDR50; + else + hostctrl2 |= SDHCI_CTRL2_UHS_SDR25; + } else if (ios->clock > SD_MMC_CARD_ID_FREQUENCY) + hostctrl2 |= SDHCI_CTRL2_UHS_SDR12; + sdhci_xenon_write_2(brdev, slot, SDHCI_HOST_CONTROL2, hostctrl2); +} + static int sdhci_xenon_phy_init(device_t brdev, struct mmc_ios *ios) { @@ -663,6 +700,8 @@ static device_method_t sdhci_xenon_methods[] = { DEVMETHOD(mmcbr_acquire_host, sdhci_generic_acquire_host), DEVMETHOD(mmcbr_release_host, sdhci_generic_release_host), DEVMETHOD(mmcbr_switch_vccq, sdhci_xenon_switch_vccq), + DEVMETHOD(mmcbr_tune, sdhci_generic_tune), + DEVMETHOD(mmcbr_retune, sdhci_generic_retune), /* SDHCI registers accessors */ DEVMETHOD(sdhci_read_1, sdhci_xenon_read_1), @@ -674,6 +713,7 @@ static device_method_t sdhci_xenon_methods[] = { DEVMETHOD(sdhci_write_4, sdhci_xenon_write_4), DEVMETHOD(sdhci_write_multi_4, sdhci_xenon_write_multi_4), DEVMETHOD(sdhci_get_card_present, sdhci_xenon_get_card_present), + DEVMETHOD(sdhci_set_uhs_timing, sdhci_xenon_set_uhs_timing), DEVMETHOD_END }; diff --git a/sys/dev/sdhci/sdhci_xenon.h b/sys/dev/sdhci/sdhci_xenon.h index b79dab6bab55..07ed99339b8d 100644 --- a/sys/dev/sdhci/sdhci_xenon.h +++ b/sys/dev/sdhci/sdhci_xenon.h @@ -46,6 +46,10 @@ #define XENON_ENABLE_DATA_STROBE (1 << 24) #define XENON_ENABLE_RESP_STROBE (1 << 25) +/* Custom HS200 / HS400 Mode Select values in SDHCI_HOST_CONTROL2 register. */ +#define XENON_CTRL2_MMC_HS200 0x5 +#define XENON_CTRL2_MMC_HS400 0x6 + /* eMMC PHY */ #define XENON_EMMC_PHY_REG_BASE 0x170 From owner-dev-commits-src-main@freebsd.org Wed Jun 2 08:17:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8075E63E0A2; Wed, 2 Jun 2021 08:17:49 +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 4Fw22j3CRWz4Zgh; Wed, 2 Jun 2021 08:17:49 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5643213999; Wed, 2 Jun 2021 08:17:49 +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 1528HnCg086554; Wed, 2 Jun 2021 08:17:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1528Hns7086553; Wed, 2 Jun 2021 08:17:49 GMT (envelope-from git) Date: Wed, 2 Jun 2021 08:17:49 GMT Message-Id: <202106020817.1528Hns7086553@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 25593adbc125 - main - arm: allwinner: Add clock driver for Display Engine to the build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 25593adbc125b88096de1b5669e1a9e40b7421a1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 08:17:49 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=25593adbc125b88096de1b5669e1a9e40b7421a1 commit 25593adbc125b88096de1b5669e1a9e40b7421a1 Author: Emmanuel Vadot AuthorDate: 2021-06-02 08:17:16 +0000 Commit: Emmanuel Vadot CommitDate: 2021-06-02 08:17:16 +0000 arm: allwinner: Add clock driver for Display Engine to the build This is needed for drm --- sys/arm/allwinner/files.allwinner | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/arm/allwinner/files.allwinner b/sys/arm/allwinner/files.allwinner index 6148c9787c06..55519fc78026 100644 --- a/sys/arm/allwinner/files.allwinner +++ b/sys/arm/allwinner/files.allwinner @@ -45,3 +45,4 @@ arm/allwinner/clkng/aw_clk_nm.c standard arm/allwinner/clkng/aw_clk_np.c standard arm/allwinner/clkng/aw_clk_nmm.c standard arm/allwinner/clkng/aw_clk_prediv_mux.c standard +arm/allwinner/clkng/ccu_de2.c standard From owner-dev-commits-src-main@freebsd.org Wed Jun 2 11:17:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA8116404E8; Wed, 2 Jun 2021 11:17:01 +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 4Fw61T5LxPz4s6n; Wed, 2 Jun 2021 11:17:01 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9C52615CAA; Wed, 2 Jun 2021 11:17:01 +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 152BH1Tu026636; Wed, 2 Jun 2021 11:17:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152BH124026635; Wed, 2 Jun 2021 11:17:01 GMT (envelope-from git) Date: Wed, 2 Jun 2021 11:17:01 GMT Message-Id: <202106021117.152BH124026635@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 0a0d6ce34d6b - main - Use the arm virtual counter in the arm64 loader MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0a0d6ce34d6be89cb356c7815648e455fabe3151 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 11:17:01 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=0a0d6ce34d6be89cb356c7815648e455fabe3151 commit 0a0d6ce34d6be89cb356c7815648e455fabe3151 Author: Andrew Turner AuthorDate: 2021-05-12 07:45:09 +0000 Commit: Andrew Turner CommitDate: 2021-06-02 10:58:20 +0000 Use the arm virtual counter in the arm64 loader It exist on all ARMv8+ CPUs, and other boot loaders rely on it being present. Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D30410 --- stand/efi/libefi/Makefile | 5 +-- stand/efi/libefi/time_arm64.c | 72 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/stand/efi/libefi/Makefile b/stand/efi/libefi/Makefile index 99b31338a75d..8f1a30d86900 100644 --- a/stand/efi/libefi/Makefile +++ b/stand/efi/libefi/Makefile @@ -27,9 +27,10 @@ SRCS+= teken.c .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" SRCS+= time.c -.elif ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm" || \ - ${MACHINE_CPUARCH} == "riscv" +.elif ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "riscv" SRCS+= time_event.c +.elif ${MACHINE_CPUARCH} == "aarch64" +SRCS+= time_arm64.c .endif # We implement a slightly non-standard %S in that it always takes a diff --git a/stand/efi/libefi/time_arm64.c b/stand/efi/libefi/time_arm64.c new file mode 100644 index 000000000000..baa0f8bfa1ed --- /dev/null +++ b/stand/efi/libefi/time_arm64.c @@ -0,0 +1,72 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Andrew Turner + * + * This work was supported by Innovate UK project 105694, "Digital Security + * by Design (DSbD) Technology Platform Prototype". + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include + +#include + +static uint64_t timer_freq; + +void +efi_time_init(void) +{ + /* Find the timer frequency */ + timer_freq = READ_SPECIALREG(cntfrq_el0); +} + +void +efi_time_fini(void) +{ +} + +time_t +time(time_t *tloc) +{ + time_t t; + + t = READ_SPECIALREG(cntvct_el0) / timer_freq; + if (tloc != NULL) + *tloc = t; + + return (t); +} + +time_t +getsecs(void) +{ + return time(NULL); +} From owner-dev-commits-src-main@freebsd.org Wed Jun 2 11:17:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E02DF640474; Wed, 2 Jun 2021 11:17: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 4Fw61V5kkwz4s1l; Wed, 2 Jun 2021 11:17:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 ACF7215E66; Wed, 2 Jun 2021 11:17: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 152BH2fW026659; Wed, 2 Jun 2021 11:17:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152BH23c026658; Wed, 2 Jun 2021 11:17:02 GMT (envelope-from git) Date: Wed, 2 Jun 2021 11:17:02 GMT Message-Id: <202106021117.152BH23c026658@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 2422138952d8 - main - Fix the KCSAN_ENABLED check when building modules MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2422138952d86dd8b02ff33c55f747ca8e381afe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 11:17:03 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=2422138952d86dd8b02ff33c55f747ca8e381afe commit 2422138952d86dd8b02ff33c55f747ca8e381afe Author: Andrew Turner AuthorDate: 2021-06-02 10:07:55 +0000 Commit: Andrew Turner CommitDate: 2021-06-02 10:59:19 +0000 Fix the KCSAN_ENABLED check when building modules The KCSAN_ENABLED variable is non-empty when the kernel is being built with KCSAN. This allows us to disable modules that are known to be broken. There was a bug where we would check if it was defined. As this is always the case the KCSAN_ENABLED variable would be set when building modules so we would never build such a module. Fix this by checking if the value is empty before passing it on to the module stage. This doesn't affect how modules are built as the CFLAGS passed to modules has the correct check. Reported by: rstone Sponsored by: Innovate UK --- sys/conf/kern.post.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index 4e830b8f5115..bb25c7277d85 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -38,7 +38,7 @@ MKMODULESENV+= WITH_CTF="${WITH_CTF}" MKMODULESENV+= WITH_EXTRA_TCP_STACKS="${WITH_EXTRA_TCP_STACKS}" .endif -.if defined(KCSAN_ENABLED) +.if !empty(KCSAN_ENABLED) MKMODULESENV+= KCSAN_ENABLED="yes" .endif From owner-dev-commits-src-main@freebsd.org Wed Jun 2 13:43:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 02C55644144; Wed, 2 Jun 2021 13:43:16 +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 4Fw9GC6jKXz3NWV; Wed, 2 Jun 2021 13:43:15 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CE7DF17BB5; Wed, 2 Jun 2021 13:43:15 +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 152DhFWq025181; Wed, 2 Jun 2021 13:43:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152DhF9X025180; Wed, 2 Jun 2021 13:43:15 GMT (envelope-from git) Date: Wed, 2 Jun 2021 13:43:15 GMT Message-Id: <202106021343.152DhF9X025180@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: a19ae1b099ad - main - vfs: fix MNT_SYNCHRONOUS check in vn_write MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a19ae1b099ad4d43588f15ef19b8506f606b27cb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 13:43:16 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a19ae1b099ad4d43588f15ef19b8506f606b27cb commit a19ae1b099ad4d43588f15ef19b8506f606b27cb Author: Rich Ercolani AuthorDate: 2021-06-02 13:00:29 +0000 Commit: Mateusz Guzik CommitDate: 2021-06-02 13:42:02 +0000 vfs: fix MNT_SYNCHRONOUS check in vn_write ca1ce50b2b5ef11d ("vfs: add more safety against concurrent forced unmount to vn_write") has a side effect of only checking MNT_SYNCHRONOUS if O_FSYNC is set. Reviewed By: mjg Differential Revision: https://reviews.freebsd.org/D30610 --- sys/kern/vfs_vnops.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 019aefead0b3..fc5118e8aa24 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1123,11 +1123,12 @@ vn_write(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, ioflag |= IO_NDELAY; if (fp->f_flag & O_DIRECT) ioflag |= IO_DIRECT; - if (fp->f_flag & O_FSYNC) { - mp = atomic_load_ptr(&vp->v_mount); - if (mp != NULL && mp->mnt_flag & MNT_SYNCHRONOUS) - ioflag |= IO_SYNC; - } + + mp = atomic_load_ptr(&vp->v_mount); + if ((fp->f_flag & O_FSYNC) || + (mp != NULL && (mp->mnt_flag & MNT_SYNCHRONOUS))) + ioflag |= IO_SYNC; + /* * For O_DSYNC we set both IO_SYNC and IO_DATASYNC, so that VOP_WRITE() * implementations that don't understand IO_DATASYNC fall back to full From owner-dev-commits-src-main@freebsd.org Wed Jun 2 15:15:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A95FC6457D1; Wed, 2 Jun 2021 15:15:59 +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 4FwCKC3fQXz3lsT; Wed, 2 Jun 2021 15:15:59 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 553A219325; Wed, 2 Jun 2021 15:15:59 +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 152FFxYx045972; Wed, 2 Jun 2021 15:15:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152FFxxi045971; Wed, 2 Jun 2021 15:15:59 GMT (envelope-from git) Date: Wed, 2 Jun 2021 15:15:59 GMT Message-Id: <202106021515.152FFxxi045971@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: c9f8dcda856c - main - kqueue: replace kq_ncallouts loop with atomic_fetchadd MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c9f8dcda856c50325190326a618dc251311bc43a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 15:15:59 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=c9f8dcda856c50325190326a618dc251311bc43a commit c9f8dcda856c50325190326a618dc251311bc43a Author: Mateusz Guzik AuthorDate: 2021-06-02 15:14:58 +0000 Commit: Mateusz Guzik CommitDate: 2021-06-02 15:14:58 +0000 kqueue: replace kq_ncallouts loop with atomic_fetchadd --- sys/kern/kern_event.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index b224ce87087e..63b28cd6024f 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -206,7 +206,7 @@ static struct filterops user_filtops = { }; static uma_zone_t knote_zone; -static unsigned int kq_ncallouts = 0; +static unsigned int __exclusive_cache_line kq_ncallouts; static unsigned int kq_calloutmax = 4 * 1024; SYSCTL_UINT(_kern, OID_AUTO, kq_calloutmax, CTLFLAG_RW, &kq_calloutmax, 0, "Maximum number of callouts allocated for kqueue"); @@ -813,18 +813,16 @@ filt_timerattach(struct knote *kn) { struct kq_timer_cb_data *kc; sbintime_t to; - unsigned int ncallouts; int error; error = filt_timervalidate(kn, &to); if (error != 0) return (error); - do { - ncallouts = kq_ncallouts; - if (ncallouts >= kq_calloutmax) - return (ENOMEM); - } while (!atomic_cmpset_int(&kq_ncallouts, ncallouts, ncallouts + 1)); + if (atomic_fetchadd_int(&kq_ncallouts, 1) + 1 > kq_calloutmax) { + atomic_subtract_int(&kq_ncallouts, 1); + return (ENOMEM); + } if ((kn->kn_sfflags & NOTE_ABSTIME) == 0) kn->kn_flags |= EV_CLEAR; /* automatically set */ From owner-dev-commits-src-main@freebsd.org Wed Jun 2 16:34:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ADB8C646B98; Wed, 2 Jun 2021 16:34:29 +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 4FwF3n46SMz3t44; Wed, 2 Jun 2021 16:34:29 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7544A1A41C; Wed, 2 Jun 2021 16:34:29 +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 152GYTXF053453; Wed, 2 Jun 2021 16:34:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152GYTbp053452; Wed, 2 Jun 2021 16:34:29 GMT (envelope-from git) Date: Wed, 2 Jun 2021 16:34:29 GMT Message-Id: <202106021634.152GYTbp053452@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ceri Davies Subject: git: 774bb1c256fb - main - periodic: add support for .xz and .zcat compressed logs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ceri X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 774bb1c256fbc58a7e8d0d1f7d6427007105b334 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 16:34:29 -0000 The branch main has been updated by ceri (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=774bb1c256fbc58a7e8d0d1f7d6427007105b334 commit 774bb1c256fbc58a7e8d0d1f7d6427007105b334 Author: Ceri Davies AuthorDate: 2021-06-02 16:28:28 +0000 Commit: Ceri Davies CommitDate: 2021-06-02 16:28:28 +0000 periodic: add support for .xz and .zcat compressed logs Also improve temporary file usage in 200.accounting, add an xref to zstd(1) to newsyslog.conf.5, and clarify in periodic.conf that "daily accounting" means process accounting and "monthly accounting" is login accounting. PR: 253868 Reviewed by: allanjude Approved by: blackend (mentor) Differential Revision: https://reviews.freebsd.org/D29267 --- share/man/man5/periodic.conf.5 | 2 +- usr.sbin/newsyslog/newsyslog.conf.5 | 1 + .../periodic/etc/daily/460.status-mail-rejects | 6 +++++ usr.sbin/periodic/etc/monthly/200.accounting | 30 ++++++++++++++++------ usr.sbin/periodic/etc/security/800.loginfail | 2 ++ usr.sbin/periodic/etc/security/900.tcpwrap | 2 ++ 6 files changed, 34 insertions(+), 9 deletions(-) diff --git a/share/man/man5/periodic.conf.5 b/share/man/man5/periodic.conf.5 index 46174da2772a..ef80578e5372 100644 --- a/share/man/man5/periodic.conf.5 +++ b/share/man/man5/periodic.conf.5 @@ -365,7 +365,7 @@ daily. .Pq Vt bool Set to .Dq Li YES -if you want to rotate your daily accounting files. +if you want to rotate your daily process accounting files. No rotations are necessary unless .Va accounting_enable is enabled in diff --git a/usr.sbin/newsyslog/newsyslog.conf.5 b/usr.sbin/newsyslog/newsyslog.conf.5 index b897389b99dd..cf1a36305b00 100644 --- a/usr.sbin/newsyslog/newsyslog.conf.5 +++ b/usr.sbin/newsyslog/newsyslog.conf.5 @@ -415,6 +415,7 @@ entry: .Xr bzip2 1 , .Xr gzip 1 , .Xr xz 1 , +.Xr zstd 1 , .Xr syslog 3 , .Xr chown 8 , .Xr newsyslog 8 , diff --git a/usr.sbin/periodic/etc/daily/460.status-mail-rejects b/usr.sbin/periodic/etc/daily/460.status-mail-rejects index ce633640b6a4..6161a5525cc1 100755 --- a/usr.sbin/periodic/etc/daily/460.status-mail-rejects +++ b/usr.sbin/periodic/etc/daily/460.status-mail-rejects @@ -52,6 +52,12 @@ case "$daily_status_mail_rejects_enable" in elif [ -f /var/log/maillog.$n.bz2 ] then bzcat -fc /var/log/maillog.$n.bz2 + elif [ -f /var/log/maillog.$n.xz ] + then + xzcat -f /var/log/maillog.$n.xz + elif [ -f /var/log/maillog.$n.zst ] + then + zstdcat -fc /var/log/maillog.$n.zst fi n=$(($n - 1)) done diff --git a/usr.sbin/periodic/etc/monthly/200.accounting b/usr.sbin/periodic/etc/monthly/200.accounting index 46f153de535a..9d50ba182777 100755 --- a/usr.sbin/periodic/etc/monthly/200.accounting +++ b/usr.sbin/periodic/etc/monthly/200.accounting @@ -18,16 +18,30 @@ case "$monthly_accounting_enable" in W=/var/log/utx.log rc=0 remove=NO + filetoread=$W.0 if [ ! -f $W.0 ] then - if [ -f $W.0.gz ] + if [ -f $W.0.gz ] || [ -f $W.0.bz2 ] || [ -f $W.0.xz ] || [ -f $W.0.zst ] then + TMP=`mktemp -t accounting` remove=YES - zcat $W.0.gz > $W.0 || rc=1 - elif [ -f $W.0.bz2 ] - then - remove=YES - bzcat $W.0.bz2 > $W.0 || rc=1 + filetoread=$TMP + if [ -f $W.0.gz ] + then + zcat $W.0.gz > $TMP || rc=1 + elif [ -f $W.0.bz2 ] + then + bzcat $W.0.bz2 > $TMP || rc=1 + elif [ -f $W.0.xz ] + then + xzcat $W.0.xz > $TMP || rc=1 + elif [ -f $W.0.zst ] + then + zstdcat $W.0.zst > $TMP || rc=1 + else + # shouldn't get here, unless something disappeared under us. + rc=2 + fi else echo '$monthly_accounting_enable is set but' \ "$W.0 doesn't exist" @@ -39,10 +53,10 @@ case "$monthly_accounting_enable" in echo "" echo "Doing login accounting:" - rc=$(ac -p -w $W.0 | sort -nr -k 2 | tee /dev/stderr | wc -l) + rc=$(ac -p -w $filetoread | sort -nr -k 2 | tee /dev/stderr | wc -l) [ $rc -gt 0 ] && rc=1 fi - [ $remove = YES ] && rm -f $W.0;; + [ $remove = YES ] && rm -f $TMP;; *) rc=0;; esac diff --git a/usr.sbin/periodic/etc/security/800.loginfail b/usr.sbin/periodic/etc/security/800.loginfail index 4c78f441639a..ef169482001c 100755 --- a/usr.sbin/periodic/etc/security/800.loginfail +++ b/usr.sbin/periodic/etc/security/800.loginfail @@ -53,6 +53,8 @@ catmsgs() { case $f in *.gz) zcat -f $f;; *.bz2) bzcat -f $f;; + *.xz) xzcat -f $f;; + *.zst) zstdcat -f $f;; esac done [ -f ${LOG}/auth.log ] && cat $LOG/auth.log diff --git a/usr.sbin/periodic/etc/security/900.tcpwrap b/usr.sbin/periodic/etc/security/900.tcpwrap index 10b02e9e2bb6..b6c44126bc1c 100755 --- a/usr.sbin/periodic/etc/security/900.tcpwrap +++ b/usr.sbin/periodic/etc/security/900.tcpwrap @@ -53,6 +53,8 @@ catmsgs() { case $f in *.gz) zcat -f $f;; *.bz2) bzcat -f $f;; + *.xz) xzcat -f $f;; + *.zst) zstdcat -f $f;; esac done [ -f ${LOG}/messages ] && cat $LOG/messages From owner-dev-commits-src-main@freebsd.org Wed Jun 2 16:40:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A837E646E01; Wed, 2 Jun 2021 16:40:07 +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 4FwFBH4Njrz3tSJ; Wed, 2 Jun 2021 16:40:07 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7B2C31A26D; Wed, 2 Jun 2021 16:40:07 +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 152Ge7ug056746; Wed, 2 Jun 2021 16:40:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152Ge7pQ056744; Wed, 2 Jun 2021 16:40:07 GMT (envelope-from git) Date: Wed, 2 Jun 2021 16:40:07 GMT Message-Id: <202106021640.152Ge7pQ056744@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: e8dca53aa06e - main - kmod.mk: Allow extra objects to be specified in modules 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/main X-Git-Reftype: branch X-Git-Commit: e8dca53aa06ed7a06a83e666c4c303692f8fdbbe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 16:40:07 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e8dca53aa06ed7a06a83e666c4c303692f8fdbbe commit e8dca53aa06ed7a06a83e666c4c303692f8fdbbe Author: Warner Losh AuthorDate: 2021-06-02 16:35:01 +0000 Commit: Warner Losh CommitDate: 2021-06-02 16:39:58 +0000 kmod.mk: Allow extra objects to be specified in modules OBJS are automatically added to CLEANFILES. For pre-built objects, this is not desirable since it will delete the object from the source tree. Introduce EXTRA_OBJS which list these object files, but aren't added to clean files. Sponsored by: Netflix Reviewed by: emaste@ Differential Revision: https://reviews.freebsd.org/D30615 --- sys/conf/kmod.mk | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index c0d4441af029..c0ad352bf625 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -44,10 +44,12 @@ # # DESTDIR The tree where the module gets installed. [not set] # -# KERNBUILDDIR -# Set to the location of the kernel build directory where +# KERNBUILDDIR Set to the location of the kernel build directory where # the opt_*.h files, .o's and kernel winds up. # +# BLOB_OBJS Prebuilt binary blobs .o's from the src tree to be linked into +# the module. These are precious and not removed in make clean. +# # +++ targets +++ # # install: @@ -241,14 +243,14 @@ LDSCRIPT_FLAGS?= -T ${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH} .endif .if ${__KLD_SHARED} == yes -${KMOD}.kld: ${OBJS} +${KMOD}.kld: ${OBJS} ${BLOB_OBJS} .else -${FULLPROG}: ${OBJS} +${FULLPROG}: ${OBJS} ${BLOB_OBJS} .endif ${LD} -m ${LD_EMULATION} ${_LDFLAGS} ${LDSCRIPT_FLAGS} -r -d \ - -o ${.TARGET} ${OBJS} + -o ${.TARGET} ${OBJS} ${BLOB_OBJS} .if ${MK_CTF} != "no" - ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} + ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} ${BLOB_OBJS} .endif .if defined(EXPORT_SYMS) .if ${EXPORT_SYMS} != YES From owner-dev-commits-src-main@freebsd.org Wed Jun 2 16:40:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B6A69646C2E; Wed, 2 Jun 2021 16:40:08 +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 4FwFBJ4bp8z3tVK; Wed, 2 Jun 2021 16:40:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 85D2C1A424; Wed, 2 Jun 2021 16:40:08 +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 152Ge8K2056954; Wed, 2 Jun 2021 16:40:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152Ge8SG056952; Wed, 2 Jun 2021 16:40:08 GMT (envelope-from git) Date: Wed, 2 Jun 2021 16:40:08 GMT Message-Id: <202106021640.152Ge8SG056952@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 455dff72fcc2 - main - hpt27xx: Use EXTRA_OBJS instead of OBJS 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/main X-Git-Reftype: branch X-Git-Commit: 455dff72fcc260f758964d61f67dd1ba79e4889d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 16:40:08 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=455dff72fcc260f758964d61f67dd1ba79e4889d commit 455dff72fcc260f758964d61f67dd1ba79e4889d Author: Warner Losh AuthorDate: 2021-06-02 16:35:12 +0000 Commit: Warner Losh CommitDate: 2021-06-02 16:39:58 +0000 hpt27xx: Use EXTRA_OBJS instead of OBJS Sponsored by: Netflix Reviewed by: emaste@ Differential Revision: https://reviews.freebsd.org/D30616 --- sys/modules/hpt27xx/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/modules/hpt27xx/Makefile b/sys/modules/hpt27xx/Makefile index c0b4d7022033..f81652d2d55a 100644 --- a/sys/modules/hpt27xx/Makefile +++ b/sys/modules/hpt27xx/Makefile @@ -6,6 +6,6 @@ KMOD= hpt27xx SRCS= bus_if.h device_if.h pci_if.h SRCS+= opt_cam.h opt_scsi.h SRCS+= os_bsd.h hpt27xx_os_bsd.c hpt27xx_osm_bsd.c hpt27xx_config.c -OBJS+= ${HPT27XX}/$(MACHINE_ARCH)-elf.hpt27xx_lib.o +BLOB_OBJS+= ${HPT27XX}/$(MACHINE_ARCH)-elf.hpt27xx_lib.o .include From owner-dev-commits-src-main@freebsd.org Wed Jun 2 16:40:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBAB7646AC7; Wed, 2 Jun 2021 16:40:09 +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 4FwFBK5Z4Tz3tb7; Wed, 2 Jun 2021 16:40:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9A2191A425; Wed, 2 Jun 2021 16:40:09 +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 152Ge9Ef057166; Wed, 2 Jun 2021 16:40:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152Ge9xD057163; Wed, 2 Jun 2021 16:40:09 GMT (envelope-from git) Date: Wed, 2 Jun 2021 16:40:09 GMT Message-Id: <202106021640.152Ge9xD057163@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 22ed04c20391 - main - hptmv: use BLOB_OBJS for pre-built .o's 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/main X-Git-Reftype: branch X-Git-Commit: 22ed04c2039191f80f4a871909fbebf6766da5fd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 16:40:10 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=22ed04c2039191f80f4a871909fbebf6766da5fd commit 22ed04c2039191f80f4a871909fbebf6766da5fd Author: Warner Losh AuthorDate: 2021-06-02 16:35:21 +0000 Commit: Warner Losh CommitDate: 2021-06-02 16:39:58 +0000 hptmv: use BLOB_OBJS for pre-built .o's Sponsored by: Netflix --- sys/modules/hptmv/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/modules/hptmv/Makefile b/sys/modules/hptmv/Makefile index 22c011b16a41..5deca85de4de 100644 --- a/sys/modules/hptmv/Makefile +++ b/sys/modules/hptmv/Makefile @@ -11,7 +11,7 @@ KMOD= hptmv SRCS= opt_scsi.h opt_cam.h SRCS+= bus_if.h device_if.h pci_if.h SRCS+= mv.c entry.c ioctl.c hptproc.c gui_lib.c -OBJS+= ${HPTMV}/${MACHINE_CPUARCH}-elf.hptmvraid.o +BLOB_OBJS+= ${HPTMV}/${MACHINE_CPUARCH}-elf.hptmvraid.o # # Debug Options: From owner-dev-commits-src-main@freebsd.org Wed Jun 2 16:40:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16329646DF3; Wed, 2 Jun 2021 16:40:11 +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 4FwFBL6F8cz3tY2; Wed, 2 Jun 2021 16:40:10 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B12A21A26E; Wed, 2 Jun 2021 16:40:10 +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 152GeARt057373; Wed, 2 Jun 2021 16:40:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152GeAGO057370; Wed, 2 Jun 2021 16:40:10 GMT (envelope-from git) Date: Wed, 2 Jun 2021 16:40:10 GMT Message-Id: <202106021640.152GeAGO057370@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: adfe4271248c - main - hptnr: use BLOB_OBJS for pre-built .o's 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/main X-Git-Reftype: branch X-Git-Commit: adfe4271248cd5ff6f17e6604da354b1c2f0026c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 16:40:11 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=adfe4271248cd5ff6f17e6604da354b1c2f0026c commit adfe4271248cd5ff6f17e6604da354b1c2f0026c Author: Warner Losh AuthorDate: 2021-06-02 16:35:26 +0000 Commit: Warner Losh CommitDate: 2021-06-02 16:39:58 +0000 hptnr: use BLOB_OBJS for pre-built .o's Sponsored by: Netflix --- sys/modules/hptnr/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/modules/hptnr/Makefile b/sys/modules/hptnr/Makefile index c37bb182f49a..95f106e6a44e 100644 --- a/sys/modules/hptnr/Makefile +++ b/sys/modules/hptnr/Makefile @@ -6,6 +6,6 @@ KMOD= hptnr SRCS= bus_if.h device_if.h pci_if.h SRCS+= opt_cam.h opt_scsi.h SRCS+= os_bsd.h hptnr_os_bsd.c hptnr_osm_bsd.c hptnr_config.c -OBJS+= ${HPTNR}/${MACHINE_ARCH}-elf.hptnr_lib.o +BLOB_OBJS+= ${HPTNR}/${MACHINE_ARCH}-elf.hptnr_lib.o .include From owner-dev-commits-src-main@freebsd.org Wed Jun 2 17:13:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C84E7647A2C; Wed, 2 Jun 2021 17:13:20 +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 4FwFwc5CNSz3wHH; Wed, 2 Jun 2021 17:13:20 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 9AC001AB9D; Wed, 2 Jun 2021 17:13:20 +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 152HDK8m007828; Wed, 2 Jun 2021 17:13:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152HDKYY007827; Wed, 2 Jun 2021 17:13:20 GMT (envelope-from git) Date: Wed, 2 Jun 2021 17:13:20 GMT Message-Id: <202106021713.152HDKYY007827@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 7ef92163ab81 - main - Allows user to specify an optional ZFSBOOT_POOL_SIZE for their zroot 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/main X-Git-Reftype: branch X-Git-Commit: 7ef92163ab81b1b14f2a111d17baf2b352338577 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 17:13:20 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7ef92163ab81b1b14f2a111d17baf2b352338577 commit 7ef92163ab81b1b14f2a111d17baf2b352338577 Author: John Ko AuthorDate: 2021-06-02 17:12:14 +0000 Commit: Warner Losh CommitDate: 2021-06-02 17:12:14 +0000 Allows user to specify an optional ZFSBOOT_POOL_SIZE for their zroot The default is to create a zroot that consumes the whole disk because if used with geli(8) this makes sense. Without geli(8), I like to keep my data pool separate from my system pool. This is different than ZFSBOOT_BOOT_POOL_SIZE which is named bootpool. Reviewed by: allenjude Pull Request: https://github.com/freebsd/freebsd-src/pull/53 Differential Revision: https://reviews.freebsd.org/D30588 --- usr.sbin/bsdinstall/scripts/zfsboot | 46 ++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot index 3b673addb10a..45c8b001c393 100755 --- a/usr.sbin/bsdinstall/scripts/zfsboot +++ b/usr.sbin/bsdinstall/scripts/zfsboot @@ -44,6 +44,11 @@ f_include $BSDCFG_SHARE/variable.subr # : ${ZFSBOOT_POOL_NAME:=zroot} +# +# Default pool size is optional +# +: ${ZFSBOOT_POOL_SIZE=} + # # Default options to use when creating zroot pool # @@ -262,6 +267,7 @@ msg_install_help="Create ZFS boot pool with displayed options" msg_invalid_boot_pool_size="Invalid boot pool size \`%s'" msg_invalid_disk_argument="Invalid disk argument \`%s'" msg_invalid_index_argument="Invalid index argument \`%s'" +msg_invalid_pool_size="Invalid pool size \`%s'" msg_invalid_swap_size="Invalid swap size \`%s'" msg_invalid_virtual_device_type="Invalid Virtual Device type \`%s'" msg_last_chance_are_you_sure="Last Chance! Are you sure you want to destroy\nthe current contents of the following disks:\n\n %s" @@ -943,9 +949,15 @@ zfs_create_diskpart() # # 4. Add freebsd-zfs partition labeled `zfs#' for zroot # - f_eval_catch $funcname gpart "$GPART_ADD_ALIGN_LABEL" \ - "$align_big" zfs$index freebsd-zfs $disk || - return $FAILURE + if [ "$ZFSBOOT_POOL_SIZE" ]; then + f_eval_catch $funcname gpart "$GPART_ADD_ALIGN_LABEL_WITH_SIZE" \ + "$align_big" zfs$index freebsd-zfs $ZFSBOOT_POOL_SIZE $disk || + return $FAILURE + else + f_eval_catch $funcname gpart "$GPART_ADD_ALIGN_LABEL" \ + "$align_big" zfs$index freebsd-zfs $disk || + return $FAILURE + fi f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \ /dev/$disk$targetpart ;; @@ -1020,9 +1032,13 @@ zfs_create_diskpart() # # 5. Add freebsd-zfs partition for zroot # - f_eval_catch $funcname gpart "$GPART_ADD_ALIGN_INDEX" \ - "$align_small" $mbrindex freebsd-zfs ${disk}s1 || - return $FAILURE + if [ "$ZFSBOOT_POOL_SIZE" ]; then + f_eval_catch $funcname gpart "$GPART_ADD_ALIGN_INDEX_WITH_SIZE" \ + "$align_small" $mbrindex freebsd-zfs $ZFSBOOT_POOL_SIZE ${disk}s1 || return $FAILURE + else + f_eval_catch $funcname gpart "$GPART_ADD_ALIGN_INDEX" \ + "$align_small" $mbrindex freebsd-zfs ${disk}s1 || return $FAILURE + fi f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \ /dev/$disk$targetpart # Pedantic f_eval_catch $funcname dd "$DD_WITH_OPTIONS" \ @@ -1114,7 +1130,7 @@ zfs_create_boot() # Expand SI units in desired sizes # f_dprintf "$funcname: Expanding supplied size values..." - local swapsize bootsize + local swapsize bootsize poolsize if ! f_expand_number "$ZFSBOOT_SWAP_SIZE" swapsize; then f_dprintf "$funcname: Invalid swap size \`%s'" \ "$ZFSBOOT_SWAP_SIZE" @@ -1128,6 +1144,16 @@ zfs_create_boot() "$ZFSBOOT_BOOT_POOL_SIZE" return $FAILURE fi + if [ "$ZFSBOOT_POOL_SIZE" ]; then + if ! f_expand_number "$ZFSBOOT_POOL_SIZE" poolsize; then + f_dprintf "$funcname: Invalid pool size \`%s'" \ + "$ZFSBOOT_POOL_SIZE" + f_show_err "$msg_invalid_pool_size" \ + "$ZFSBOOT_POOL_SIZE" + fi + f_dprintf "$funcname: ZFSBOOT_POOL_SIZE=[%s] poolsize=[%s]" \ + "$ZFSBOOT_POOL_SIZE" "$poolsize" + fi f_dprintf "$funcname: ZFSBOOT_SWAP_SIZE=[%s] swapsize=[%s]" \ "$ZFSBOOT_SWAP_SIZE" "$swapsize" f_dprintf "$funcname: ZFSBOOT_BOOT_POOL_SIZE=[%s] bootsize=[%s]" \ @@ -1627,7 +1653,11 @@ while :; do f_expand_number "$ZFSBOOT_BOOT_POOL_SIZE" bootsize && f_expand_number "1g" zpoolmin then - minsize=$(( $swapsize + $zpoolmin )) teeny_disks= + minsize=$swapsize teeny_disks= + if [ "$ZFSBOOT_POOL_SIZE" ]; then + f_expand_number "$ZFSBOOT_POOL_SIZE" poolsize + minsize=$(( $minsize + $poolsize )) + fi [ "$ZFSBOOT_BOOT_POOL" ] && minsize=$(( $minsize + $bootsize )) for disk in $ZFSBOOT_DISKS; do From owner-dev-commits-src-main@freebsd.org Wed Jun 2 17:29:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E8E8647FC8; Wed, 2 Jun 2021 17:29:54 +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 4FwGHk2GW1z4S80; Wed, 2 Jun 2021 17:29:54 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 367411ACCA; Wed, 2 Jun 2021 17:29:54 +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 152HTsu2021786; Wed, 2 Jun 2021 17:29:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152HTsgr021785; Wed, 2 Jun 2021 17:29:54 GMT (envelope-from git) Date: Wed, 2 Jun 2021 17:29:54 GMT Message-Id: <202106021729.152HTsgr021785@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 1976e079544c - main - Add bcm2710-rpi-cm3.dtb to the list of DTBs being added. 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/main X-Git-Reftype: branch X-Git-Commit: 1976e079544c8ff691f2eec497d68611d8215af5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 17:29:54 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1976e079544c8ff691f2eec497d68611d8215af5 commit 1976e079544c8ff691f2eec497d68611d8215af5 Author: Max Stucchi AuthorDate: 2021-01-25 13:07:19 +0000 Commit: Warner Losh CommitDate: 2021-06-02 17:28:01 +0000 Add bcm2710-rpi-cm3.dtb to the list of DTBs being added. This allows to boot out of the box on the RPI COmpute Module 3 with 32G of eMMC. Tested by: imp confirmed .dtb is in the rpi-firmware pkg Reviewed by: gjb@, imp@ Pull Request: https://github.com/freebsd/freebsd-src/pull/452 Sponsored by: Netflix --- release/arm64/RPI.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/arm64/RPI.conf b/release/arm64/RPI.conf index e7fd12f95090..bce6236fbfae 100644 --- a/release/arm64/RPI.conf +++ b/release/arm64/RPI.conf @@ -4,7 +4,7 @@ # DTB_DIR="/usr/local/share/rpi-firmware" -DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb bcm2711-rpi-4-b.dtb" +DTB="bcm2710-rpi-2-b.dtb bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb bcm2710-rpi-cm3.dtb bcm2711-rpi-4-b.dtb" EMBEDDED_TARGET_ARCH="aarch64" EMBEDDED_TARGET="arm64" EMBEDDEDBUILD=1 From owner-dev-commits-src-main@freebsd.org Wed Jun 2 19:25:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3004264A270; Wed, 2 Jun 2021 19:25:12 +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 4FwJrm0j32z4bTh; Wed, 2 Jun 2021 19:25:12 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EF5E71C82A; Wed, 2 Jun 2021 19:25:11 +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 152JPBhg082779; Wed, 2 Jun 2021 19:25:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152JPBlJ082778; Wed, 2 Jun 2021 19:25:11 GMT (envelope-from git) Date: Wed, 2 Jun 2021 19:25:11 GMT Message-Id: <202106021925.152JPBlJ082778@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 4bc2174a1b48 - main - kern: fail getgroup and setgroup with negative int 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/main X-Git-Reftype: branch X-Git-Commit: 4bc2174a1b489c36195ccc8cfc15e0775b817c69 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 19:25:12 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4bc2174a1b489c36195ccc8cfc15e0775b817c69 commit 4bc2174a1b489c36195ccc8cfc15e0775b817c69 Author: Moritz Buhl AuthorDate: 2019-07-09 15:03:37 +0000 Commit: Warner Losh CommitDate: 2021-06-02 19:22:57 +0000 kern: fail getgroup and setgroup with negative int Found using https://github.com/NetBSD/src/blob/trunk/tests/lib/libc/sys/t_getgroups.c getgroups/setgroups want an int and therefore casting it to u_int resulted in `getgroups(-1, ...)` not returning -1 / errno = EINVAL. imp@ updated syscall.master and made changes markj@ suggested PR: 189941 Tested by: imp@ Reviewed by: markj@ Pull Request: https://github.com/freebsd/freebsd-src/pull/407 Differential Revision: https://reviews.freebsd.org/D30617 --- sys/kern/kern_prot.c | 12 +++++------- sys/kern/syscalls.master | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index a107c7cced95..647acfa60681 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -288,7 +288,7 @@ sys_getegid(struct thread *td, struct getegid_args *uap) #ifndef _SYS_SYSPROTO_H_ struct getgroups_args { - u_int gidsetsize; + int gidsetsize; gid_t *gidset; }; #endif @@ -296,8 +296,7 @@ int sys_getgroups(struct thread *td, struct getgroups_args *uap) { struct ucred *cred; - u_int ngrp; - int error; + int ngrp, error; cred = td->td_ucred; ngrp = cred->cr_ngroups; @@ -791,7 +790,7 @@ fail: #ifndef _SYS_SYSPROTO_H_ struct setgroups_args { - u_int gidsetsize; + int gidsetsize; gid_t *gidset; }; #endif @@ -801,11 +800,10 @@ sys_setgroups(struct thread *td, struct setgroups_args *uap) { gid_t smallgroups[XU_NGROUPS]; gid_t *groups; - u_int gidsetsize; - int error; + int gidsetsize, error; gidsetsize = uap->gidsetsize; - if (gidsetsize > ngroups_max + 1) + if (gidsetsize > ngroups_max + 1 || gidsetsize < 0) return (EINVAL); if (gidsetsize > XU_NGROUPS) diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master index 95317d413209..69a82d642d79 100644 --- a/sys/kern/syscalls.master +++ b/sys/kern/syscalls.master @@ -523,13 +523,13 @@ } 79 AUE_GETGROUPS STD { int getgroups( - u_int gidsetsize, + int gidsetsize, _Out_writes_opt_(gidsetsize) gid_t *gidset ); } 80 AUE_SETGROUPS STD { int setgroups( - u_int gidsetsize, + int gidsetsize, _In_reads_(gidsetsize) gid_t *gidset ); } From owner-dev-commits-src-main@freebsd.org Wed Jun 2 19:25:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 84F0C649FFA; Wed, 2 Jun 2021 19:25:13 +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 4FwJrn1lk0z4bPq; Wed, 2 Jun 2021 19:25:13 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1AD6A1C636; Wed, 2 Jun 2021 19:25:13 +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 152JPCf7082802; Wed, 2 Jun 2021 19:25:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152JPCbh082801; Wed, 2 Jun 2021 19:25:12 GMT (envelope-from git) Date: Wed, 2 Jun 2021 19:25:12 GMT Message-Id: <202106021925.152JPCbh082801@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: bf26ea775539 - main - t_getgroups: No longer expected to fail 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/main X-Git-Reftype: branch X-Git-Commit: bf26ea77553931c22e72ddf1f9df6fb51fcbadfe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 19:25:13 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=bf26ea77553931c22e72ddf1f9df6fb51fcbadfe commit bf26ea77553931c22e72ddf1f9df6fb51fcbadfe Author: Warner Losh AuthorDate: 2021-06-02 18:02:56 +0000 Commit: Warner Losh CommitDate: 2021-06-02 19:24:47 +0000 t_getgroups: No longer expected to fail Sponsored by: Netflix --- contrib/netbsd-tests/lib/libc/sys/t_getgroups.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/contrib/netbsd-tests/lib/libc/sys/t_getgroups.c b/contrib/netbsd-tests/lib/libc/sys/t_getgroups.c index 7dedca445288..9a8ec8ede271 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_getgroups.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_getgroups.c @@ -57,9 +57,6 @@ ATF_TC_BODY(getgroups_err, tc) errno = 0; -#ifdef __FreeBSD__ - atf_tc_expect_fail("Reported as kern/189941"); -#endif ATF_REQUIRE(getgroups(-1, gidset) == -1); ATF_REQUIRE(errno == EINVAL); } From owner-dev-commits-src-main@freebsd.org Wed Jun 2 19:25:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 696AB649E35; Wed, 2 Jun 2021 19:25:14 +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 4FwJrp2QQ6z4bXV; Wed, 2 Jun 2021 19:25:14 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 36EEC1C82B; Wed, 2 Jun 2021 19:25:14 +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 152JPEcG082825; Wed, 2 Jun 2021 19:25:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152JPE5E082824; Wed, 2 Jun 2021 19:25:14 GMT (envelope-from git) Date: Wed, 2 Jun 2021 19:25:14 GMT Message-Id: <202106021925.152JPE5E082824@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 9f3d1a98dd17 - main - regen after tweaks to getgroups and setgroups 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/main X-Git-Reftype: branch X-Git-Commit: 9f3d1a98dd17b9f02912aecab328fd0315d8ef35 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 19:25:14 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9f3d1a98dd17b9f02912aecab328fd0315d8ef35 commit 9f3d1a98dd17b9f02912aecab328fd0315d8ef35 Author: Warner Losh AuthorDate: 2021-06-02 18:06:13 +0000 Commit: Warner Losh CommitDate: 2021-06-02 19:24:50 +0000 regen after tweaks to getgroups and setgroups Sponsored by: Netflix --- sys/kern/systrace_args.c | 8 ++++---- sys/sys/sysproto.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/kern/systrace_args.c b/sys/kern/systrace_args.c index 68fe1eff8769..8f8274b1cdac 100644 --- a/sys/kern/systrace_args.c +++ b/sys/kern/systrace_args.c @@ -470,7 +470,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* getgroups */ case 79: { struct getgroups_args *p = params; - uarg[0] = p->gidsetsize; /* u_int */ + iarg[0] = p->gidsetsize; /* int */ uarg[1] = (intptr_t)p->gidset; /* gid_t * */ *n_args = 2; break; @@ -478,7 +478,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) /* setgroups */ case 80: { struct setgroups_args *p = params; - uarg[0] = p->gidsetsize; /* u_int */ + iarg[0] = p->gidsetsize; /* int */ uarg[1] = (intptr_t)p->gidset; /* gid_t * */ *n_args = 2; break; @@ -4122,7 +4122,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 79: switch (ndx) { case 0: - p = "u_int"; + p = "int"; break; case 1: p = "userland gid_t *"; @@ -4135,7 +4135,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 80: switch (ndx) { case 0: - p = "u_int"; + p = "int"; break; case 1: p = "userland gid_t *"; diff --git a/sys/sys/sysproto.h b/sys/sys/sysproto.h index 66060ab77f9a..83b74f53df5e 100644 --- a/sys/sys/sysproto.h +++ b/sys/sys/sysproto.h @@ -284,11 +284,11 @@ struct mincore_args { char vec_l_[PADL_(char *)]; char * vec; char vec_r_[PADR_(char *)]; }; struct getgroups_args { - char gidsetsize_l_[PADL_(u_int)]; u_int gidsetsize; char gidsetsize_r_[PADR_(u_int)]; + char gidsetsize_l_[PADL_(int)]; int gidsetsize; char gidsetsize_r_[PADR_(int)]; char gidset_l_[PADL_(gid_t *)]; gid_t * gidset; char gidset_r_[PADR_(gid_t *)]; }; struct setgroups_args { - char gidsetsize_l_[PADL_(u_int)]; u_int gidsetsize; char gidsetsize_r_[PADR_(u_int)]; + char gidsetsize_l_[PADL_(int)]; int gidsetsize; char gidsetsize_r_[PADR_(int)]; char gidset_l_[PADL_(gid_t *)]; gid_t * gidset; char gidset_r_[PADR_(gid_t *)]; }; struct getpgrp_args { From owner-dev-commits-src-main@freebsd.org Wed Jun 2 19:28:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63DB464A3C4; Wed, 2 Jun 2021 19:28:21 +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 4FwJwP2MYgz4c8y; Wed, 2 Jun 2021 19:28:21 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 350C91C76D; Wed, 2 Jun 2021 19:28:21 +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 152JSLhh083192; Wed, 2 Jun 2021 19:28:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152JSLJP083191; Wed, 2 Jun 2021 19:28:21 GMT (envelope-from git) Date: Wed, 2 Jun 2021 19:28:21 GMT Message-Id: <202106021928.152JSLJP083191@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Leandro Lupori Subject: git: 4a66b8083cc6 - main - powerpc: fix boot on pseries without hugepages MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4a66b8083cc61e89ffdddaae876d882950d6aade Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 19:28:21 -0000 The branch main has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=4a66b8083cc61e89ffdddaae876d882950d6aade commit 4a66b8083cc61e89ffdddaae876d882950d6aade Author: Leandro Lupori AuthorDate: 2021-06-02 19:10:57 +0000 Commit: Leandro Lupori CommitDate: 2021-06-02 19:27:36 +0000 powerpc: fix boot on pseries without hugepages Commit 49c894ddced5 introduced an issue that prevented pseries boot, when hugepages were not available to the guest. Now large page info must be available before moea64_install is called, so this change moves the code that scans large page sizes before the call. Reviewed by: jhibbits (IRC) Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) --- sys/powerpc/pseries/mmu_phyp.c | 83 +++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 41 deletions(-) diff --git a/sys/powerpc/pseries/mmu_phyp.c b/sys/powerpc/pseries/mmu_phyp.c index d94fb2aa5ae1..5769f0db5572 100644 --- a/sys/powerpc/pseries/mmu_phyp.c +++ b/sys/powerpc/pseries/mmu_phyp.c @@ -106,6 +106,7 @@ static struct moea64_funcs mmu_phyp_funcs = { MMU_DEF_INHERIT(pseries_mmu, "mmu_phyp", mphyp_methods, oea64_mmu); static int brokenkvm = 0; +static uint64_t final_pteg_count = 0; static void print_kvm_bug_warning(void *data) @@ -125,48 +126,32 @@ SYSINIT(kvmbugwarn2, SI_SUB_LAST, SI_ORDER_THIRD + 1, print_kvm_bug_warning, static void mphyp_install() { - - moea64_ops = &mmu_phyp_funcs; - - moea64_install(); -} - -static void -mphyp_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend) -{ - uint64_t final_pteg_count = 0; char buf[8]; uint32_t prop[2]; uint32_t nptlp, shift = 0, slb_encoding = 0; uint32_t lp_size, lp_encoding; - struct lpte old; - uint64_t vsid; phandle_t dev, node, root; int idx, len, res; bool has_lp; - rm_init(&mphyp_eviction_lock, "pte eviction"); - - moea64_early_bootstrap(kernelstart, kernelend); - root = OF_peer(0); - dev = OF_child(root); + dev = OF_child(root); while (dev != 0) { - res = OF_getprop(dev, "name", buf, sizeof(buf)); - if (res > 0 && strcmp(buf, "cpus") == 0) - break; - dev = OF_peer(dev); - } + res = OF_getprop(dev, "name", buf, sizeof(buf)); + if (res > 0 && strcmp(buf, "cpus") == 0) + break; + dev = OF_peer(dev); + } node = OF_child(dev); while (node != 0) { - res = OF_getprop(node, "device_type", buf, sizeof(buf)); - if (res > 0 && strcmp(buf, "cpu") == 0) - break; - node = OF_peer(node); - } + res = OF_getprop(node, "device_type", buf, sizeof(buf)); + if (res > 0 && strcmp(buf, "cpu") == 0) + break; + node = OF_peer(node); + } res = OF_getencprop(node, "ibm,pft-size", prop, sizeof(prop)); if (res <= 0) @@ -177,20 +162,6 @@ mphyp_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend) n_slbs = prop[0]; dprintf0("slb-size=%i\n", n_slbs); - moea64_pteg_count = final_pteg_count / sizeof(struct lpteg); - - /* Clear any old page table entries */ - for (idx = 0; idx < moea64_pteg_count*8; idx++) { - phyp_pft_hcall(H_READ, 0, idx, 0, 0, &old.pte_hi, - &old.pte_lo, &old.pte_lo); - vsid = (old.pte_hi << (ADDR_API_SHFT64 - ADDR_PIDX_SHFT)) >> 28; - if (vsid == VSID_VRMA || vsid == 0 /* Older VRMA */) - continue; - - if (old.pte_hi & LPTE_VALID) - phyp_hcall(H_REMOVE, 0, idx, 0); - } - /* * Scan the large page size property for PAPR compatible machines. * See PAPR D.5 Changes to Section 5.1.4, 'CPU Node Properties' @@ -264,6 +235,36 @@ mphyp_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend) } } + moea64_ops = &mmu_phyp_funcs; + + moea64_install(); +} + +static void +mphyp_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend) +{ + struct lpte old; + uint64_t vsid; + int idx; + + rm_init(&mphyp_eviction_lock, "pte eviction"); + + moea64_early_bootstrap(kernelstart, kernelend); + + moea64_pteg_count = final_pteg_count / sizeof(struct lpteg); + + /* Clear any old page table entries */ + for (idx = 0; idx < moea64_pteg_count*8; idx++) { + phyp_pft_hcall(H_READ, 0, idx, 0, 0, &old.pte_hi, + &old.pte_lo, &old.pte_lo); + vsid = (old.pte_hi << (ADDR_API_SHFT64 - ADDR_PIDX_SHFT)) >> 28; + if (vsid == VSID_VRMA || vsid == 0 /* Older VRMA */) + continue; + + if (old.pte_hi & LPTE_VALID) + phyp_hcall(H_REMOVE, 0, idx, 0); + } + moea64_mid_bootstrap(kernelstart, kernelend); moea64_late_bootstrap(kernelstart, kernelend); From owner-dev-commits-src-main@freebsd.org Wed Jun 2 21:00:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 616BF64B8E5; Wed, 2 Jun 2021 21:00:29 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FwLyh1chTz4n1X; Wed, 2 Jun 2021 21:00:28 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-ej1-f47.google.com with SMTP id k25so381903eja.9; Wed, 02 Jun 2021 14:00:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1vla06XCedsm1nJ1NNIYiDfaKXKtc+eVbmuLmwG3w2Y=; b=An+jeliY2aezifeVCGXv9M9x8SCHY+xmV0GxQIP0HE/EW4Xj3JeYmXsDLvuVkJVxCO lNOL4V9a9ssvmJZFhr7v6BvPxbzGwQGG74zEgwVucF8XcSyNZjn3tvrBhCMAjIXtU3Qj ++OW1nUJyR9XtYawOmN838mGT5i240Nbc5PbdJ2lgBCwYwQm/KWL5AzzkFY9fSfsT7+7 GwyvXwa3L1WYX9nAdMRHuL2h0N4ewBb0wtnmrmpaMU4/B8/CW6GO38QKW4GBjPPkKXYB PWVkOnK4HqTPXHHpFDuTD7tgtqZB9QtVosNctS2ETsee6ptvfE9xg9yrfV1NVGRxn8b9 2+ig== X-Gm-Message-State: AOAM530wekRlfDXTEAjMpl61fNYxJ+R+f22DCPpwZluaYHD9QZYZXiB7 qGDhqUmsT0+kc6SFSVFFvUpTcjKi7GjiBg== X-Google-Smtp-Source: ABdhPJz8xPnRLsUdgqE1bN4P/zxRDbCKzlHDaYjrsMhySdf+qq2JSM1e1httUGX9XXHX1DUMbAhKTg== X-Received: by 2002:a17:906:f111:: with SMTP id gv17mr19477577ejb.435.1622667625459; Wed, 02 Jun 2021 14:00:25 -0700 (PDT) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com. [209.85.128.48]) by smtp.gmail.com with ESMTPSA id ho32sm485156ejc.82.2021.06.02.14.00.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Jun 2021 14:00:25 -0700 (PDT) Received: by mail-wm1-f48.google.com with SMTP id m18so2143303wmq.0; Wed, 02 Jun 2021 14:00:25 -0700 (PDT) X-Received: by 2002:a7b:c042:: with SMTP id u2mr33195429wmc.127.1622667624826; Wed, 02 Jun 2021 14:00:24 -0700 (PDT) MIME-Version: 1.0 References: <202105291459.14TExadZ056959@gitrepo.freebsd.org> In-Reply-To: <202105291459.14TExadZ056959@gitrepo.freebsd.org> From: Alexander Richardson Date: Wed, 2 Jun 2021 22:00:13 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: d81f999ac223 - main - rtld direct exec: add option to ignore LD_ variables To: Konstantin Belousov Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4FwLyh1chTz4n1X X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of arichardsonkde@gmail.com designates 209.85.218.47 as permitted sender) smtp.mailfrom=arichardsonkde@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; RCVD_COUNT_THREE(0.00)[4]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[arichardson@freebsd.org,arichardsonkde@gmail.com]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[arichardson@freebsd.org,arichardsonkde@gmail.com]; TAGGED_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.218.47:from]; SPAMHAUS_ZRD(0.00)[209.85.218.47:from:127.0.2.255]; RCVD_IN_DNSWL_NONE(0.00)[209.85.218.47:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.218.47:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 21:00:29 -0000 On Sat, 29 May 2021 at 15:59, Konstantin Belousov wrote: > > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=d81f999ac22342789f2b3e21206d83d410be4df3 > > commit d81f999ac22342789f2b3e21206d83d410be4df3 > Author: Konstantin Belousov > AuthorDate: 2021-05-28 23:59:07 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-05-29 14:59:09 +0000 > > rtld direct exec: add option to ignore LD_ variables > > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > --- > libexec/rtld-elf/rtld.1 | 10 +++++++++- > libexec/rtld-elf/rtld.c | 3 +++ > 2 files changed, 12 insertions(+), 1 deletion(-) > > diff --git a/libexec/rtld-elf/rtld.1 b/libexec/rtld-elf/rtld.1 > index 7f633ce0b486..16466c7a853e 100644 > --- a/libexec/rtld-elf/rtld.1 > +++ b/libexec/rtld-elf/rtld.1 > @@ -28,7 +28,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd March 24, 2021 > +.Dd May 29, 2021 > .Dt RTLD 1 > .Os > .Sh NAME > @@ -131,6 +131,7 @@ all the environment variables listed below, but is being prefixed with > .Ev LD_32_ , > for example: > .Ev LD_32_TRACE_LOADED_OBJECTS . > +If the activated image is setuid or setgid, the variables are ignored. > .Bl -tag -width ".Ev LD_LIBMAP_DISABLE" > .It Ev LD_DUMP_REL_POST > If set, > @@ -313,6 +314,8 @@ The syntax of the direct invocation is > .Op Fl b Ar exe > .Op Fl f Ar fd > .Op Fl p > +.Op Fl t > +.Op Fl v > .Op Fl - > .Pa image_path > .Op Ar image arguments > @@ -353,6 +356,11 @@ character, > uses the search path provided by the environment variable > .Dv PATH > to find the binary to execute. > +.It Fl t > +Ignore all > +.Ev LD_ > +environment variables that otherwise affect the dynamic > +linker behavior. > .It Fl v > Display information about this run-time linker binary, then exit. > .It Fl - > diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c > index 75c502e8cc85..a517de83b8f5 100644 > --- a/libexec/rtld-elf/rtld.c > +++ b/libexec/rtld-elf/rtld.c > @@ -5793,6 +5793,8 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp, > break; > } else if (opt == 'p') { > *use_pathp = true; > + } else if (opt == 't') { > + trust = false; Hi, In CheriBSD I used the -t flag to set ld_tracing = "yes" (we used this in ldd). I've been meaning to submit this as a review, but haven't got around to it yet. How do you feel about using "-u" for "untrusted" or "-i" for "ignore" here instead of "-t"? Thanks, Alex > } else if (opt == 'v') { > machine[0] = '\0'; > mib[0] = CTL_HW; > @@ -5863,6 +5865,7 @@ print_usage(const char *argv0) > " -b Execute instead of , arg0 is \n" > " -f Execute instead of searching for \n" > " -p Search in PATH for named binary\n" > + " -t Ignore LD_ environment variables\n" > " -v Display identification information\n" > " -- End of RTLD options\n" > " Name of process to execute\n" From owner-dev-commits-src-main@freebsd.org Wed Jun 2 21:37:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52EEA64C22F; Wed, 2 Jun 2021 21:37: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 4FwMns1kdFz4r5g; Wed, 2 Jun 2021 21:37:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2134A1E1C7; Wed, 2 Jun 2021 21:37:53 +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 152Lbqma054570; Wed, 2 Jun 2021 21:37:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152LbqFA054569; Wed, 2 Jun 2021 21:37:52 GMT (envelope-from git) Date: Wed, 2 Jun 2021 21:37:52 GMT Message-Id: <202106022137.152LbqFA054569@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: e5be21d19b41 - main - sbin/veriexec: fixed parameter parsing of option -x 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/main X-Git-Reftype: branch X-Git-Commit: e5be21d19b41e4d42ffea5c7978d7e64a5cec4fc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 21:37:53 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e5be21d19b41e4d42ffea5c7978d7e64a5cec4fc commit e5be21d19b41e4d42ffea5c7978d7e64a5cec4fc Author: sebastien.bini AuthorDate: 2020-10-20 14:52:16 +0000 Commit: Warner Losh CommitDate: 2021-06-02 21:37:51 +0000 sbin/veriexec: fixed parameter parsing of option -x The -x parameter doesn't take any arguments. It says that all further arguments are paths to check. Reviewed by: imp@ Sponsored by: Netflix Pull Request: https://github.com/freebsd/freebsd-src/pull/443/files --- sbin/veriexec/veriexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/veriexec/veriexec.c b/sbin/veriexec/veriexec.c index b9299efaad02..c1facbd4a9fa 100644 --- a/sbin/veriexec/veriexec.c +++ b/sbin/veriexec/veriexec.c @@ -70,7 +70,7 @@ main(int argc, char *argv[]) dev_fd = open(_PATH_DEV_VERIEXEC, O_WRONLY, 0); - while ((c = getopt(argc, argv, "C:i:x:vz:")) != -1) { + while ((c = getopt(argc, argv, "C:i:xvz:")) != -1) { switch (c) { case 'C': Cdir = optarg; From owner-dev-commits-src-main@freebsd.org Wed Jun 2 21:56:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12F5464C706; Wed, 2 Jun 2021 21:56:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4FwNBq3sYxz4rkN; Wed, 2 Jun 2021 21:56:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 152LtlMM045720 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 3 Jun 2021 00:55:50 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 152LtlMM045720 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 152Ltl6r045719; Thu, 3 Jun 2021 00:55:47 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 3 Jun 2021 00:55:47 +0300 From: Konstantin Belousov To: Alexander Richardson Cc: src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: d81f999ac223 - main - rtld direct exec: add option to ignore LD_ variables Message-ID: References: <202105291459.14TExadZ056959@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4FwNBq3sYxz4rkN X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 21:56:04 -0000 On Wed, Jun 02, 2021 at 10:00:13PM +0100, Alexander Richardson wrote: > On Sat, 29 May 2021 at 15:59, Konstantin Belousov wrote: > > > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=d81f999ac22342789f2b3e21206d83d410be4df3 > > > > commit d81f999ac22342789f2b3e21206d83d410be4df3 > > Author: Konstantin Belousov > > AuthorDate: 2021-05-28 23:59:07 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2021-05-29 14:59:09 +0000 > > > > rtld direct exec: add option to ignore LD_ variables > > > > Sponsored by: The FreeBSD Foundation > > MFC after: 1 week > > --- > > libexec/rtld-elf/rtld.1 | 10 +++++++++- > > libexec/rtld-elf/rtld.c | 3 +++ > > 2 files changed, 12 insertions(+), 1 deletion(-) > > > > diff --git a/libexec/rtld-elf/rtld.1 b/libexec/rtld-elf/rtld.1 > > index 7f633ce0b486..16466c7a853e 100644 > > --- a/libexec/rtld-elf/rtld.1 > > +++ b/libexec/rtld-elf/rtld.1 > > @@ -28,7 +28,7 @@ > > .\" > > .\" $FreeBSD$ > > .\" > > -.Dd March 24, 2021 > > +.Dd May 29, 2021 > > .Dt RTLD 1 > > .Os > > .Sh NAME > > @@ -131,6 +131,7 @@ all the environment variables listed below, but is being prefixed with > > .Ev LD_32_ , > > for example: > > .Ev LD_32_TRACE_LOADED_OBJECTS . > > +If the activated image is setuid or setgid, the variables are ignored. > > .Bl -tag -width ".Ev LD_LIBMAP_DISABLE" > > .It Ev LD_DUMP_REL_POST > > If set, > > @@ -313,6 +314,8 @@ The syntax of the direct invocation is > > .Op Fl b Ar exe > > .Op Fl f Ar fd > > .Op Fl p > > +.Op Fl t > > +.Op Fl v > > .Op Fl - > > .Pa image_path > > .Op Ar image arguments > > @@ -353,6 +356,11 @@ character, > > uses the search path provided by the environment variable > > .Dv PATH > > to find the binary to execute. > > +.It Fl t > > +Ignore all > > +.Ev LD_ > > +environment variables that otherwise affect the dynamic > > +linker behavior. > > .It Fl v > > Display information about this run-time linker binary, then exit. > > .It Fl - > > diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c > > index 75c502e8cc85..a517de83b8f5 100644 > > --- a/libexec/rtld-elf/rtld.c > > +++ b/libexec/rtld-elf/rtld.c > > @@ -5793,6 +5793,8 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp, > > break; > > } else if (opt == 'p') { > > *use_pathp = true; > > + } else if (opt == 't') { > > + trust = false; > > Hi, > > In CheriBSD I used the -t flag to set ld_tracing = "yes" (we used this > in ldd). I've been meaning to submit this as a review, but haven't got > around to it yet. How do you feel about using "-u" for "untrusted" or > "-i" for "ignore" here instead of "-t"? I am fine with renaming it to -u. I will do it slightly later. From owner-dev-commits-src-main@freebsd.org Wed Jun 2 22:03:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3B6964C7A2; Wed, 2 Jun 2021 22:03:58 +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 4FwNMy42ZYz4sCh; Wed, 2 Jun 2021 22:03:58 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6F3811E5BD; Wed, 2 Jun 2021 22:03:58 +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 152M3wgf094569; Wed, 2 Jun 2021 22:03:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152M3wIO094568; Wed, 2 Jun 2021 22:03:58 GMT (envelope-from git) Date: Wed, 2 Jun 2021 22:03:58 GMT Message-Id: <202106022203.152M3wIO094568@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: e61e072f3bdf - main - gconcat: Switch array to TAILQ to prepare for online append 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/main X-Git-Reftype: branch X-Git-Commit: e61e072f3bdfd2016b87c255c9bdc880bb1aa2f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 22:03:58 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e61e072f3bdfd2016b87c255c9bdc880bb1aa2f9 commit e61e072f3bdfd2016b87c255c9bdc880bb1aa2f9 Author: Noah Bergbauer AuthorDate: 2020-12-27 21:01:37 +0000 Commit: Warner Losh CommitDate: 2021-06-02 21:50:27 +0000 gconcat: Switch array to TAILQ to prepare for online append Reviewed by: imp@ Pull Request: https://github.com/freebsd/freebsd-src/pull/447 Sponsored by: Netflix --- sys/geom/concat/g_concat.c | 70 +++++++++++++++++++++++++--------------------- sys/geom/concat/g_concat.h | 3 +- 2 files changed, 40 insertions(+), 33 deletions(-) diff --git a/sys/geom/concat/g_concat.c b/sys/geom/concat/g_concat.c index dfa7b97a1806..b3f912a3013c 100644 --- a/sys/geom/concat/g_concat.c +++ b/sys/geom/concat/g_concat.c @@ -102,11 +102,12 @@ lcm(u_int a, u_int b) static u_int g_concat_nvalid(struct g_concat_softc *sc) { - u_int i, no; + u_int no; + struct g_concat_disk *disk; no = 0; - for (i = 0; i < sc->sc_ndisks; i++) { - if (sc->sc_disks[i].d_consumer != NULL) + TAILQ_FOREACH(disk, &sc->sc_disks, d_next) { + if (disk->d_consumer != NULL) no++; } @@ -210,15 +211,14 @@ g_concat_candelete(struct bio *bp) { struct g_concat_softc *sc; struct g_concat_disk *disk; - int i, val; + int val; sc = bp->bio_to->geom->softc; - for (i = 0; i < sc->sc_ndisks; i++) { - disk = &sc->sc_disks[i]; + TAILQ_FOREACH(disk, &sc->sc_disks, d_next) { if (!disk->d_removed && disk->d_candelete) break; } - val = i < sc->sc_ndisks; + val = disk != NULL; g_handleattr(bp, "GEOM::candelete", &val, sizeof(val)); } @@ -229,20 +229,19 @@ g_concat_kernel_dump(struct bio *bp) struct g_concat_disk *disk; struct bio *cbp; struct g_kerneldump *gkd; - u_int i; sc = bp->bio_to->geom->softc; gkd = (struct g_kerneldump *)bp->bio_data; - for (i = 0; i < sc->sc_ndisks; i++) { - if (sc->sc_disks[i].d_start <= gkd->offset && - sc->sc_disks[i].d_end > gkd->offset) + TAILQ_FOREACH(disk, &sc->sc_disks, d_next) { + if (disk->d_start <= gkd->offset && + disk->d_end > gkd->offset) break; } - if (i == sc->sc_ndisks) { + if (disk == NULL) { g_io_deliver(bp, EOPNOTSUPP); return; } - disk = &sc->sc_disks[i]; + gkd->offset -= disk->d_start; if (gkd->length > disk->d_end - disk->d_start - gkd->offset) gkd->length = disk->d_end - disk->d_start - gkd->offset; @@ -287,10 +286,10 @@ g_concat_passdown(struct g_concat_softc *sc, struct bio *bp) struct bio_queue_head queue; struct g_consumer *cp; struct bio *cbp; - u_int no; + struct g_concat_disk *disk; bioq_init(&queue); - for (no = 0; no < sc->sc_ndisks; no++) { + TAILQ_FOREACH(disk, &sc->sc_disks, d_next) { cbp = g_clone_bio(bp); if (cbp == NULL) { while ((cbp = bioq_takefirst(&queue)) != NULL) @@ -302,8 +301,8 @@ g_concat_passdown(struct g_concat_softc *sc, struct bio *bp) } bioq_insert_tail(&queue, cbp); cbp->bio_done = g_concat_done; - cbp->bio_caller1 = sc->sc_disks[no].d_consumer; - cbp->bio_to = sc->sc_disks[no].d_consumer->provider; + cbp->bio_caller1 = disk->d_consumer; + cbp->bio_to = disk->d_consumer->provider; } while ((cbp = bioq_takefirst(&queue)) != NULL) { G_CONCAT_LOGREQ(cbp, "Sending request."); @@ -323,7 +322,6 @@ g_concat_start(struct bio *bp) off_t offset, end, length, off, len; struct bio *cbp; char *addr; - u_int no; pp = bp->bio_to; sc = pp->geom->softc; @@ -370,8 +368,7 @@ g_concat_start(struct bio *bp) end = offset + length; bioq_init(&queue); - for (no = 0; no < sc->sc_ndisks; no++) { - disk = &sc->sc_disks[no]; + TAILQ_FOREACH(disk, &sc->sc_disks, d_next) { if (disk->d_end <= offset) continue; if (disk->d_start >= end) @@ -432,7 +429,7 @@ g_concat_check_and_run(struct g_concat_softc *sc) { struct g_concat_disk *disk; struct g_provider *dp, *pp; - u_int no, sectorsize = 0; + u_int sectorsize = 0; off_t start; int error; @@ -444,8 +441,7 @@ g_concat_check_and_run(struct g_concat_softc *sc) pp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE | G_PF_ACCEPT_UNMAPPED; start = 0; - for (no = 0; no < sc->sc_ndisks; no++) { - disk = &sc->sc_disks[no]; + TAILQ_FOREACH(disk, &sc->sc_disks, d_next) { dp = disk->d_consumer->provider; disk->d_start = start; disk->d_end = disk->d_start + dp->mediasize; @@ -462,7 +458,7 @@ g_concat_check_and_run(struct g_concat_softc *sc) } else G_CONCAT_DEBUG(1, "Failed to access disk %s, error %d.", dp->name, error); - if (no == 0) + if (disk == TAILQ_FIRST(&sc->sc_disks)) sectorsize = dp->sectorsize; else sectorsize = lcm(sectorsize, dp->sectorsize); @@ -477,8 +473,9 @@ g_concat_check_and_run(struct g_concat_softc *sc) pp->sectorsize = sectorsize; /* We have sc->sc_disks[sc->sc_ndisks - 1].d_end in 'start'. */ pp->mediasize = start; - pp->stripesize = sc->sc_disks[0].d_consumer->provider->stripesize; - pp->stripeoffset = sc->sc_disks[0].d_consumer->provider->stripeoffset; + dp = TAILQ_FIRST(&sc->sc_disks)->d_consumer->provider; + pp->stripesize = dp->stripesize; + pp->stripeoffset = dp->stripeoffset; sc->sc_provider = pp; g_error_provider(pp, 0); @@ -529,7 +526,10 @@ g_concat_add_disk(struct g_concat_softc *sc, struct g_provider *pp, u_int no) if (no >= sc->sc_ndisks) return (EINVAL); - disk = &sc->sc_disks[no]; + for (disk = TAILQ_FIRST(&sc->sc_disks); no > 0; no--) { + disk = TAILQ_NEXT(disk, d_next); + } + /* Check if disk is not already attached. */ if (disk->d_consumer != NULL) return (EEXIST); @@ -594,6 +594,7 @@ g_concat_create(struct g_class *mp, const struct g_concat_metadata *md, u_int type) { struct g_concat_softc *sc; + struct g_concat_disk *disk; struct g_geom *gp; u_int no; @@ -623,10 +624,11 @@ g_concat_create(struct g_class *mp, const struct g_concat_metadata *md, sc->sc_id = md->md_id; sc->sc_ndisks = md->md_all; - sc->sc_disks = malloc(sizeof(struct g_concat_disk) * sc->sc_ndisks, - M_CONCAT, M_WAITOK | M_ZERO); - for (no = 0; no < sc->sc_ndisks; no++) - sc->sc_disks[no].d_consumer = NULL; + TAILQ_INIT(&sc->sc_disks); + for (no = 0; no < sc->sc_ndisks; no++) { + disk = malloc(sizeof(*disk), M_CONCAT, M_WAITOK | M_ZERO); + TAILQ_INSERT_TAIL(&sc->sc_disks, disk, d_next); + } sc->sc_type = type; mtx_init(&sc->sc_lock, "gconcat lock", NULL, MTX_DEF); @@ -645,6 +647,7 @@ g_concat_destroy(struct g_concat_softc *sc, boolean_t force) struct g_provider *pp; struct g_consumer *cp, *cp1; struct g_geom *gp; + struct g_concat_disk *disk; g_topology_assert(); @@ -676,7 +679,10 @@ g_concat_destroy(struct g_concat_softc *sc, boolean_t force) gp->softc = NULL; KASSERT(sc->sc_provider == NULL, ("Provider still exists? (device=%s)", gp->name)); - free(sc->sc_disks, M_CONCAT); + while ((disk = TAILQ_FIRST(&sc->sc_disks)) != NULL) { + TAILQ_REMOVE(&sc->sc_disks, disk, d_next); + free(disk, M_CONCAT); + } mtx_destroy(&sc->sc_lock); free(sc, M_CONCAT); diff --git a/sys/geom/concat/g_concat.h b/sys/geom/concat/g_concat.h index 32e60b1b4cb2..31fb45d73f5a 100644 --- a/sys/geom/concat/g_concat.h +++ b/sys/geom/concat/g_concat.h @@ -55,6 +55,7 @@ _GEOM_DEBUG("GEOM_CONCAT", g_concat_debug, 2, (bp), __VA_ARGS__) struct g_concat_disk { + TAILQ_ENTRY(g_concat_disk) d_next; struct g_consumer *d_consumer; struct g_concat_softc *d_softc; off_t d_start; @@ -69,9 +70,9 @@ struct g_concat_softc { struct g_provider *sc_provider; uint32_t sc_id; /* concat unique ID */ - struct g_concat_disk *sc_disks; uint16_t sc_ndisks; struct mtx sc_lock; + TAILQ_HEAD(g_concat_disks, g_concat_disk) sc_disks; }; #define sc_name sc_geom->name #endif /* _KERNEL */ From owner-dev-commits-src-main@freebsd.org Wed Jun 2 22:03:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6C6D64C8FA; Wed, 2 Jun 2021 22:03:59 +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 4FwNMz501rz4s7W; Wed, 2 Jun 2021 22:03:59 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8EB641EB0D; Wed, 2 Jun 2021 22:03:59 +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 152M3x8N094590; Wed, 2 Jun 2021 22:03:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152M3xeo094589; Wed, 2 Jun 2021 22:03:59 GMT (envelope-from git) Date: Wed, 2 Jun 2021 22:03:59 GMT Message-Id: <202106022203.152M3xeo094589@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 56fd97660ac4 - main - gconcat: Add new lock to allow modifications to the disk list in preparation for online append 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/main X-Git-Reftype: branch X-Git-Commit: 56fd97660ac44aacd502dff6e2580d0259146e42 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 22:03:59 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=56fd97660ac44aacd502dff6e2580d0259146e42 commit 56fd97660ac44aacd502dff6e2580d0259146e42 Author: Noah Bergbauer AuthorDate: 2020-12-27 21:04:45 +0000 Commit: Warner Losh CommitDate: 2021-06-02 21:59:25 +0000 gconcat: Add new lock to allow modifications to the disk list in preparation for online append In addition, rename existing sc_lock to sc_append_lock Reviewed by: imp@ Pull Request: https://github.com/freebsd/freebsd-src/pull/447 Sponsored by: Netflix --- sys/geom/concat/g_concat.c | 62 ++++++++++++++++++++++++++++++++++++---------- sys/geom/concat/g_concat.h | 4 ++- 2 files changed, 52 insertions(+), 14 deletions(-) diff --git a/sys/geom/concat/g_concat.c b/sys/geom/concat/g_concat.c index b3f912a3013c..3cbf50a7af1a 100644 --- a/sys/geom/concat/g_concat.c +++ b/sys/geom/concat/g_concat.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -105,6 +106,8 @@ g_concat_nvalid(struct g_concat_softc *sc) u_int no; struct g_concat_disk *disk; + sx_assert(&sc->sc_disks_lock, SA_LOCKED); + no = 0; TAILQ_FOREACH(disk, &sc->sc_disks, d_next) { if (disk->d_consumer != NULL) @@ -173,10 +176,12 @@ g_concat_access(struct g_provider *pp, int dr, int dw, int de) struct g_consumer *cp1, *cp2, *tmp; struct g_concat_disk *disk; struct g_geom *gp; + struct g_concat_softc *sc; int error; g_topology_assert(); gp = pp->geom; + sc = gp->softc; /* On first open, grab an extra "exclusive" bit */ if (pp->acr == 0 && pp->acw == 0 && pp->ace == 0) @@ -185,6 +190,7 @@ g_concat_access(struct g_provider *pp, int dr, int dw, int de) if ((pp->acr + dr) == 0 && (pp->acw + dw) == 0 && (pp->ace + de) == 0) de--; + sx_slock(&sc->sc_disks_lock); LIST_FOREACH_SAFE(cp1, &gp->consumer, consumer, tmp) { error = g_access(cp1, dr, dw, de); if (error != 0) @@ -195,9 +201,11 @@ g_concat_access(struct g_provider *pp, int dr, int dw, int de) g_concat_remove_disk(disk); /* May destroy geom. */ } } + sx_sunlock(&sc->sc_disks_lock); return (0); fail: + sx_sunlock(&sc->sc_disks_lock); LIST_FOREACH(cp2, &gp->consumer, consumer) { if (cp1 == cp2) break; @@ -214,6 +222,7 @@ g_concat_candelete(struct bio *bp) int val; sc = bp->bio_to->geom->softc; + sx_assert(&sc->sc_disks_lock, SX_LOCKED); TAILQ_FOREACH(disk, &sc->sc_disks, d_next) { if (!disk->d_removed && disk->d_candelete) break; @@ -264,16 +273,16 @@ g_concat_done(struct bio *bp) pbp = bp->bio_parent; sc = pbp->bio_to->geom->softc; - mtx_lock(&sc->sc_lock); + mtx_lock(&sc->sc_completion_lock); if (pbp->bio_error == 0) pbp->bio_error = bp->bio_error; pbp->bio_completed += bp->bio_completed; pbp->bio_inbed++; if (pbp->bio_children == pbp->bio_inbed) { - mtx_unlock(&sc->sc_lock); + mtx_unlock(&sc->sc_completion_lock); g_io_deliver(pbp, pbp->bio_error); } else - mtx_unlock(&sc->sc_lock); + mtx_unlock(&sc->sc_completion_lock); g_destroy_bio(bp); } @@ -288,6 +297,8 @@ g_concat_passdown(struct g_concat_softc *sc, struct bio *bp) struct bio *cbp; struct g_concat_disk *disk; + sx_assert(&sc->sc_disks_lock, SX_LOCKED); + bioq_init(&queue); TAILQ_FOREACH(disk, &sc->sc_disks, d_next) { cbp = g_clone_bio(bp); @@ -334,6 +345,7 @@ g_concat_start(struct bio *bp) bp->bio_to->error, bp->bio_to->name)); G_CONCAT_LOGREQ(bp, "Request received."); + sx_slock(&sc->sc_disks_lock); switch (bp->bio_cmd) { case BIO_READ: @@ -343,20 +355,20 @@ g_concat_start(struct bio *bp) case BIO_SPEEDUP: case BIO_FLUSH: g_concat_passdown(sc, bp); - return; + goto end; case BIO_GETATTR: if (strcmp("GEOM::kerneldump", bp->bio_attribute) == 0) { g_concat_kernel_dump(bp); - return; + goto end; } else if (strcmp("GEOM::candelete", bp->bio_attribute) == 0) { g_concat_candelete(bp); - return; + goto end; } /* To which provider it should be delivered? */ /* FALLTHROUGH */ default: g_io_deliver(bp, EOPNOTSUPP); - return; + goto end; } offset = bp->bio_offset; @@ -386,7 +398,7 @@ g_concat_start(struct bio *bp) if (bp->bio_error == 0) bp->bio_error = ENOMEM; g_io_deliver(bp, bp->bio_error); - return; + goto end; } bioq_insert_tail(&queue, cbp); /* @@ -422,6 +434,8 @@ g_concat_start(struct bio *bp) cbp->bio_caller1 = NULL; g_io_request(cbp, disk->d_consumer); } +end: + sx_sunlock(&sc->sc_disks_lock); } static void @@ -522,17 +536,24 @@ g_concat_add_disk(struct g_concat_softc *sc, struct g_provider *pp, u_int no) int error; g_topology_assert(); + + sx_slock(&sc->sc_disks_lock); + /* Metadata corrupted? */ - if (no >= sc->sc_ndisks) + if (no >= sc->sc_ndisks) { + sx_sunlock(&sc->sc_disks_lock); return (EINVAL); + } for (disk = TAILQ_FIRST(&sc->sc_disks); no > 0; no--) { disk = TAILQ_NEXT(disk, d_next); } /* Check if disk is not already attached. */ - if (disk->d_consumer != NULL) + if (disk->d_consumer != NULL) { + sx_sunlock(&sc->sc_disks_lock); return (EEXIST); + } gp = sc->sc_geom; fcp = LIST_FIRST(&gp->consumer); @@ -541,6 +562,7 @@ g_concat_add_disk(struct g_concat_softc *sc, struct g_provider *pp, u_int no) cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; error = g_attach(cp, pp); if (error != 0) { + sx_sunlock(&sc->sc_disks_lock); g_destroy_consumer(cp); return (error); } @@ -548,6 +570,7 @@ g_concat_add_disk(struct g_concat_softc *sc, struct g_provider *pp, u_int no) if (fcp != NULL && (fcp->acr > 0 || fcp->acw > 0 || fcp->ace > 0)) { error = g_access(cp, fcp->acr, fcp->acw, fcp->ace); if (error != 0) { + sx_sunlock(&sc->sc_disks_lock); g_detach(cp); g_destroy_consumer(cp); return (error); @@ -556,8 +579,13 @@ g_concat_add_disk(struct g_concat_softc *sc, struct g_provider *pp, u_int no) if (sc->sc_type == G_CONCAT_TYPE_AUTOMATIC) { struct g_concat_metadata md; + // temporarily give up the lock to avoid lock order violation + // due to topology unlock in g_concat_read_metadata + sx_sunlock(&sc->sc_disks_lock); /* Re-read metadata. */ error = g_concat_read_metadata(cp, &md); + sx_slock(&sc->sc_disks_lock); + if (error != 0) goto fail; @@ -579,9 +607,11 @@ g_concat_add_disk(struct g_concat_softc *sc, struct g_provider *pp, u_int no) G_CONCAT_DEBUG(0, "Disk %s attached to %s.", pp->name, sc->sc_name); g_concat_check_and_run(sc); + sx_sunlock(&sc->sc_disks_lock); // need lock for check_and_run return (0); fail: + sx_sunlock(&sc->sc_disks_lock); if (fcp != NULL && (fcp->acr > 0 || fcp->acw > 0 || fcp->ace > 0)) g_access(cp, -fcp->acr, -fcp->acw, -fcp->ace); g_detach(cp); @@ -630,7 +660,8 @@ g_concat_create(struct g_class *mp, const struct g_concat_metadata *md, TAILQ_INSERT_TAIL(&sc->sc_disks, disk, d_next); } sc->sc_type = type; - mtx_init(&sc->sc_lock, "gconcat lock", NULL, MTX_DEF); + mtx_init(&sc->sc_completion_lock, "gconcat lock", NULL, MTX_DEF); + sx_init(&sc->sc_disks_lock, "gconcat append lock"); gp->softc = sc; sc->sc_geom = gp; @@ -683,7 +714,8 @@ g_concat_destroy(struct g_concat_softc *sc, boolean_t force) TAILQ_REMOVE(&sc->sc_disks, disk, d_next); free(disk, M_CONCAT); } - mtx_destroy(&sc->sc_lock); + mtx_destroy(&sc->sc_completion_lock); + sx_destroy(&sc->sc_disks_lock); free(sc, M_CONCAT); G_CONCAT_DEBUG(0, "Device %s destroyed.", gp->name); @@ -990,6 +1022,8 @@ g_concat_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, sc = gp->softc; if (sc == NULL) return; + + sx_slock(&sc->sc_disks_lock); if (pp != NULL) { /* Nothing here. */ } else if (cp != NULL) { @@ -997,7 +1031,7 @@ g_concat_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, disk = cp->private; if (disk == NULL) - return; + goto end; sbuf_printf(sb, "%s%jd\n", indent, (intmax_t)disk->d_end); sbuf_printf(sb, "%s%jd\n", indent, @@ -1026,6 +1060,8 @@ g_concat_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, sbuf_cat(sb, "DOWN"); sbuf_cat(sb, "\n"); } +end: + sx_sunlock(&sc->sc_disks_lock); } DECLARE_GEOM_CLASS(g_concat_class, g_concat); diff --git a/sys/geom/concat/g_concat.h b/sys/geom/concat/g_concat.h index 31fb45d73f5a..23adf2c7b5e0 100644 --- a/sys/geom/concat/g_concat.h +++ b/sys/geom/concat/g_concat.h @@ -71,8 +71,10 @@ struct g_concat_softc { uint32_t sc_id; /* concat unique ID */ uint16_t sc_ndisks; - struct mtx sc_lock; TAILQ_HEAD(g_concat_disks, g_concat_disk) sc_disks; + + struct mtx sc_completion_lock; /* synchronizes cross-boundary IOs */ + struct sx sc_disks_lock; /* synchronizes modification of sc_disks */ }; #define sc_name sc_geom->name #endif /* _KERNEL */ From owner-dev-commits-src-main@freebsd.org Wed Jun 2 22:31:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5FDC564D169; Wed, 2 Jun 2021 22:31:33 +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 4FwNzn272Dz4twL; Wed, 2 Jun 2021 22:31:33 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2D4671EE97; Wed, 2 Jun 2021 22:31:33 +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 152MVXcm029457; Wed, 2 Jun 2021 22:31:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152MVXi9029456; Wed, 2 Jun 2021 22:31:33 GMT (envelope-from git) Date: Wed, 2 Jun 2021 22:31:33 GMT Message-Id: <202106022231.152MVXi9029456@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 984c71f90300 - main - nfsd: Fix the failure return for non-fh NFSv4 operations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 984c71f90300906e106b9714af0e7d9b542c50e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 22:31:33 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=984c71f90300906e106b9714af0e7d9b542c50e6 commit 984c71f90300906e106b9714af0e7d9b542c50e6 Author: Rick Macklem AuthorDate: 2021-06-02 22:28:07 +0000 Commit: Rick Macklem CommitDate: 2021-06-02 22:28:07 +0000 nfsd: Fix the failure return for non-fh NFSv4 operations Without this patch, nfsd_checkrootexp() returns failure and then the NFSv4 operation would reply NFSERR_WRONGSEC. RFC5661 Sec. 2.6 only allows a few NFSv4 operations, none of which call nfsv4_checktootexp(), to return NFSERR_WRONGSEC. This patch modifies nfsd_checkrootexp() to return the error instead of a boolean and sets the returned error to an RPC layer AUTH_ERR, as discussed on nfsv4@ietf.org. The patch also fixes nfsd_errmap() so that the pseudo error NFSERR_AUTHERR is handled correctly such that an RPC layer AUTH_ERR is replied to the NFSv4 client. The two new "enum auth_stat" values have not yet been assigned by IANA, but are the expected next two values. The effect on extant NFSv4 clients of this change appears limited to reporting a different failure error when a mount that does not use adequate security is attempted. MFC after: 2 weeks --- sys/fs/nfsserver/nfs_nfsdserv.c | 45 ++++++++++------------------------------- sys/fs/nfsserver/nfs_nfsdsubs.c | 11 ++++++++-- sys/rpc/auth.h | 5 +++++ 3 files changed, 25 insertions(+), 36 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 329c096c7570..f4d6dbe42a21 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$"); extern u_int32_t newnfs_false, newnfs_true; extern enum vtype nv34tov_type[8]; extern struct timeval nfsboottime; -extern int nfs_rootfhset; extern int nfsrv_enable_crossmntpt; extern int nfsrv_statehashsize; extern int nfsrv_layouthashsize; @@ -3360,10 +3359,8 @@ nfsrvd_delegpurge(struct nfsrv_descript *nd, __unused int isdgram, nfsquad_t clientid; struct thread *p = curthread; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; + if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) goto nfsmout; - } NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED); clientid.lval[0] = *tl++; clientid.lval[1] = *tl; @@ -3625,10 +3622,8 @@ nfsrvd_renew(struct nfsrv_descript *nd, __unused int isdgram, nd->nd_repstat = NFSERR_NOTSUPP; goto nfsmout; } - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; + if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) goto nfsmout; - } NFSM_DISSECT(tl, u_int32_t *, NFSX_HYPER); clientid.lval[0] = *tl++; clientid.lval[1] = *tl; @@ -3893,10 +3888,8 @@ nfsrvd_setclientid(struct nfsrv_descript *nd, __unused int isdgram, nd->nd_repstat = NFSERR_NOTSUPP; goto nfsmout; } - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; + if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) goto out; - } NFSM_DISSECT(tl, u_int32_t *, NFSX_VERF + NFSX_UNSIGNED); verf = (u_char *)tl; tl += (NFSX_VERF / NFSX_UNSIGNED); @@ -4048,10 +4041,8 @@ nfsrvd_setclientidcfrm(struct nfsrv_descript *nd, nd->nd_repstat = NFSERR_NOTSUPP; goto nfsmout; } - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; + if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) goto nfsmout; - } NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_HYPER); clientid.lval[0] = *tl++; clientid.lval[1] = *tl++; @@ -4146,10 +4137,8 @@ nfsrvd_releaselckown(struct nfsrv_descript *nd, __unused int isdgram, nd->nd_repstat = NFSERR_NOTSUPP; goto nfsmout; } - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; + if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) goto nfsmout; - } NFSM_DISSECT(tl, u_int32_t *, 3 * NFSX_UNSIGNED); len = fxdr_unsigned(int, *(tl + 2)); if (len <= 0 || len > NFSV4_OPAQUELIMIT) { @@ -4213,10 +4202,8 @@ nfsrvd_exchangeid(struct nfsrv_descript *nd, __unused int isdgram, #endif struct thread *p = curthread; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; + if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) goto nfsmout; - } NFSM_DISSECT(tl, u_int32_t *, NFSX_VERF + NFSX_UNSIGNED); verf = (uint8_t *)tl; tl += (NFSX_VERF / NFSX_UNSIGNED); @@ -4370,10 +4357,8 @@ nfsrvd_createsession(struct nfsrv_descript *nd, __unused int isdgram, uint32_t rdmacnt; struct thread *p = curthread; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; + if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) goto nfsmout; - } sep = (struct nfsdsession *)malloc(sizeof(struct nfsdsession), M_NFSDSESSION, M_WAITOK | M_ZERO); sep->sess_refcnt = 1; @@ -4481,10 +4466,8 @@ nfsrvd_sequence(struct nfsrv_descript *nd, __unused int isdgram, int cache_this, error = 0; struct thread *p = curthread; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; + if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_V4SESSIONID); NFSBCOPY(tl, nd->nd_sessionid, NFSX_V4SESSIONID); NFSM_DISSECT(tl, uint32_t *, 4 * NFSX_UNSIGNED); @@ -4554,10 +4537,8 @@ nfsrvd_destroyclientid(struct nfsrv_descript *nd, __unused int isdgram, int error = 0; struct thread *p = curthread; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; + if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED); clientid.lval[0] = *tl++; clientid.lval[1] = *tl; @@ -4578,10 +4559,8 @@ nfsrvd_bindconnsess(struct nfsrv_descript *nd, __unused int isdgram, uint8_t sessid[NFSX_V4SESSIONID]; int error = 0, foreaft; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; + if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) goto nfsmout; - } NFSM_DISSECT(tl, uint32_t *, NFSX_V4SESSIONID + 2 * NFSX_UNSIGNED); NFSBCOPY(tl, sessid, NFSX_V4SESSIONID); tl += (NFSX_V4SESSIONID / NFSX_UNSIGNED); @@ -4616,10 +4595,8 @@ nfsrvd_destroysession(struct nfsrv_descript *nd, __unused int isdgram, uint8_t *cp, sessid[NFSX_V4SESSIONID]; int error = 0; - if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) { - nd->nd_repstat = NFSERR_WRONGSEC; + if ((nd->nd_repstat = nfsd_checkrootexp(nd)) != 0) goto nfsmout; - } NFSM_DISSECT(cp, uint8_t *, NFSX_V4SESSIONID); NFSBCOPY(cp, sessid, NFSX_V4SESSIONID); nd->nd_repstat = nfsrv_destroysession(nd, sessid); diff --git a/sys/fs/nfsserver/nfs_nfsdsubs.c b/sys/fs/nfsserver/nfs_nfsdsubs.c index 8c7db36bbd05..8c3e748a290f 100644 --- a/sys/fs/nfsserver/nfs_nfsdsubs.c +++ b/sys/fs/nfsserver/nfs_nfsdsubs.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include extern u_int32_t newnfs_true, newnfs_false; +extern int nfs_rootfhset; extern int nfs_pubfhset; extern struct nfsclienthashhead *nfsclienthash; extern int nfsrv_clienthashsize; @@ -1543,6 +1544,8 @@ nfsd_errmap(struct nfsrv_descript *nd) if (!nd->nd_repstat) return (0); + if ((nd->nd_repstat & NFSERR_AUTHERR) != 0) + return (txdr_unsigned(NFSERR_ACCES)); if (nd->nd_flag & (ND_NFSV3 | ND_NFSV4)) { if (nd->nd_procnum == NFSPROC_NOOP) return (txdr_unsigned(nd->nd_repstat & 0xffff)); @@ -2116,6 +2119,8 @@ int nfsd_checkrootexp(struct nfsrv_descript *nd) { + if (nfs_rootfhset == 0) + return (NFSERR_AUTHERR | AUTH_FAILED); if ((nd->nd_flag & (ND_GSS | ND_EXAUTHSYS)) == ND_EXAUTHSYS) goto checktls; if ((nd->nd_flag & (ND_GSSINTEGRITY | ND_EXGSSINTEGRITY)) == @@ -2127,7 +2132,7 @@ nfsd_checkrootexp(struct nfsrv_descript *nd) if ((nd->nd_flag & (ND_GSS | ND_GSSINTEGRITY | ND_GSSPRIVACY | ND_EXGSS)) == (ND_GSS | ND_EXGSS)) goto checktls; - return (1); + return (NFSERR_AUTHERR | AUTH_TOOWEAK); checktls: if ((nd->nd_flag & ND_EXTLS) == 0) return (0); @@ -2140,7 +2145,9 @@ checktls: if ((nd->nd_flag & (ND_TLS | ND_EXTLSCERTUSER | ND_EXTLSCERT)) == ND_TLS) return (0); - return (1); + if ((nd->nd_flag & ND_TLS) == 0) + return (NFSERR_AUTHERR | AUTH_NEEDS_TLS); + return (NFSERR_AUTHERR | AUTH_NEEDS_TLS_MUTUAL_HOST); } /* diff --git a/sys/rpc/auth.h b/sys/rpc/auth.h index a426a34c3747..fd56b33da52e 100644 --- a/sys/rpc/auth.h +++ b/sys/rpc/auth.h @@ -150,6 +150,11 @@ enum auth_stat { */ RPCSEC_GSS_CREDPROBLEM = 13, RPCSEC_GSS_CTXPROBLEM = 14, + /* + * RPC-over-TLS errors + */ + AUTH_NEEDS_TLS = 15, + AUTH_NEEDS_TLS_MUTUAL_HOST = 16, /* Also used by RPCSEC_TLS for the same purpose */ RPCSEC_GSS_NODISPATCH = 0x8000000 }; From owner-dev-commits-src-main@freebsd.org Wed Jun 2 22:55:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 249A764D3CC; Wed, 2 Jun 2021 22:55: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 4FwPWK6cvBz3CV9; Wed, 2 Jun 2021 22:55:25 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C40F41EF6E; Wed, 2 Jun 2021 22:55:25 +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 152MtPUK060447; Wed, 2 Jun 2021 22:55:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152MtPX2060446; Wed, 2 Jun 2021 22:55:25 GMT (envelope-from git) Date: Wed, 2 Jun 2021 22:55:25 GMT Message-Id: <202106022255.152MtPX2060446@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: e3149e0a02d6 - main - rtld: Rename -t option to -u (ignore LD_ vars) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e3149e0a02d6d09fb4c3acd085da2509dbab7320 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 22:55:26 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e3149e0a02d6d09fb4c3acd085da2509dbab7320 commit e3149e0a02d6d09fb4c3acd085da2509dbab7320 Author: Konstantin Belousov AuthorDate: 2021-06-02 22:50:49 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-02 22:55:08 +0000 rtld: Rename -t option to -u (ignore LD_ vars) Requested by: arichardson Sponsored by: The FreeBSD Foundation MFC after: 3 days --- libexec/rtld-elf/rtld.1 | 6 +++--- libexec/rtld-elf/rtld.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libexec/rtld-elf/rtld.1 b/libexec/rtld-elf/rtld.1 index 16466c7a853e..2d262f77aa13 100644 --- a/libexec/rtld-elf/rtld.1 +++ b/libexec/rtld-elf/rtld.1 @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 29, 2021 +.Dd June 2, 2021 .Dt RTLD 1 .Os .Sh NAME @@ -314,7 +314,7 @@ The syntax of the direct invocation is .Op Fl b Ar exe .Op Fl f Ar fd .Op Fl p -.Op Fl t +.Op Fl u .Op Fl v .Op Fl - .Pa image_path @@ -356,7 +356,7 @@ character, uses the search path provided by the environment variable .Dv PATH to find the binary to execute. -.It Fl t +.It Fl u Ignore all .Ev LD_ environment variables that otherwise affect the dynamic diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index a517de83b8f5..9897248bffbb 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -5793,7 +5793,7 @@ parse_args(char* argv[], int argc, bool *use_pathp, int *fdp, break; } else if (opt == 'p') { *use_pathp = true; - } else if (opt == 't') { + } else if (opt == 'u') { trust = false; } else if (opt == 'v') { machine[0] = '\0'; @@ -5865,7 +5865,7 @@ print_usage(const char *argv0) " -b Execute instead of , arg0 is \n" " -f Execute instead of searching for \n" " -p Search in PATH for named binary\n" - " -t Ignore LD_ environment variables\n" + " -u Ignore LD_ environment variables\n" " -v Display identification information\n" " -- End of RTLD options\n" " Name of process to execute\n" From owner-dev-commits-src-main@freebsd.org Wed Jun 2 23:08:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7813B64D07D; Wed, 2 Jun 2021 23:08:25 +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 4FwPpK2p9xz3CRD; Wed, 2 Jun 2021 23:08:25 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3C79E1F663; Wed, 2 Jun 2021 23:08:25 +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 152N8Ovg074480; Wed, 2 Jun 2021 23:08:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152N8OCc074479; Wed, 2 Jun 2021 23:08:24 GMT (envelope-from git) Date: Wed, 2 Jun 2021 23:08:24 GMT Message-Id: <202106022308.152N8OCc074479@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jung-uk Kim Subject: git: 29cd0d72008e - main - hptrr: use BLOB_OBJS for pre-built .o's MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 29cd0d72008ec4c0048fb0ca8c506d9e58c3dde3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 23:08:25 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=29cd0d72008ec4c0048fb0ca8c506d9e58c3dde3 commit 29cd0d72008ec4c0048fb0ca8c506d9e58c3dde3 Author: Jung-uk Kim AuthorDate: 2021-06-02 23:07:38 +0000 Commit: Jung-uk Kim CommitDate: 2021-06-02 23:07:38 +0000 hptrr: use BLOB_OBJS for pre-built .o's --- sys/modules/hptrr/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/modules/hptrr/Makefile b/sys/modules/hptrr/Makefile index 4ab595ce13a4..dd463ea27c68 100644 --- a/sys/modules/hptrr/Makefile +++ b/sys/modules/hptrr/Makefile @@ -6,6 +6,6 @@ HPTRR= ${SRCTOP}/sys/dev/hptrr KMOD = hptrr SRCS = opt_scsi.h opt_cam.h bus_if.h device_if.h pci_if.h os_bsd.h SRCS+= hptrr_os_bsd.c hptrr_osm_bsd.c hptrr_config.c -OBJS = ${HPTRR}/${MACHINE_CPUARCH}-elf.hptrr_lib.o +BLOB_OBJS = ${HPTRR}/${MACHINE_CPUARCH}-elf.hptrr_lib.o .include From owner-dev-commits-src-main@freebsd.org Wed Jun 2 23:59:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 277F164DD6A; Wed, 2 Jun 2021 23:59:38 +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 4FwQxQ0ZgQz3GBD; Wed, 2 Jun 2021 23:59:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 F025B1FEDC; Wed, 2 Jun 2021 23:59:37 +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 152Nxbck040703; Wed, 2 Jun 2021 23:59:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 152Nxb50040702; Wed, 2 Jun 2021 23:59:37 GMT (envelope-from git) Date: Wed, 2 Jun 2021 23:59:37 GMT Message-Id: <202106022359.152Nxb50040702@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 903526542ac2 - main - Cirrus-CI: Add descriptive task name MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 903526542ac2309c08c769e517ea173a9f67cdb2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 23:59:38 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=903526542ac2309c08c769e517ea173a9f67cdb2 commit 903526542ac2309c08c769e517ea173a9f67cdb2 Author: Ed Maste AuthorDate: 2021-06-02 15:31:48 +0000 Commit: Ed Maste CommitDate: 2021-06-02 23:58:40 +0000 Cirrus-CI: Add descriptive task name Previously it appeared only as "main" in places like GitHub's list of checks run as part of a pull request. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- .cirrus.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.cirrus.yml b/.cirrus.yml index 58a57e5c61c8..2cc2243162ac 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -14,6 +14,7 @@ env: CIRRUS_CLONE_DEPTH: 1 task: + name: World and kernel amd64 build and boot smoke test timeout_in: 120m install_script: - pkg install -y qemu uefi-edk2-qemu-x86_64 llvm12 From owner-dev-commits-src-main@freebsd.org Thu Jun 3 00:26:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 25AF964EA66; Thu, 3 Jun 2021 00:26:03 +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 4FwRWv0K9gz3HJT; Thu, 3 Jun 2021 00:26:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E35D4204D8; Thu, 3 Jun 2021 00:26: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 1530Q2XE080885; Thu, 3 Jun 2021 00:26:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1530Q2a9080884; Thu, 3 Jun 2021 00:26:02 GMT (envelope-from git) Date: Thu, 3 Jun 2021 00:26:02 GMT Message-Id: <202106030026.1530Q2a9080884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 48b11217bf7e - main - libradius: fix no SSL build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 48b11217bf7e605e1c386e316cd6e935aceb4927 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 00:26:03 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=48b11217bf7e605e1c386e316cd6e935aceb4927 commit 48b11217bf7e605e1c386e316cd6e935aceb4927 Author: Cy Schubert AuthorDate: 2021-06-02 18:31:00 +0000 Commit: Cy Schubert CommitDate: 2021-06-03 00:25:37 +0000 libradius: fix no SSL build int alen is only used with SSL. --- lib/libradius/radlib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libradius/radlib.c b/lib/libradius/radlib.c index 4d21887c4ee2..ce0c0ccf453a 100644 --- a/lib/libradius/radlib.c +++ b/lib/libradius/radlib.c @@ -187,8 +187,10 @@ is_valid_response(struct rad_handle *h, int srv, MD5_CTX ctx; unsigned char md5[MD5_DIGEST_LENGTH]; const struct rad_server *srvp; - int alen, len; + + int len; #ifdef WITH_SSL + int alen; HMAC_CTX *hctx; u_char resp[MSGSIZE], md[EVP_MAX_MD_SIZE]; u_int md_len; From owner-dev-commits-src-main@freebsd.org Thu Jun 3 00:26:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2447664E57F; Thu, 3 Jun 2021 00:26:04 +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 4FwRWw0NYhz3HM1; Thu, 3 Jun 2021 00:26:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EAA6920788; Thu, 3 Jun 2021 00:26:03 +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 1530Q36h080911; Thu, 3 Jun 2021 00:26:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1530Q3BO080910; Thu, 3 Jun 2021 00:26:03 GMT (envelope-from git) Date: Thu, 3 Jun 2021 00:26:03 GMT Message-Id: <202106030026.1530Q3BO080910@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 9a0f82285322 - main - wpa: Fix a SIGBUS error in wpa_sm_set_rekey_offload MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9a0f82285322a338548d13fcda07e1d574301190 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 00:26:04 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=9a0f82285322a338548d13fcda07e1d574301190 commit 9a0f82285322a338548d13fcda07e1d574301190 Author: Cy Schubert AuthorDate: 2021-06-02 19:46:02 +0000 Commit: Cy Schubert CommitDate: 2021-06-03 00:25:37 +0000 wpa: Fix a SIGBUS error in wpa_sm_set_rekey_offload Incorrectly linked built-in wpa functions resulted in overwriting sm->ctx->set_rekey_offload with garbage. It was initialized correctly however it changed after wpa_supplicant became a daemon. No SIGBUS violations reported by dhw@ were experienced during testing of the original commit by msyelf or philip@. Reported by: dhw Tested by: dhw MFC after: 2 months X-MFC with: 25ecdc7d52770caf1c9b44b5ec11f468f6b636f3 --- usr.sbin/wpa/Makefile.crypto | 1 + usr.sbin/wpa/hostapd/Makefile | 6 +- usr.sbin/wpa/hostapd_cli/Makefile | 4 +- usr.sbin/wpa/src/ap/Makefile | 4 +- usr.sbin/wpa/src/common/Makefile | 4 +- usr.sbin/wpa/src/crypto/Makefile | 175 ++++++++++++++++++++++++++++------- usr.sbin/wpa/src/drivers/Makefile | 4 +- usr.sbin/wpa/src/eap_common/Makefile | 4 +- usr.sbin/wpa/src/eap_peer/Makefile | 4 +- usr.sbin/wpa/src/eap_server/Makefile | 4 +- usr.sbin/wpa/src/eapol_auth/Makefile | 4 +- usr.sbin/wpa/src/eapol_supp/Makefile | 4 +- usr.sbin/wpa/src/l2_packet/Makefile | 4 +- usr.sbin/wpa/src/radius/Makefile | 4 +- usr.sbin/wpa/src/rsn_supp/Makefile | 4 +- usr.sbin/wpa/src/tls/Makefile | 15 ++- usr.sbin/wpa/src/utils/Makefile | 4 +- usr.sbin/wpa/src/wps/Makefile | 4 +- usr.sbin/wpa/wpa_cli/Makefile | 6 +- usr.sbin/wpa/wpa_passphrase/Makefile | 4 +- usr.sbin/wpa/wpa_priv/Makefile | 6 +- usr.sbin/wpa/wpa_supplicant/Makefile | 7 +- 22 files changed, 191 insertions(+), 85 deletions(-) diff --git a/usr.sbin/wpa/Makefile.crypto b/usr.sbin/wpa/Makefile.crypto index a7ddb917ac6d..a65ee29e0ebe 100644 --- a/usr.sbin/wpa/Makefile.crypto +++ b/usr.sbin/wpa/Makefile.crypto @@ -24,6 +24,7 @@ NEED_AES_ENC=true NEED_AES_CBC=true .endif NEED_AES_OMAC1=true +TLS_FUNCS=y .if defined(TLS_FUNCS) NEED_TLS_PRF=y diff --git a/usr.sbin/wpa/hostapd/Makefile b/usr.sbin/wpa/hostapd/Makefile index 6e026babae1a..c0083747782a 100644 --- a/usr.sbin/wpa/hostapd/Makefile +++ b/usr.sbin/wpa/hostapd/Makefile @@ -3,6 +3,8 @@ .include .include "../Makefile.inc" +.include "../Makefile.crypto" + .PATH.c:${HOSTAPD_DISTDIR} PACKAGE= hostapd @@ -40,8 +42,6 @@ CFLAGS+=${HOSTAPD_CFLAGS} LDADD+=${HOSTAPD_LDADD} #LDFLAGS+=${HOSTAPD_LDFLAGS} -TLS_FUNCS=y - # For WPS, EAP modes, etc NEED_DH_GROUPS=y NEED_DH_GROUPS_ALL=y @@ -67,6 +67,4 @@ CFLAGS+=-DEAP_GPSK_SHA256 NEED_AES_OMAC1=y .endif -.include "../Makefile.crypto" - .include diff --git a/usr.sbin/wpa/hostapd_cli/Makefile b/usr.sbin/wpa/hostapd_cli/Makefile index 276e25058298..fef18dab7b32 100644 --- a/usr.sbin/wpa/hostapd_cli/Makefile +++ b/usr.sbin/wpa/hostapd_cli/Makefile @@ -2,6 +2,8 @@ .include "../Makefile.inc" +.include "../Makefile.crypto" + .PATH.c:${HOSTAPD_DISTDIR} PACKAGE= hostapd @@ -12,6 +14,4 @@ LIBADD+= util wpacommon wpautils MAN= hostapd_cli.8 -.include "../Makefile.crypto" - .include diff --git a/usr.sbin/wpa/src/ap/Makefile b/usr.sbin/wpa/src/ap/Makefile index edb2f1e9d089..77caf1ed8efe 100644 --- a/usr.sbin/wpa/src/ap/Makefile +++ b/usr.sbin/wpa/src/ap/Makefile @@ -2,6 +2,8 @@ .include "../../Makefile.inc" +.include "../../Makefile.crypto" + LIB= wpaap INTERNALLIB= @@ -51,8 +53,6 @@ CFLAGS+=-DCONFIG_MBO \ -DCONFIG_RSN_PREAUTH \ -DHOSTAPD -.include "../../Makefile.crypto" - # We are only interested in includes at this point. Not libraries. LIBADD= diff --git a/usr.sbin/wpa/src/common/Makefile b/usr.sbin/wpa/src/common/Makefile index 28c16ff9d31a..b415b926c207 100644 --- a/usr.sbin/wpa/src/common/Makefile +++ b/usr.sbin/wpa/src/common/Makefile @@ -2,6 +2,8 @@ .include "../../Makefile.inc" +.include "../../Makefile.crypto" + LIB= wpacommon INTERNALLIB= @@ -19,8 +21,6 @@ CFLAGS+=-DCONFIG_SAE \ -DCONFIG_SUITE \ -DCONFIG_SUITEB -.include "../../Makefile.crypto" - # We are only interested in includes at this point. Not libraries. LIBADD= diff --git a/usr.sbin/wpa/src/crypto/Makefile b/usr.sbin/wpa/src/crypto/Makefile index d7e1304dc95e..b25489072425 100644 --- a/usr.sbin/wpa/src/crypto/Makefile +++ b/usr.sbin/wpa/src/crypto/Makefile @@ -2,49 +2,156 @@ .include "../../Makefile.inc" +.include "../../Makefile.crypto" + LIB= wpacrypto INTERNALLIB= .PATH: ${WPA_DISTDIR}/src/crypto -SRCS= aes-cbc.c \ - aes-ctr.c \ - aes-eax.c \ - aes-encblock.c \ - aes-internal.c \ - aes-internal-dec.c \ - aes-internal-enc.c \ - aes-omac1.c \ - aes-unwrap.c \ - aes-wrap.c \ - crypto_internal.c \ - crypto_internal-cipher.c \ - crypto_internal-modexp.c \ - crypto_internal-rsa.c \ - des-internal.c \ - dh_group5.c \ - dh_groups.c \ - fips_prf_internal.c \ - md4-internal.c \ - md5.c \ - md5-internal.c \ - ms_funcs.c \ +.if ${MK_OPENSSL} != "no" +SRCS= crypto_openssl.c \ random.c \ - rc4.c \ - sha1.c \ - sha1-internal.c \ - sha1-pbkdf2.c \ sha1-prf.c \ - sha1-tlsprf.c \ - sha256.c \ sha256-prf.c \ sha256-tlsprf.c \ - sha256-internal.c \ - sha384.c \ - sha384-prf.c \ - sha384-internal.c \ - sha512-internal.c \ + sha512.c +.else +SRCS= crypto_internal.c \ + random.c +.endif + +.if defined(TLS_FUNCS) +.if defined(CONFIG_INTERNAL_TLS) +SRCS+= crypto_internal-cipher.c \ + crypto_internal-modexp.c \ + crypto_internal-rsa.c \ tls_internal.c +.else +SRCS+= tls_openssl.c \ + tls_openssl_ocsp.c +.endif +.endif + +.if defined(CONFIG_INTERNAL_AES) +SRCS+= aes-unwrap.c aes-wrap.c \ + aes-internal.c \ + aes-internal-dec.c \ + aes-internal-enc.c +.else +.endif + +.if defined(NEED_AES_CBC) +SRCS+= aes-cbc.c +.endif + +.if defined(NEED_AES_EAX) +SRCS+= aes-eax.c +.endif + +.if defined(NEED_AES_CTR) +SRCS+= aes-ctr.c +.endif + +.if defined(NEED_AES_ENCBLOCK) +SRCS+= aes-encblock.c +.endif + +.if defined(NEED_AES_OMAC1) +SRCS+= aes-omac1.c +.endif + +.if defined(NEED_DES) +.if defined(CONFIG_INTERNAL_DES) +SRCS+= des-internal.c +.endif +.endif + +.if defined(NEED_MD4) +.if defined(CONFIG_INTERNAL_MD4) +SRCS+= md4-internal.c +.endif +.endif + +.if defined(CONFIG_INTERNAL_MD5) +SRCS+= md5.c \ + md5-internal.c +.endif + +.if defined(NEED_FIPS186_2_PRF) +.if defined(CONFIG_INTERNAL_SHA1) +SRCS+= fips_prf_internal.c +.else +SRCS+= fips_prf_openssl.c +.endif +.endif + +.if defined(CONFIG_INTERNAL_RC4) +SRCS+= rc4.c +.endif + +.if defined(CONFIG_INTERNAL_SHA1) +SRCS+= sha1-internal.c \ + sha1-pbkdf2.c \ + sha1.c \ + sha1-prf.c +.endif + +.if defined(NEED_SHA256) +SRCS+= sha256.c +.if defined(CONFIG_INTERNAL_SHA256) +SRCS+= sha256-internal.c \ + sha256-prf.c +.endif +.endif + +.if defined(NEED_SHA384) +SRCS+= sha384.c +.if defined(CONFIG_INTERNAL_SHA384) +SRCS+= sha384-internal.c \ + sha384-prf.c +.endif +.endif + +.if defined(NEED_SHA512) +SRCS+= sha512.c +.if defined(CONFIG_INTERNAL_SHA512) +SRCS+= sha512-internal.c \ + sha512-prf.c +.endif +.endif + +.if defined(NEED_TLS_PRF) +SRCS+= sha1-tlsprf.c +.endif + +.if defined(CONFIG_INTERNAL_DH5) +.if defined(NEED_DH_GROUPS) +SRCS+= dh_group5.c +.endif +.endif + +.if defined(NEED_DH_GROUPS) +SRCS+= dh_groups.c +.endif + +.if ${MK_WPA_SUPPLICANT_EAPOL} != "no" +CFLAGS+=-DCONFIG_WPS \ + -DCONFIG_HS20 \ + -DCONFIG_INTERWORKING \ + -DEAP_GTC \ + -DEAP_LEAP \ + -DEAP_MD5 \ + -DEAP_MSCHAPv2 \ + -DEAP_OTP \ + -DEAP_PEAP \ + -DEAP_PSK \ + -DEAP_TLS \ + -DEAP_TTLS \ + -DEAP_WSC \ + -DIEEE8021X_EAPOL +SRCS+= ms_funcs.c +.endif CFLAGS+=-DCONFIG_CRYPTO_INTERNAL \ -DCONFIG_TLS_INTERNAL_CLIENT \ @@ -55,8 +162,6 @@ CFLAGS+=-DCONFIG_CRYPTO_INTERNAL \ -DCONFIG_INTERNAL_SHA384 #CFLAGS+=-DALL_DH_GROUPS -.include "../../Makefile.crypto" - # We are only interested in includes at this point. Not libraries. LIBADD= diff --git a/usr.sbin/wpa/src/drivers/Makefile b/usr.sbin/wpa/src/drivers/Makefile index 1800b651885f..0f901bdcf2fd 100644 --- a/usr.sbin/wpa/src/drivers/Makefile +++ b/usr.sbin/wpa/src/drivers/Makefile @@ -2,6 +2,8 @@ .include "../../Makefile.inc" +.include "../../Makefile.crypto" + LIB= wpadrivers INTERNALLIB= @@ -13,8 +15,6 @@ SRCS= drivers.c \ driver_wired.c \ driver_wired_common.c -.include "../../Makefile.crypto" - # We are only interested in includes at this point. Not libraries. LIBADD= diff --git a/usr.sbin/wpa/src/eap_common/Makefile b/usr.sbin/wpa/src/eap_common/Makefile index 4da89b221b36..7ec416c74102 100644 --- a/usr.sbin/wpa/src/eap_common/Makefile +++ b/usr.sbin/wpa/src/eap_common/Makefile @@ -2,6 +2,8 @@ .include "../../Makefile.inc" +.include "../../Makefile.crypto" + LIB= wpaeap_common INTERNALLIB= @@ -17,8 +19,6 @@ SRCS= chap.c \ eap_sim_common.c \ eap_wsc_common.c -.include "../../Makefile.crypto" - # We are only interested in includes at this point. Not libraries. LIBADD= diff --git a/usr.sbin/wpa/src/eap_peer/Makefile b/usr.sbin/wpa/src/eap_peer/Makefile index 524c7cf6c6f1..bab1b690f6d9 100644 --- a/usr.sbin/wpa/src/eap_peer/Makefile +++ b/usr.sbin/wpa/src/eap_peer/Makefile @@ -2,6 +2,8 @@ .include "../../Makefile.inc" +.include "../../Makefile.crypto" + LIB= wpaeap_peer INTERNALLIB= @@ -25,8 +27,6 @@ SRCS= eap.c \ CFLAGS+=-DIEEE8021X_EAPOL -.include "../../Makefile.crypto" - # We are only interested in includes at this point. Not libraries. LIBADD= diff --git a/usr.sbin/wpa/src/eap_server/Makefile b/usr.sbin/wpa/src/eap_server/Makefile index c5a4566bb444..795d2a9c68a0 100644 --- a/usr.sbin/wpa/src/eap_server/Makefile +++ b/usr.sbin/wpa/src/eap_server/Makefile @@ -2,6 +2,8 @@ .include "../../Makefile.inc" +.include "../../Makefile.crypto" + LIB= wpaeap_server INTERNALLIB= @@ -26,8 +28,6 @@ SRCS= eap_server.c \ eap_server_wsc.c \ eap_sim_db.c -.include "../../Makefile.crypto" - # We are only interested in includes at this point. Not libraries. LIBADD= diff --git a/usr.sbin/wpa/src/eapol_auth/Makefile b/usr.sbin/wpa/src/eapol_auth/Makefile index 7f05367edfb0..984b96df5c6f 100644 --- a/usr.sbin/wpa/src/eapol_auth/Makefile +++ b/usr.sbin/wpa/src/eapol_auth/Makefile @@ -2,6 +2,8 @@ .include "../../Makefile.inc" +.include "../../Makefile.crypto" + LIB= wpaeapol_auth INTERNALLIB= @@ -10,8 +12,6 @@ INTERNALLIB= SRCS= eapol_auth_sm.c \ eapol_auth_dump.c -.include "../../Makefile.crypto" - # We are only interested in includes at this point. Not libraries. LIBADD= diff --git a/usr.sbin/wpa/src/eapol_supp/Makefile b/usr.sbin/wpa/src/eapol_supp/Makefile index 2b3cc0179109..a4588fc23de1 100644 --- a/usr.sbin/wpa/src/eapol_supp/Makefile +++ b/usr.sbin/wpa/src/eapol_supp/Makefile @@ -2,6 +2,8 @@ .include "../../Makefile.inc" +.include "../../Makefile.crypto" + LIB= wpaeapol_supp INTERNALLIB= @@ -11,8 +13,6 @@ SRCS= eapol_supp_sm.c CFLAGS+=-DIEEE8021X_EAPOL -.include "../../Makefile.crypto" - # We are only interested in includes at this point. Not libraries. LIBADD= diff --git a/usr.sbin/wpa/src/l2_packet/Makefile b/usr.sbin/wpa/src/l2_packet/Makefile index 89ce771b0343..f53dc81fdf52 100644 --- a/usr.sbin/wpa/src/l2_packet/Makefile +++ b/usr.sbin/wpa/src/l2_packet/Makefile @@ -2,6 +2,8 @@ .include "../../Makefile.inc" +.include "../../Makefile.crypto" + LIB= wpal2_packet INTERNALLIB= @@ -11,8 +13,6 @@ SRCS= l2_packet_freebsd.c CFLAGS+=-DIEEE8021X_EAPOL -.include "../../Makefile.crypto" - # We are only interested in includes at this point. Not libraries. LIBADD= diff --git a/usr.sbin/wpa/src/radius/Makefile b/usr.sbin/wpa/src/radius/Makefile index 1ef986a799ae..a37d60be6f7d 100644 --- a/usr.sbin/wpa/src/radius/Makefile +++ b/usr.sbin/wpa/src/radius/Makefile @@ -2,6 +2,8 @@ .include "../../Makefile.inc" +.include "../../Makefile.crypto" + LIB= wparadius INTERNALLIB= @@ -16,8 +18,6 @@ SRCS= radius.c \ CFLAGS+= -DCONFIG_IPV6 .endif -.include "../../Makefile.crypto" - # We are only interested in includes at this point. Not libraries. LIBADD= diff --git a/usr.sbin/wpa/src/rsn_supp/Makefile b/usr.sbin/wpa/src/rsn_supp/Makefile index 1b50689e6960..4d952c2204c4 100644 --- a/usr.sbin/wpa/src/rsn_supp/Makefile +++ b/usr.sbin/wpa/src/rsn_supp/Makefile @@ -2,6 +2,8 @@ .include "../../Makefile.inc" +.include "../../Makefile.crypto" + LIB= wparsn_supp INTERNALLIB= @@ -18,8 +20,6 @@ CFLAGS+=-DCONFIG_TDLS \ -DCONFIG_WNM \ -DIEEE8021X_EAPOL -.include "../../Makefile.crypto" - # We are only interested in includes at this point. Not libraries. LIBADD= diff --git a/usr.sbin/wpa/src/tls/Makefile b/usr.sbin/wpa/src/tls/Makefile index defe9b0faf6e..e5fdf96444d6 100644 --- a/usr.sbin/wpa/src/tls/Makefile +++ b/usr.sbin/wpa/src/tls/Makefile @@ -2,36 +2,41 @@ .include "../../Makefile.inc" +.include "../../Makefile.crypto" + LIB= wpatls INTERNALLIB= .PATH: ${WPA_DISTDIR}/src/tls -SRCS= asn1.c \ +SRCS= tlsv1_server.c + +.if defined(TLS_FUNCS) +.if defined(CONFIG_INTERNAL_TLS) +SRCS+= asn1.c \ bignum.c \ pkcs1.c \ pkcs5.c \ pkcs8.c \ rsa.c \ tlsv1_client.c \ + tlsv1_client_ocsp.c \ tlsv1_client_read.c \ tlsv1_client_write.c \ - tlsv1_client_ocsp.c \ tlsv1_common.c \ tlsv1_cred.c \ tlsv1_record.c \ - tlsv1_server.c \ tlsv1_server_read.c \ tlsv1_server_write.c \ x509v3.c +.endif +.endif CFLAGS+=-DCONFIG_INTERNAL_LIBTOMMATH \ -DCONFIG_CRYPTO_INTERNAL \ -DCONFIG_TLSV11 \ -DCONFIG_TLSV12 -.include "../../Makefile.crypto" - # We are only interested in includes at this point. Not libraries. LIBADD= diff --git a/usr.sbin/wpa/src/utils/Makefile b/usr.sbin/wpa/src/utils/Makefile index f08a2d78fced..22ec732a2b3b 100644 --- a/usr.sbin/wpa/src/utils/Makefile +++ b/usr.sbin/wpa/src/utils/Makefile @@ -2,6 +2,8 @@ .include "../../Makefile.inc" +.include "../../Makefile.crypto" + LIB= wpautils INTERNALLIB= @@ -24,8 +26,6 @@ CFLAGS+=-DCONFIG_DEBUG_FILE CFLAGS+= -DCONFIG_IPV6 .endif -.include "../../Makefile.crypto" - # We are only interested in includes at this point. Not libraries. LIBADD= diff --git a/usr.sbin/wpa/src/wps/Makefile b/usr.sbin/wpa/src/wps/Makefile index ddb40b682c27..5f5485d69bce 100644 --- a/usr.sbin/wpa/src/wps/Makefile +++ b/usr.sbin/wpa/src/wps/Makefile @@ -2,6 +2,8 @@ .include "../../Makefile.inc" +.include "../../Makefile.crypto" + LIB= wpawps INTERNALLIB= @@ -31,8 +33,6 @@ CFLAGS+=-DCONFIG_P2P CFLAGS+= -DCONFIG_IPV6 .endif -.include "../../Makefile.crypto" - # We are only interested in includes at this point. Not libraries. LIBADD= diff --git a/usr.sbin/wpa/wpa_cli/Makefile b/usr.sbin/wpa/wpa_cli/Makefile index 7568154a7e45..bf2cf6252550 100644 --- a/usr.sbin/wpa/wpa_cli/Makefile +++ b/usr.sbin/wpa/wpa_cli/Makefile @@ -4,6 +4,8 @@ .include "../Makefile.inc" +.include "../Makefile.crypto" + .PATH.c:${WPA_SUPPLICANT_DISTDIR} PACKAGE= wpa @@ -32,8 +34,4 @@ LIBADD+=wpaap \ wpautils LIBADD+= pcap util -TLS_FUNCS=y - -.include "../Makefile.crypto" - .include diff --git a/usr.sbin/wpa/wpa_passphrase/Makefile b/usr.sbin/wpa/wpa_passphrase/Makefile index 0dcb3e69da98..4cd540696d67 100644 --- a/usr.sbin/wpa/wpa_passphrase/Makefile +++ b/usr.sbin/wpa/wpa_passphrase/Makefile @@ -2,6 +2,8 @@ .include "../Makefile.inc" +.include "../Makefile.crypto" + .PATH.c:${WPA_SUPPLICANT_DISTDIR} PACKAGE= wpa @@ -14,6 +16,4 @@ LIBADD+= util wpacrypto wpautils MAN= wpa_passphrase.8 -.include "../Makefile.crypto" - .include diff --git a/usr.sbin/wpa/wpa_priv/Makefile b/usr.sbin/wpa/wpa_priv/Makefile index fd316402c1cf..d3b693341276 100644 --- a/usr.sbin/wpa/wpa_priv/Makefile +++ b/usr.sbin/wpa/wpa_priv/Makefile @@ -2,6 +2,8 @@ .include "../Makefile.inc" +.include "../Makefile.crypto" + .PATH.c:${WPA_SUPPLICANT_DISTDIR} PACKAGE= wpa @@ -9,8 +11,6 @@ PROG= wpa_priv SRCS= os_unix.c eloop.c common.c wpa_debug.c wpabuf.c wpa_priv.c \ l2_packet_freebsd.c -LIBADD= pcap wpadrivers - -.include "../Makefile.crypto" +LIBADD+=pcap wpadrivers .include diff --git a/usr.sbin/wpa/wpa_supplicant/Makefile b/usr.sbin/wpa/wpa_supplicant/Makefile index 482c06d68e40..332f66315346 100644 --- a/usr.sbin/wpa/wpa_supplicant/Makefile +++ b/usr.sbin/wpa/wpa_supplicant/Makefile @@ -4,6 +4,8 @@ .include "../Makefile.inc" +.include "../Makefile.crypto" + .PATH.c:${WPA_SUPPLICANT_DISTDIR} \ ${WPA_DISTDIR}/src/drivers @@ -39,7 +41,7 @@ FILES= wpa_supplicant.conf CFLAGS+=-DCONFIG_BACKEND_FILE #CFLAGS+= -g -LIBADD= pcap util wpaap wpacommon wpacrypto wpadrivers wpaeapol_supp \ +LIBADD+=pcap util wpaap wpacommon wpacrypto wpadrivers wpaeapol_supp \ wpaeap_common wpaeap_server \ wpaeap_peer wpal2_packet wparsn_supp wpatls wpautils wpawps @@ -68,7 +70,6 @@ NEED_AES_EAX=y NEED_AES_ENCBLOCK=y NEED_AES_OMAC1=y .endif -TLS_FUNCS=y .if !empty(CFLAGS:M*-DEAP_AKA) SRCS+= eap_aka.c @@ -116,6 +117,4 @@ SRCS+= eap_sake.c \ eap_sake_common.c .endif -.include "../Makefile.crypto" - .include From owner-dev-commits-src-main@freebsd.org Thu Jun 3 01:49:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8115C64FDA8; Thu, 3 Jun 2021 01:49:03 +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 4FwTMg3DTRz3MyY; Thu, 3 Jun 2021 01:49:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5726D211CD; Thu, 3 Jun 2021 01:49:03 +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 1531n35k086675; Thu, 3 Jun 2021 01:49:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1531n3xr086674; Thu, 3 Jun 2021 01:49:03 GMT (envelope-from git) Date: Thu, 3 Jun 2021 01:49:03 GMT Message-Id: <202106030149.1531n3xr086674@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: e7dc08415a32 - main - mmc: ignore CRC errors from CMD13 (status) when changing rates 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/main X-Git-Reftype: branch X-Git-Commit: e7dc08415a324d1000cd067fbc12b1ec79e0b2ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 01:49:03 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=e7dc08415a324d1000cd067fbc12b1ec79e0b2ac commit e7dc08415a324d1000cd067fbc12b1ec79e0b2ac Author: Austin Shafer AuthorDate: 2021-06-03 01:46:23 +0000 Commit: Warner Losh CommitDate: 2021-06-03 01:46:23 +0000 mmc: ignore CRC errors from CMD13 (status) when changing rates Update mmc_switch_status to ignore a few CRC errrors when asking for the card status after setting the new rate with CMD6. Since the card may take a little while to make the switch, it's possible we'll get a communications error if we sent the command at the wrong time. Several low end laptops needs this workaround as they have a window that seems longer than other systems. This is known to fix at least the Acer Aspire A114-32-P7E5. Reviewed by: imp@, manu@ Differential Revision: https://reviews.freebsd.org/D24740 --- sys/dev/mmc/mmc_subr.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sys/dev/mmc/mmc_subr.c b/sys/dev/mmc/mmc_subr.c index 53c9009c6e64..b43a233820bb 100644 --- a/sys/dev/mmc/mmc_subr.c +++ b/sys/dev/mmc/mmc_subr.c @@ -193,7 +193,7 @@ int mmc_switch_status(device_t busdev, device_t dev, uint16_t rca, u_int timeout) { struct timeval cur, end; - int err; + int err, crc_timeout; uint32_t status; KASSERT(timeout != 0, ("%s: no timeout", __func__)); @@ -205,7 +205,19 @@ mmc_switch_status(device_t busdev, device_t dev, uint16_t rca, u_int timeout) */ end.tv_sec = end.tv_usec = 0; for (;;) { - err = mmc_send_status(busdev, dev, rca, &status); + crc_timeout=0; + do { + /* + * CRC errors indicate that the command wasn't accepted + * and executed due to a communications error. Retry + * CRC errors a couple of times to cope with transient + * failures. + * + * This is required for some cheap laptops to boot. + */ + err = mmc_send_status(busdev, dev, rca, &status); + crc_timeout++; + } while (err == MMC_ERR_BADCRC && crc_timeout < 10); if (err != MMC_ERR_NONE) break; if (R1_CURRENT_STATE(status) == R1_STATE_TRAN) From owner-dev-commits-src-main@freebsd.org Thu Jun 3 02:32:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A85476507AC; Thu, 3 Jun 2021 02:32:46 +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 4FwVL64NJgz3Q6M; Thu, 3 Jun 2021 02:32:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7E40C21CD1; Thu, 3 Jun 2021 02:32:46 +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 1532WkCN052343; Thu, 3 Jun 2021 02:32:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1532Wkwf052342; Thu, 3 Jun 2021 02:32:46 GMT (envelope-from git) Date: Thu, 3 Jun 2021 02:32:46 GMT Message-Id: <202106030232.1532Wkwf052342@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 441e69e419ef - main - fsck_ufs: fix segfault with gjournal MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 441e69e419effac0225a45f4cdb948280b8ce5ab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 02:32:46 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=441e69e419effac0225a45f4cdb948280b8ce5ab commit 441e69e419effac0225a45f4cdb948280b8ce5ab Author: Robert Wing AuthorDate: 2021-06-03 01:41:31 +0000 Commit: Robert Wing CommitDate: 2021-06-03 02:30:20 +0000 fsck_ufs: fix segfault with gjournal The segfault was being hit in ckfini() (sbin/fsck_ffs/fsutil.c) while attempting to traverse the buffer cache. The tail queue used for the buffer cache was not initialized before dropping into gjournal_check(). Initialize the buffer cache before calling gjournal_check(). PR: 245907 Reviewed by: jhb, mckusick MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30537 --- sbin/fsck_ffs/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index 401ee10f9be3..67aff2dde73c 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -309,6 +309,7 @@ checkfilesys(char *filesys) exit(0); } if ((sblock.fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) == 0) { + bufinit(); gjournal_check(filesys); if (chkdoreload(mntp) == 0) exit(0); From owner-dev-commits-src-main@freebsd.org Thu Jun 3 02:42:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D63E4650B8F; Thu, 3 Jun 2021 02:42:11 +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 4FwVXz5nnzz3Q9W; Thu, 3 Jun 2021 02:42:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 AF0AA222A0; Thu, 3 Jun 2021 02:42:11 +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 1532gBs5062988; Thu, 3 Jun 2021 02:42:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1532gBvS062987; Thu, 3 Jun 2021 02:42:11 GMT (envelope-from git) Date: Thu, 3 Jun 2021 02:42:11 GMT Message-Id: <202106030242.1532gBvS062987@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: dd41de95a84d - main - Cirrus-CI: retry pkg installation on failure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dd41de95a84d979615a2ef11df6850622bf6184e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 02:42:11 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=dd41de95a84d979615a2ef11df6850622bf6184e commit dd41de95a84d979615a2ef11df6850622bf6184e Author: Ed Maste AuthorDate: 2021-06-02 14:42:57 +0000 Commit: Ed Maste CommitDate: 2021-06-03 02:41:20 +0000 Cirrus-CI: retry pkg installation on failure Pkg installation failed somewhat frequently, always at: [62/104] Fetching jpeg-turbo-2.0.6.txz: .......... done pkg: http://pkgmir.geo.freebsd.org/FreeBSD:13:amd64/quarterly/All/jbigkit-2.1_1.txz: No route to host Move pkg installation to a script and retry once upon failure as a (hopefully temporary) workaround. Reviewed by: imp MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30613 --- .cirrus-ci/pkg-install.sh | 15 +++++++++++++++ .cirrus.yml | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.cirrus-ci/pkg-install.sh b/.cirrus-ci/pkg-install.sh new file mode 100644 index 000000000000..ef83e5284078 --- /dev/null +++ b/.cirrus-ci/pkg-install.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -e + +pkg install -y "$@" && exit 0 + +cat < Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA418651610; Thu, 3 Jun 2021 03:51:04 +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 4FwX4S5PPYz3l8s; Thu, 3 Jun 2021 03:51:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A18122302B; Thu, 3 Jun 2021 03:51: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 1533p4Cl054396; Thu, 3 Jun 2021 03:51:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1533p467054395; Thu, 3 Jun 2021 03:51:04 GMT (envelope-from git) Date: Thu, 3 Jun 2021 03:51:04 GMT Message-Id: <202106030351.1533p467054395@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 43521b46fc78 - main - Correcting comment about "sched_interact_score". 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/main X-Git-Reftype: branch X-Git-Commit: 43521b46fc788096648dfa89650dfe394dc0d455 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 03:51:04 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=43521b46fc788096648dfa89650dfe394dc0d455 commit 43521b46fc788096648dfa89650dfe394dc0d455 Author: wiklam AuthorDate: 2020-05-19 01:55:08 +0000 Commit: Warner Losh CommitDate: 2021-06-03 03:50:57 +0000 Correcting comment about "sched_interact_score". Reviewed by: jrtc@, imp@ Pull Request: https://github.com/freebsd/freebsd-src/pull/431 Sponsored by: Netflix --- sys/kern/sched_ule.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c index 49bf3328f3d9..094a3fffef8c 100644 --- a/sys/kern/sched_ule.c +++ b/sys/kern/sched_ule.c @@ -1516,7 +1516,7 @@ sched_initticks(void *dummy) * When a thread's sleep time is greater than its run time the * calculation is: * - * scaling factor + * scaling factor * interactivity score = --------------------- * sleep time / run time * @@ -1524,9 +1524,9 @@ sched_initticks(void *dummy) * When a thread's run time is greater than its sleep time the * calculation is: * - * scaling factor - * interactivity score = --------------------- + scaling factor - * run time / sleep time + * scaling factor + * interactivity score = 2 * scaling factor - --------------------- + * run time / sleep time */ static int sched_interact_score(struct thread *td) From owner-dev-commits-src-main@freebsd.org Thu Jun 3 04:02:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 383AE651B10; Thu, 3 Jun 2021 04:02:29 +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 4FwXKd19Kpz3lfN; Thu, 3 Jun 2021 04:02:29 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1066F22D62; Thu, 3 Jun 2021 04:02:29 +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 15342SbQ072846; Thu, 3 Jun 2021 04:02:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15342ShS072845; Thu, 3 Jun 2021 04:02:28 GMT (envelope-from git) Date: Thu, 3 Jun 2021 04:02:28 GMT Message-Id: <202106030402.15342ShS072845@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: cfae21201a2b - main - mmc-fdt: fix mmc_fdt_gpio_get_{present, readonly} 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/main X-Git-Reftype: branch X-Git-Commit: cfae21201a2b28b4146a09923ed142af7b86cdec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 04:02:29 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=cfae21201a2b28b4146a09923ed142af7b86cdec commit cfae21201a2b28b4146a09923ed142af7b86cdec Author: Priit Trees AuthorDate: 2021-03-31 20:15:31 +0000 Commit: Warner Losh CommitDate: 2021-06-03 03:58:30 +0000 mmc-fdt: fix mmc_fdt_gpio_get_{present,readonly} Currently, mmc_fdt_gpio_get_{present,readonly} return all time true. true ^ 100b = true false ^ 100b = true since that's done after promotion to integers. Use !! to convert the bit to a bool before xor. Reviewed by: imp@ (converted to (bool) to !! for portability) Pull Request: https://github.com/freebsd/freebsd-src/pull/461 --- sys/dev/mmc/mmc_fdt_helpers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/mmc/mmc_fdt_helpers.c b/sys/dev/mmc/mmc_fdt_helpers.c index 4e8a1730d240..9d120fa01a26 100644 --- a/sys/dev/mmc/mmc_fdt_helpers.c +++ b/sys/dev/mmc/mmc_fdt_helpers.c @@ -407,7 +407,7 @@ mmc_fdt_gpio_get_present(struct mmc_fdt_helper *helper) gpio_pin_is_active(helper->cd_pin, &pinstate); - return (pinstate ^ (helper->props & MMC_PROP_CD_INVERTED)); + return (pinstate ^ !!(helper->props & MMC_PROP_CD_INVERTED)); } bool @@ -423,7 +423,7 @@ mmc_fdt_gpio_get_readonly(struct mmc_fdt_helper *helper) gpio_pin_is_active(helper->wp_pin, &pinstate); - return (pinstate ^ (helper->props & MMC_PROP_WP_INVERTED)); + return (pinstate ^ !!(helper->props & MMC_PROP_WP_INVERTED)); } void From owner-dev-commits-src-main@freebsd.org Thu Jun 3 04:50:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B60F6520BA; Thu, 3 Jun 2021 04:50:40 +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 4FwYPD2BhXz3qq9; Thu, 3 Jun 2021 04:50:40 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 34F7523A4C; Thu, 3 Jun 2021 04:50:40 +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 1534oeww034001; Thu, 3 Jun 2021 04:50:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1534oec1034000; Thu, 3 Jun 2021 04:50:40 GMT (envelope-from git) Date: Thu, 3 Jun 2021 04:50:40 GMT Message-Id: <202106030450.1534oec1034000@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 5104dfbeff3e - main - bsdinstall: Fix typo (Instalation -> Installation). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5104dfbeff3e1489f1caee482c7ad1ff9be8e61d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 04:50:40 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=5104dfbeff3e1489f1caee482c7ad1ff9be8e61d commit 5104dfbeff3e1489f1caee482c7ad1ff9be8e61d Author: Navdeep Parhar AuthorDate: 2021-06-03 04:43:14 +0000 Commit: Navdeep Parhar CommitDate: 2021-06-03 04:44:11 +0000 bsdinstall: Fix typo (Instalation -> Installation). --- usr.sbin/bsdinstall/scripts/script | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bsdinstall/scripts/script b/usr.sbin/bsdinstall/scripts/script index 131ef008d35f..cb42aed7706a 100755 --- a/usr.sbin/bsdinstall/scripts/script +++ b/usr.sbin/bsdinstall/scripts/script @@ -101,7 +101,7 @@ if [ "$BSDINSTALL_LOG" != "${debugFile#+}" ]; then export debugFile="$BSDINSTALL_LOG" f_quietly f_debug_init # NB: Being scripted, let debug go to terminal for invalid debugFile - f_dprintf "Began Instalation at %s" "$( date )" + f_dprintf "Began Installation at %s" "$( date )" fi # Make partitions From owner-dev-commits-src-main@freebsd.org Thu Jun 3 05:24:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22020652AED; Thu, 3 Jun 2021 05:24:05 +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 4FwZ7m5LZkz3w4J; Thu, 3 Jun 2021 05:24:04 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7C0D424337; Thu, 3 Jun 2021 05:24: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 1535O44X078594; Thu, 3 Jun 2021 05:24:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1535O4XH078593; Thu, 3 Jun 2021 05:24:04 GMT (envelope-from git) Date: Thu, 3 Jun 2021 05:24:04 GMT Message-Id: <202106030524.1535O4XH078593@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: 8682abbf7bff - main - stress2: Remove thr_new() from the ignore list after 6cda62755612 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8682abbf7bff37e1e27db088bbde7a58bd575f5b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 05:24:05 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=8682abbf7bff37e1e27db088bbde7a58bd575f5b commit 8682abbf7bff37e1e27db088bbde7a58bd575f5b Author: Peter Holm AuthorDate: 2021-06-03 05:23:01 +0000 Commit: Peter Holm CommitDate: 2021-06-03 05:23:01 +0000 stress2: Remove thr_new() from the ignore list after 6cda62755612 --- tools/test/stress2/misc/syscall4.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/test/stress2/misc/syscall4.sh b/tools/test/stress2/misc/syscall4.sh index f2c5a2f38002..824089760ba7 100755 --- a/tools/test/stress2/misc/syscall4.sh +++ b/tools/test/stress2/misc/syscall4.sh @@ -145,7 +145,6 @@ static int ignore[] = { SYS_mac_syscall, SYS_sigtimedwait, SYS_sigwaitinfo, - SYS_thr_new, /* Page fault seen */ }; static int fd[900], fds[2], kq, socketpr[2]; From owner-dev-commits-src-main@freebsd.org Thu Jun 3 13:10:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61FDA639225 for ; Thu, 3 Jun 2021 13:10:28 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FwmTv6FpJz3Hhq for ; Thu, 3 Jun 2021 13:10:27 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x82b.google.com with SMTP id g17so4267246qtk.9 for ; Thu, 03 Jun 2021 06:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=uOG975MYcsqsmP8UWmQXGUhLnMVlEL6myl2hBIN1Afs=; b=E+3OXLxg/8SX9Sq+QRXnE96N+/u5h5mwH9daV+OTtE9Kxuy1Q/vH765mUCsiAsJT2S ZABPG2ZGB3MYvJqopFGcNCF2HaIwyKFcenNyy3AOH+h0ZJerIp94mtPcjx4puVYtU5d4 1YckJwrVN8KrsWTvaC/yCbk0WVoVQpp/oXoOgEF7hmwtCQEMl+Rm/LAxDI7semn3fqJC fHYYu/MZCGqyZCnwzzLb17M8dlcL7ioGvgnsAjIFLVGgHKz0J8eaYoNSo9k+J9jBb8TO WW66GEgg89nwPD7UEhCf8bRAGS0O2yRyqih7LjZtKAzEtAx8HjgpXj8lFCrqBf6TOhaY uIlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=uOG975MYcsqsmP8UWmQXGUhLnMVlEL6myl2hBIN1Afs=; b=F2eYv3MxlRCaeGVBdG7Uwvg7N8ov8Hx+U5QYf7fl7POvzP8VEQrxA2l0zRZsrlgZsg QTmy0lGp0Hj/gfHTMwaOND2lxgNRO4jk2vthuMAvsiFe9ZrZwR23HrasmGKa2E1UJrvQ TiVOHNJg1d6KTVUPZdyiKd3jrzPlPF/kVl60qpl2FyegQUzGTzlb05IZ2cjpn9asdS/o 1H4IDQFbmCWcUjnEr+wX9ff51tE0vfvT/f7tF+gEQa6yvfW7eOpWiSpzDzIz9rZaXkT8 JgzjWtM9llGcaHwYwoFIajSPdUHoLERioqUE9EaBSbtcY+bMkIf6chsWhTaM/Mu1qXbt SnuQ== X-Gm-Message-State: AOAM5338XEDyzwGiNAYGywF3gX3udP6Bt7hCS//Mjk0hOQQcYmJD5V1t +TTN1eXyivP/TGKBHSxi6Wn/bIINHrDtxw== X-Google-Smtp-Source: ABdhPJwvbm3JL01IHjOie8qhCt9Wf+joc5PmQvvB3B1Byzn+Hw8DrsGScqq3BLpP7XZ4hHQ/OgqGDw== X-Received: by 2002:ac8:7e93:: with SMTP id w19mr28710003qtj.314.1622725827023; Thu, 03 Jun 2021 06:10:27 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id l20sm804541qtx.53.2021.06.03.06.10.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 06:10:26 -0700 (PDT) Date: Thu, 3 Jun 2021 09:10:25 -0400 From: Shawn Webb To: Warner Losh Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 455dff72fcc2 - main - hpt27xx: Use EXTRA_OBJS instead of OBJS Message-ID: <20210603131025.sncyft4fq3ip7wiu@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202106021640.152Ge8SG056952@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="h7enesqcwlgcuumg" Content-Disposition: inline In-Reply-To: <202106021640.152Ge8SG056952@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4FwmTv6FpJz3Hhq X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 13:10:28 -0000 --h7enesqcwlgcuumg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 02, 2021 at 04:40:08PM +0000, Warner Losh wrote: > The branch main has been updated by imp: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D455dff72fcc260f758964d61f6= 7dd1ba79e4889d >=20 > commit 455dff72fcc260f758964d61f67dd1ba79e4889d > Author: Warner Losh > AuthorDate: 2021-06-02 16:35:12 +0000 > Commit: Warner Losh > CommitDate: 2021-06-02 16:39:58 +0000 >=20 > hpt27xx: Use EXTRA_OBJS instead of OBJS > =20 > Sponsored by: Netflix > Reviewed by: emaste@ > Differential Revision: https://reviews.freebsd.org/D30616 > --- > sys/modules/hpt27xx/Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/sys/modules/hpt27xx/Makefile b/sys/modules/hpt27xx/Makefile > index c0b4d7022033..f81652d2d55a 100644 > --- a/sys/modules/hpt27xx/Makefile > +++ b/sys/modules/hpt27xx/Makefile > @@ -6,6 +6,6 @@ KMOD=3D hpt27xx > SRCS=3D bus_if.h device_if.h pci_if.h > SRCS+=3D opt_cam.h opt_scsi.h > SRCS+=3D os_bsd.h hpt27xx_os_bsd.c hpt27xx_osm_bsd.c hpt27xx_config.c > -OBJS+=3D ${HPT27XX}/$(MACHINE_ARCH)-elf.hpt27xx_lib.o > +BLOB_OBJS+=3D ${HPT27XX}/$(MACHINE_ARCH)-elf.hpt27xx_lib.o Hey Warner, There's something about this change that breaks buildkernel: make[4]: make[4]: don't know how to make /usr/src/sys/dev/hptrr/amd64-elf.h= ptrr_lib.o. Stop `/usr/src/sys/dev/hptrr/amd64-elf.hptrr_lib.o' was not built (being made, t= ype OP_DEPS_FOUND|OP_MARK, flags REMAKE|DONE_WAIT|DONE_ALLSRC|DONECYCLE)! Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --h7enesqcwlgcuumg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmC41L4ACgkQ/y5nonf4 4fpTpg/9Fp2TB2l3XDPZSyeHm+ya6Xm7vECjUEcezBWiPWkOWBC/Nw4SMhFoJRNu jWeLVXmWLaOqjcjc3dwaJoo3NMHi122ETmW9HikrHHPvycVrRhWTbQ2jK3cRL6Rl d0mbdt3ZJdzjzSwwKwCD5BHpn6tzUbIlnM6xe6J6PVyneawzu1X6dbOyJVV7OZoy 66GqZfbxY8EyVD6B8Xq+gNWRXFSI9yG54MUJdE0THm93oq9PQ8sti44A85mMbcaT V23n8M8b/3ldwQMOBu2gGcThMhTMLEvr3KFKuvWh63ZEZ8nNaj5Ai12gmHQ1TYtc tJFKmAQ+EFsg4Abfz5X3WW5u2O3uqIB8iY7sImvdR24ZGzB1TaAhx5h/gCIAn8xp rXIJ29sltja7V4W9lDEIfUDDeLmddxo8jrk7y6ffoWgyxxCSEox5l3vu9Jpa5ofu 3yCQzwFnKwDfVXRXD0DrNdnvlAmEauMArWTPrUH6K8eM9lQn5AqG5Xb2ynBlD1Fm yPbMdeVMHB34VjMwJsSzlsgKGZqqAtIWsFL8JUll/FmvvCi4XEOSRe8KKAVunh4J p7suyfUfIqJw4ulhIh/Pl9puFbx9EEVgEJxUyMNg3+RI5RcO2EsKhOwjF64CLG4A u31VL1cPvsrDEkMpFkZ25FDQXVYpmrfE/jaLs/h1hWrNI2HWtus= =wEka -----END PGP SIGNATURE----- --h7enesqcwlgcuumg-- From owner-dev-commits-src-main@freebsd.org Thu Jun 3 13:38:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC0E063986A; Thu, 3 Jun 2021 13:38:22 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f169.google.com (mail-il1-f169.google.com [209.85.166.169]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fwn666H1jz3KKg; Thu, 3 Jun 2021 13:38:22 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-il1-f169.google.com with SMTP id b14so5229295ilq.7; Thu, 03 Jun 2021 06:38:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZcdTmTQSclggTuBAyoMW057Yj4rDICbweOgb+Fwra88=; b=QQYNddDeR3aK7VlEggH6XbLnXOYIquifMUsp/mQdB+IElGTP8n2+CwpQdb6f0bXcMD ijhTyYpQiwEVE7lPoWI409WQvWQOpb8LPBjCVIXIdsT0OM+pT5W3+o5o9Qcav5pQXSKf QVd5z+k280M5lKmCCXHIIlLzdT3i/KG5KP9K7BgZ9V6ajPM36W3+3szgTkEMy3uR6b4r HxEptvJwYcdBMK8yvbbQTspaAcPyHgdjWTpbuHTu17b/YyTju54gpsy1oKFXD5H+jEyq q68pYsMBu/wcLL6e1QgUyBngYteqws0z8eVjEiRnq5pGlh9nhAclZWfeqliLBY1EmLtc 1Zyg== X-Gm-Message-State: AOAM5301kFElktophVY5pIpTTmM6b852E89IhYTHHL9UVCpKa+Qe06Yu hFq01/u6J828+J7p2UXPCp6Ghr9zqaIUxKY/A9Q= X-Google-Smtp-Source: ABdhPJyQEDo99Zp3VgODKtR7w0uuLqDF8wLSylGvNUCZ7mYkdxjCnilk/NfNPEDbhWxtkxyP+VB3baKv2zH9tnAZwWQ= X-Received: by 2002:a92:ad07:: with SMTP id w7mr30120516ilh.98.1622727501862; Thu, 03 Jun 2021 06:38:21 -0700 (PDT) MIME-Version: 1.0 References: <202106021640.152Ge8SG056952@gitrepo.freebsd.org> <20210603131025.sncyft4fq3ip7wiu@mutt-hbsd> In-Reply-To: <20210603131025.sncyft4fq3ip7wiu@mutt-hbsd> From: Ed Maste Date: Thu, 3 Jun 2021 09:38:07 -0400 Message-ID: Subject: Re: git: 455dff72fcc2 - main - hpt27xx: Use EXTRA_OBJS instead of OBJS To: Shawn Webb Cc: Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Fwn666H1jz3KKg X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 13:38:23 -0000 On Thu, 3 Jun 2021 at 09:10, Shawn Webb wrote: > > There's something about this change that breaks buildkernel: > > make[4]: make[4]: don't know how to make /usr/src/sys/dev/hptrr/amd64-elf.hptrr_lib.o. Stop > `/usr/src/sys/dev/hptrr/amd64-elf.hptrr_lib.o' was not built (being made, type OP_DEPS_FOUND|OP_MARK, flags REMAKE|DONE_WAIT|DONE_ALLSRC|DONECYCLE)! It builds for me and in CI. It looks like you're still missing the .o file (because of the bug Warner fixed) and need to restore it via `git checkout`. From owner-dev-commits-src-main@freebsd.org Thu Jun 3 13:43:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A0BD639D77 for ; Thu, 3 Jun 2021 13:43:12 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FwnCh13M7z3Kxm for ; Thu, 3 Jun 2021 13:43:11 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x72b.google.com with SMTP id k11so4276208qkk.1 for ; Thu, 03 Jun 2021 06:43:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=EsmrbfYiUGkv5WLrLk46+OM5/kTj62vzu84P8chRLMg=; b=FBA3gIY2aGokrbcstf1OTsADWh+2ANht6W6LGFXssF4Ci3rzZtf/Ku/JM1Y2HAy0t+ QF17vMga6Aft2zRElw8ADStGFjmss4IU7MwNVbSWMFK49Ak+etL01+WeampI9ZTd4ycF szFS87+CmkQOIJwZXJWI7GjoL9FKDu3N17+j4hrPAzR866saR//5pL0hMQ5S685Vf1lc kcMEn6YcwQvoVqT3Qh2Tj200t6eOyfM2TJLS+fmgw/MBP6s6NRQsuSco0XREvm+cIHAu dsTVuf2KhS5BkppVyZpoX2YGNlU5HN87AKFq6fg0OJcboI3aePMeeengs38y+XKEgx6/ 8vwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EsmrbfYiUGkv5WLrLk46+OM5/kTj62vzu84P8chRLMg=; b=MIces/6P4MGxc94PGKM62bGcDVhZF1AUH2UBMgB6QGSU86sWF3Ag5OjwVIhXxbiZ+c 6oIBZuKQLZiekqRxTghzbiWb+v6WPOIo3CXEXup2ksuR8lgXfBSQyLSAOTMQQtJ3Jlkg 114SAdr9iOlCZGa1NB+2en9knXqJZqCMsXs2GAnTjdmjJ2Fb5Ekacn/F+Am4QlnE3h9h cJby0x0AkzRWvVfuP1qd2TY2/CKxQiuyOMnFg8clJZ6jTRGh64oodJMGiR1fJKHj1/tv lJClLqaEy/ofxRI1aqyxsxV+R6Qfgrg8PgtswNMvSorj78ypfLbYy65cNKYoW4ajXE3n xn4A== X-Gm-Message-State: AOAM533aQM6CZ/XI+QMGhnvewn9mZHKgihVEzHNlmrbbA2vas55MiaxV DbDMUJ1jtcAx+lrlSntmspMqgw== X-Google-Smtp-Source: ABdhPJy8ggXWKHIyxF6nRMzLSKRmRT8N1AUeBfJ5yH995wRm1fZNR3J9fG9qYC5txFAMsTjIWhHp7g== X-Received: by 2002:ae9:e40f:: with SMTP id q15mr25842902qkc.125.1622727791237; Thu, 03 Jun 2021 06:43:11 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-224-136.bltmmd.fios.verizon.net. [100.16.224.136]) by smtp.gmail.com with ESMTPSA id j62sm1931285qkf.125.2021.06.03.06.43.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 06:43:10 -0700 (PDT) Date: Thu, 3 Jun 2021 09:43:09 -0400 From: Shawn Webb To: Ed Maste Cc: Warner Losh , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 455dff72fcc2 - main - hpt27xx: Use EXTRA_OBJS instead of OBJS Message-ID: <20210603134309.rk2tfnk2xa34gnsj@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202106021640.152Ge8SG056952@gitrepo.freebsd.org> <20210603131025.sncyft4fq3ip7wiu@mutt-hbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="zkwks7vboo7yzatn" Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4FwnCh13M7z3Kxm X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 13:43:12 -0000 --zkwks7vboo7yzatn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 03, 2021 at 09:38:07AM -0400, Ed Maste wrote: > On Thu, 3 Jun 2021 at 09:10, Shawn Webb wrot= e: > > > > There's something about this change that breaks buildkernel: > > > > make[4]: make[4]: don't know how to make /usr/src/sys/dev/hptrr/amd64-e= lf.hptrr_lib.o. Stop > > `/usr/src/sys/dev/hptrr/amd64-elf.hptrr_lib.o' was not built (being mad= e, type OP_DEPS_FOUND|OP_MARK, flags REMAKE|DONE_WAIT|DONE_ALLSRC|DONECYCLE= )! >=20 > It builds for me and in CI. It looks like you're still missing the .o > file (because of the bug Warner fixed) and need to restore it via `git > checkout`. Good catch. Thanks! --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --zkwks7vboo7yzatn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmC43GsACgkQ/y5nonf4 4frC9w//foxl+n9eRDA0cGv58IBEl4qZgoVTljaht5mjsQydNuIuquCn0ZowXGvV wdrnZadsnM2aOIBP935H099lSykhJ2r4JHbnXNyRtNL6quVziZU4gR9ky/fhuQaY ehJ9I8TsSaZNR7GMPoN40N/785+5IHcJFQheQggBmKEcZvp6GsFxWTWOOud7N/Uv iIDalr1nQ0g7MP38DODmGTfFw1lot8XcF3bEgxOWXCEtDpdtGFV+dn5zvtBRMeO/ UQKjWoXECDGw4rvj5Kc/rRc90qvZVmWNSsIS/SnyVxQBtchPI0udoVBUVDcp+aK4 i+ikyqNoJaUaeBj4oTBwlNy1SYAfUNMPYivbq0eWJkMl+MPkOXAsVAF/gmaWe1J9 soJXucQlAvS//6kWRLl796QiN5/a7LXw3DU/PcILIP4zqkUKO7pzFh8MhmbP2ORP LeMTVrBp31+sa6WDP0lZep1pAqejxHN8e/Uczesayh43YyV6tBOQbwYng0c9mwWW yI/AucwsOX03PgfEGE2Ab4q887gjBMhJ/2mepwNYAuFMbB3CWNkH5R52mxCQamej XXD1YDZkeRU9c9UepeCa9mp0mUhRKXCGKSbIF38A2/TaDNUKdSyNsqTklVZ7ryOX 2j71uSh3TASxbMMdpATVENBKLQgjsQ4+wNByutEEP8u/O4bYdw4= =6rwP -----END PGP SIGNATURE----- --zkwks7vboo7yzatn-- From owner-dev-commits-src-main@freebsd.org Thu Jun 3 15:19:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4282E63B9DA; Thu, 3 Jun 2021 15:19:42 +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 4FwqM20vL5z3jjj; Thu, 3 Jun 2021 15:19:42 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0646E42B3; Thu, 3 Jun 2021 15:19:42 +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 153FJfJW063878; Thu, 3 Jun 2021 15:19:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153FJfrR063877; Thu, 3 Jun 2021 15:19:41 GMT (envelope-from git) Date: Thu, 3 Jun 2021 15:19:41 GMT Message-Id: <202106031519.153FJfrR063877@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: fe3bcfbda30e - main - VNETify dummynet MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fe3bcfbda30e763a3ec56083b3a19cebbeaf8952 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 15:19:42 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fe3bcfbda30e763a3ec56083b3a19cebbeaf8952 commit fe3bcfbda30e763a3ec56083b3a19cebbeaf8952 Author: Tom Jones AuthorDate: 2021-05-15 12:36:45 +0000 Commit: Kristof Provost CommitDate: 2021-06-03 07:01:56 +0000 VNETify dummynet This moves dn_cfg and other parameters into per VNET variables. The taskqueue and control state remains global. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D29274 --- sys/netpfil/ipfw/dn_aqm.h | 6 +- sys/netpfil/ipfw/dn_aqm_codel.c | 2 +- sys/netpfil/ipfw/dn_aqm_pie.c | 2 +- sys/netpfil/ipfw/dn_sched.h | 2 +- sys/netpfil/ipfw/dn_sched_fq_codel.c | 2 +- sys/netpfil/ipfw/dn_sched_fq_codel.h | 7 +- sys/netpfil/ipfw/dn_sched_fq_pie.c | 9 +- sys/netpfil/ipfw/ip_dn_glue.c | 8 +- sys/netpfil/ipfw/ip_dn_io.c | 180 ++++++++++++----------- sys/netpfil/ipfw/ip_dn_private.h | 42 +++--- sys/netpfil/ipfw/ip_dummynet.c | 271 +++++++++++++++++++---------------- 11 files changed, 281 insertions(+), 250 deletions(-) diff --git a/sys/netpfil/ipfw/dn_aqm.h b/sys/netpfil/ipfw/dn_aqm.h index 8bbe9fe69e86..b0eaf2ecfc8a 100644 --- a/sys/netpfil/ipfw/dn_aqm.h +++ b/sys/netpfil/ipfw/dn_aqm.h @@ -37,9 +37,9 @@ #define _IP_DN_AQM_H /* NOW is the current time in millisecond*/ -#define NOW ((dn_cfg.curr_time * tick) / 1000) +#define NOW ((V_dn_cfg.curr_time * tick) / 1000) -#define AQM_UNOW (dn_cfg.curr_time * tick) +#define AQM_UNOW (V_dn_cfg.curr_time * tick) #define AQM_TIME_1US ((aqm_time_t)(1)) #define AQM_TIME_1MS ((aqm_time_t)(1000)) #define AQM_TIME_1S ((aqm_time_t)(AQM_TIME_1MS * 1000)) @@ -134,7 +134,7 @@ update_stats(struct dn_queue *q, int len, int drop) if (drop) { qni->drops++; sni->drops++; - dn_cfg.io_pkt_drop++; + V_dn_cfg.io_pkt_drop++; } else { /*update queue stats */ qni->length += inc; diff --git a/sys/netpfil/ipfw/dn_aqm_codel.c b/sys/netpfil/ipfw/dn_aqm_codel.c index a1f90461ecab..79c6afd8b635 100644 --- a/sys/netpfil/ipfw/dn_aqm_codel.c +++ b/sys/netpfil/ipfw/dn_aqm_codel.c @@ -202,7 +202,7 @@ codel_extract_head(struct dn_queue *q, aqm_time_t *pkt_ts) update_stats(q, -m->m_pkthdr.len, 0); if (q->ni.length == 0) /* queue is now idle */ - q->q_time = dn_cfg.curr_time; + q->q_time = V_dn_cfg.curr_time; /* extract packet TS*/ mtag = m_tag_locate(m, MTAG_ABI_COMPAT, DN_AQM_MTAG_TS, NULL); diff --git a/sys/netpfil/ipfw/dn_aqm_pie.c b/sys/netpfil/ipfw/dn_aqm_pie.c index 2d5d500e275c..4a55aed662f7 100644 --- a/sys/netpfil/ipfw/dn_aqm_pie.c +++ b/sys/netpfil/ipfw/dn_aqm_pie.c @@ -338,7 +338,7 @@ pie_extract_head(struct dn_queue *q, aqm_time_t *pkt_ts, int getts) update_stats(q, -m->m_pkthdr.len, 0); if (q->ni.length == 0) /* queue is now idle */ - q->q_time = dn_cfg.curr_time; + q->q_time = V_dn_cfg.curr_time; if (getts) { /* extract packet TS*/ diff --git a/sys/netpfil/ipfw/dn_sched.h b/sys/netpfil/ipfw/dn_sched.h index 9bbd9019d623..1aa885ce3ccf 100644 --- a/sys/netpfil/ipfw/dn_sched.h +++ b/sys/netpfil/ipfw/dn_sched.h @@ -187,7 +187,7 @@ dn_dequeue(struct dn_queue *q) q->_si->ni.len_bytes -= m->m_pkthdr.len; } if (q->ni.length == 0) /* queue is now idle */ - q->q_time = dn_cfg.curr_time; + q->q_time = V_dn_cfg.curr_time; return m; } diff --git a/sys/netpfil/ipfw/dn_sched_fq_codel.c b/sys/netpfil/ipfw/dn_sched_fq_codel.c index bc61be867d36..97341f5a9a60 100644 --- a/sys/netpfil/ipfw/dn_sched_fq_codel.c +++ b/sys/netpfil/ipfw/dn_sched_fq_codel.c @@ -165,7 +165,7 @@ codel_drop_head(struct fq_codel_flow *q, struct fq_codel_si *si) fq_update_stats(q, si, -m->m_pkthdr.len, 1); if (si->main_q.ni.length == 0) /* queue is now idle */ - si->main_q.q_time = dn_cfg.curr_time; + si->main_q.q_time = V_dn_cfg.curr_time; FREE_PKT(m); } diff --git a/sys/netpfil/ipfw/dn_sched_fq_codel.h b/sys/netpfil/ipfw/dn_sched_fq_codel.h index a8369ac83129..dcdbc6f32e7a 100644 --- a/sys/netpfil/ipfw/dn_sched_fq_codel.h +++ b/sys/netpfil/ipfw/dn_sched_fq_codel.h @@ -36,6 +36,9 @@ #ifndef _IP_DN_SCHED_FQ_CODEL_H #define _IP_DN_SCHED_FQ_CODEL_H +VNET_DECLARE(unsigned long, io_pkt_drop); +#define V_io_pkt_drop VNET(io_pkt_drop) + /* list of queues */ STAILQ_HEAD(fq_codel_list, fq_codel_flow) ; @@ -104,7 +107,7 @@ fq_update_stats(struct fq_codel_flow *q, struct fq_codel_si *si, int len, si->main_q.ni.drops ++; q->stats.drops ++; si->_si.ni.drops ++; - dn_cfg.io_pkt_drop ++; + V_dn_cfg.io_pkt_drop ++; } if (!drop || (drop && len < 0)) { @@ -147,7 +150,7 @@ fq_codel_extract_head(struct fq_codel_flow *q, aqm_time_t *pkt_ts, struct fq_cod fq_update_stats(q, si, -m->m_pkthdr.len, 0); if (si->main_q.ni.length == 0) /* queue is now idle */ - si->main_q.q_time = dn_cfg.curr_time; + si->main_q.q_time = V_dn_cfg.curr_time; /* extract packet timestamp*/ struct m_tag *mtag; diff --git a/sys/netpfil/ipfw/dn_sched_fq_pie.c b/sys/netpfil/ipfw/dn_sched_fq_pie.c index 809ca2b5f4e8..76215aed610a 100644 --- a/sys/netpfil/ipfw/dn_sched_fq_pie.c +++ b/sys/netpfil/ipfw/dn_sched_fq_pie.c @@ -82,6 +82,9 @@ #define DN_SCHED_FQ_PIE 7 +VNET_DECLARE(unsigned long, io_pkt_drop); +#define V_io_pkt_drop VNET(io_pkt_drop) + /* list of queues */ STAILQ_HEAD(fq_pie_list, fq_pie_flow) ; @@ -299,7 +302,7 @@ fq_update_stats(struct fq_pie_flow *q, struct fq_pie_si *si, int len, si->main_q.ni.drops ++; q->stats.drops ++; si->_si.ni.drops ++; - dn_cfg.io_pkt_drop ++; + V_dn_cfg.io_pkt_drop ++; } if (!drop || (drop && len < 0)) { @@ -347,7 +350,7 @@ fq_pie_extract_head(struct fq_pie_flow *q, aqm_time_t *pkt_ts, fq_update_stats(q, si, -m->m_pkthdr.len, 0); if (si->main_q.ni.length == 0) /* queue is now idle */ - si->main_q.q_time = dn_cfg.curr_time; + si->main_q.q_time = V_dn_cfg.curr_time; if (getts) { /* extract packet timestamp*/ @@ -768,7 +771,7 @@ pie_drop_head(struct fq_pie_flow *q, struct fq_pie_si *si) fq_update_stats(q, si, -m->m_pkthdr.len, 1); if (si->main_q.ni.length == 0) /* queue is now idle */ - si->main_q.q_time = dn_cfg.curr_time; + si->main_q.q_time = V_dn_cfg.curr_time; /* reset accu_prob after packet drop */ q->pst.accu_prob = 0; diff --git a/sys/netpfil/ipfw/ip_dn_glue.c b/sys/netpfil/ipfw/ip_dn_glue.c index 5a39a1a47282..83f26cb23680 100644 --- a/sys/netpfil/ipfw/ip_dn_glue.c +++ b/sys/netpfil/ipfw/ip_dn_glue.c @@ -567,10 +567,10 @@ dn_compat_calc_size(void) * - all flowset queues: queue_count * - all pipe queue: si_count */ - need += dn_cfg.schk_count * sizeof(struct dn_pipe8) / 2; - need += dn_cfg.fsk_count * sizeof(struct dn_flow_set); - need += dn_cfg.si_count * sizeof(struct dn_flow_queue8); - need += dn_cfg.queue_count * sizeof(struct dn_flow_queue8); + need += V_dn_cfg.schk_count * sizeof(struct dn_pipe8) / 2; + need += V_dn_cfg.fsk_count * sizeof(struct dn_flow_set); + need += V_dn_cfg.si_count * sizeof(struct dn_flow_queue8); + need += V_dn_cfg.queue_count * sizeof(struct dn_flow_queue8); return need; } diff --git a/sys/netpfil/ipfw/ip_dn_io.c b/sys/netpfil/ipfw/ip_dn_io.c index 4a65bd0ef798..39bea3eb99dd 100644 --- a/sys/netpfil/ipfw/ip_dn_io.c +++ b/sys/netpfil/ipfw/ip_dn_io.c @@ -74,11 +74,10 @@ __FBSDID("$FreeBSD$"); /* * We keep a private variable for the simulation time, but we could * probably use an existing one ("softticks" in sys/kern/kern_timeout.c) - * instead of dn_cfg.curr_time + * instead of V_dn_cfg.curr_time */ - -struct dn_parms dn_cfg; -//VNET_DEFINE(struct dn_parms, _base_dn_cfg); +VNET_DEFINE(struct dn_parms, dn_cfg); +#define V_dn_cfg VNET(dn_cfg) /* * We use a heap to store entities for which we have pending timer events. @@ -102,13 +101,13 @@ sysctl_hash_size(SYSCTL_HANDLER_ARGS) { int error, value; - value = dn_cfg.hash_size; + value = V_dn_cfg.hash_size; error = sysctl_handle_int(oidp, &value, 0, req); if (error != 0 || req->newptr == NULL) return (error); if (value < 16 || value > 65536) return (EINVAL); - dn_cfg.hash_size = value; + V_dn_cfg.hash_size = value; return (0); } @@ -119,9 +118,9 @@ sysctl_limits(SYSCTL_HANDLER_ARGS) long value; if (arg2 != 0) - value = dn_cfg.slot_limit; + value = V_dn_cfg.slot_limit; else - value = dn_cfg.byte_limit; + value = V_dn_cfg.byte_limit; error = sysctl_handle_long(oidp, &value, 0, req); if (error != 0 || req->newptr == NULL) @@ -129,11 +128,11 @@ sysctl_limits(SYSCTL_HANDLER_ARGS) if (arg2 != 0) { if (value < 1) return (EINVAL); - dn_cfg.slot_limit = value; + V_dn_cfg.slot_limit = value; } else { if (value < 1500) return (EINVAL); - dn_cfg.byte_limit = value; + V_dn_cfg.byte_limit = value; } return (0); } @@ -151,9 +150,9 @@ static SYSCTL_NODE(_net_inet_ip, OID_AUTO, dummynet, "Dummynet"); #endif -/* wrapper to pass dn_cfg fields to SYSCTL_* */ -//#define DC(x) (&(VNET_NAME(_base_dn_cfg).x)) -#define DC(x) (&(dn_cfg.x)) +/* wrapper to pass V_dn_cfg fields to SYSCTL_* */ +#define DC(x) (&(VNET_NAME(dn_cfg).x)) + /* parameters */ SYSCTL_PROC(_net_inet_ip_dummynet, OID_AUTO, hash_size, @@ -349,7 +348,7 @@ red_drops (struct dn_queue *q, int len) * XXX check wraps... */ if (q->avg) { - u_int t = div64((dn_cfg.curr_time - q->q_time), fs->lookup_step); + u_int t = div64((V_dn_cfg.curr_time - q->q_time), fs->lookup_step); q->avg = (t < fs->lookup_depth) ? SCALE_MUL(q->avg, fs->w_q_lookup[t]) : 0; @@ -524,7 +523,7 @@ dn_enqueue(struct dn_queue *q, struct mbuf* m, int drop) return (0); drop: - dn_cfg.io_pkt_drop++; + V_dn_cfg.io_pkt_drop++; q->ni.drops++; ni->drops++; FREE_PKT(m); @@ -553,7 +552,7 @@ transmit_event(struct mq *q, struct delay_line *dline, uint64_t now) } if (m != NULL) { dline->oid.subtype = 1; /* in heap */ - heap_insert(&dn_cfg.evheap, pkt->output_time, dline); + heap_insert(&V_dn_cfg.evheap, pkt->output_time, dline); } } @@ -616,7 +615,7 @@ serve_sched(struct mq *q, struct dn_sch_inst *si, uint64_t now) (m->m_pkthdr.len * 8 + extra_bits(m, s)); si->credit -= len_scaled; /* Move packet in the delay line */ - dn_tag_get(m)->output_time = dn_cfg.curr_time + s->link.delay ; + dn_tag_get(m)->output_time = V_dn_cfg.curr_time + s->link.delay ; mq_append(&si->dline.mq, m); } @@ -634,7 +633,7 @@ serve_sched(struct mq *q, struct dn_sch_inst *si, uint64_t now) if (m) dn_tag_get(m)->output_time += t; si->kflags |= DN_ACTIVE; - heap_insert(&dn_cfg.evheap, now + t, si); + heap_insert(&V_dn_cfg.evheap, now + t, si); } if (delay_line_idle && done) transmit_event(q, &si->dline, now); @@ -651,74 +650,85 @@ dummynet_task(void *context, int pending) { struct timeval t; struct mq q = { NULL, NULL }; /* queue to accumulate results */ + struct epoch_tracker et; - CURVNET_SET((struct vnet *)context); + VNET_ITERATOR_DECL(vnet_iter); + VNET_LIST_RLOCK(); + NET_EPOCH_ENTER(et); - DN_BH_WLOCK(); + VNET_FOREACH(vnet_iter) { + memset(&q, 0, sizeof(struct mq)); + CURVNET_SET(vnet_iter); - /* Update number of lost(coalesced) ticks. */ - dn_cfg.tick_lost += pending - 1; + DN_BH_WLOCK(); - getmicrouptime(&t); - /* Last tick duration (usec). */ - dn_cfg.tick_last = (t.tv_sec - dn_cfg.prev_t.tv_sec) * 1000000 + - (t.tv_usec - dn_cfg.prev_t.tv_usec); - /* Last tick vs standard tick difference (usec). */ - dn_cfg.tick_delta = (dn_cfg.tick_last * hz - 1000000) / hz; - /* Accumulated tick difference (usec). */ - dn_cfg.tick_delta_sum += dn_cfg.tick_delta; + /* Update number of lost(coalesced) ticks. */ + V_dn_cfg.tick_lost += pending - 1; - dn_cfg.prev_t = t; + getmicrouptime(&t); + /* Last tick duration (usec). */ + V_dn_cfg.tick_last = (t.tv_sec - V_dn_cfg.prev_t.tv_sec) * 1000000 + + (t.tv_usec - V_dn_cfg.prev_t.tv_usec); + /* Last tick vs standard tick difference (usec). */ + V_dn_cfg.tick_delta = (V_dn_cfg.tick_last * hz - 1000000) / hz; + /* Accumulated tick difference (usec). */ + V_dn_cfg.tick_delta_sum += V_dn_cfg.tick_delta; - /* - * Adjust curr_time if the accumulated tick difference is - * greater than the 'standard' tick. Since curr_time should - * be monotonically increasing, we do positive adjustments - * as required, and throttle curr_time in case of negative - * adjustment. - */ - dn_cfg.curr_time++; - if (dn_cfg.tick_delta_sum - tick >= 0) { - int diff = dn_cfg.tick_delta_sum / tick; - - dn_cfg.curr_time += diff; - dn_cfg.tick_diff += diff; - dn_cfg.tick_delta_sum %= tick; - dn_cfg.tick_adjustment++; - } else if (dn_cfg.tick_delta_sum + tick <= 0) { - dn_cfg.curr_time--; - dn_cfg.tick_diff--; - dn_cfg.tick_delta_sum += tick; - dn_cfg.tick_adjustment++; - } + V_dn_cfg.prev_t = t; - /* serve pending events, accumulate in q */ - for (;;) { - struct dn_id *p; /* generic parameter to handler */ + /* + * Adjust curr_time if the accumulated tick difference is + * greater than the 'standard' tick. Since curr_time should + * be monotonically increasing, we do positive adjustments + * as required, and throttle curr_time in case of negative + * adjustment. + */ + V_dn_cfg.curr_time++; + if (V_dn_cfg.tick_delta_sum - tick >= 0) { + int diff = V_dn_cfg.tick_delta_sum / tick; + + V_dn_cfg.curr_time += diff; + V_dn_cfg.tick_diff += diff; + V_dn_cfg.tick_delta_sum %= tick; + V_dn_cfg.tick_adjustment++; + } else if (V_dn_cfg.tick_delta_sum + tick <= 0) { + V_dn_cfg.curr_time--; + V_dn_cfg.tick_diff--; + V_dn_cfg.tick_delta_sum += tick; + V_dn_cfg.tick_adjustment++; + } - if (dn_cfg.evheap.elements == 0 || - DN_KEY_LT(dn_cfg.curr_time, HEAP_TOP(&dn_cfg.evheap)->key)) - break; - p = HEAP_TOP(&dn_cfg.evheap)->object; - heap_extract(&dn_cfg.evheap, NULL); + /* serve pending events, accumulate in q */ + for (;;) { + struct dn_id *p; /* generic parameter to handler */ - if (p->type == DN_SCH_I) { - serve_sched(&q, (struct dn_sch_inst *)p, dn_cfg.curr_time); - } else { /* extracted a delay line */ - transmit_event(&q, (struct delay_line *)p, dn_cfg.curr_time); + if (V_dn_cfg.evheap.elements == 0 || + DN_KEY_LT(V_dn_cfg.curr_time, HEAP_TOP(&V_dn_cfg.evheap)->key)) + break; + p = HEAP_TOP(&V_dn_cfg.evheap)->object; + heap_extract(&V_dn_cfg.evheap, NULL); + if (p->type == DN_SCH_I) { + serve_sched(&q, (struct dn_sch_inst *)p, V_dn_cfg.curr_time); + } else { /* extracted a delay line */ + transmit_event(&q, (struct delay_line *)p, V_dn_cfg.curr_time); + } } + if (V_dn_cfg.expire && ++V_dn_cfg.expire_cycle >= V_dn_cfg.expire) { + V_dn_cfg.expire_cycle = 0; + dn_drain_scheduler(); + dn_drain_queue(); + } + DN_BH_WUNLOCK(); + if (q.head != NULL) + dummynet_send(q.head); + + CURVNET_RESTORE(); } - if (dn_cfg.expire && ++dn_cfg.expire_cycle >= dn_cfg.expire) { - dn_cfg.expire_cycle = 0; - dn_drain_scheduler(); - dn_drain_queue(); - } + NET_EPOCH_EXIT(et); + VNET_LIST_RUNLOCK(); + /* Schedule our next run. */ dn_reschedule(); - DN_BH_WUNLOCK(); - if (q.head != NULL) - dummynet_send(q.head); - CURVNET_RESTORE(); } /* @@ -834,7 +844,7 @@ tag_mbuf(struct mbuf *m, int dir, struct ip_fw_args *fwa) dt->dn_dir = dir; dt->ifp = fwa->flags & IPFW_ARGS_OUT ? fwa->ifp : NULL; /* dt->output tame is updated as we move through */ - dt->output_time = dn_cfg.curr_time; + dt->output_time = V_dn_cfg.curr_time; dt->iphdr_off = (dir & PROTO_LAYER2) ? ETHER_HDR_LEN : 0; return 0; } @@ -866,12 +876,12 @@ dummynet_io(struct mbuf **m0, struct ip_fw_args *fwa) else if (fwa->flags & IPFW_ARGS_IP6) dir |= PROTO_IPV6; DN_BH_WLOCK(); - dn_cfg.io_pkt++; + V_dn_cfg.io_pkt++; /* we could actually tag outside the lock, but who cares... */ if (tag_mbuf(m, dir, fwa)) goto dropit; /* XXX locate_flowset could be optimised with a direct ref. */ - fs = dn_ht_find(dn_cfg.fshash, fs_id, 0, NULL); + fs = dn_ht_find(V_dn_cfg.fshash, fs_id, 0, NULL); if (fs == NULL) goto dropit; /* This queue/pipe does not exist! */ if (fs->sched == NULL) /* should not happen */ @@ -894,7 +904,7 @@ dummynet_io(struct mbuf **m0, struct ip_fw_args *fwa) m = *m0 = NULL; /* dn_enqueue already increases io_pkt_drop */ - dn_cfg.io_pkt_drop--; + V_dn_cfg.io_pkt_drop--; goto dropit; } @@ -905,34 +915,34 @@ dummynet_io(struct mbuf **m0, struct ip_fw_args *fwa) } /* compute the initial allowance */ - if (si->idle_time < dn_cfg.curr_time) { + if (si->idle_time < V_dn_cfg.curr_time) { /* Do this only on the first packet on an idle pipe */ struct dn_link *p = &fs->sched->link; - si->sched_time = dn_cfg.curr_time; - si->credit = dn_cfg.io_fast ? p->bandwidth : 0; + si->sched_time = V_dn_cfg.curr_time; + si->credit = V_dn_cfg.io_fast ? p->bandwidth : 0; if (p->burst) { - uint64_t burst = (dn_cfg.curr_time - si->idle_time) * p->bandwidth; + uint64_t burst = (V_dn_cfg.curr_time - si->idle_time) * p->bandwidth; if (burst > p->burst) burst = p->burst; si->credit += burst; } } /* pass through scheduler and delay line */ - m = serve_sched(NULL, si, dn_cfg.curr_time); + m = serve_sched(NULL, si, V_dn_cfg.curr_time); /* optimization -- pass it back to ipfw for immediate send */ /* XXX Don't call dummynet_send() if scheduler return the packet * just enqueued. This avoid a lock order reversal. * */ - if (/*dn_cfg.io_fast &&*/ m == *m0 && (dir & PROTO_LAYER2) == 0 ) { + if (/*V_dn_cfg.io_fast &&*/ m == *m0 && (dir & PROTO_LAYER2) == 0 ) { /* fast io, rename the tag * to carry reinject info. */ struct m_tag *tag = m_tag_first(m); tag->m_tag_cookie = MTAG_IPFW_RULE; tag->m_tag_id = 0; - dn_cfg.io_pkt_fast++; + V_dn_cfg.io_pkt_fast++; if (m->m_nextpkt != NULL) { printf("dummynet: fast io: pkt chain detected!\n"); m->m_nextpkt = NULL; @@ -948,7 +958,7 @@ done: return 0; dropit: - dn_cfg.io_pkt_drop++; + V_dn_cfg.io_pkt_drop++; DN_BH_WUNLOCK(); if (m) FREE_PKT(m); diff --git a/sys/netpfil/ipfw/ip_dn_private.h b/sys/netpfil/ipfw/ip_dn_private.h index e6e699bf35b2..8dedd071bd81 100644 --- a/sys/netpfil/ipfw/ip_dn_private.h +++ b/sys/netpfil/ipfw/ip_dn_private.h @@ -46,7 +46,7 @@ #define D(fmt, ...) printf("%-10s " fmt "\n", \ __FUNCTION__, ## __VA_ARGS__) #define DX(lev, fmt, ...) do { \ - if (dn_cfg.debug > lev) D(fmt, ## __VA_ARGS__); } while (0) + if (V_dn_cfg.debug > lev) D(fmt, ## __VA_ARGS__); } while (0) #endif MALLOC_DECLARE(M_DUMMYNET); @@ -56,26 +56,26 @@ MALLOC_DECLARE(M_DUMMYNET); #endif #define DN_LOCK_INIT() do { \ - mtx_init(&dn_cfg.uh_mtx, "dn_uh", NULL, MTX_DEF); \ - mtx_init(&dn_cfg.bh_mtx, "dn_bh", NULL, MTX_DEF); \ + mtx_init(&V_dn_cfg.uh_mtx, "dn_uh", NULL, MTX_DEF); \ + mtx_init(&V_dn_cfg.bh_mtx, "dn_bh", NULL, MTX_DEF); \ } while (0) #define DN_LOCK_DESTROY() do { \ - mtx_destroy(&dn_cfg.uh_mtx); \ - mtx_destroy(&dn_cfg.bh_mtx); \ + mtx_destroy(&V_dn_cfg.uh_mtx); \ + mtx_destroy(&V_dn_cfg.bh_mtx); \ } while (0) #if 0 /* not used yet */ -#define DN_UH_RLOCK() mtx_lock(&dn_cfg.uh_mtx) -#define DN_UH_RUNLOCK() mtx_unlock(&dn_cfg.uh_mtx) -#define DN_UH_WLOCK() mtx_lock(&dn_cfg.uh_mtx) -#define DN_UH_WUNLOCK() mtx_unlock(&dn_cfg.uh_mtx) -#define DN_UH_LOCK_ASSERT() mtx_assert(&dn_cfg.uh_mtx, MA_OWNED) +#define DN_UH_RLOCK() mtx_lock(&V_dn_cfg.uh_mtx) +#define DN_UH_RUNLOCK() mtx_unlock(&V_dn_cfg.uh_mtx) +#define DN_UH_WLOCK() mtx_lock(&V_dn_cfg.uh_mtx) +#define DN_UH_WUNLOCK() mtx_unlock(&V_dn_cfg.uh_mtx) +#define DN_UH_LOCK_ASSERT() mtx_assert(&V_dn_cfg.uh_mtx, MA_OWNED) #endif -#define DN_BH_RLOCK() mtx_lock(&dn_cfg.uh_mtx) -#define DN_BH_RUNLOCK() mtx_unlock(&dn_cfg.uh_mtx) -#define DN_BH_WLOCK() mtx_lock(&dn_cfg.uh_mtx) -#define DN_BH_WUNLOCK() mtx_unlock(&dn_cfg.uh_mtx) -#define DN_BH_LOCK_ASSERT() mtx_assert(&dn_cfg.uh_mtx, MA_OWNED) +#define DN_BH_RLOCK() mtx_lock(&V_dn_cfg.uh_mtx) +#define DN_BH_RUNLOCK() mtx_unlock(&V_dn_cfg.uh_mtx) +#define DN_BH_WLOCK() mtx_lock(&V_dn_cfg.uh_mtx) +#define DN_BH_WUNLOCK() mtx_unlock(&V_dn_cfg.uh_mtx) +#define DN_BH_LOCK_ASSERT() mtx_assert(&V_dn_cfg.uh_mtx, MA_OWNED) SLIST_HEAD(dn_schk_head, dn_schk); SLIST_HEAD(dn_sch_inst_head, dn_sch_inst); @@ -101,7 +101,7 @@ set_oid(struct dn_id *o, int type, int len) } /* - * configuration and global data for a dummynet instance + * configuration and data for a dummynet instance * * When a configuration is modified from userland, 'id' is incremented * so we can use the value to check for stale pointers. @@ -154,10 +154,6 @@ struct dn_parms { struct dn_ht *schedhash; /* list of flowsets without a scheduler -- use sch_chain */ struct dn_fsk_head fsu; /* list of unlinked flowsets */ - struct dn_alg_head schedlist; /* list of algorithms */ -#ifdef NEW_AQM - struct dn_aqm_head aqmlist; /* list of AQMs */ -#endif /* Store the fs/sch to scan when draining. The value is the * bucket number of the hash table. Expire can be disabled @@ -406,9 +402,9 @@ enum { PROTO_IFB = 0x0c, /* layer2 + ifbridge */ }; -extern struct dn_parms dn_cfg; -//VNET_DECLARE(struct dn_parms, _base_dn_cfg); -//#define dn_cfg VNET(_base_dn_cfg) +//extern struct dn_parms V_dn_cfg; +VNET_DECLARE(struct dn_parms, dn_cfg); +#define V_dn_cfg VNET(dn_cfg) int dummynet_io(struct mbuf **, struct ip_fw_args *); void dummynet_task(void *context, int pending); diff --git a/sys/netpfil/ipfw/ip_dummynet.c b/sys/netpfil/ipfw/ip_dummynet.c index 17f3e364756e..3abc78fc1410 100644 --- a/sys/netpfil/ipfw/ip_dummynet.c +++ b/sys/netpfil/ipfw/ip_dummynet.c @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include /* ip_output(), IP_FORWARDING */ #include #include +#include #include #include @@ -87,10 +88,17 @@ struct schk_new_arg { /*---- callout hooks. ----*/ static struct callout dn_timeout; +static int dn_tasks_started = 0; static int dn_gone; static struct task dn_task; static struct taskqueue *dn_tq = NULL; +/* global scheduler list */ +struct dn_alg_head schedlist; +#ifdef NEW_AQM +struct dn_aqm_head aqmlist; /* list of AQMs */ +#endif + static void dummynet(void *arg) { @@ -117,7 +125,7 @@ find_aqm_type(int type, char *name) { struct dn_aqm *d; - SLIST_FOREACH(d, &dn_cfg.aqmlist, next) { + SLIST_FOREACH(d, &aqmlist, next) { if (d->type == type || (name && !strcasecmp(d->name, name))) return d; } @@ -131,7 +139,7 @@ find_sched_type(int type, char *name) { struct dn_alg *d; - SLIST_FOREACH(d, &dn_cfg.schedlist, next) { + SLIST_FOREACH(d, &schedlist, next) { if (d->type == type || (name && !strcasecmp(d->name, name))) return d; } @@ -354,7 +362,7 @@ q_new(uintptr_t key, int flags, void *arg) if(fs->aqmfp->init(q)) D("unable to init AQM for fs %d", fs->fs.fs_nr); #endif - dn_cfg.queue_count++; + V_dn_cfg.queue_count++; return q; } @@ -387,7 +395,7 @@ dn_delete_queue(struct dn_queue *q, int flags) dn_free_pkts(q->mq.head); bzero(q, sizeof(*q)); // safety free(q, M_DUMMYNET); - dn_cfg.queue_count--; + V_dn_cfg.queue_count--; } } @@ -527,7 +535,7 @@ si_new(uintptr_t key, int flags, void *arg) } #endif - dn_cfg.si_count++; + V_dn_cfg.si_count++; return si; error: @@ -552,10 +560,10 @@ si_destroy(void *_si, void *arg) struct delay_line *dl = &si->dline; if (dl->oid.subtype) /* remove delay line from event heap */ - heap_extract(&dn_cfg.evheap, dl); + heap_extract(&V_dn_cfg.evheap, dl); dn_free_pkts(dl->mq.head); /* drain delay line */ if (si->kflags & DN_ACTIVE) /* remove si from event heap */ - heap_extract(&dn_cfg.evheap, si); + heap_extract(&V_dn_cfg.evheap, si); #ifdef NEW_AQM /* clean up AQM status for !DN_MULTIQUEUE sched @@ -574,7 +582,7 @@ si_destroy(void *_si, void *arg) s->fp->free_sched(si); bzero(si, sizeof(*si)); /* safety */ free(si, M_DUMMYNET); - dn_cfg.si_count--; + V_dn_cfg.si_count--; return DNHT_SCAN_DEL; } @@ -605,7 +613,7 @@ si_reset_credit(void *_si, void *arg) struct dn_sch_inst *si = _si; struct dn_link *p = &si->sched->link; - si->credit = p->burst + (dn_cfg.io_fast ? p->bandwidth : 0); + si->credit = p->burst + (V_dn_cfg.io_fast ? p->bandwidth : 0); return 0; } @@ -651,9 +659,9 @@ fsk_new(uintptr_t key, int flags, void *arg) fs = malloc(sizeof(*fs), M_DUMMYNET, M_NOWAIT | M_ZERO); if (fs) { set_oid(&fs->fs.oid, DN_FS, sizeof(fs->fs)); - dn_cfg.fsk_count++; + V_dn_cfg.fsk_count++; fs->drain_bucket = 0; - SLIST_INSERT_HEAD(&dn_cfg.fsu, fs, sch_chain); + SLIST_INSERT_HEAD(&V_dn_cfg.fsu, fs, sch_chain); } return fs; } @@ -737,7 +745,7 @@ fsk_detach(struct dn_fsk *fs, int flags) (flags & DN_DETACH) ? "DET":""); if (flags & DN_DETACH) { /* detach from the list */ struct dn_fsk_head *h; - h = fs->sched ? &fs->sched->fsk_list : &dn_cfg.fsu; + h = fs->sched ? &fs->sched->fsk_list : &V_dn_cfg.fsu; SLIST_REMOVE(h, fs, dn_fsk, sch_chain); } /* Free the RED parameters, they will be recomputed on @@ -757,9 +765,9 @@ fsk_detach(struct dn_fsk *fs, int flags) if (flags & DN_DELETE_FS) { bzero(fs, sizeof(*fs)); /* safety */ free(fs, M_DUMMYNET); - dn_cfg.fsk_count--; + V_dn_cfg.fsk_count--; } else { - SLIST_INSERT_HEAD(&dn_cfg.fsu, fs, sch_chain); + SLIST_INSERT_HEAD(&V_dn_cfg.fsu, fs, sch_chain); } } @@ -797,7 +805,7 @@ delete_fs(int i, int locked) if (!locked) DN_BH_WLOCK(); - fs = dn_ht_find(dn_cfg.fshash, i, DNHT_REMOVE, NULL); + fs = dn_ht_find(V_dn_cfg.fshash, i, DNHT_REMOVE, NULL); ND("fs %d found %p", i, fs); if (fs) { fsk_detach(fs, DN_DETACH | DN_DELETE_FS); @@ -866,7 +874,7 @@ schk_new(uintptr_t key, int flags, void *arg) } } s->fp = NULL; /* mark as a new scheduler */ - dn_cfg.schk_count++; + V_dn_cfg.schk_count++; return s; } @@ -905,7 +913,7 @@ schk_delete_cb(void *obj, void *arg) s->fp->destroy(s); bzero(s, sizeof(*s)); // safety free(obj, M_DUMMYNET); - dn_cfg.schk_count--; + V_dn_cfg.schk_count--; return DNHT_SCAN_DEL; } @@ -919,7 +927,7 @@ delete_schk(int i) { struct dn_schk *s; - s = dn_ht_find(dn_cfg.schedhash, i, DNHT_REMOVE, NULL); + s = dn_ht_find(V_dn_cfg.schedhash, i, DNHT_REMOVE, NULL); ND("%d %p", i, s); if (!s) return EINVAL; @@ -1176,7 +1184,7 @@ copy_data_helper(void *_o, void *_arg) static inline struct dn_schk * locate_scheduler(int i) { - return dn_ht_find(dn_cfg.schedhash, i, 0, NULL); + return dn_ht_find(V_dn_cfg.schedhash, i, 0, NULL); } /* @@ -1194,10 +1202,10 @@ config_red(struct dn_fsk *fs) /* Doing stuff that was in userland */ i = fs->sched->link.bandwidth; s = (i <= 0) ? 0 : - hz * dn_cfg.red_avg_pkt_size * 8 * SCALE(1) / i; + hz * V_dn_cfg.red_avg_pkt_size * 8 * SCALE(1) / i; idle = div64((s * 3) , fs->w_q); /* s, fs->w_q scaled; idle not scaled */ - fs->lookup_step = div64(idle , dn_cfg.red_lookup_depth); + fs->lookup_step = div64(idle , V_dn_cfg.red_lookup_depth); /* fs->lookup_step not scaled, */ if (!fs->lookup_step) fs->lookup_step = 1; @@ -1227,14 +1235,14 @@ config_red(struct dn_fsk *fs) free(fs->w_q_lookup, M_DUMMYNET); fs->w_q_lookup = NULL; } - if (dn_cfg.red_lookup_depth == 0) { + if (V_dn_cfg.red_lookup_depth == 0) { printf("\ndummynet: net.inet.ip.dummynet.red_lookup_depth" "must be > 0\n"); fs->fs.flags &= ~DN_IS_RED; fs->fs.flags &= ~DN_IS_GENTLE_RED; return (EINVAL); } - fs->lookup_depth = dn_cfg.red_lookup_depth; + fs->lookup_depth = V_dn_cfg.red_lookup_depth; fs->w_q_lookup = (u_int *)malloc(fs->lookup_depth * sizeof(int), M_DUMMYNET, M_NOWAIT); if (fs->w_q_lookup == NULL) { @@ -1251,12 +1259,12 @@ config_red(struct dn_fsk *fs) fs->w_q_lookup[i] = SCALE_MUL(fs->w_q_lookup[i - 1], fs->lookup_weight); - if (dn_cfg.red_avg_pkt_size < 1) - dn_cfg.red_avg_pkt_size = 512; - fs->avg_pkt_size = dn_cfg.red_avg_pkt_size; - if (dn_cfg.red_max_pkt_size < 1) - dn_cfg.red_max_pkt_size = 1500; - fs->max_pkt_size = dn_cfg.red_max_pkt_size; + if (V_dn_cfg.red_avg_pkt_size < 1) + V_dn_cfg.red_avg_pkt_size = 512; + fs->avg_pkt_size = V_dn_cfg.red_avg_pkt_size; + if (V_dn_cfg.red_max_pkt_size < 1) + V_dn_cfg.red_max_pkt_size = 1500; + fs->max_pkt_size = V_dn_cfg.red_max_pkt_size; ND("exit"); return 0; } @@ -1278,7 +1286,7 @@ fsk_attach(struct dn_fsk *fs, struct dn_schk *s) { ND("remove fs %d from fsunlinked, link to sched %d", fs->fs.fs_nr, s->sch.sched_nr); - SLIST_REMOVE(&dn_cfg.fsu, fs, dn_fsk, sch_chain); + SLIST_REMOVE(&V_dn_cfg.fsu, fs, dn_fsk, sch_chain); fs->sched = s; SLIST_INSERT_HEAD(&s->fsk_list, fs, sch_chain); if (s->fp->new_fsk) @@ -1317,7 +1325,7 @@ update_fs(struct dn_schk *s) { struct dn_fsk *fs, *tmp; - SLIST_FOREACH_SAFE(fs, &dn_cfg.fsu, sch_chain, tmp) { + SLIST_FOREACH_SAFE(fs, &V_dn_cfg.fsu, sch_chain, tmp) { if (s->sch.sched_nr != fs->fs.sched_nr) { D("fs %d for sch %d not %d still unlinked", fs->fs.fs_nr, fs->fs.sched_nr, @@ -1362,7 +1370,7 @@ get_aqm_parms(struct sockopt *sopt) break; } - fs = dn_ht_find(dn_cfg.fshash, ep->nr, 0, NULL); + fs = dn_ht_find(V_dn_cfg.fshash, ep->nr, 0, NULL); if (!fs) { D("fs %d not found", ep->nr); err = EINVAL; @@ -1579,7 +1587,7 @@ config_link(struct dn_link *p, struct dn_id *arg) s->link.burst = p->burst; schk_reset_credit(s); } - dn_cfg.id++; + V_dn_cfg.id++; DN_BH_WUNLOCK(); return 0; } @@ -1616,15 +1624,15 @@ config_fs(struct dn_fs *nfs, struct dn_id *arg, int locked) /* XXX other sanity checks */ if (nfs->flags & DN_QSIZE_BYTES) { ipdn_bound_var(&nfs->qsize, 16384, - 1500, dn_cfg.byte_limit, NULL); // "queue byte size"); + 1500, V_dn_cfg.byte_limit, NULL); // "queue byte size"); } else { ipdn_bound_var(&nfs->qsize, 50, - 1, dn_cfg.slot_limit, NULL); // "queue slot size"); + 1, V_dn_cfg.slot_limit, NULL); // "queue slot size"); } if (nfs->flags & DN_HAVE_MASK) { /* make sure we have some buckets */ - ipdn_bound_var((int *)&nfs->buckets, dn_cfg.hash_size, - 1, dn_cfg.max_hash_size, "flowset buckets"); + ipdn_bound_var((int *)&nfs->buckets, V_dn_cfg.hash_size, + 1, V_dn_cfg.max_hash_size, "flowset buckets"); } else { nfs->buckets = 1; /* we only need 1 */ } @@ -1634,8 +1642,8 @@ config_fs(struct dn_fs *nfs, struct dn_id *arg, int locked) struct dn_schk *s; int flags = nfs->sched_nr ? DNHT_INSERT : 0; int j; - int oldc = dn_cfg.fsk_count; - fs = dn_ht_find(dn_cfg.fshash, i, flags, NULL); + int oldc = V_dn_cfg.fsk_count; + fs = dn_ht_find(V_dn_cfg.fshash, i, flags, NULL); if (fs == NULL) { D("missing sched for flowset %d", i); break; @@ -1662,8 +1670,8 @@ config_fs(struct dn_fs *nfs, struct dn_id *arg, int locked) #endif break; /* no change, nothing to do */ } - if (oldc != dn_cfg.fsk_count) /* new item */ - dn_cfg.id++; + if (oldc != V_dn_cfg.fsk_count) /* new item */ + V_dn_cfg.id++; s = locate_scheduler(nfs->sched_nr); /* detach from old scheduler if needed, preserving * queues if we need to reattach. Then update the @@ -1729,8 +1737,8 @@ config_sched(struct dn_sch *_nsch, struct dn_id *arg) return EINVAL; /* make sure we have some buckets */ if (a.sch->flags & DN_HAVE_MASK) - ipdn_bound_var((int *)&a.sch->buckets, dn_cfg.hash_size, - 1, dn_cfg.max_hash_size, "sched buckets"); + ipdn_bound_var((int *)&a.sch->buckets, V_dn_cfg.hash_size, + 1, V_dn_cfg.max_hash_size, "sched buckets"); /* XXX other sanity checks */ bzero(&p, sizeof(p)); @@ -1748,14 +1756,14 @@ again: /* run twice, for wfq and fifo */ * lookup the type. If not supplied, use the previous one * or default to WF2Q+. Otherwise, return an error. */ - dn_cfg.id++; + V_dn_cfg.id++; a.fp = find_sched_type(a.sch->oid.subtype, a.sch->name); if (a.fp != NULL) { /* found. Lookup or create entry */ - s = dn_ht_find(dn_cfg.schedhash, i, DNHT_INSERT, &a); + s = dn_ht_find(V_dn_cfg.schedhash, i, DNHT_INSERT, &a); } else if (a.sch->oid.subtype == 0 && !a.sch->name[0]) { /* No type. search existing s* or retry with WF2Q+ */ - s = dn_ht_find(dn_cfg.schedhash, i, 0, &a); + s = dn_ht_find(V_dn_cfg.schedhash, i, 0, &a); if (s != NULL) { a.fp = s->fp; /* Scheduler exists, skip to FIFO scheduler @@ -1827,7 +1835,7 @@ again: /* run twice, for wfq and fifo */ memcpy(pf, s->profile, sizeof(*pf)); } /* remove from the hash */ - dn_ht_find(dn_cfg.schedhash, i, DNHT_REMOVE, NULL); + dn_ht_find(V_dn_cfg.schedhash, i, DNHT_REMOVE, NULL); /* Detach flowsets, preserve queues. */ // schk_delete_cb(s, NULL); // XXX temporarily, kill queues @@ -1845,7 +1853,7 @@ again: /* run twice, for wfq and fifo */ * trying to reuse existing ones if available */ if (!(s->fp->flags & DN_MULTIQUEUE) && !s->fs) { - s->fs = dn_ht_find(dn_cfg.fshash, i, 0, NULL); + s->fs = dn_ht_find(V_dn_cfg.fshash, i, 0, NULL); *** 381 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Thu Jun 3 15:19:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 625EB63BB19; Thu, 3 Jun 2021 15:19:43 +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 4FwqM31yr9z3k4B; Thu, 3 Jun 2021 15:19:43 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2A11841E7; Thu, 3 Jun 2021 15:19:43 +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 153FJh08063899; Thu, 3 Jun 2021 15:19:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153FJhHD063898; Thu, 3 Jun 2021 15:19:43 GMT (envelope-from git) Date: Thu, 3 Jun 2021 15:19:43 GMT Message-Id: <202106031519.153FJhHD063898@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 51d73df18e4d - main - dummynet: Fix schedlist and aqmlist locking MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 51d73df18e4d120f6f062062c18efae3ed5193a6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 15:19:43 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=51d73df18e4d120f6f062062c18efae3ed5193a6 commit 51d73df18e4d120f6f062062c18efae3ed5193a6 Author: Kristof Provost AuthorDate: 2021-05-21 12:26:49 +0000 Commit: Kristof Provost CommitDate: 2021-06-03 07:02:49 +0000 dummynet: Fix schedlist and aqmlist locking These are global (i.e. shared across vnets) structures, so we need global lock to protect them. However, we look up entries in these lists (find_aqm_type(), find_sched_type()) and return them. We must ensure that the returned structures cannot go away while we are using them. Resolve this by using NET_EPOCH(). The structures can be safely accessed under it, and we postpone their cleanup until we're sure they're no longer used. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30381 --- sys/netpfil/ipfw/dn_aqm.h | 4 +- sys/netpfil/ipfw/dn_sched.h | 4 +- sys/netpfil/ipfw/ip_dn_glue.c | 6 +- sys/netpfil/ipfw/ip_dummynet.c | 122 +++++++++++++++++++++++++++++------------ 4 files changed, 98 insertions(+), 38 deletions(-) diff --git a/sys/netpfil/ipfw/dn_aqm.h b/sys/netpfil/ipfw/dn_aqm.h index b0eaf2ecfc8a..cfa1c266c7c8 100644 --- a/sys/netpfil/ipfw/dn_aqm.h +++ b/sys/netpfil/ipfw/dn_aqm.h @@ -36,6 +36,8 @@ #ifndef _IP_DN_AQM_H #define _IP_DN_AQM_H +#include + /* NOW is the current time in millisecond*/ #define NOW ((V_dn_cfg.curr_time * tick) / 1000) @@ -107,7 +109,7 @@ typedef int32_t aqm_stime_t; int ref_count; /*Number of queues instances in the system */ int cfg_ref_count; /*Number of AQM instances in the system */ - SLIST_ENTRY (dn_aqm) next; /* Next AQM in the list */ + CK_LIST_ENTRY(dn_aqm) next; /* Next AQM in the list */ }; /* Helper function to update queue and scheduler statistics. diff --git a/sys/netpfil/ipfw/dn_sched.h b/sys/netpfil/ipfw/dn_sched.h index 1aa885ce3ccf..5c506c1d30ac 100644 --- a/sys/netpfil/ipfw/dn_sched.h +++ b/sys/netpfil/ipfw/dn_sched.h @@ -35,6 +35,8 @@ #ifndef _DN_SCHED_H #define _DN_SCHED_H +#include + #define DN_MULTIQUEUE 0x01 /* * Descriptor for a scheduling algorithm. @@ -141,7 +143,7 @@ struct dn_alg { /* run-time fields */ int ref_count; /* XXX number of instances in the system */ - SLIST_ENTRY(dn_alg) next; /* Next scheduler in the list */ + CK_LIST_ENTRY(dn_alg) next; /* Next scheduler in the list */ }; /* MSVC does not support initializers so we need this ugly macro */ diff --git a/sys/netpfil/ipfw/ip_dn_glue.c b/sys/netpfil/ipfw/ip_dn_glue.c index 83f26cb23680..e035fedaaf91 100644 --- a/sys/netpfil/ipfw/ip_dn_glue.c +++ b/sys/netpfil/ipfw/ip_dn_glue.c @@ -814,7 +814,11 @@ ip_dummynet_compat(struct sockopt *sopt) break; case IP_DUMMYNET_CONFIGURE: - v = malloc(len, M_TEMP, M_WAITOK); + v = malloc(len, M_TEMP, M_NOWAIT); + if (v == NULL) { + error = ENOMEM; + break; + } error = sooptcopyin(sopt, v, len, len); if (error) break; diff --git a/sys/netpfil/ipfw/ip_dummynet.c b/sys/netpfil/ipfw/ip_dummynet.c index 3abc78fc1410..b03ad93041bd 100644 --- a/sys/netpfil/ipfw/ip_dummynet.c +++ b/sys/netpfil/ipfw/ip_dummynet.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include +#include #include #include #include @@ -94,9 +95,10 @@ static struct task dn_task; static struct taskqueue *dn_tq = NULL; /* global scheduler list */ -struct dn_alg_head schedlist; +struct mtx sched_mtx; +CK_LIST_HEAD(, dn_alg) schedlist; #ifdef NEW_AQM -struct dn_aqm_head aqmlist; /* list of AQMs */ +CK_LIST_HEAD(, dn_aqm) aqmlist; /* list of AQMs */ #endif static void @@ -125,7 +127,9 @@ find_aqm_type(int type, char *name) { struct dn_aqm *d; - SLIST_FOREACH(d, &aqmlist, next) { + NET_EPOCH_ASSERT(); + + CK_LIST_FOREACH(d, &aqmlist, next) { if (d->type == type || (name && !strcasecmp(d->name, name))) return d; } @@ -139,7 +143,9 @@ find_sched_type(int type, char *name) { struct dn_alg *d; - SLIST_FOREACH(d, &schedlist, next) { + NET_EPOCH_ASSERT(); + + CK_LIST_FOREACH(d, &schedlist, next) { if (d->type == type || (name && !strcasecmp(d->name, name))) return d; } @@ -1355,7 +1361,7 @@ get_aqm_parms(struct sockopt *sopt) err = EINVAL; return err; } - ep = malloc(l, M_DUMMYNET, M_WAITOK); + ep = malloc(l, M_DUMMYNET, M_NOWAIT); if(!ep) { err = ENOMEM ; return err; @@ -1410,7 +1416,7 @@ get_sched_parms(struct sockopt *sopt) err = EINVAL; return err; } - ep = malloc(l, M_DUMMYNET, M_WAITOK); + ep = malloc(l, M_DUMMYNET, M_NOWAIT); if(!ep) { err = ENOMEM ; return err; @@ -1455,6 +1461,8 @@ config_aqm(struct dn_fsk *fs, struct dn_extra_parms *ep, int busy) { int err = 0; + NET_EPOCH_ASSERT(); + do { /* no configurations */ if (!ep) { @@ -1614,7 +1622,7 @@ config_fs(struct dn_fs *nfs, struct dn_id *arg, int locked) #ifdef NEW_AQM ep = NULL; if (arg != NULL) { - ep = malloc(sizeof(*ep), M_TEMP, locked ? M_NOWAIT : M_WAITOK); + ep = malloc(sizeof(*ep), M_TEMP, M_NOWAIT); if (ep == NULL) return (NULL); memcpy(ep, arg, sizeof(*ep)); @@ -1727,6 +1735,8 @@ config_sched(struct dn_sch *_nsch, struct dn_id *arg) int pipe_cmd; int err = ENOMEM; + NET_EPOCH_ASSERT(); + a.sch = _nsch; if (a.sch->oid.len != sizeof(*a.sch)) { D("bad sched len %d", a.sch->oid.len); @@ -2070,34 +2080,53 @@ do_config(void *p, int l) DN_BH_WUNLOCK(); break; case DN_TEXT: /* store argument of next block */ - if (arg != NULL) - free(arg, M_TEMP); - arg = malloc(o.len, M_TEMP, M_WAITOK); + free(arg, M_TEMP); + arg = malloc(o.len, M_TEMP, M_NOWAIT); + if (arg == NULL) { + err = ENOMEM; + break; + } memcpy(arg, (char *)p + off, o.len); break; case DN_LINK: if (dn == NULL) - dn = malloc(sizeof(*dn), M_TEMP, M_WAITOK); + dn = malloc(sizeof(*dn), M_TEMP, M_NOWAIT); + if (dn == NULL) { + err = ENOMEM; + break; + } memcpy(&dn->link, (char *)p + off, sizeof(dn->link)); err = config_link(&dn->link, arg); break; case DN_PROFILE: if (dn == NULL) - dn = malloc(sizeof(*dn), M_TEMP, M_WAITOK); + dn = malloc(sizeof(*dn), M_TEMP, M_NOWAIT); + if (dn == NULL) { + err = ENOMEM; + break; + } memcpy(&dn->profile, (char *)p + off, sizeof(dn->profile)); err = config_profile(&dn->profile, arg); break; case DN_SCH: if (dn == NULL) - dn = malloc(sizeof(*dn), M_TEMP, M_WAITOK); + dn = malloc(sizeof(*dn), M_TEMP, M_NOWAIT); + if (dn == NULL) { + err = ENOMEM; + break; + } memcpy(&dn->sched, (char *)p + off, sizeof(dn->sched)); err = config_sched(&dn->sched, arg); break; case DN_FS: if (dn == NULL) - dn = malloc(sizeof(*dn), M_TEMP, M_WAITOK); + dn = malloc(sizeof(*dn), M_TEMP, M_NOWAIT); + if (dn == NULL) { + err = ENOMEM; + break; + } memcpy(&dn->fs, (char *)p + off, sizeof(dn->fs)); err = (NULL == config_fs(&dn->fs, arg, 0)); break; @@ -2230,7 +2259,11 @@ dummynet_get(struct sockopt *sopt, void **compat) #endif if (l > sizeof(r)) { /* request larger than default, allocate buffer */ - cmd = malloc(l, M_DUMMYNET, M_WAITOK); + cmd = malloc(l, M_DUMMYNET, M_NOWAIT); + if (cmd == NULL) { + error = ENOMEM; + goto done; + } error = sooptcopyin(sopt, cmd, l, l); sopt->sopt_valsize = sopt_valsize; if (error) @@ -2298,7 +2331,7 @@ dummynet_get(struct sockopt *sopt, void **compat) break; have = need; - start = malloc(have, M_DUMMYNET, M_WAITOK | M_ZERO); + start = malloc(have, M_DUMMYNET, M_NOWAIT | M_ZERO); } if (start == NULL) { @@ -2461,6 +2494,7 @@ dn_drain_queue(void) static int ip_dn_ctl(struct sockopt *sopt) { + struct epoch_tracker et; void *p = NULL; int error, l; @@ -2475,6 +2509,8 @@ ip_dn_ctl(struct sockopt *sopt) return (error); } + NET_EPOCH_ENTER(et); + switch (sopt->sopt_name) { default : D("dummynet: unknown option %d", sopt->sopt_name); @@ -2499,7 +2535,11 @@ ip_dn_ctl(struct sockopt *sopt) D("argument len %d invalid", l); break; } - p = malloc(l, M_TEMP, M_WAITOK); // XXX can it fail ? + p = malloc(l, M_TEMP, M_NOWAIT); + if (p == NULL) { + error = ENOMEM; + break; + } error = sooptcopyin(sopt, p, l, l); if (error) break ; @@ -2510,6 +2550,8 @@ ip_dn_ctl(struct sockopt *sopt) if (p != NULL) free(p, M_TEMP); + NET_EPOCH_EXIT(et); + return error ; } @@ -2578,13 +2620,16 @@ ip_dn_init(void) { if (dn_tasks_started) return; + + mtx_init(&sched_mtx, "dn_sched", NULL, MTX_DEF); + dn_tasks_started = 1; TASK_INIT(&dn_task, 0, dummynet_task, NULL); dn_tq = taskqueue_create_fast("dummynet", M_WAITOK, taskqueue_thread_enqueue, &dn_tq); taskqueue_start_threads(&dn_tq, 1, PI_NET, "dummynet"); - SLIST_INIT(&schedlist); + CK_LIST_INIT(&schedlist); callout_init(&dn_timeout, 1); dn_reschedule(); } @@ -2644,16 +2689,16 @@ load_dn_sched(struct dn_alg *d) } /* Search if scheduler already exists */ - DN_BH_WLOCK(); - SLIST_FOREACH(s, &schedlist, next) { + mtx_lock(&sched_mtx); + CK_LIST_FOREACH(s, &schedlist, next) { if (strcmp(s->name, d->name) == 0) { D("%s already loaded", d->name); break; /* scheduler already exists */ } } if (s == NULL) - SLIST_INSERT_HEAD(&schedlist, d, next); - DN_BH_WUNLOCK(); + CK_LIST_INSERT_HEAD(&schedlist, d, next); + mtx_unlock(&sched_mtx); D("dn_sched %s %sloaded", d->name, s ? "not ":""); return s ? 1 : 0; } @@ -2666,17 +2711,18 @@ unload_dn_sched(struct dn_alg *s) ND("called for %s", s->name); - DN_BH_WLOCK(); - SLIST_FOREACH_SAFE(r, &schedlist, next, tmp) { + mtx_lock(&sched_mtx); + CK_LIST_FOREACH_SAFE(r, &schedlist, next, tmp) { if (strcmp(s->name, r->name) != 0) continue; ND("ref_count = %d", r->ref_count); err = (r->ref_count != 0) ? EBUSY : 0; if (err == 0) - SLIST_REMOVE(&schedlist, r, dn_alg, next); + CK_LIST_REMOVE(r, next); break; } - DN_BH_WUNLOCK(); + mtx_unlock(&sched_mtx); + NET_EPOCH_WAIT(); D("dn_sched %s %sunloaded", s->name, err ? "not ":""); return err; } @@ -2736,17 +2782,20 @@ load_dn_aqm(struct dn_aqm *d) return 1; } + mtx_lock(&sched_mtx); + /* Search if AQM already exists */ - DN_BH_WLOCK(); /* XXX Global lock? */ - SLIST_FOREACH(aqm, &aqmlist, next) { + CK_LIST_FOREACH(aqm, &aqmlist, next) { if (strcmp(aqm->name, d->name) == 0) { D("%s already loaded", d->name); break; /* AQM already exists */ } } if (aqm == NULL) - SLIST_INSERT_HEAD(&aqmlist, d, next); - DN_BH_WUNLOCK(); + CK_LIST_INSERT_HEAD(&aqmlist, d, next); + + mtx_unlock(&sched_mtx); + D("dn_aqm %s %sloaded", d->name, aqm ? "not ":""); return aqm ? 1 : 0; } @@ -2775,21 +2824,24 @@ unload_dn_aqm(struct dn_aqm *aqm) err = 0; ND("called for %s", aqm->name); - DN_BH_WLOCK(); - /* clean up AQM status and deconfig flowset */ dn_ht_scan(V_dn_cfg.fshash, fs_cleanup, &aqm->type); - SLIST_FOREACH_SAFE(r, &aqmlist, next, tmp) { + mtx_lock(&sched_mtx); + + CK_LIST_FOREACH_SAFE(r, &aqmlist, next, tmp) { if (strcmp(aqm->name, r->name) != 0) continue; ND("ref_count = %d", r->ref_count); err = (r->ref_count != 0 || r->cfg_ref_count != 0) ? EBUSY : 0; if (err == 0) - SLIST_REMOVE(&aqmlist, r, dn_aqm, next); + CK_LIST_REMOVE(r, next); break; } - DN_BH_WUNLOCK(); + + mtx_unlock(&sched_mtx); + NET_EPOCH_WAIT(); + D("%s %sunloaded", aqm->name, err ? "not ":""); if (err) D("ref_count=%d, cfg_ref_count=%d", r->ref_count, r->cfg_ref_count); From owner-dev-commits-src-main@freebsd.org Thu Jun 3 15:19:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C1FEB63BA32; Thu, 3 Jun 2021 15:19:44 +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 4FwqM44D5Kz3k1P; Thu, 3 Jun 2021 15:19:44 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 4F22E4251; Thu, 3 Jun 2021 15:19:44 +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 153FJiHd063920; Thu, 3 Jun 2021 15:19:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153FJiAI063919; Thu, 3 Jun 2021 15:19:44 GMT (envelope-from git) Date: Thu, 3 Jun 2021 15:19:44 GMT Message-Id: <202106031519.153FJiAI063919@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 1b2dbe37fa32 - main - dummynet: free(NULL, M_DUMMYNET); is safe MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1b2dbe37fa32d7255faf7d1feec7bb31414a8102 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 15:19:44 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1b2dbe37fa32d7255faf7d1feec7bb31414a8102 commit 1b2dbe37fa32d7255faf7d1feec7bb31414a8102 Author: Kristof Provost AuthorDate: 2021-05-21 14:55:07 +0000 Commit: Kristof Provost CommitDate: 2021-06-03 07:02:53 +0000 dummynet: free(NULL, M_DUMMYNET); is safe There's no need to check pointers for NULL before free()ing them. No functional change. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30382 --- sys/netpfil/ipfw/ip_dummynet.c | 46 ++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/sys/netpfil/ipfw/ip_dummynet.c b/sys/netpfil/ipfw/ip_dummynet.c index b03ad93041bd..56fa56138d96 100644 --- a/sys/netpfil/ipfw/ip_dummynet.c +++ b/sys/netpfil/ipfw/ip_dummynet.c @@ -757,8 +757,7 @@ fsk_detach(struct dn_fsk *fs, int flags) /* Free the RED parameters, they will be recomputed on * subsequent attach if needed. */ - if (fs->w_q_lookup) - free(fs->w_q_lookup, M_DUMMYNET); + free(fs->w_q_lookup, M_DUMMYNET); fs->w_q_lookup = NULL; qht_delete(fs, flags); #ifdef NEW_AQM @@ -910,10 +909,9 @@ schk_delete_cb(void *obj, void *arg) dn_ht_free(s->siht, 0); } else if (s->siht) si_destroy(s->siht, NULL); - if (s->profile) { - free(s->profile, M_DUMMYNET); - s->profile = NULL; - } + + free(s->profile, M_DUMMYNET); + s->profile = NULL; s->siht = NULL; if (s->fp->destroy) s->fp->destroy(s); @@ -1237,10 +1235,8 @@ config_red(struct dn_fsk *fs) } /* If the lookup table already exist, free and create it again. */ - if (fs->w_q_lookup) { - free(fs->w_q_lookup, M_DUMMYNET); - fs->w_q_lookup = NULL; - } + free(fs->w_q_lookup, M_DUMMYNET); + fs->w_q_lookup = NULL; if (V_dn_cfg.red_lookup_depth == 0) { printf("\ndummynet: net.inet.ip.dummynet.red_lookup_depth" "must be > 0\n"); @@ -1579,10 +1575,9 @@ config_link(struct dn_link *p, struct dn_id *arg) return EINVAL; } /* remove profile if exists */ - if (s->profile) { - free(s->profile, M_DUMMYNET); - s->profile = NULL; - } + free(s->profile, M_DUMMYNET); + s->profile = NULL; + /* copy all parameters */ s->link.oid = p->oid; s->link.link_nr = i; @@ -1706,8 +1701,7 @@ config_fs(struct dn_fs *nfs, struct dn_id *arg, int locked) if (!locked) DN_BH_WUNLOCK(); #ifdef NEW_AQM - if (ep != NULL) - free(ep, M_TEMP); + free(ep, M_TEMP); #endif return fs; } @@ -1906,8 +1900,7 @@ next: err = 0; error: DN_BH_WUNLOCK(); - if (pf) - free(pf, M_DUMMYNET); + free(pf, M_DUMMYNET); return err; } @@ -2135,10 +2128,8 @@ do_config(void *p, int l) break; off += o.len; } - if (arg != NULL) - free(arg, M_TEMP); - if (dn != NULL) - free(dn, M_TEMP); + free(arg, M_TEMP); + free(dn, M_TEMP); return err; } @@ -2324,8 +2315,7 @@ dummynet_get(struct sockopt *sopt, void **compat) break; DN_BH_WUNLOCK(); - if (start) - free(start, M_DUMMYNET); + free(start, M_DUMMYNET); start = NULL; if (need > sopt_valsize) break; @@ -2383,10 +2373,9 @@ dummynet_get(struct sockopt *sopt, void **compat) error = sooptcopyout(sopt, start, buf - start); } done: - if (cmd && cmd != &r.o) + if (cmd != &r.o) free(cmd, M_DUMMYNET); - if (start) - free(start, M_DUMMYNET); + free(start, M_DUMMYNET); return error; } @@ -2547,8 +2536,7 @@ ip_dn_ctl(struct sockopt *sopt) break; } - if (p != NULL) - free(p, M_TEMP); + free(p, M_TEMP); NET_EPOCH_EXIT(et); From owner-dev-commits-src-main@freebsd.org Thu Jun 3 15:19:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C85A63BB20; Thu, 3 Jun 2021 15:19:45 +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 4FwqM53py1z3k4S; Thu, 3 Jun 2021 15:19:45 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6A87A3F7B; Thu, 3 Jun 2021 15:19:45 +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 153FJj0o063941; Thu, 3 Jun 2021 15:19:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153FJjPs063940; Thu, 3 Jun 2021 15:19:45 GMT (envelope-from git) Date: Thu, 3 Jun 2021 15:19:45 GMT Message-Id: <202106031519.153FJjPs063940@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: ea3eca5cb6db - main - netpfil tests: Basic dummynet pipe test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ea3eca5cb6dbcb4deb7c7277a65c48911f0475d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 15:19:45 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ea3eca5cb6dbcb4deb7c7277a65c48911f0475d1 commit ea3eca5cb6dbcb4deb7c7277a65c48911f0475d1 Author: Kristof Provost AuthorDate: 2021-05-21 09:14:34 +0000 Commit: Kristof Provost CommitDate: 2021-06-03 07:02:58 +0000 netpfil tests: Basic dummynet pipe test Test dummynet pipes (i.e. bandwidth limitation) with ipfw. This is put in the common tests because we hope to add dummynet support to pf in the near future. MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D30380 --- tests/sys/netpfil/common/Makefile | 1 + tests/sys/netpfil/common/dummynet.sh | 75 ++++++++++++++++++++++++++++++++++++ tests/sys/netpfil/common/utils.subr | 15 ++++++++ 3 files changed, 91 insertions(+) diff --git a/tests/sys/netpfil/common/Makefile b/tests/sys/netpfil/common/Makefile index e63a23b59687..f4d5fb2be3fc 100644 --- a/tests/sys/netpfil/common/Makefile +++ b/tests/sys/netpfil/common/Makefile @@ -6,6 +6,7 @@ TESTSDIR= ${TESTSBASE}/sys/netpfil/common ATF_TESTS_SH+= \ + dummynet \ pass_block \ nat \ tos \ diff --git a/tests/sys/netpfil/common/dummynet.sh b/tests/sys/netpfil/common/dummynet.sh new file mode 100644 index 000000000000..82cd22b77fef --- /dev/null +++ b/tests/sys/netpfil/common/dummynet.sh @@ -0,0 +1,75 @@ +# $FreeBSD$ +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2021 Rubicon Communications, LLC (Netgate) +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +. $(atf_get_srcdir)/utils.subr +. $(atf_get_srcdir)/runner.subr + +pipe_head() +{ + atf_set descr 'Basic pipe test' + atf_set require.user root +} + +pipe_body() +{ + fw=$1 + firewall_init $fw + dummynet_init $fw + + epair=$(vnet_mkepair) + vnet_mkjail alcatraz ${epair}b + + ifconfig ${epair}a 192.0.2.1/24 up + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + + # Sanity check + atf_check -s exit:0 -o ignore ping -i .1 -c 3 -s 1200 192.0.2.2 + + jexec alcatraz dnctl pipe 1 config bw 30Byte/s + + firewall_config alcatraz ${fw} \ + "ipfw" \ + "ipfw add 1000 pipe 1 ip from any to any" + + # single ping succeeds just fine + atf_check -s exit:0 -o ignore ping -c 1 192.0.2.2 + + # Saturate the link + ping -i .1 -c 5 -s 1200 192.0.2.2 + + # We should now be hitting the limits and get this packet dropped. + atf_check -s exit:2 -o ignore ping -c 1 -s 1200 192.0.2.2 +} + +pipe_cleanup() +{ + firewall_cleanup $1 +} + +setup_tests \ + pipe \ + ipfw diff --git a/tests/sys/netpfil/common/utils.subr b/tests/sys/netpfil/common/utils.subr index 3f9d6b40183a..722271981af4 100644 --- a/tests/sys/netpfil/common/utils.subr +++ b/tests/sys/netpfil/common/utils.subr @@ -103,6 +103,21 @@ firewall_init() } +dummynet_init() +{ + firewall=$1 + + if ! kldstat -q -m dummynet; then + atf_skip "This test requires dummynet" + fi + + if [ ${firewall} == "ipfw" ]; then + # Nothing. This is okay. + else + atf_skip "${firewall} does not support dummynet" + fi +} + nat_init() { firewall=$1 From owner-dev-commits-src-main@freebsd.org Thu Jun 3 15:19:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 240CA63B9F9; Thu, 3 Jun 2021 15:19:47 +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 4FwqM65QsYz3jpg; Thu, 3 Jun 2021 15:19:46 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8D00E4252; Thu, 3 Jun 2021 15:19:46 +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 153FJkG1063968; Thu, 3 Jun 2021 15:19:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153FJkoK063967; Thu, 3 Jun 2021 15:19:46 GMT (envelope-from git) Date: Thu, 3 Jun 2021 15:19:46 GMT Message-Id: <202106031519.153FJkoK063967@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 70dd30d49c29 - main - pf tests: Make killstate:match more robust MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 70dd30d49c29a27e1ef159660a7e3dbb84082674 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 15:19:47 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=70dd30d49c29a27e1ef159660a7e3dbb84082674 commit 70dd30d49c29a27e1ef159660a7e3dbb84082674 Author: Kristof Provost AuthorDate: 2021-06-03 13:22:19 +0000 Commit: Kristof Provost CommitDate: 2021-06-03 13:22:19 +0000 pf tests: Make killstate:match more robust The killstate:match test starts nc as a background process. There was no guarantee that the nc process would have connected by the time we check for states, so this test occasionally failed without good reason. Teach the test to wait for at least some states to turn up before executing the critical checks. MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/killstate.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/sys/netpfil/pf/killstate.sh b/tests/sys/netpfil/pf/killstate.sh index b3d94a245548..f53ede8c7578 100644 --- a/tests/sys/netpfil/pf/killstate.sh +++ b/tests/sys/netpfil/pf/killstate.sh @@ -384,6 +384,17 @@ match_head() atf_set require.user root } +wait_for_state() +{ + jail=$1 + addr=$2 + + while ! jexec $jail pfctl -s s | grep $addr >/dev/null; + do + sleep .1 + done +} + match_body() { pft_init @@ -412,6 +423,7 @@ match_body() "pass all" nc 198.51.100.2 7 & + wait_for_state alcatraz 192.0.2.1 # Expect two states states=$(jexec alcatraz pfctl -s s | wc -l) @@ -432,6 +444,7 @@ match_body() jexec alcatraz pfctl -F states nc 198.51.100.2 7 & + wait_for_state alcatraz 192.0.2.1 # Kill matching states, expect all of them to be gone jexec alcatraz pfctl -M -k 192.0.2.1 From owner-dev-commits-src-main@freebsd.org Thu Jun 3 15:52:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B372A63C61D; Thu, 3 Jun 2021 15:52:58 +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 4Fwr5Q4T4Vz3nDY; Thu, 3 Jun 2021 15:52:58 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8187C48EB; Thu, 3 Jun 2021 15:52:58 +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 153FqwtV016559; Thu, 3 Jun 2021 15:52:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153Fqw5p016558; Thu, 3 Jun 2021 15:52:58 GMT (envelope-from git) Date: Thu, 3 Jun 2021 15:52:58 GMT Message-Id: <202106031552.153Fqw5p016558@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 5c447fe67792 - main - usb: reduce verbosity of logging about unsuccessful port reset 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/main X-Git-Reftype: branch X-Git-Commit: 5c447fe67792dff4e8d996f438908612c2111b58 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 15:52:58 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5c447fe67792dff4e8d996f438908612c2111b58 commit 5c447fe67792dff4e8d996f438908612c2111b58 Author: Maksym Stetsyuk AuthorDate: 2021-06-03 15:52:21 +0000 Commit: Warner Losh CommitDate: 2021-06-03 15:52:52 +0000 usb: reduce verbosity of logging about unsuccessful port reset Reviewed by: imp@,hselasny@ Pull Request: https://github.com/freebsd/freebsd-src/pull/385 Differential Revision: https://reviews.freebsd.org/D30621 --- sys/dev/usb/usb_hub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/usb/usb_hub.c b/sys/dev/usb/usb_hub.c index 52ac0a8a7ff7..7f11eea2500d 100644 --- a/sys/dev/usb/usb_hub.c +++ b/sys/dev/usb/usb_hub.c @@ -720,7 +720,7 @@ repeat: if ((sc->sc_st.port_change & UPS_C_CONNECT_STATUS) || (!(sc->sc_st.port_status & UPS_CURRENT_CONNECT_STATUS))) { if (timeout) { - DPRINTFN(0, "giving up port %d reset - " + DPRINTFN(1, "giving up port %d reset - " "device vanished: change %#x status %#x\n", portno, sc->sc_st.port_change, sc->sc_st.port_status); From owner-dev-commits-src-main@freebsd.org Thu Jun 3 16:48:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA04E63D31F; Thu, 3 Jun 2021 16:48:25 +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 4FwsKP5qVQz3qn8; Thu, 3 Jun 2021 16:48:25 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B0B325362; Thu, 3 Jun 2021 16:48:25 +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 153GmPZ9082686; Thu, 3 Jun 2021 16:48:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153GmPu2082685; Thu, 3 Jun 2021 16:48:25 GMT (envelope-from git) Date: Thu, 3 Jun 2021 16:48:25 GMT Message-Id: <202106031648.153GmPu2082685@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 0e6549c87450 - main - bectl(8): don't allow creation of boot environments with spaces MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0e6549c8745049e3d6fba3ad748034de2d5cbd2a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 16:48:25 -0000 The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=0e6549c8745049e3d6fba3ad748034de2d5cbd2a commit 0e6549c8745049e3d6fba3ad748034de2d5cbd2a Author: Robert Wing AuthorDate: 2021-06-03 16:36:11 +0000 Commit: Robert Wing CommitDate: 2021-06-03 16:36:11 +0000 bectl(8): don't allow creation of boot environments with spaces Boot environment datasets that contain spaces are not bootable. When a user attempts to create a boot environment with a space, abort the creation and print an error message. PR: 254441 Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D30194 --- sbin/bectl/bectl.c | 9 ++++++++- sbin/bectl/tests/bectl_test.sh | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sbin/bectl/bectl.c b/sbin/bectl/bectl.c index 50229b4b96b7..d3de58ea2982 100644 --- a/sbin/bectl/bectl.c +++ b/sbin/bectl/bectl.c @@ -233,7 +233,10 @@ bectl_cmd_create(int argc, char *argv[]) bootenv = *argv; err = BE_ERR_SUCCESS; - if ((atpos = strchr(bootenv, '@')) != NULL) { + if (strchr(bootenv, ' ') != NULL) + /* BE datasets with spaces are not bootable */ + err = BE_ERR_INVALIDNAME; + else if ((atpos = strchr(bootenv, '@')) != NULL) { /* * This is the "create a snapshot variant". No new boot * environment is to be created here. @@ -261,6 +264,10 @@ bectl_cmd_create(int argc, char *argv[]) switch (err) { case BE_ERR_SUCCESS: break; + case BE_ERR_INVALIDNAME: + fprintf(stderr, + "bectl create: boot environment name must not contain spaces\n"); + break; default: if (atpos != NULL) fprintf(stderr, diff --git a/sbin/bectl/tests/bectl_test.sh b/sbin/bectl/tests/bectl_test.sh index 221fe21e29ed..b101591c3ee9 100755 --- a/sbin/bectl/tests/bectl_test.sh +++ b/sbin/bectl/tests/bectl_test.sh @@ -122,6 +122,10 @@ bectl_create_body() atf_check zfs create -o mountpoint=/usr -o canmount=noauto \ ${zpool}/ROOT/default/usr + # BE datasets with spaces are not bootable, PR 254441. + atf_check -e not-empty -s not-exit:0 \ + bectl -r ${zpool}/ROOT create "foo bar" + # Test standard creation, creation of a snapshot, and creation from a # snapshot. atf_check bectl -r ${zpool}/ROOT create -e default default2 From owner-dev-commits-src-main@freebsd.org Thu Jun 3 17:29:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF9A763DCE0; Thu, 3 Jun 2021 17:29:08 +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 4FwtDN60LTz3v43; Thu, 3 Jun 2021 17:29:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B37025E20; Thu, 3 Jun 2021 17:29:08 +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 153HT8Ov036527; Thu, 3 Jun 2021 17:29:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153HT8Ak036526; Thu, 3 Jun 2021 17:29:08 GMT (envelope-from git) Date: Thu, 3 Jun 2021 17:29:08 GMT Message-Id: <202106031729.153HT8Ak036526@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: ef65f7bdf26e - main - mmc:: Undo my conversion of (bool) to !!. 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/main X-Git-Reftype: branch X-Git-Commit: ef65f7bdf26e2f69e13d54e1ffd671de7d9032f6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 17:29:08 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ef65f7bdf26e2f69e13d54e1ffd671de7d9032f6 commit ef65f7bdf26e2f69e13d54e1ffd671de7d9032f6 Author: Warner Losh AuthorDate: 2021-06-03 17:26:57 +0000 Commit: Warner Losh CommitDate: 2021-06-03 17:29:04 +0000 mmc:: Undo my conversion of (bool) to !!. The need for !! over (bool) pre-dates gcc 4.2, so go with the patch as-submitted because the kernel tends to prefer that. Suggested by: emaste@ Sponsored by: Netflix --- sys/dev/mmc/mmc_fdt_helpers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/mmc/mmc_fdt_helpers.c b/sys/dev/mmc/mmc_fdt_helpers.c index 9d120fa01a26..175de28ac5fb 100644 --- a/sys/dev/mmc/mmc_fdt_helpers.c +++ b/sys/dev/mmc/mmc_fdt_helpers.c @@ -407,7 +407,7 @@ mmc_fdt_gpio_get_present(struct mmc_fdt_helper *helper) gpio_pin_is_active(helper->cd_pin, &pinstate); - return (pinstate ^ !!(helper->props & MMC_PROP_CD_INVERTED)); + return (pinstate ^ (bool)(helper->props & MMC_PROP_CD_INVERTED)); } bool @@ -423,7 +423,7 @@ mmc_fdt_gpio_get_readonly(struct mmc_fdt_helper *helper) gpio_pin_is_active(helper->wp_pin, &pinstate); - return (pinstate ^ !!(helper->props & MMC_PROP_WP_INVERTED)); + return (pinstate ^ (bool)(helper->props & MMC_PROP_WP_INVERTED)); } void From owner-dev-commits-src-main@freebsd.org Thu Jun 3 18:04:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8343E63E49B; Thu, 3 Jun 2021 18:04:18 +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 4Fwv0y39jWz4W2J; Thu, 3 Jun 2021 18:04:18 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5676C6548; Thu, 3 Jun 2021 18:04:18 +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 153I4Ia2089171; Thu, 3 Jun 2021 18:04:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153I4IUv089170; Thu, 3 Jun 2021 18:04:18 GMT (envelope-from git) Date: Thu, 3 Jun 2021 18:04:18 GMT Message-Id: <202106031804.153I4IUv089170@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: ce0a9d7c126f - main - axgbe: Don't dereference NULL pointers 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/main X-Git-Reftype: branch X-Git-Commit: ce0a9d7c126fd712d3e3801323e9c8fb06269d64 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 18:04:18 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=ce0a9d7c126fd712d3e3801323e9c8fb06269d64 commit ce0a9d7c126fd712d3e3801323e9c8fb06269d64 Author: Warner Losh AuthorDate: 2021-06-03 18:03:45 +0000 Commit: Warner Losh CommitDate: 2021-06-03 18:03:45 +0000 axgbe: Don't dereference NULL pointers if (sb == NULL) { ... sb->s_error } is going to be a bad time. Return ENOMEM when we cannot allocate an sbuf for the sysctl rather than dereferencing the NULL pointer just returned. Reviewed by: manu@, allanjude@ Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30373 --- sys/dev/axgbe/xgbe-sysctl.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/sys/dev/axgbe/xgbe-sysctl.c b/sys/dev/axgbe/xgbe-sysctl.c index f7998b943b16..4f1e25e39ae2 100644 --- a/sys/dev/axgbe/xgbe-sysctl.c +++ b/sys/dev/axgbe/xgbe-sysctl.c @@ -515,7 +515,7 @@ sysctl_xgmac_reg_addr_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } @@ -551,7 +551,7 @@ sysctl_get_drv_info_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } @@ -583,7 +583,7 @@ sysctl_get_link_info_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } @@ -639,7 +639,7 @@ sysctl_coalesce_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } sys_op->rx_coalesce_usecs = pdata->rx_usecs; @@ -770,7 +770,7 @@ sysctl_pauseparam_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } sys_op->autoneg = pdata->phy.pause_autoneg; @@ -868,7 +868,7 @@ sysctl_link_ksettings_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } sys_op->autoneg = pdata->phy.autoneg; @@ -993,7 +993,7 @@ sysctl_ringparam_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } sys_op->rx_max_pending = XGBE_RX_DESC_CNT_MAX; @@ -1096,7 +1096,7 @@ sysctl_channels_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } rx = min(pdata->hw_feat.rx_ch_cnt, pdata->rx_max_channel_count); @@ -1174,7 +1174,7 @@ sysctl_mac_stats_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } @@ -1220,7 +1220,7 @@ sysctl_xgmac_reg_value_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } @@ -1256,7 +1256,7 @@ sysctl_xpcs_mmd_reg_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } @@ -1293,7 +1293,7 @@ sysctl_xpcs_reg_addr_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } @@ -1330,7 +1330,7 @@ sysctl_xpcs_reg_value_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } @@ -1368,7 +1368,7 @@ sysctl_xprop_reg_addr_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } @@ -1405,7 +1405,7 @@ sysctl_xprop_reg_value_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } @@ -1441,7 +1441,7 @@ sysctl_xi2c_reg_addr_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } @@ -1478,7 +1478,7 @@ sysctl_xi2c_reg_value_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } @@ -1514,7 +1514,7 @@ sysctl_an_cdr_wr_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } @@ -1555,7 +1555,7 @@ sysctl_an_cdr_track_early_handler(SYSCTL_HANDLER_ARGS) if (req->newptr == NULL) { sb = sbuf_new_for_sysctl(NULL, NULL, buf_size, req); if (sb == NULL) { - rc = sb->s_error; + rc = ENOMEM; return (rc); } From owner-dev-commits-src-main@freebsd.org Thu Jun 3 18:53:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D87463ED6F; Thu, 3 Jun 2021 18:53:52 +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 4Fww676lQvz4fHB; Thu, 3 Jun 2021 18:53:51 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 D08207294; Thu, 3 Jun 2021 18:53:51 +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 153IrpOM054597; Thu, 3 Jun 2021 18:53:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153Irp9a054596; Thu, 3 Jun 2021 18:53:51 GMT (envelope-from git) Date: Thu, 3 Jun 2021 18:53:51 GMT Message-Id: <202106031853.153Irp9a054596@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 95aa617e4bf0 - main - Add C++ headers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 95aa617e4bf09fcc813b1bab3d0dbf4b606807b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 18:53:52 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=95aa617e4bf09fcc813b1bab3d0dbf4b606807b1 commit 95aa617e4bf09fcc813b1bab3d0dbf4b606807b1 Author: Dimitry Andric AuthorDate: 2021-06-03 18:53:18 +0000 Commit: Dimitry Andric CommitDate: 2021-06-03 18:53:18 +0000 Add C++ headers I missed adding these to the libc++ Makefile, when importing llvm-project 11.0.0-rc1, even though they were supplied by upstream. While here, update OptionalObsoleteFiles.inc to add these new headers, and cleanup old cruft. Reported by: yuri Submitted by: jkim (Makefile diff) PR: 255374 MFC after: 3 days --- lib/libc++/Makefile | 6 +++++ tools/build/mk/OptionalObsoleteFiles.inc | 43 ++++++++++++++++++++------------ 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/lib/libc++/Makefile b/lib/libc++/Makefile index bfb394fda2fb..066faf4abb1f 100644 --- a/lib/libc++/Makefile +++ b/lib/libc++/Makefile @@ -112,6 +112,7 @@ STD_HEADERS+= algorithm STD_HEADERS+= any STD_HEADERS+= array STD_HEADERS+= atomic +STD_HEADERS+= barrier STD_HEADERS+= bit STD_HEADERS+= bitset STD_HEADERS+= cassert @@ -131,6 +132,7 @@ STD_HEADERS+= codecvt STD_HEADERS+= compare STD_HEADERS+= complex STD_HEADERS+= complex.h +STD_HEADERS+= concepts STD_HEADERS+= condition_variable STD_HEADERS+= csetjmp STD_HEADERS+= csignal @@ -149,6 +151,7 @@ STD_HEADERS+= cwctype STD_HEADERS+= deque STD_HEADERS+= errno.h STD_HEADERS+= exception +STD_HEADERS+= execution STD_HEADERS+= fenv.h STD_HEADERS+= filesystem STD_HEADERS+= float.h @@ -164,6 +167,7 @@ STD_HEADERS+= iosfwd STD_HEADERS+= iostream STD_HEADERS+= istream STD_HEADERS+= iterator +STD_HEADERS+= latch STD_HEADERS+= limits STD_HEADERS+= limits.h STD_HEADERS+= list @@ -174,6 +178,7 @@ STD_HEADERS+= math.h STD_HEADERS+= memory STD_HEADERS+= mutex STD_HEADERS+= new +STD_HEADERS+= numbers STD_HEADERS+= numeric STD_HEADERS+= optional STD_HEADERS+= ostream @@ -182,6 +187,7 @@ STD_HEADERS+= random STD_HEADERS+= ratio STD_HEADERS+= regex STD_HEADERS+= scoped_allocator +STD_HEADERS+= semaphore STD_HEADERS+= set STD_HEADERS+= setjmp.h STD_HEADERS+= shared_mutex diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 5a534a91c057..1186ea17266a 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -3834,6 +3834,7 @@ OLD_FILES+=usr/include/c++/v1/algorithm OLD_FILES+=usr/include/c++/v1/any OLD_FILES+=usr/include/c++/v1/array OLD_FILES+=usr/include/c++/v1/atomic +OLD_FILES+=usr/include/c++/v1/barrier OLD_FILES+=usr/include/c++/v1/bit OLD_FILES+=usr/include/c++/v1/bitset OLD_FILES+=usr/include/c++/v1/cassert @@ -3853,6 +3854,7 @@ OLD_FILES+=usr/include/c++/v1/codecvt OLD_FILES+=usr/include/c++/v1/compare OLD_FILES+=usr/include/c++/v1/complex OLD_FILES+=usr/include/c++/v1/complex.h +OLD_FILES+=usr/include/c++/v1/concepts OLD_FILES+=usr/include/c++/v1/condition_variable OLD_FILES+=usr/include/c++/v1/csetjmp OLD_FILES+=usr/include/c++/v1/csignal @@ -3872,14 +3874,12 @@ OLD_FILES+=usr/include/c++/v1/cxxabi.h OLD_FILES+=usr/include/c++/v1/deque OLD_FILES+=usr/include/c++/v1/errno.h OLD_FILES+=usr/include/c++/v1/exception +OLD_FILES+=usr/include/c++/v1/execution OLD_FILES+=usr/include/c++/v1/experimental/__config OLD_FILES+=usr/include/c++/v1/experimental/__memory OLD_FILES+=usr/include/c++/v1/experimental/algorithm -OLD_FILES+=usr/include/c++/v1/experimental/any -OLD_FILES+=usr/include/c++/v1/experimental/chrono OLD_FILES+=usr/include/c++/v1/experimental/coroutine OLD_FILES+=usr/include/c++/v1/experimental/deque -OLD_FILES+=usr/include/c++/v1/experimental/dynarray OLD_FILES+=usr/include/c++/v1/experimental/filesystem OLD_FILES+=usr/include/c++/v1/experimental/forward_list OLD_FILES+=usr/include/c++/v1/experimental/functional @@ -3887,25 +3887,22 @@ OLD_FILES+=usr/include/c++/v1/experimental/iterator OLD_FILES+=usr/include/c++/v1/experimental/list OLD_FILES+=usr/include/c++/v1/experimental/map OLD_FILES+=usr/include/c++/v1/experimental/memory_resource -OLD_FILES+=usr/include/c++/v1/experimental/numeric -OLD_FILES+=usr/include/c++/v1/experimental/optional OLD_FILES+=usr/include/c++/v1/experimental/propagate_const -OLD_FILES+=usr/include/c++/v1/experimental/ratio OLD_FILES+=usr/include/c++/v1/experimental/regex OLD_FILES+=usr/include/c++/v1/experimental/set OLD_FILES+=usr/include/c++/v1/experimental/simd OLD_FILES+=usr/include/c++/v1/experimental/string -OLD_FILES+=usr/include/c++/v1/experimental/string_view -OLD_FILES+=usr/include/c++/v1/experimental/system_error -OLD_FILES+=usr/include/c++/v1/experimental/tuple OLD_FILES+=usr/include/c++/v1/experimental/type_traits OLD_FILES+=usr/include/c++/v1/experimental/unordered_map OLD_FILES+=usr/include/c++/v1/experimental/unordered_set OLD_FILES+=usr/include/c++/v1/experimental/utility OLD_FILES+=usr/include/c++/v1/experimental/vector +OLD_DIRS+=usr/include/c++/v1/experimental OLD_FILES+=usr/include/c++/v1/ext/__hash OLD_FILES+=usr/include/c++/v1/ext/hash_map OLD_FILES+=usr/include/c++/v1/ext/hash_set +OLD_DIRS+=usr/include/c++/v1/ext +OLD_FILES+=usr/include/c++/v1/fenv.h OLD_FILES+=usr/include/c++/v1/filesystem OLD_FILES+=usr/include/c++/v1/float.h OLD_FILES+=usr/include/c++/v1/forward_list @@ -3920,6 +3917,7 @@ OLD_FILES+=usr/include/c++/v1/iosfwd OLD_FILES+=usr/include/c++/v1/iostream OLD_FILES+=usr/include/c++/v1/istream OLD_FILES+=usr/include/c++/v1/iterator +OLD_FILES+=usr/include/c++/v1/latch OLD_FILES+=usr/include/c++/v1/limits OLD_FILES+=usr/include/c++/v1/limits.h OLD_FILES+=usr/include/c++/v1/list @@ -3930,7 +3928,7 @@ OLD_FILES+=usr/include/c++/v1/math.h OLD_FILES+=usr/include/c++/v1/memory OLD_FILES+=usr/include/c++/v1/mutex OLD_FILES+=usr/include/c++/v1/new -OLD_FILES+=usr/include/c++/v1/numeric +OLD_FILES+=usr/include/c++/v1/numbers OLD_FILES+=usr/include/c++/v1/numeric OLD_FILES+=usr/include/c++/v1/optional OLD_FILES+=usr/include/c++/v1/ostream @@ -3939,6 +3937,7 @@ OLD_FILES+=usr/include/c++/v1/random OLD_FILES+=usr/include/c++/v1/ratio OLD_FILES+=usr/include/c++/v1/regex OLD_FILES+=usr/include/c++/v1/scoped_allocator +OLD_FILES+=usr/include/c++/v1/semaphore OLD_FILES+=usr/include/c++/v1/set OLD_FILES+=usr/include/c++/v1/setjmp.h OLD_FILES+=usr/include/c++/v1/shared_mutex @@ -3959,12 +3958,12 @@ OLD_FILES+=usr/include/c++/v1/strstream OLD_FILES+=usr/include/c++/v1/system_error OLD_FILES+=usr/include/c++/v1/tgmath.h OLD_FILES+=usr/include/c++/v1/thread -OLD_FILES+=usr/include/c++/v1/version OLD_FILES+=usr/include/c++/v1/tr1/__bit_reference OLD_FILES+=usr/include/c++/v1/tr1/__bsd_locale_defaults.h OLD_FILES+=usr/include/c++/v1/tr1/__bsd_locale_fallbacks.h OLD_FILES+=usr/include/c++/v1/tr1/__config OLD_FILES+=usr/include/c++/v1/tr1/__debug +OLD_FILES+=usr/include/c++/v1/tr1/__errc OLD_FILES+=usr/include/c++/v1/tr1/__functional_03 OLD_FILES+=usr/include/c++/v1/tr1/__functional_base OLD_FILES+=usr/include/c++/v1/tr1/__functional_base_03 @@ -3972,6 +3971,7 @@ OLD_FILES+=usr/include/c++/v1/tr1/__hash_table OLD_FILES+=usr/include/c++/v1/tr1/__libcpp_version OLD_FILES+=usr/include/c++/v1/tr1/__locale OLD_FILES+=usr/include/c++/v1/tr1/__mutex_base +OLD_FILES+=usr/include/c++/v1/tr1/__node_handle OLD_FILES+=usr/include/c++/v1/tr1/__nullptr OLD_FILES+=usr/include/c++/v1/tr1/__split_buffer OLD_FILES+=usr/include/c++/v1/tr1/__sso_allocator @@ -3985,6 +3985,8 @@ OLD_FILES+=usr/include/c++/v1/tr1/algorithm OLD_FILES+=usr/include/c++/v1/tr1/any OLD_FILES+=usr/include/c++/v1/tr1/array OLD_FILES+=usr/include/c++/v1/tr1/atomic +OLD_FILES+=usr/include/c++/v1/tr1/barrier +OLD_FILES+=usr/include/c++/v1/tr1/bit OLD_FILES+=usr/include/c++/v1/tr1/bitset OLD_FILES+=usr/include/c++/v1/tr1/cassert OLD_FILES+=usr/include/c++/v1/tr1/ccomplex @@ -3992,6 +3994,7 @@ OLD_FILES+=usr/include/c++/v1/tr1/cctype OLD_FILES+=usr/include/c++/v1/tr1/cerrno OLD_FILES+=usr/include/c++/v1/tr1/cfenv OLD_FILES+=usr/include/c++/v1/tr1/cfloat +OLD_FILES+=usr/include/c++/v1/tr1/charconv OLD_FILES+=usr/include/c++/v1/tr1/chrono OLD_FILES+=usr/include/c++/v1/tr1/cinttypes OLD_FILES+=usr/include/c++/v1/tr1/ciso646 @@ -3999,8 +4002,10 @@ OLD_FILES+=usr/include/c++/v1/tr1/climits OLD_FILES+=usr/include/c++/v1/tr1/clocale OLD_FILES+=usr/include/c++/v1/tr1/cmath OLD_FILES+=usr/include/c++/v1/tr1/codecvt +OLD_FILES+=usr/include/c++/v1/tr1/compare OLD_FILES+=usr/include/c++/v1/tr1/complex OLD_FILES+=usr/include/c++/v1/tr1/complex.h +OLD_FILES+=usr/include/c++/v1/tr1/concepts OLD_FILES+=usr/include/c++/v1/tr1/condition_variable OLD_FILES+=usr/include/c++/v1/tr1/csetjmp OLD_FILES+=usr/include/c++/v1/tr1/csignal @@ -4019,6 +4024,9 @@ OLD_FILES+=usr/include/c++/v1/tr1/cwctype OLD_FILES+=usr/include/c++/v1/tr1/deque OLD_FILES+=usr/include/c++/v1/tr1/errno.h OLD_FILES+=usr/include/c++/v1/tr1/exception +OLD_FILES+=usr/include/c++/v1/tr1/execution +OLD_FILES+=usr/include/c++/v1/tr1/fenv.h +OLD_FILES+=usr/include/c++/v1/tr1/filesystem OLD_FILES+=usr/include/c++/v1/tr1/float.h OLD_FILES+=usr/include/c++/v1/tr1/forward_list OLD_FILES+=usr/include/c++/v1/tr1/fstream @@ -4032,6 +4040,7 @@ OLD_FILES+=usr/include/c++/v1/tr1/iosfwd OLD_FILES+=usr/include/c++/v1/tr1/iostream OLD_FILES+=usr/include/c++/v1/tr1/istream OLD_FILES+=usr/include/c++/v1/tr1/iterator +OLD_FILES+=usr/include/c++/v1/tr1/latch OLD_FILES+=usr/include/c++/v1/tr1/limits OLD_FILES+=usr/include/c++/v1/tr1/limits.h OLD_FILES+=usr/include/c++/v1/tr1/list @@ -4042,7 +4051,7 @@ OLD_FILES+=usr/include/c++/v1/tr1/math.h OLD_FILES+=usr/include/c++/v1/tr1/memory OLD_FILES+=usr/include/c++/v1/tr1/mutex OLD_FILES+=usr/include/c++/v1/tr1/new -OLD_FILES+=usr/include/c++/v1/tr1/numeric +OLD_FILES+=usr/include/c++/v1/tr1/numbers OLD_FILES+=usr/include/c++/v1/tr1/numeric OLD_FILES+=usr/include/c++/v1/tr1/optional OLD_FILES+=usr/include/c++/v1/tr1/ostream @@ -4051,9 +4060,11 @@ OLD_FILES+=usr/include/c++/v1/tr1/random OLD_FILES+=usr/include/c++/v1/tr1/ratio OLD_FILES+=usr/include/c++/v1/tr1/regex OLD_FILES+=usr/include/c++/v1/tr1/scoped_allocator +OLD_FILES+=usr/include/c++/v1/tr1/semaphore OLD_FILES+=usr/include/c++/v1/tr1/set OLD_FILES+=usr/include/c++/v1/tr1/setjmp.h OLD_FILES+=usr/include/c++/v1/tr1/shared_mutex +OLD_FILES+=usr/include/c++/v1/tr1/span OLD_FILES+=usr/include/c++/v1/tr1/sstream OLD_FILES+=usr/include/c++/v1/tr1/stack OLD_FILES+=usr/include/c++/v1/tr1/stdbool.h @@ -4080,8 +4091,10 @@ OLD_FILES+=usr/include/c++/v1/tr1/utility OLD_FILES+=usr/include/c++/v1/tr1/valarray OLD_FILES+=usr/include/c++/v1/tr1/variant OLD_FILES+=usr/include/c++/v1/tr1/vector +OLD_FILES+=usr/include/c++/v1/tr1/version OLD_FILES+=usr/include/c++/v1/tr1/wchar.h OLD_FILES+=usr/include/c++/v1/tr1/wctype.h +OLD_DIRS+=usr/include/c++/v1/tr1 OLD_FILES+=usr/include/c++/v1/tuple OLD_FILES+=usr/include/c++/v1/type_traits OLD_FILES+=usr/include/c++/v1/typeindex @@ -4095,8 +4108,10 @@ OLD_FILES+=usr/include/c++/v1/utility OLD_FILES+=usr/include/c++/v1/valarray OLD_FILES+=usr/include/c++/v1/variant OLD_FILES+=usr/include/c++/v1/vector +OLD_FILES+=usr/include/c++/v1/version OLD_FILES+=usr/include/c++/v1/wchar.h OLD_FILES+=usr/include/c++/v1/wctype.h +OLD_DIRS+=usr/include/c++/v1 OLD_FILES+=usr/lib32/libc++.a OLD_FILES+=usr/lib32/libc++.so OLD_LIBS+=usr/lib32/libc++.so.1 @@ -4107,10 +4122,6 @@ OLD_FILES+=usr/lib32/libcxxrt.a OLD_FILES+=usr/lib32/libcxxrt.so OLD_LIBS+=usr/lib32/libcxxrt.so.1 OLD_FILES+=usr/lib32/libcxxrt_p.a -OLD_DIRS+=usr/include/c++/v1/tr1 -OLD_DIRS+=usr/include/c++/v1/experimental -OLD_DIRS+=usr/include/c++/v1/ext -OLD_DIRS+=usr/include/c++/v1 .endif .if ${MK_LLD} == no From owner-dev-commits-src-main@freebsd.org Thu Jun 3 19:08:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E6DE63F351; Thu, 3 Jun 2021 19:08:40 +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 4FwwRD0DChz4fyb; Thu, 3 Jun 2021 19:08:40 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E46766EE4; Thu, 3 Jun 2021 19:08:39 +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 153J8dJr068686; Thu, 3 Jun 2021 19:08:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153J8dMG068685; Thu, 3 Jun 2021 19:08:39 GMT (envelope-from git) Date: Thu, 3 Jun 2021 19:08:39 GMT Message-Id: <202106031908.153J8dMG068685@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: cc384c67ce2b - main - cam: prefer cam_sim_softc() over accessing cam_sim structure directly. 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/main X-Git-Reftype: branch X-Git-Commit: cc384c67ce2b6b0b30e08a264d4ef9a116e70505 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 19:08:40 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=cc384c67ce2b6b0b30e08a264d4ef9a116e70505 commit cc384c67ce2b6b0b30e08a264d4ef9a116e70505 Author: Warner Losh AuthorDate: 2021-06-03 19:05:20 +0000 Commit: Warner Losh CommitDate: 2021-06-03 19:08:29 +0000 cam: prefer cam_sim_softc() over accessing cam_sim structure directly. Use the accessor function to get the softc for this sim. This also drops an unneeded cast. Sponsored by: Netflix Reviewed by: mav@, hselasky@ Differential Revision: https://reviews.freebsd.org/D30360 --- sys/dev/firewire/sbp.c | 4 ++-- sys/dev/usb/storage/umass.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/firewire/sbp.c b/sys/dev/firewire/sbp.c index 58e2086399d2..a161713a94ad 100644 --- a/sys/dev/firewire/sbp.c +++ b/sys/dev/firewire/sbp.c @@ -2273,7 +2273,7 @@ static void sbp_action(struct cam_sim *sim, union ccb *ccb) { - struct sbp_softc *sbp = (struct sbp_softc *)sim->softc; + struct sbp_softc *sbp = cam_sim_softc(sim); struct sbp_target *target = NULL; struct sbp_dev *sdev = NULL; @@ -2632,7 +2632,7 @@ sbp_poll(struct cam_sim *sim) struct sbp_softc *sbp; struct firewire_comm *fc; - sbp = (struct sbp_softc *)sim->softc; + sbp = cam_sim_softc(sim); fc = sbp->fd.fc; fc->poll(fc, 0, -1); diff --git a/sys/dev/usb/storage/umass.c b/sys/dev/usb/storage/umass.c index 8260226e5d12..bc07fe50b6ab 100644 --- a/sys/dev/usb/storage/umass.c +++ b/sys/dev/usb/storage/umass.c @@ -2157,7 +2157,7 @@ umass_cam_detach_sim(struct umass_softc *sc) static void umass_cam_action(struct cam_sim *sim, union ccb *ccb) { - struct umass_softc *sc = (struct umass_softc *)sim->softc; + struct umass_softc *sc = cam_sim_softc(sim); if (sc == NULL) { ccb->ccb_h.status = CAM_SEL_TIMEOUT; @@ -2433,7 +2433,7 @@ done: static void umass_cam_poll(struct cam_sim *sim) { - struct umass_softc *sc = (struct umass_softc *)sim->softc; + struct umass_softc *sc = cam_sim_softc(sim); if (sc == NULL) return; From owner-dev-commits-src-main@freebsd.org Thu Jun 3 19:46:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F109863F9F3; Thu, 3 Jun 2021 19:46: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 4FwxHK6Vhdz4jX8; Thu, 3 Jun 2021 19:46:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C2C1D7BF7; Thu, 3 Jun 2021 19:46:53 +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 153Jkrv7021551; Thu, 3 Jun 2021 19:46:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153Jkrkp021550; Thu, 3 Jun 2021 19:46:53 GMT (envelope-from git) Date: Thu, 3 Jun 2021 19:46:53 GMT Message-Id: <202106031946.153Jkrkp021550@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 175ad3d00318 - main - Fix mpr(4) and mps(4) state transitions and a use-after-free panic. 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/main X-Git-Reftype: branch X-Git-Commit: 175ad3d00318a345790eecf2f5a33cd16b119e55 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 19:46:54 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=175ad3d00318a345790eecf2f5a33cd16b119e55 commit 175ad3d00318a345790eecf2f5a33cd16b119e55 Author: Kenneth D. Merry AuthorDate: 2021-06-03 19:46:11 +0000 Commit: Warner Losh CommitDate: 2021-06-03 19:46:11 +0000 Fix mpr(4) and mps(4) state transitions and a use-after-free panic. When the mpr(4) and mps(4) drivers probe a SATA device, they issue an ATA Identify command (via mp{s,r}sas_get_sata_identify()) before the target is fully setup in the driver. The drivers wait for completion of the identify command, and have a 5 second timeout. If the timeout fires, the command is marked with the SATA_ID_TIMEOUT flag so it can be freed later. That is where the use-after-free problem comes in. Once the ATA Identify times out, the driver sends a target reset, and then frees any identify commands that have timed out. But, once the target reset completes, commands that were queued to the drive are returned to the driver by the controller. At that point, the driver (in mp{s,r}_intr_locked()) looks up the command descriptor for that particular SMID, marks it CM_STATE_BUSY and sends it on for completion handling. The problem at this stage is that the command has already been freed, and put on the free queue, so its state is CM_STATE_FREE. If INVARIANTS are turned on, we get a panic as soon as this command is allocated, because its state is no longer CM_STATE_FREE, but rather CM_STATE_BUSY. So, the solution is to not free ATA Identify commands that get stuck until they actually return from the controller. Hopefully this works correctly on older firmware versions. If not, it could result in commands hanging around indefinitely. But, the alternative is a use-after-free panic or assertion (in the INVARIANTS case). This also tightens up the state transitions between CM_STATE_FREE, CM_STATE_BUSY and CM_STATE_INQUEUE, so that the state transitions happen once, and we have assertions to make sure that commands are in the correct state before transitioning to the next state. Also, for each state assertion, we print out the current state of the command if it is incorrect. mp{s,r}.c: Add a new sysctl variable, dump_reqs_alltypes, that controls the behavior of the dump_reqs sysctl. If dump_reqs_alltypes is non-zero, it will dump all commands, not just the commands that are in the CM_STATE_INQUEUE state. (You can see the commands that are in the queue by using mp{s,r}util debug dumpreqs.) Make sure that the INQUEUE -> BUSY state transition happens in one place, the mp{s,r}_complete_command routine. mp{s,r}_sas.c: Make sure we print the current command type in command state assertions. mp{s,r}_sas_lsi.c: Add a new completion handler, mp{s,r}sas_ata_id_complete. This completion handler will free data allocated for an ATA Identify command and free the command structure. In mp{s,r}_ata_id_timeout, do not set the command state to CM_STATE_BUSY. The command is still in queue in the controller. Since we were blocking waiting for this command to complete, there was no completion handler previously. Set the completion handler, so that whenever the command does come back, it will get freed properly. Do not free ATA Identify commands that have timed out in mp{s,r}sas_add_device(). Wait for them to actually come back from the controller. mp{s,r}var.h: Add a dump_reqs_alltypes variable for the new dump_reqs_alltypes sysctl. Make sure we print the current state for state transition asserts. This was tested in the Spectra Logic test bed (as described in the review), as well Netflix's Open Connect fleet (where panics dropped from a dozen or two a month to zero). Reviewed by: imp@ (who is handling the commit with ken's OK) Sponsored by: Spectra Logic Differential Revision: https://reviews.freebsd.org/D25476 --- sys/dev/mpr/mpr.c | 15 ++++++++++----- sys/dev/mpr/mpr_sas.c | 4 ++-- sys/dev/mpr/mpr_sas_lsi.c | 41 +++++++++++++++++++++++++++-------------- sys/dev/mpr/mprvar.h | 11 +++++++---- sys/dev/mps/mps.c | 17 +++++++++++------ sys/dev/mps/mps_sas.c | 4 ++-- sys/dev/mps/mps_sas_lsi.c | 46 +++++++++++++++++++++++++++++----------------- sys/dev/mps/mpsvar.h | 9 +++++---- 8 files changed, 93 insertions(+), 54 deletions(-) diff --git a/sys/dev/mpr/mpr.c b/sys/dev/mpr/mpr.c index 5d57be27f9b2..a840f8f3d5ee 100644 --- a/sys/dev/mpr/mpr.c +++ b/sys/dev/mpr/mpr.c @@ -1141,7 +1141,8 @@ mpr_enqueue_request(struct mpr_softc *sc, struct mpr_command *cm) if (++sc->io_cmds_active > sc->io_cmds_highwater) sc->io_cmds_highwater++; - KASSERT(cm->cm_state == MPR_CM_STATE_BUSY, ("command not busy\n")); + KASSERT(cm->cm_state == MPR_CM_STATE_BUSY, + ("command not busy, state = %u\n", cm->cm_state)); cm->cm_state = MPR_CM_STATE_INQUEUE; if (sc->atomic_desc_capable) { @@ -1917,6 +1918,11 @@ mpr_setup_sysctl(struct mpr_softc *sc) CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_SKIP | CTLFLAG_NEEDGIANT, sc, 0, mpr_dump_reqs, "I", "Dump Active Requests"); + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "dump_reqs_alltypes", CTLFLAG_RW, + &sc->dump_reqs_alltypes, 0, + "dump all request types not just inqueue"); + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "use_phy_num", CTLFLAG_RD, &sc->use_phynum, 0, "Use the phy number for enumeration"); @@ -2101,7 +2107,7 @@ mpr_dump_reqs(SYSCTL_HANDLER_ARGS) /* Best effort, no locking */ for (i = smid; i < numreqs; i++) { cm = &sc->commands[i]; - if (cm->cm_state != state) + if ((sc->dump_reqs_alltypes == 0) && (cm->cm_state != state)) continue; hdr.smid = i; hdr.state = cm->cm_state; @@ -2365,6 +2371,8 @@ mpr_complete_command(struct mpr_softc *sc, struct mpr_command *cm) return; } + KASSERT(cm->cm_state == MPR_CM_STATE_INQUEUE, + ("command not inqueue, state = %u\n", cm->cm_state)); cm->cm_state = MPR_CM_STATE_BUSY; if (cm->cm_flags & MPR_CM_FLAGS_POLLED) cm->cm_flags |= MPR_CM_FLAGS_COMPLETE; @@ -2544,9 +2552,6 @@ mpr_intr_locked(void *data) case MPI25_RPY_DESCRIPT_FLAGS_FAST_PATH_SCSI_IO_SUCCESS: case MPI26_RPY_DESCRIPT_FLAGS_PCIE_ENCAPSULATED_SUCCESS: cm = &sc->commands[le16toh(desc->SCSIIOSuccess.SMID)]; - KASSERT(cm->cm_state == MPR_CM_STATE_INQUEUE, - ("command not inqueue\n")); - cm->cm_state = MPR_CM_STATE_BUSY; cm->cm_reply = NULL; break; case MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY: diff --git a/sys/dev/mpr/mpr_sas.c b/sys/dev/mpr/mpr_sas.c index 7c6bc110069a..f529fdf23d52 100644 --- a/sys/dev/mpr/mpr_sas.c +++ b/sys/dev/mpr/mpr_sas.c @@ -1194,7 +1194,7 @@ mprsas_tm_timeout(void *data) "out\n", tm); KASSERT(tm->cm_state == MPR_CM_STATE_INQUEUE, - ("command not inqueue\n")); + ("command not inqueue, state = %u\n", tm->cm_state)); tm->cm_state = MPR_CM_STATE_BUSY; mpr_reinit(sc); @@ -2437,7 +2437,7 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mpr_command *cm) if (cm->cm_flags & MPR_CM_FLAGS_ON_RECOVERY) { TAILQ_REMOVE(&cm->cm_targ->timedout_commands, cm, cm_recovery); KASSERT(cm->cm_state == MPR_CM_STATE_BUSY, - ("Not busy for CM_FLAGS_TIMEDOUT: %d\n", cm->cm_state)); + ("Not busy for CM_FLAGS_TIMEDOUT: %u\n", cm->cm_state)); cm->cm_flags &= ~MPR_CM_FLAGS_ON_RECOVERY; if (cm->cm_reply != NULL) mprsas_log_command(cm, MPR_RECOVERY, diff --git a/sys/dev/mpr/mpr_sas_lsi.c b/sys/dev/mpr/mpr_sas_lsi.c index 3d698cc4d431..0800fd0385a7 100644 --- a/sys/dev/mpr/mpr_sas_lsi.c +++ b/sys/dev/mpr/mpr_sas_lsi.c @@ -125,6 +125,7 @@ static int mprsas_add_pcie_device(struct mpr_softc *sc, u16 handle, static int mprsas_get_sata_identify(struct mpr_softc *sc, u16 handle, Mpi2SataPassthroughReply_t *mpi_reply, char *id_buffer, int sz, u32 devinfo); +static void mprsas_ata_id_complete(struct mpr_softc *, struct mpr_command *); static void mprsas_ata_id_timeout(struct mpr_softc *, struct mpr_command *); int mprsas_get_sas_address_for_sata_disk(struct mpr_softc *sc, u64 *sas_address, u16 handle, u32 device_info, u8 *is_SATA_SSD); @@ -1005,7 +1006,8 @@ mprsas_add_device(struct mpr_softc *sc, u16 handle, u8 linkrate) * An Abort Task TM should be used instead of a Target Reset, but that * would be much more difficult because targets have not been fully * discovered yet, and LUN's haven't been setup. So, just reset the - * target instead of the LUN. + * target instead of the LUN. The commands should complete once + * the target has been reset. */ for (i = 1; i < sc->num_reqs; i++) { cm = &sc->commands[i]; @@ -1033,16 +1035,6 @@ mprsas_add_device(struct mpr_softc *sc, u16 handle, u8 linkrate) } } out: - /* - * Free the commands that may not have been freed from the SATA ID call - */ - for (i = 1; i < sc->num_reqs; i++) { - cm = &sc->commands[i]; - if (cm->cm_flags & MPR_CM_FLAGS_SATA_ID_TIMEOUT) { - free(cm->cm_data, M_MPR); - mpr_free_command(sc, cm); - } - } mprsas_startup_decrement(sassc); return (error); } @@ -1218,8 +1210,8 @@ mprsas_get_sata_identify(struct mpr_softc *sc, u16 handle, out: /* * If the SATA_ID_TIMEOUT flag has been set for this command, don't free - * it. The command and buffer will be freed after sending an Abort - * Task TM. + * it. The command and buffer will be freed after we send a Target + * Reset TM and the command comes back from the controller. */ if ((cm->cm_flags & MPR_CM_FLAGS_SATA_ID_TIMEOUT) == 0) { mpr_free_command(sc, cm); @@ -1228,6 +1220,22 @@ out: return (error); } +/* + * This is completion handler to make sure that commands and allocated + * buffers get freed when timed out SATA ID commands finally complete after + * we've reset the target. In the normal case, we wait for the command to + * complete. + */ +static void +mprsas_ata_id_complete(struct mpr_softc *sc, struct mpr_command *cm) +{ + mpr_dprint(sc, MPR_INFO, "%s ATA ID completed late cm %p sc %p\n", + __func__, cm, sc); + + free(cm->cm_data, M_MPR); + mpr_free_command(sc, cm); +} + static void mprsas_ata_id_timeout(struct mpr_softc *sc, struct mpr_command *cm) { @@ -1242,7 +1250,12 @@ mprsas_ata_id_timeout(struct mpr_softc *sc, struct mpr_command *cm) * this command has timed out, it's no longer in the queue. */ cm->cm_flags |= MPR_CM_FLAGS_SATA_ID_TIMEOUT; - cm->cm_state = MPR_CM_STATE_BUSY; + + /* + * Since we will no longer be waiting for the command to complete, + * set a completion handler to make sure we free all resources. + */ + cm->cm_complete = mprsas_ata_id_complete; } static int diff --git a/sys/dev/mpr/mprvar.h b/sys/dev/mpr/mprvar.h index 5abcdd5d4299..524c93861b70 100644 --- a/sys/dev/mpr/mprvar.h +++ b/sys/dev/mpr/mprvar.h @@ -367,6 +367,7 @@ struct mpr_softc { u_int enable_ssu; int spinup_wait_time; int use_phynum; + int dump_reqs_alltypes; uint64_t chain_alloc_fail; uint64_t prp_page_alloc_fail; struct sysctl_ctx_list sysctl_ctx; @@ -617,7 +618,8 @@ mpr_free_command(struct mpr_softc *sc, struct mpr_command *cm) struct mpr_chain *chain, *chain_temp; struct mpr_prp_page *prp_page, *prp_page_temp; - KASSERT(cm->cm_state == MPR_CM_STATE_BUSY, ("state not busy\n")); + KASSERT(cm->cm_state == MPR_CM_STATE_BUSY, + ("state not busy, state = %u\n", cm->cm_state)); if (cm->cm_reply != NULL) mpr_free_reply(sc, cm->cm_reply_data); @@ -658,7 +660,7 @@ mpr_alloc_command(struct mpr_softc *sc) return (NULL); KASSERT(cm->cm_state == MPR_CM_STATE_FREE, - ("mpr: Allocating busy command\n")); + ("mpr: Allocating busy command, state = %u\n", cm->cm_state)); TAILQ_REMOVE(&sc->req_list, cm, cm_link); cm->cm_state = MPR_CM_STATE_BUSY; @@ -671,7 +673,8 @@ mpr_free_high_priority_command(struct mpr_softc *sc, struct mpr_command *cm) { struct mpr_chain *chain, *chain_temp; - KASSERT(cm->cm_state == MPR_CM_STATE_BUSY, ("state not busy\n")); + KASSERT(cm->cm_state == MPR_CM_STATE_BUSY, + ("state not busy, state = %u\n", cm->cm_state)); if (cm->cm_reply != NULL) mpr_free_reply(sc, cm->cm_reply_data); @@ -700,7 +703,7 @@ mpr_alloc_high_priority_command(struct mpr_softc *sc) return (NULL); KASSERT(cm->cm_state == MPR_CM_STATE_FREE, - ("mpr: Allocating busy command\n")); + ("mpr: Allocating busy command, state = %u\n", cm->cm_state)); TAILQ_REMOVE(&sc->high_priority_req_list, cm, cm_link); cm->cm_state = MPR_CM_STATE_BUSY; diff --git a/sys/dev/mps/mps.c b/sys/dev/mps/mps.c index e4d79b10e358..98c224237b0c 100644 --- a/sys/dev/mps/mps.c +++ b/sys/dev/mps/mps.c @@ -1112,7 +1112,8 @@ mps_enqueue_request(struct mps_softc *sc, struct mps_command *cm) rd.u.high = cm->cm_desc.Words.High; rd.word = htole64(rd.word); - KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, ("command not busy\n")); + KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, + ("command not busy, state = %u\n", cm->cm_state)); cm->cm_state = MPS_CM_STATE_INQUEUE; /* TODO-We may need to make below regwrite atomic */ @@ -1774,6 +1775,11 @@ mps_setup_sysctl(struct mps_softc *sc) CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_SKIP | CTLFLAG_NEEDGIANT, sc, 0, mps_dump_reqs, "I", "Dump Active Requests"); + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), + OID_AUTO, "dump_reqs_alltypes", CTLFLAG_RW, + &sc->dump_reqs_alltypes, 0, + "dump all request types not just inqueue"); + SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "use_phy_num", CTLFLAG_RD, &sc->use_phynum, 0, "Use the phy number for enumeration"); @@ -1947,7 +1953,7 @@ mps_dump_reqs(SYSCTL_HANDLER_ARGS) /* Best effort, no locking */ for (i = smid; i < numreqs; i++) { cm = &sc->commands[i]; - if (cm->cm_state != state) + if ((sc->dump_reqs_alltypes == 0) && (cm->cm_state != state)) continue; hdr.smid = i; hdr.state = cm->cm_state; @@ -2206,6 +2212,9 @@ mps_complete_command(struct mps_softc *sc, struct mps_command *cm) return; } + KASSERT(cm->cm_state == MPS_CM_STATE_INQUEUE, + ("command not inqueue, state = %u\n", cm->cm_state)); + cm->cm_state = MPS_CM_STATE_BUSY; if (cm->cm_flags & MPS_CM_FLAGS_POLLED) cm->cm_flags |= MPS_CM_FLAGS_COMPLETE; @@ -2382,9 +2391,6 @@ mps_intr_locked(void *data) switch (flags) { case MPI2_RPY_DESCRIPT_FLAGS_SCSI_IO_SUCCESS: cm = &sc->commands[le16toh(desc->SCSIIOSuccess.SMID)]; - KASSERT(cm->cm_state == MPS_CM_STATE_INQUEUE, - ("command not inqueue\n")); - cm->cm_state = MPS_CM_STATE_BUSY; cm->cm_reply = NULL; break; case MPI2_RPY_DESCRIPT_FLAGS_ADDRESS_REPLY: @@ -2460,7 +2466,6 @@ mps_intr_locked(void *data) cm = &sc->commands[ le16toh(desc->AddressReply.SMID)]; if (cm->cm_state == MPS_CM_STATE_INQUEUE) { - cm->cm_state = MPS_CM_STATE_BUSY; cm->cm_reply = reply; cm->cm_reply_data = le32toh( desc->AddressReply.ReplyFrameAddress); diff --git a/sys/dev/mps/mps_sas.c b/sys/dev/mps/mps_sas.c index e961b3fd826c..2413fa532d92 100644 --- a/sys/dev/mps/mps_sas.c +++ b/sys/dev/mps/mps_sas.c @@ -1170,7 +1170,7 @@ mpssas_tm_timeout(void *data) "task mgmt %p timed out\n", tm); KASSERT(tm->cm_state == MPS_CM_STATE_INQUEUE, - ("command not inqueue\n")); + ("command not inqueue, state = %u\n", tm->cm_state)); tm->cm_state = MPS_CM_STATE_BUSY; mps_reinit(sc); @@ -2015,7 +2015,7 @@ mpssas_scsiio_complete(struct mps_softc *sc, struct mps_command *cm) if (cm->cm_flags & MPS_CM_FLAGS_ON_RECOVERY) { TAILQ_REMOVE(&cm->cm_targ->timedout_commands, cm, cm_recovery); KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, - ("Not busy for CM_FLAGS_TIMEDOUT: %d\n", cm->cm_state)); + ("Not busy for CM_FLAGS_TIMEDOUT: %u\n", cm->cm_state)); cm->cm_flags &= ~MPS_CM_FLAGS_ON_RECOVERY; if (cm->cm_reply != NULL) mpssas_log_command(cm, MPS_RECOVERY, diff --git a/sys/dev/mps/mps_sas_lsi.c b/sys/dev/mps/mps_sas_lsi.c index cc207f7f1dfb..8cfb1700c705 100644 --- a/sys/dev/mps/mps_sas_lsi.c +++ b/sys/dev/mps/mps_sas_lsi.c @@ -123,6 +123,7 @@ static int mpssas_add_device(struct mps_softc *sc, u16 handle, u8 linkrate); static int mpssas_get_sata_identify(struct mps_softc *sc, u16 handle, Mpi2SataPassthroughReply_t *mpi_reply, char *id_buffer, int sz, u32 devinfo); +static void mpssas_ata_id_complete(struct mps_softc *, struct mps_command *); static void mpssas_ata_id_timeout(struct mps_softc *, struct mps_command *); int mpssas_get_sas_address_for_sata_disk(struct mps_softc *sc, u64 *sas_address, u16 handle, u32 device_info, u8 *is_SATA_SSD); @@ -780,7 +781,8 @@ mpssas_add_device(struct mps_softc *sc, u16 handle, u8 linkrate){ * An Abort Task TM should be used instead of a Target Reset, but that * would be much more difficult because targets have not been fully * discovered yet, and LUN's haven't been setup. So, just reset the - * target instead of the LUN. + * target instead of the LUN. The commands should complete once the + * target has been reset. */ for (i = 1; i < sc->num_reqs; i++) { cm = &sc->commands[i]; @@ -808,16 +810,6 @@ mpssas_add_device(struct mps_softc *sc, u16 handle, u8 linkrate){ } } out: - /* - * Free the commands that may not have been freed from the SATA ID call - */ - for (i = 1; i < sc->num_reqs; i++) { - cm = &sc->commands[i]; - if (cm->cm_flags & MPS_CM_FLAGS_SATA_ID_TIMEOUT) { - free(cm->cm_data, M_MPT2); - mps_free_command(sc, cm); - } - } mpssas_startup_decrement(sassc); return (error); } @@ -993,8 +985,8 @@ mpssas_get_sata_identify(struct mps_softc *sc, u16 handle, out: /* * If the SATA_ID_TIMEOUT flag has been set for this command, don't free - * it. The command and buffer will be freed after sending an Abort - * Task TM. + * it. The command and buffer will be freed after we send a Target + * Reset TM and the command comes back from the controller. */ if ((cm->cm_flags & MPS_CM_FLAGS_SATA_ID_TIMEOUT) == 0) { mps_free_command(sc, cm); @@ -1003,21 +995,41 @@ out: return (error); } +/* + * This is completion handler to make sure that commands and allocated + * buffers get freed when timed out SATA ID commands finally complete after + * we've reset the target. In the normal case, we wait for the command to + * complete. + */ static void -mpssas_ata_id_timeout(struct mps_softc *sc, struct mps_command *cm) +mpssas_ata_id_complete(struct mps_softc *sc, struct mps_command *cm) { + mps_dprint(sc, MPS_INFO, "%s ATA ID completed late cm %p sc %p\n", + __func__, cm, sc); + + free(cm->cm_data, M_MPT2); + mps_free_command(sc, cm); +} + +static void +mpssas_ata_id_timeout(struct mps_softc *sc, struct mps_command *cm) +{ mps_dprint(sc, MPS_INFO, "%s ATA ID command timeout cm %p sc %p\n", __func__, cm, sc); /* * The Abort Task cannot be sent from here because the driver has not * completed setting up targets. Instead, the command is flagged so - * that special handling will be used to send the abort. Now that - * this command has timed out, it's no longer in the queue. + * that special handling will be used to send a target reset. */ cm->cm_flags |= MPS_CM_FLAGS_SATA_ID_TIMEOUT; - cm->cm_state = MPS_CM_STATE_BUSY; + + /* + * Since we will no longer be waiting for the command to complete, + * set a completion handler to make sure we free all resources. + */ + cm->cm_complete = mpssas_ata_id_complete; } static int diff --git a/sys/dev/mps/mpsvar.h b/sys/dev/mps/mpsvar.h index 6e6c9fd28c2b..9cffd0f730d5 100644 --- a/sys/dev/mps/mpsvar.h +++ b/sys/dev/mps/mpsvar.h @@ -326,6 +326,7 @@ struct mps_softc { u_int enable_ssu; int spinup_wait_time; int use_phynum; + int dump_reqs_alltypes; uint64_t chain_alloc_fail; struct sysctl_ctx_list sysctl_ctx; struct sysctl_oid *sysctl_tree; @@ -548,7 +549,7 @@ mps_free_command(struct mps_softc *sc, struct mps_command *cm) struct mps_chain *chain, *chain_temp; KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, - ("state not busy: %d\n", cm->cm_state)); + ("state not busy: %u\n", cm->cm_state)); if (cm->cm_reply != NULL) mps_free_reply(sc, cm->cm_reply_data); @@ -584,7 +585,7 @@ mps_alloc_command(struct mps_softc *sc) return (NULL); KASSERT(cm->cm_state == MPS_CM_STATE_FREE, - ("mps: Allocating busy command: %d\n", cm->cm_state)); + ("mps: Allocating busy command: %u\n", cm->cm_state)); TAILQ_REMOVE(&sc->req_list, cm, cm_link); cm->cm_state = MPS_CM_STATE_BUSY; @@ -598,7 +599,7 @@ mps_free_high_priority_command(struct mps_softc *sc, struct mps_command *cm) struct mps_chain *chain, *chain_temp; KASSERT(cm->cm_state == MPS_CM_STATE_BUSY, - ("state not busy: %d\n", cm->cm_state)); + ("state not busy: %u\n", cm->cm_state)); if (cm->cm_reply != NULL) mps_free_reply(sc, cm->cm_reply_data); @@ -627,7 +628,7 @@ mps_alloc_high_priority_command(struct mps_softc *sc) return (NULL); KASSERT(cm->cm_state == MPS_CM_STATE_FREE, - ("mps: Allocating high priority busy command: %d\n", cm->cm_state)); + ("mps: Allocating high priority busy command: %u\n", cm->cm_state)); TAILQ_REMOVE(&sc->high_priority_req_list, cm, cm_link); cm->cm_state = MPS_CM_STATE_BUSY; From owner-dev-commits-src-main@freebsd.org Thu Jun 3 19:46:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 477CF63FE0C; Thu, 3 Jun 2021 19:46:55 +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 4FwxHM01fYz4jCf; Thu, 3 Jun 2021 19:46:55 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DB8627B3E; Thu, 3 Jun 2021 19:46:54 +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 153JksSG021572; Thu, 3 Jun 2021 19:46:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153Jkst3021571; Thu, 3 Jun 2021 19:46:54 GMT (envelope-from git) Date: Thu, 3 Jun 2021 19:46:54 GMT Message-Id: <202106031946.153Jkst3021571@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 33755dbb2078 - main - mpr/mps: Minor state machine fix 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/main X-Git-Reftype: branch X-Git-Commit: 33755dbb207878c10fd99de39dadf89fad713bc7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 19:46:55 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=33755dbb207878c10fd99de39dadf89fad713bc7 commit 33755dbb207878c10fd99de39dadf89fad713bc7 Author: Warner Losh AuthorDate: 2021-06-03 19:46:19 +0000 Commit: Warner Losh CommitDate: 2021-06-03 19:46:19 +0000 mpr/mps: Minor state machine fix When a DMA chain can't be loaded, set the state to STATE_INQUEUE so that the mp[rs]_complete_command can properly fail the command. Sponsored by: Netflix --- sys/dev/mpr/mpr.c | 1 + sys/dev/mps/mps.c | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/dev/mpr/mpr.c b/sys/dev/mpr/mpr.c index a840f8f3d5ee..e5ed9b250ca0 100644 --- a/sys/dev/mpr/mpr.c +++ b/sys/dev/mpr/mpr.c @@ -3703,6 +3703,7 @@ mpr_data_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) mpr_dprint(sc, MPR_INFO, "Out of chain frames, " "consider increasing hw.mpr.max_chains.\n"); cm->cm_flags |= MPR_CM_FLAGS_CHAIN_FAILED; + cm->cm_state = MPR_CM_STATE_INQUEUE; mpr_complete_command(sc, cm); return; } diff --git a/sys/dev/mps/mps.c b/sys/dev/mps/mps.c index 98c224237b0c..88e5cd0516bd 100644 --- a/sys/dev/mps/mps.c +++ b/sys/dev/mps/mps.c @@ -2978,6 +2978,7 @@ mps_data_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) mps_dprint(sc, MPS_INFO, "Out of chain frames, " "consider increasing hw.mps.max_chains.\n"); cm->cm_flags |= MPS_CM_FLAGS_CHAIN_FAILED; + cm->cm_state = MPS_CM_STATE_INQUEUE; mps_complete_command(sc, cm); return; } From owner-dev-commits-src-main@freebsd.org Thu Jun 3 19:47:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6919763FECA; Thu, 3 Jun 2021 19:47:37 +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 4FwxJ92Ry1z4jZ0; Thu, 3 Jun 2021 19:47:37 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3D2FF7CBB; Thu, 3 Jun 2021 19:47:37 +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 153Jlb4i021790; Thu, 3 Jun 2021 19:47:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153JlbiA021789; Thu, 3 Jun 2021 19:47:37 GMT (envelope-from git) Date: Thu, 3 Jun 2021 19:47:37 GMT Message-Id: <202106031947.153JlbiA021789@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: a603d41aca48 - main - madt_setup_local: skip further checks if ACPI DMAR table already disabled x2APIC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a603d41aca48ff21df59967c55ddef181e16ec14 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 19:47:37 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a603d41aca48ff21df59967c55ddef181e16ec14 commit a603d41aca48ff21df59967c55ddef181e16ec14 Author: Konstantin Belousov AuthorDate: 2021-06-02 22:01:28 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-03 19:47:31 +0000 madt_setup_local: skip further checks if ACPI DMAR table already disabled x2APIC Reviewed by: markj Tested by: David Sebek Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30624 --- sys/x86/acpica/madt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/x86/acpica/madt.c b/sys/x86/acpica/madt.c index 5683f7eb321d..11c7b9de52d7 100644 --- a/sys/x86/acpica/madt.c +++ b/sys/x86/acpica/madt.c @@ -158,7 +158,9 @@ madt_setup_local(void) reason = "by DMAR table"; acpi_unmap_table(dmartbl); } - if (vm_guest == VM_GUEST_VMWARE) { + if (reason != NULL) { + /* Already disabled */ + } else if (vm_guest == VM_GUEST_VMWARE) { vmware_hvcall(VMW_HVCMD_GETVCPU_INFO, p); if ((p[0] & VMW_VCPUINFO_VCPU_RESERVED) != 0 || (p[0] & VMW_VCPUINFO_LEGACY_X2APIC) == 0) From owner-dev-commits-src-main@freebsd.org Thu Jun 3 19:47:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE6F963FD42; Thu, 3 Jun 2021 19:47:38 +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 4FwxJB3Wlmz4jTv; Thu, 3 Jun 2021 19:47:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5FDCD7BFB; Thu, 3 Jun 2021 19:47:38 +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 153JlcX9021811; Thu, 3 Jun 2021 19:47:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153Jlc0U021810; Thu, 3 Jun 2021 19:47:38 GMT (envelope-from git) Date: Thu, 3 Jun 2021 19:47:38 GMT Message-Id: <202106031947.153Jlc0U021810@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 92adf00d0512 - main - madt_setup_local: convert series of strcmp to iteration over the array MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 92adf00d0512b674ce18eb1a542ae42e85dd5bca Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 19:47:39 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=92adf00d0512b674ce18eb1a542ae42e85dd5bca commit 92adf00d0512b674ce18eb1a542ae42e85dd5bca Author: Konstantin Belousov AuthorDate: 2021-06-02 22:19:09 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-03 19:47:31 +0000 madt_setup_local: convert series of strcmp to iteration over the array to prepare for one more addition Reviewed by: markj Tested by: David Sebek Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30624 --- sys/x86/acpica/madt.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/sys/x86/acpica/madt.c b/sys/x86/acpica/madt.c index 11c7b9de52d7..035a618f68a3 100644 --- a/sys/x86/acpica/madt.c +++ b/sys/x86/acpica/madt.c @@ -128,6 +128,11 @@ madt_probe_cpus(void) return (0); } +static const char *x2apic_sandy_dis[] = { + "LENOVO", + "ASUSTeK Computer Inc.", +}; + /* * Initialize the local APIC on the BSP. */ @@ -139,7 +144,7 @@ madt_setup_local(void) const char *reason; char *hw_vendor; u_int p[4]; - int user_x2apic; + int i, user_x2apic; bool bios_x2apic; if ((cpu_feature2 & CPUID2_X2APIC) != 0) { @@ -173,21 +178,22 @@ madt_setup_local(void) CPUID_TO_MODEL(cpu_id) == 0x2a) { hw_vendor = kern_getenv("smbios.planar.maker"); /* - * It seems that some Lenovo and ASUS - * SandyBridge-based notebook BIOSes have a - * bug which prevents booting AP in x2APIC - * mode. Since the only way to detect mobile - * CPU is to check northbridge pci id, which - * cannot be done that early, disable x2APIC - * for all Lenovo and ASUS SandyBridge + * It seems that some SandyBridge-based + * notebook BIOSes have a bug which prevents + * booting AP in x2APIC mode. Since the only + * way to detect mobile CPU is to check + * northbridge pci id, which cannot be done + * that early, disable x2APIC for all such * machines. */ if (hw_vendor != NULL) { - if (!strcmp(hw_vendor, "LENOVO") || - !strcmp(hw_vendor, - "ASUSTeK Computer Inc.")) { - reason = + for (i = 0; i < nitems(x2apic_sandy_dis); i++) { + if (strcmp(hw_vendor, + x2apic_sandy_dis[i]) == 0) { + reason = "for a suspected SandyBridge BIOS bug"; + break; + } } freeenv(hw_vendor); } From owner-dev-commits-src-main@freebsd.org Thu Jun 3 19:47:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C177B640015; Thu, 3 Jun 2021 19:47:39 +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 4FwxJC4ssKz4jM9; Thu, 3 Jun 2021 19:47:39 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 81C777C27; Thu, 3 Jun 2021 19:47:39 +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 153JldVp021836; Thu, 3 Jun 2021 19:47:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153JldxH021835; Thu, 3 Jun 2021 19:47:39 GMT (envelope-from git) Date: Thu, 3 Jun 2021 19:47:39 GMT Message-Id: <202106031947.153JldxH021835@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: e9e00cc0c987 - main - madt_setup_local: extract special case checks into a helper MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e9e00cc0c98738f0ce7bface221c920c36a1356e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 19:47:39 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e9e00cc0c98738f0ce7bface221c920c36a1356e commit e9e00cc0c98738f0ce7bface221c920c36a1356e Author: Konstantin Belousov AuthorDate: 2021-06-02 22:27:32 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-03 19:47:31 +0000 madt_setup_local: extract special case checks into a helper Reviewed by: markj Tested by: David Sebek Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30624 --- sys/x86/acpica/madt.c | 114 ++++++++++++++++++++++++++++---------------------- 1 file changed, 64 insertions(+), 50 deletions(-) diff --git a/sys/x86/acpica/madt.c b/sys/x86/acpica/madt.c index 035a618f68a3..e041296d4ca5 100644 --- a/sys/x86/acpica/madt.c +++ b/sys/x86/acpica/madt.c @@ -134,70 +134,84 @@ static const char *x2apic_sandy_dis[] = { }; /* - * Initialize the local APIC on the BSP. + * Automatically detect several configurations where x2APIC mode is + * known to cause troubles. User can override the setting with + * hw.x2apic_enable tunable. */ -static int -madt_setup_local(void) +static const char * +madt_x2apic_disable_reason(void) { ACPI_TABLE_DMAR *dmartbl; vm_paddr_t dmartbl_physaddr; const char *reason; char *hw_vendor; u_int p[4]; - int i, user_x2apic; - bool bios_x2apic; + int i; - if ((cpu_feature2 & CPUID2_X2APIC) != 0) { - reason = NULL; + reason = NULL; + dmartbl_physaddr = acpi_find_table(ACPI_SIG_DMAR); + if (dmartbl_physaddr != 0) { + dmartbl = acpi_map_table(dmartbl_physaddr, ACPI_SIG_DMAR); + if ((dmartbl->Flags & ACPI_DMAR_X2APIC_OPT_OUT) != 0) + reason = "by DMAR table"; + acpi_unmap_table(dmartbl); + if (reason != NULL) + return (reason); + } + + if (vm_guest == VM_GUEST_VMWARE) { + vmware_hvcall(VMW_HVCMD_GETVCPU_INFO, p); + if ((p[0] & VMW_VCPUINFO_VCPU_RESERVED) != 0 || + (p[0] & VMW_VCPUINFO_LEGACY_X2APIC) == 0) + return ("inside VMWare without intr redirection"); + } + + if (vm_guest == VM_GUEST_XEN) + return ("due to running under XEN"); + + if (vm_guest == VM_GUEST_NO && + CPUID_TO_FAMILY(cpu_id) == 0x6 && + CPUID_TO_MODEL(cpu_id) == 0x2a) { + hw_vendor = kern_getenv("smbios.planar.maker"); /* - * Automatically detect several configurations where - * x2APIC mode is known to cause troubles. User can - * override the setting with hw.x2apic_enable tunable. + * It seems that some SandyBridge-based notebook + * BIOSes have a bug which prevents booting AP in + * x2APIC mode. Since the only way to detect mobile + * CPU is to check northbridge pci id, which cannot be + * done that early, disable x2APIC for all such + * machines. */ - dmartbl_physaddr = acpi_find_table(ACPI_SIG_DMAR); - if (dmartbl_physaddr != 0) { - dmartbl = acpi_map_table(dmartbl_physaddr, - ACPI_SIG_DMAR); - if ((dmartbl->Flags & ACPI_DMAR_X2APIC_OPT_OUT) != 0) - reason = "by DMAR table"; - acpi_unmap_table(dmartbl); - } - if (reason != NULL) { - /* Already disabled */ - } else if (vm_guest == VM_GUEST_VMWARE) { - vmware_hvcall(VMW_HVCMD_GETVCPU_INFO, p); - if ((p[0] & VMW_VCPUINFO_VCPU_RESERVED) != 0 || - (p[0] & VMW_VCPUINFO_LEGACY_X2APIC) == 0) - reason = - "inside VMWare without intr redirection"; - } else if (vm_guest == VM_GUEST_XEN) { - reason = "due to running under XEN"; - } else if (vm_guest == VM_GUEST_NO && - CPUID_TO_FAMILY(cpu_id) == 0x6 && - CPUID_TO_MODEL(cpu_id) == 0x2a) { - hw_vendor = kern_getenv("smbios.planar.maker"); - /* - * It seems that some SandyBridge-based - * notebook BIOSes have a bug which prevents - * booting AP in x2APIC mode. Since the only - * way to detect mobile CPU is to check - * northbridge pci id, which cannot be done - * that early, disable x2APIC for all such - * machines. - */ - if (hw_vendor != NULL) { - for (i = 0; i < nitems(x2apic_sandy_dis); i++) { - if (strcmp(hw_vendor, - x2apic_sandy_dis[i]) == 0) { - reason = - "for a suspected SandyBridge BIOS bug"; - break; - } + if (hw_vendor != NULL) { + for (i = 0; i < nitems(x2apic_sandy_dis); i++) { + if (strcmp(hw_vendor, x2apic_sandy_dis[i]) == + 0) { + reason = + "for a suspected SandyBridge BIOS bug"; + break; } - freeenv(hw_vendor); } + freeenv(hw_vendor); } + if (reason != NULL) + return (reason); + } + + return (NULL); +} + +/* + * Initialize the local APIC on the BSP. + */ +static int +madt_setup_local(void) +{ + const char *reason; + int user_x2apic; + bool bios_x2apic; + + if ((cpu_feature2 & CPUID2_X2APIC) != 0) { + reason = madt_x2apic_disable_reason(); bios_x2apic = lapic_is_x2apic(); if (reason != NULL && bios_x2apic) { if (bootverbose) From owner-dev-commits-src-main@freebsd.org Thu Jun 3 19:47:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3271A63FF2F; Thu, 3 Jun 2021 19:47:41 +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 4FwxJD63qKz4jMD; Thu, 3 Jun 2021 19:47:40 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A48AB7DEE; Thu, 3 Jun 2021 19:47:40 +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 153JleAm021860; Thu, 3 Jun 2021 19:47:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153JlerA021859; Thu, 3 Jun 2021 19:47:40 GMT (envelope-from git) Date: Thu, 3 Jun 2021 19:47:40 GMT Message-Id: <202106031947.153JlerA021859@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 37f780d3e0a2 - main - Disable x2APIC for SandyBridge laptops with Samsung BIOS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 37f780d3e0a2e8e4c64c526b6e7dc77ff6b91057 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 19:47:41 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=37f780d3e0a2e8e4c64c526b6e7dc77ff6b91057 commit 37f780d3e0a2e8e4c64c526b6e7dc77ff6b91057 Author: Konstantin Belousov AuthorDate: 2021-06-02 22:29:07 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-03 19:47:31 +0000 Disable x2APIC for SandyBridge laptops with Samsung BIOS From the PR: Almost always, my Samsung RF511 laptop could not boot with x2APIC enabled in the kernel. It froze during SMP initialization, shortly after "ACPI APIC Table: " was printed to the console. When the kernel is instructed not to use x2APIC, the system boots correctly. PR: 256389 Submitted by: David Sebek Reviewed by: markj MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30624 --- sys/x86/acpica/madt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/x86/acpica/madt.c b/sys/x86/acpica/madt.c index e041296d4ca5..8e343a6619f3 100644 --- a/sys/x86/acpica/madt.c +++ b/sys/x86/acpica/madt.c @@ -131,6 +131,7 @@ madt_probe_cpus(void) static const char *x2apic_sandy_dis[] = { "LENOVO", "ASUSTeK Computer Inc.", + "SAMSUNG ELECTRONICS CO., LTD.", }; /* From owner-dev-commits-src-main@freebsd.org Thu Jun 3 21:22:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DF68641122; Thu, 3 Jun 2021 21:22:30 +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 4FwzPf0sD5z4prY; Thu, 3 Jun 2021 21:22:30 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 06544114B9; Thu, 3 Jun 2021 21:22: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 153LMTUf054634; Thu, 3 Jun 2021 21:22:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153LMTkK054633; Thu, 3 Jun 2021 21:22:29 GMT (envelope-from git) Date: Thu, 3 Jun 2021 21:22:29 GMT Message-Id: <202106032122.153LMTkK054633@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 5deb35002545 - main - uefisign: fix SizeOfHeaders sanity check. 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/main X-Git-Reftype: branch X-Git-Commit: 5deb35002545ca5081cc90795fec68bcea30f75d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 21:22:30 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=5deb35002545ca5081cc90795fec68bcea30f75d commit 5deb35002545ca5081cc90795fec68bcea30f75d Author: Kenneth Camann AuthorDate: 2021-01-03 02:11:42 +0000 Commit: Warner Losh CommitDate: 2021-06-03 21:22:14 +0000 uefisign: fix SizeOfHeaders sanity check. This check was too aggressive: it is fine if SizeOfHeaders is exactly equal to the size of the DOS stub + PE header + section table. Despite being wrong this code typically worked for most EFI binaries because SizeOfHeaders is rounded up to a multiple of FileAlignment, which is often large (e.g., 512 bytes for the FreeBSD loader) so most binaries made it through. Reviewed by: imp@ Sponsored by: Netflix Pull Request: https://github.com/freebsd/freebsd-src/pull/445 --- usr.sbin/uefisign/pe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/uefisign/pe.c b/usr.sbin/uefisign/pe.c index 6459321441d8..09b5edd56ab7 100644 --- a/usr.sbin/uefisign/pe.c +++ b/usr.sbin/uefisign/pe.c @@ -232,7 +232,7 @@ parse_section_table(struct executable *x, off_t off, int number_of_sections) range_check(x, off, sizeof(*psh) * number_of_sections, "section table"); - if (x->x_headers_len <= off + sizeof(*psh) * number_of_sections) + if (x->x_headers_len < off + sizeof(*psh) * number_of_sections) errx(1, "section table outside of headers"); psh = (const struct pe_section_header *)(x->x_buf + off); From owner-dev-commits-src-main@freebsd.org Thu Jun 3 23:46:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D8CE643399; Thu, 3 Jun 2021 23:46:03 +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 4Fx2bH1Xvdz3DjP; Thu, 3 Jun 2021 23:46:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1E57A132AA; Thu, 3 Jun 2021 23:46:03 +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 153Nk3IT040128; Thu, 3 Jun 2021 23:46:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 153Nk3On040127; Thu, 3 Jun 2021 23:46:03 GMT (envelope-from git) Date: Thu, 3 Jun 2021 23:46:03 GMT Message-Id: <202106032346.153Nk3On040127@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: eae2ef5a0103 - main - smartpqi: Remove stray declaration 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/main X-Git-Reftype: branch X-Git-Commit: eae2ef5a010366c673ad912cae23b426ebb9a8a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jun 2021 23:46:03 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=eae2ef5a010366c673ad912cae23b426ebb9a8a2 commit eae2ef5a010366c673ad912cae23b426ebb9a8a2 Author: Warner Losh AuthorDate: 2021-06-03 23:44:27 +0000 Commit: Warner Losh CommitDate: 2021-06-03 23:45:27 +0000 smartpqi: Remove stray declaration pqisrc_is_firmware_feature_enabled shouldn't be declared inline in a header, and then static inline in the .c function. Remove this stray declartion from the header. gcc6 complains, but clang does not. Sponsored by: Netflix --- sys/dev/smartpqi/smartpqi_prototypes.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/dev/smartpqi/smartpqi_prototypes.h b/sys/dev/smartpqi/smartpqi_prototypes.h index 34b10c5941e8..1aa68cf889b9 100644 --- a/sys/dev/smartpqi/smartpqi_prototypes.h +++ b/sys/dev/smartpqi/smartpqi_prototypes.h @@ -37,8 +37,6 @@ void pqisrc_pqi_uninit(pqisrc_softstate_t *); int pqisrc_process_config_table(pqisrc_softstate_t *); int pqisrc_flush_cache(pqisrc_softstate_t *, enum pqisrc_flush_cache_event_type); int pqisrc_wait_for_pqi_reset_completion(pqisrc_softstate_t *); -inline boolean_t pqisrc_is_firmware_feature_enabled(pqisrc_softstate_t *, - struct pqi_conf_table_firmware_features *, uint16_t ); /* pqi_sis.c*/ int pqisrc_sis_init(pqisrc_softstate_t *); From owner-dev-commits-src-main@freebsd.org Fri Jun 4 00:30:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB352643F22; Fri, 4 Jun 2021 00:30:28 +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 4Fx3ZX4Wvtz3HFr; Fri, 4 Jun 2021 00:30:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 84F8913458; Fri, 4 Jun 2021 00:30:28 +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 1540USs4002419; Fri, 4 Jun 2021 00:30:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1540USg0002418; Fri, 4 Jun 2021 00:30:28 GMT (envelope-from git) Date: Fri, 4 Jun 2021 00:30:28 GMT Message-Id: <202106040030.1540USg0002418@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: f9b1e711f0d8 - main - fdescfs: add an option to return underlying file vnode on lookup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f9b1e711f0d8c27f2d29e7a8e6276947d37a6a22 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 00:30:28 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f9b1e711f0d8c27f2d29e7a8e6276947d37a6a22 commit f9b1e711f0d8c27f2d29e7a8e6276947d37a6a22 Author: Konstantin Belousov AuthorDate: 2021-05-05 22:53:20 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-04 00:30:12 +0000 fdescfs: add an option to return underlying file vnode on lookup The 'nodup' option forces fdescfs to return real vnode behind file descriptor instead of the fdescfs fd vnode, on lookup. The end result is that e.g. stat("/dev/fd/3") returns the stat data for the underlying vnode, if any. Similarly, fchdir(2) works in the expected way. For open(2), if applied over file descriptor opened with O_PATH, it effectively re-open that vnode into normal file descriptor which has the specified access mode, assuming the current vnode permissions allow it. If the file descriptor does not reference vnode, the behavior is unchanged. This is done by a mount option, because permission check on open(2) breaks established fdescfs open semantic of dup(2)-ing the descriptor. So it is not suitable for /dev/fd mount. Tested by: Andrew Walker Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30140 --- share/man/man5/fdescfs.5 | 94 +++++++++++++++++++++++++++++++++++++------ sys/fs/fdescfs/fdesc.h | 1 + sys/fs/fdescfs/fdesc_vfsops.c | 2 + sys/fs/fdescfs/fdesc_vnops.c | 12 +++++- 4 files changed, 95 insertions(+), 14 deletions(-) diff --git a/share/man/man5/fdescfs.5 b/share/man/man5/fdescfs.5 index 3f16104c0ac8..f2abda2bb4c2 100644 --- a/share/man/man5/fdescfs.5 +++ b/share/man/man5/fdescfs.5 @@ -1,3 +1,5 @@ +.\" Copyright (c) 2021 The FreeBSD Foundation, Inc. +.\" .\" Copyright (c) 1996 .\" Mike Pritchard . All rights reserved. .\" @@ -8,6 +10,10 @@ .\" This code is derived from software donated to Berkeley by .\" Jan-Simon Pendry. .\" +.\" Parts of this documentation was written by +.\" Konstantin Belousov under sponsorship +.\" from the FreeBSD Foundation. +.\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: @@ -34,7 +40,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 1, 2017 +.Dd May 17, 2021 .Dt FDESCFS 5 .Os .Sh NAME @@ -62,7 +68,40 @@ through .Pa /dev/fd/# refer to file descriptors which can be accessed through the file system. -If the file descriptor is open and the mode the file is being opened +.Pp +The following mount options can be used when mounting +.Nm +filesystem: +.Bl -tag -width linrdlnk +.It Cm nodup +For file descriptors referencing vnodes, instead of the +.Xr dup 2 +semantic described above, implement re-opening of the referenced vnode. +See below for more details. +.It Cm linrdlnk +Report the type of the +.Nm +vnode as +.Dv VLNK +instead of +.Fx +traditional +.Dv VCHR . +For +.Xr linux 4 +ABI compatibility mount +.Nm +volume with the +.Cm linrdlnk +option. +.El +.Pp +For +.Nm +mounted without the +.Cm nodup +mount option, +if the file descriptor is open and the mode the file is being opened with is a subset of the mode of the existing descriptor, the call: .Bd -literal -offset indent fd = open("/dev/fd/0", mode); @@ -74,7 +113,6 @@ fd = fcntl(0, F_DUPFD, 0); .Ed .Pp are equivalent. -.Pp Flags to the .Xr open 2 call other than @@ -84,6 +122,38 @@ and .Dv O_RDWR are ignored. .Pp +For +.Nm +mounted with the +.Cm nodup +option, and file descriptor referencing a vnode, the call: +.Bd -literal -offset indent +fd = open("/dev/fd/0", mode); +.Ed +.Pp +reopens the referenced vnode with the specified +.Fa mode . +In other words, the +.Fn open +call above is equivalent to +.Bd -literal -offset indent +fd = openat(0, "", O_EMPTY_PATH, mode); +.Ed +.Pp +In particular, if the file descriptor was opened with the +.Dv O_PATH +flag, then either +.Dv O_EMPTY_PATH +or +.Fn open +over +.Nm +mount with +.Cm nodup +option allows one to convert it to a regularly opened file, +assuming that the current permissions allow the requested +.Fa mode . +.Pp .Em "Note:" .Pa /dev/fd/0 , .Pa /dev/fd/1 @@ -92,14 +162,6 @@ and files are created by default when devfs alone is mounted. .Nm creates entries for all file descriptors opened by the process. -.Pp -For -.Xr linux 4 -ABI compatibility mount -.Nm -volume with -.Cm linrdlnk -option. .Sh FILES .Bl -tag -width /dev/stderr -compact .It Pa /dev/fd/# @@ -110,13 +172,19 @@ To mount a volume located on .Pa /dev/fd : .Pp -.Dl "mount -t fdescfs null /dev/fd" +.Dl "mount -t fdescfs none /dev/fd" .Pp For .Xr linux 4 ABI compatibility: .Pp -.Dl "mount -t fdescfs -o linrdlnk null /compat/linux/dev/fd" +.Dl "mount -t fdescfs -o linrdlnk none /compat/linux/dev/fd" +.Pp +For substitute of +.Dv O_EMPTY_PATH +flag use: +.Pp +.Dl "mount -t fdescfs -o nodup none /dev/fdpath" .Sh SEE ALSO .Xr devfs 5 , .Xr mount 8 diff --git a/sys/fs/fdescfs/fdesc.h b/sys/fs/fdescfs/fdesc.h index b578b7309130..94682f42cdb3 100644 --- a/sys/fs/fdescfs/fdesc.h +++ b/sys/fs/fdescfs/fdesc.h @@ -42,6 +42,7 @@ /* Private mount flags for fdescfs. */ #define FMNT_UNMOUNTF 0x01 #define FMNT_LINRDLNKF 0x02 +#define FMNT_NODUP 0x04 struct fdescmount { struct vnode *f_root; /* Root node */ diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c index 64f8d28bdcfd..9d8fdda47cbf 100644 --- a/sys/fs/fdescfs/fdesc_vfsops.c +++ b/sys/fs/fdescfs/fdesc_vfsops.c @@ -101,6 +101,8 @@ fdesc_mount(struct mount *mp) fmp->flags = 0; if (vfs_getopt(mp->mnt_optnew, "linrdlnk", NULL, NULL) == 0) fmp->flags |= FMNT_LINRDLNKF; + if (vfs_getopt(mp->mnt_optnew, "nodup", NULL, NULL) == 0) + fmp->flags |= FMNT_NODUP; error = fdesc_allocvp(Froot, -1, FD_ROOT, mp, &rvp); if (error) { free(fmp, M_FDESCMNT); diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 1271b50e6e94..c5a7b86f1de5 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -264,10 +264,20 @@ fdesc_get_ino_alloc(struct mount *mp, void *arg, int lkflags, struct vnode **rvp) { struct fdesc_get_ino_args *a; + struct fdescmount *fdm; + struct vnode *vp; int error; a = arg; - error = fdesc_allocvp(a->ftype, a->fd_fd, a->ix, mp, rvp); + fdm = VFSTOFDESC(mp); + if ((fdm->flags & FMNT_NODUP) != 0 && a->fp->f_type == DTYPE_VNODE) { + vp = a->fp->f_vnode; + vget(vp, lkflags | LK_RETRY); + *rvp = vp; + error = 0; + } else { + error = fdesc_allocvp(a->ftype, a->fd_fd, a->ix, mp, rvp); + } fdrop(a->fp, a->td); return (error); } From owner-dev-commits-src-main@freebsd.org Fri Jun 4 03:54:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A747646A2C; Fri, 4 Jun 2021 03:54:05 +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 4Fx85T1rCvz3pSH; Fri, 4 Jun 2021 03:54:05 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 27246165C7; Fri, 4 Jun 2021 03:54:05 +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 1543s5BP072707; Fri, 4 Jun 2021 03:54:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1543s53V072706; Fri, 4 Jun 2021 03:54:05 GMT (envelope-from git) Date: Fri, 4 Jun 2021 03:54:05 GMT Message-Id: <202106040354.1543s53V072706@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: d224f05fcfc1 - main - nfsd: Pre-parse the next NFSv4 operation number for put FH operations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d224f05fcfc13725c43ea0a02d511b3bf6a8ad14 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 03:54:05 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=d224f05fcfc13725c43ea0a02d511b3bf6a8ad14 commit d224f05fcfc13725c43ea0a02d511b3bf6a8ad14 Author: Rick Macklem AuthorDate: 2021-06-04 03:48:26 +0000 Commit: Rick Macklem CommitDate: 2021-06-04 03:48:26 +0000 nfsd: Pre-parse the next NFSv4 operation number for put FH operations RFC5661 Sec. 2.6 specifies when a NFSERR_WRONGSEC error reply can be done. For the four operations PutFH, PutrootFH, PutpublicFH and RestoreFH, NFSERR_WRONGSEC can or cannot be replied, depending upon what operation follows one of these operations in the compound. This patch modifies nfsrvd_compound() so that it parses the next operation number before executing any of the above four operations, storing it in "nextop". A future commit will implement use of "nextop" to decide if NFSERR_WRONGSEC can be replied for the above four operations. This commit should not change the semantics of performing the compound RPC. MFC after: 2 weeks --- sys/fs/nfsserver/nfs_nfsdsocket.c | 109 ++++++++++++++++++++++++++++++++++---- 1 file changed, 100 insertions(+), 9 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdsocket.c b/sys/fs/nfsserver/nfs_nfsdsocket.c index a8e1757835ac..f40569da0097 100644 --- a/sys/fs/nfsserver/nfs_nfsdsocket.c +++ b/sys/fs/nfsserver/nfs_nfsdsocket.c @@ -705,7 +705,7 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag, int i, lktype, op, op0 = 0, statsinprog = 0; u_int32_t *tl; struct nfsclient *clp, *nclp; - int numops, error = 0, igotlock; + int error = 0, igotlock, nextop, numops, savefhcnt; u_int32_t retops = 0, *retopsp = NULL, *repp; vnode_t vp, nvp, savevp; struct nfsrvfh fh; @@ -822,6 +822,8 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag, savevp = vp = NULL; save_fsid.val[0] = save_fsid.val[1] = 0; cur_fsid.val[0] = cur_fsid.val[1] = 0; + nextop = -1; + savefhcnt = 0; /* If taglen < 0, there was a parsing error in nfsd_getminorvers(). */ if (taglen < 0) { @@ -850,10 +852,20 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag, * savevpnes and vpnes - are the export flags for the above. */ for (i = 0; i < numops; i++) { - NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); NFSM_BUILD(repp, u_int32_t *, 2 * NFSX_UNSIGNED); - *repp = *tl; - op = fxdr_unsigned(int, *tl); + if (savefhcnt > 0) { + op = NFSV4OP_SAVEFH; + *repp = txdr_unsigned(op); + savefhcnt--; + } else if (nextop == -1) { + NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); + *repp = *tl; + op = fxdr_unsigned(int, *tl); + } else { + op = nextop; + *repp = txdr_unsigned(op); + nextop = -1; + } NFSD_DEBUG(4, "op=%d\n", op); if (op < NFSV4OP_ACCESS || op >= NFSV42_NOPS || (op >= NFSV4OP_NOPS && (nd->nd_flag & ND_NFSV41) == 0) || @@ -950,6 +962,25 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag, error = nfsrv_mtofh(nd, &fh); if (error) goto nfsmout; + if ((nd->nd_flag & ND_LASTOP) == 0) { + /* + * Pre-parse the next op#. If it is + * SaveFH, count it and skip to the + * next op#, if not the last op#. + * nextop is used to determine if + * NFSERR_WRONGSEC can be returned, + * per RFC5661 Sec. 2.6. + */ + do { + NFSM_DISSECT(tl, uint32_t *, + NFSX_UNSIGNED); + nextop = fxdr_unsigned(int, *tl); + if (nextop == NFSV4OP_SAVEFH && + i < numops - 1) + savefhcnt++; + } while (nextop == NFSV4OP_SAVEFH && + i < numops - 1); + } if (!nd->nd_repstat) nfsd_fhtovp(nd, &fh, LK_SHARED, &nvp, &nes, NULL, 0); @@ -964,11 +995,31 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag, } break; case NFSV4OP_PUTPUBFH: - if (nfs_pubfhset) - nfsd_fhtovp(nd, &nfs_pubfh, LK_SHARED, &nvp, - &nes, NULL, 0); - else - nd->nd_repstat = NFSERR_NOFILEHANDLE; + if (nfs_pubfhset) { + if ((nd->nd_flag & ND_LASTOP) == 0) { + /* + * Pre-parse the next op#. If it is + * SaveFH, count it and skip to the + * next op#, if not the last op#. + * nextop is used to determine if + * NFSERR_WRONGSEC can be returned, + * per RFC5661 Sec. 2.6. + */ + do { + NFSM_DISSECT(tl, uint32_t *, + NFSX_UNSIGNED); + nextop = fxdr_unsigned(int, + *tl); + if (nextop == NFSV4OP_SAVEFH && + i < numops - 1) + savefhcnt++; + } while (nextop == NFSV4OP_SAVEFH && + i < numops - 1); + } + nfsd_fhtovp(nd, &nfs_pubfh, LK_SHARED, &nvp, + &nes, NULL, 0); + } else + nd->nd_repstat = NFSERR_NOFILEHANDLE; if (!nd->nd_repstat) { if (vp) vrele(vp); @@ -980,6 +1031,26 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag, break; case NFSV4OP_PUTROOTFH: if (nfs_rootfhset) { + if ((nd->nd_flag & ND_LASTOP) == 0) { + /* + * Pre-parse the next op#. If it is + * SaveFH, count it and skip to the + * next op#, if not the last op#. + * nextop is used to determine if + * NFSERR_WRONGSEC can be returned, + * per RFC5661 Sec. 2.6. + */ + do { + NFSM_DISSECT(tl, uint32_t *, + NFSX_UNSIGNED); + nextop = fxdr_unsigned(int, + *tl); + if (nextop == NFSV4OP_SAVEFH && + i < numops - 1) + savefhcnt++; + } while (nextop == NFSV4OP_SAVEFH && + i < numops - 1); + } nfsd_fhtovp(nd, &nfs_rootfh, LK_SHARED, &nvp, &nes, NULL, 0); if (!nd->nd_repstat) { @@ -1016,6 +1087,26 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag, break; case NFSV4OP_RESTOREFH: if (savevp) { + if ((nd->nd_flag & ND_LASTOP) == 0) { + /* + * Pre-parse the next op#. If it is + * SaveFH, count it and skip to the + * next op#, if not the last op#. + * nextop is used to determine if + * NFSERR_WRONGSEC can be returned, + * per RFC5661 Sec. 2.6. + */ + do { + NFSM_DISSECT(tl, uint32_t *, + NFSX_UNSIGNED); + nextop = fxdr_unsigned(int, + *tl); + if (nextop == NFSV4OP_SAVEFH && + i < numops - 1) + savefhcnt++; + } while (nextop == NFSV4OP_SAVEFH && + i < numops - 1); + } nd->nd_repstat = 0; /* If vp == savevp, a no-op */ if (vp != savevp) { From owner-dev-commits-src-main@freebsd.org Fri Jun 4 04:14:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E31F647193; Fri, 4 Jun 2021 04:14:33 +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 4Fx8Y51ckgz3pnR; Fri, 4 Jun 2021 04:14:33 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 152E7167BC; Fri, 4 Jun 2021 04:14:33 +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 1544EW3F099868; Fri, 4 Jun 2021 04:14:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1544EWfd099867; Fri, 4 Jun 2021 04:14:32 GMT (envelope-from git) Date: Fri, 4 Jun 2021 04:14:32 GMT Message-Id: <202106040414.1544EWfd099867@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: 681500889424 - main - wpa: Fix GCC 6 build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 681500889424423403ace51f118b3467e09acc00 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 04:14:33 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=681500889424423403ace51f118b3467e09acc00 commit 681500889424423403ace51f118b3467e09acc00 Author: Cy Schubert AuthorDate: 2021-06-04 01:40:55 +0000 Commit: Cy Schubert CommitDate: 2021-06-04 04:13:00 +0000 wpa: Fix GCC 6 build GCC 6 searches serially to resolve external references. MFC after: 2 months X-MFC with: 25ecdc7d52770caf1c9b44b5ec11f468f6b636f3 --- usr.sbin/wpa/hostapd/Makefile | 8 ++++---- usr.sbin/wpa/wpa_cli/Makefile | 4 ++-- usr.sbin/wpa/wpa_supplicant/Makefile | 7 ++++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/usr.sbin/wpa/hostapd/Makefile b/usr.sbin/wpa/hostapd/Makefile index c0083747782a..c7775c960ddd 100644 --- a/usr.sbin/wpa/hostapd/Makefile +++ b/usr.sbin/wpa/hostapd/Makefile @@ -31,10 +31,10 @@ CFLAGS+=-I${.CURDIR:H}/wpa_supplicant \ CFLAGS+= -DCONFIG_IPV6 .endif #CFLAGS+= -g -LIBADD+= pcap util wpaap wpacommon wpacrypto \ - wpadrivers wpal2_packet wpaeap_common wpaeap_server \ - wpaeapol_auth \ - wparadius wpatls wpautils wpawps +LIBADD+= pcap util \ + wpadrivers wpaap wpal2_packet wpaeap_server \ + wpaeapol_auth wpaeap_common \ + wparadius wpatls wpawps wpacommon wpacrypto wpautils # User customizations for wpa_supplicant/hostapd build environment CFLAGS+=${HOSTAPD_CFLAGS} diff --git a/usr.sbin/wpa/wpa_cli/Makefile b/usr.sbin/wpa/wpa_cli/Makefile index bf2cf6252550..93a24295f4a2 100644 --- a/usr.sbin/wpa/wpa_cli/Makefile +++ b/usr.sbin/wpa/wpa_cli/Makefile @@ -21,16 +21,16 @@ CFLAGS+= -D_DIRENT_HAVE_D_TYPE CFLAGS+= -DCONFIG_WPA_CLI_EDIT=y LIBADD+=wpaap \ wpacommon \ - wpacrypto \ - wpaeap_common \ wpaeap_peer \ wpaeap_server \ wpaeapol_auth \ wpaeapol_supp \ + wpaeap_common \ wpal2_packet \ wparadius \ wparsn_supp \ wpatls \ + wpacrypto \ wpautils LIBADD+= pcap util diff --git a/usr.sbin/wpa/wpa_supplicant/Makefile b/usr.sbin/wpa/wpa_supplicant/Makefile index 332f66315346..c86be9497eca 100644 --- a/usr.sbin/wpa/wpa_supplicant/Makefile +++ b/usr.sbin/wpa/wpa_supplicant/Makefile @@ -41,9 +41,10 @@ FILES= wpa_supplicant.conf CFLAGS+=-DCONFIG_BACKEND_FILE #CFLAGS+= -g -LIBADD+=pcap util wpaap wpacommon wpacrypto wpadrivers wpaeapol_supp \ - wpaeap_common wpaeap_server \ - wpaeap_peer wpal2_packet wparsn_supp wpatls wpautils wpawps +LIBADD+=pcap util wpadrivers wpaap wpaeapol_supp \ + wpaeap_server \ + wpaeap_peer wpaeap_common wpal2_packet wparsn_supp wpatls wpawps \ + wpacommon wpacrypto wpautils # User customizations to the wpa_supplicant build environment CFLAGS+=${WPA_SUPPLICANT_CFLAGS} From owner-dev-commits-src-main@freebsd.org Fri Jun 4 08:06:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9251564A1C8; Fri, 4 Jun 2021 08:06:41 +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 4FxFhx3p8bz4Xc5; Fri, 4 Jun 2021 08:06:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 661AB199C7; Fri, 4 Jun 2021 08:06:41 +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 15486faj007514; Fri, 4 Jun 2021 08:06:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15486fki007513; Fri, 4 Jun 2021 08:06:41 GMT (envelope-from git) Date: Fri, 4 Jun 2021 08:06:41 GMT Message-Id: <202106040806.15486fki007513@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 73570795e790 - main - gitignore: Add compile_commands.json MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 73570795e7906ec555b37ff7e20e5d5d559ccdad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 08:06:41 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=73570795e7906ec555b37ff7e20e5d5d559ccdad commit 73570795e7906ec555b37ff7e20e5d5d559ccdad Author: Ka Ho Ng AuthorDate: 2021-06-04 08:04:04 +0000 Commit: Ka Ho Ng CommitDate: 2021-06-04 08:06:32 +0000 gitignore: Add compile_commands.json The purpose of this change is to make sure no one would accidentally include their own workspace leftover into a commit. compile_commands.json is a generated file which contains build commands. The file is consumed by Language Servers such as clangd and ccls. Sponsored by: The FreeBSD Foundation Reviewed by: lwhsu Differential Revision: https://reviews.freebsd.org/D26514 --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c674e06fda50..2e735237b30f 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ cscope.files cscope.in.out cscope.out cscope.po.out +compile_commands.json From owner-dev-commits-src-main@freebsd.org Fri Jun 4 08:33:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 217CF64A54C; Fri, 4 Jun 2021 08:33:03 +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 4FxGHM082Pz4YXM; Fri, 4 Jun 2021 08:33:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E131D19E1E; Fri, 4 Jun 2021 08:33: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 1548X2mw046383; Fri, 4 Jun 2021 08:33:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1548X2EF046382; Fri, 4 Jun 2021 08:33:02 GMT (envelope-from git) Date: Fri, 4 Jun 2021 08:33:02 GMT Message-Id: <202106040833.1548X2EF046382@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: d4cf41a99b40 - main - Add support for RTL8153B, RTL8156 and RTL8156B to if_ure(4). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d4cf41a99b405c73288aea81e3c4580d1de18435 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 08:33:03 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=d4cf41a99b405c73288aea81e3c4580d1de18435 commit d4cf41a99b405c73288aea81e3c4580d1de18435 Author: Hans Petter Selasky AuthorDate: 2021-06-04 08:28:58 +0000 Commit: Hans Petter Selasky CommitDate: 2021-06-04 08:29:55 +0000 Add support for RTL8153B, RTL8156 and RTL8156B to if_ure(4). Submitted by: fbbz@synack.eu PR: 253374 MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/usb/net/if_ure.c | 965 ++++++++++++++++++++++++++++++++------------ sys/dev/usb/net/if_urereg.h | 200 ++++++++- 2 files changed, 890 insertions(+), 275 deletions(-) diff --git a/sys/dev/usb/net/if_ure.c b/sys/dev/usb/net/if_ure.c index 30fcee59cce3..2e4053a0e0c6 100644 --- a/sys/dev/usb/net/if_ure.c +++ b/sys/dev/usb/net/if_ure.c @@ -96,16 +96,17 @@ SYSCTL_INT(_hw_usb_ure, OID_AUTO, debug, CTLFLAG_RWTUN, &ure_debug, 0, */ static const STRUCT_USB_HOST_ID ure_devs[] = { #define URE_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } - URE_DEV(LENOVO, RTL8153, 0), + URE_DEV(LENOVO, RTL8153, URE_FLAG_8153), URE_DEV(LENOVO, TBT3LAN, 0), URE_DEV(LENOVO, TBT3LANGEN2, 0), URE_DEV(LENOVO, ONELINK, 0), URE_DEV(LENOVO, USBCLAN, 0), URE_DEV(LENOVO, USBCLANGEN2, 0), - URE_DEV(NVIDIA, RTL8153, 0), + URE_DEV(NVIDIA, RTL8153, URE_FLAG_8153), URE_DEV(REALTEK, RTL8152, URE_FLAG_8152), - URE_DEV(REALTEK, RTL8153, 0), - URE_DEV(TPLINK, RTL8153, 0), + URE_DEV(REALTEK, RTL8153, URE_FLAG_8153), + URE_DEV(TPLINK, RTL8153, URE_FLAG_8153), + URE_DEV(REALTEK, RTL8156, URE_FLAG_8156), #undef URE_DEV }; @@ -141,6 +142,7 @@ static int ure_write_2(struct ure_softc *, uint16_t, uint16_t, uint32_t); static int ure_write_4(struct ure_softc *, uint16_t, uint16_t, uint32_t); static uint16_t ure_ocp_reg_read(struct ure_softc *, uint16_t); static void ure_ocp_reg_write(struct ure_softc *, uint16_t, uint16_t); +static void ure_sram_write(struct ure_softc *, uint16_t, uint16_t); static int ure_sysctl_chipver(SYSCTL_HANDLER_ARGS); @@ -149,96 +151,21 @@ static int ure_attach_post_sub(struct usb_ether *); static void ure_reset(struct ure_softc *); static int ure_ifmedia_upd(struct ifnet *); static void ure_ifmedia_sts(struct ifnet *, struct ifmediareq *); -static int ure_ioctl(struct ifnet *, u_long, caddr_t); +static void ure_add_media_types(struct ure_softc *); +static void ure_link_state(struct ure_softc *sc); +static int ure_get_link_status(struct ure_softc *); +static int ure_ioctl(struct ifnet *, u_long, caddr_t); static void ure_rtl8152_init(struct ure_softc *); +static void ure_rtl8152_nic_reset(struct ure_softc *); static void ure_rtl8153_init(struct ure_softc *); +static void ure_rtl8153b_init(struct ure_softc *); +static void ure_rtl8153b_nic_reset(struct ure_softc *); static void ure_disable_teredo(struct ure_softc *); -static void ure_init_fifo(struct ure_softc *); +static void ure_enable_aldps(struct ure_softc *, bool); +static uint16_t ure_phy_status(struct ure_softc *, uint16_t); static void ure_rxcsum(int capenb, struct ure_rxpkt *rp, struct mbuf *m); static int ure_txcsum(struct mbuf *m, int caps, uint32_t *regout); -static const struct usb_config ure_config_rx[URE_N_TRANSFER] = { - { - .type = UE_BULK, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_IN, - .bufsize = URE_TRANSFER_SIZE, - .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .callback = ure_bulk_read_callback, - .timeout = 0, /* no timeout */ - }, - { - .type = UE_BULK, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_IN, - .bufsize = URE_TRANSFER_SIZE, - .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .callback = ure_bulk_read_callback, - .timeout = 0, /* no timeout */ - }, -#if URE_N_TRANSFER == 4 - { - .type = UE_BULK, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_IN, - .bufsize = URE_TRANSFER_SIZE, - .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .callback = ure_bulk_read_callback, - .timeout = 0, /* no timeout */ - }, - { - .type = UE_BULK, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_IN, - .bufsize = URE_TRANSFER_SIZE, - .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, - .callback = ure_bulk_read_callback, - .timeout = 0, /* no timeout */ - }, -#endif -}; - -static const struct usb_config ure_config_tx[URE_N_TRANSFER] = { - { - .type = UE_BULK, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_OUT, - .bufsize = URE_TRANSFER_SIZE, - .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, - .callback = ure_bulk_write_callback, - .timeout = 10000, /* 10 seconds */ - }, - { - .type = UE_BULK, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_OUT, - .bufsize = URE_TRANSFER_SIZE, - .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, - .callback = ure_bulk_write_callback, - .timeout = 10000, /* 10 seconds */ - }, -#if URE_N_TRANSFER == 4 - { - .type = UE_BULK, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_OUT, - .bufsize = URE_TRANSFER_SIZE, - .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, - .callback = ure_bulk_write_callback, - .timeout = 10000, /* 10 seconds */ - }, - { - .type = UE_BULK, - .endpoint = UE_ADDR_ANY, - .direction = UE_DIR_OUT, - .bufsize = URE_TRANSFER_SIZE, - .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, - .callback = ure_bulk_write_callback, - .timeout = 10000, /* 10 seconds */ - }, -#endif -}; - static device_method_t ure_methods[] = { /* Device interface. */ DEVMETHOD(device_probe, ure_probe), @@ -283,6 +210,20 @@ static const struct usb_ether_methods ure_ue_methods = { .ue_mii_sts = ure_ifmedia_sts, }; +#define URE_SETBIT_1(sc, reg, index, x) \ + ure_write_1(sc, reg, index, ure_read_1(sc, reg, index) | (x)) +#define URE_SETBIT_2(sc, reg, index, x) \ + ure_write_2(sc, reg, index, ure_read_2(sc, reg, index) | (x)) +#define URE_SETBIT_4(sc, reg, index, x) \ + ure_write_4(sc, reg, index, ure_read_4(sc, reg, index) | (x)) + +#define URE_CLRBIT_1(sc, reg, index, x) \ + ure_write_1(sc, reg, index, ure_read_1(sc, reg, index) & ~(x)) +#define URE_CLRBIT_2(sc, reg, index, x) \ + ure_write_2(sc, reg, index, ure_read_2(sc, reg, index) & ~(x)) +#define URE_CLRBIT_4(sc, reg, index, x) \ + ure_write_4(sc, reg, index, ure_read_4(sc, reg, index) & ~(x)) + static int ure_ctl(struct ure_softc *sc, uint8_t rw, uint16_t val, uint16_t index, void *buf, int len) @@ -435,6 +376,13 @@ ure_ocp_reg_write(struct ure_softc *sc, uint16_t addr, uint16_t data) ure_write_2(sc, reg, URE_MCU_TYPE_PLA, data); } +static void +ure_sram_write(struct ure_softc *sc, uint16_t addr, uint16_t data) +{ + ure_ocp_reg_write(sc, URE_OCP_SRAM_ADDR, addr); + ure_ocp_reg_write(sc, URE_OCP_SRAM_DATA, data); +} + static int ure_miibus_readreg(device_t dev, int phy, int reg) { @@ -558,25 +506,58 @@ ure_attach(device_t dev) struct usb_attach_arg *uaa = device_get_ivars(dev); struct ure_softc *sc = device_get_softc(dev); struct usb_ether *ue = &sc->sc_ue; + struct usb_config ure_config_rx[URE_MAX_RX]; + struct usb_config ure_config_tx[URE_MAX_TX]; uint8_t iface_index; int error; + int i; sc->sc_flags = USB_GET_DRIVER_INFO(uaa); device_set_usb_desc(dev); mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); iface_index = URE_IFACE_IDX; + + if (sc->sc_flags & (URE_FLAG_8153 | URE_FLAG_8153B)) + sc->sc_rxbufsz = URE_8153_RX_BUFSZ; + else if (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B)) + sc->sc_rxbufsz = URE_8156_RX_BUFSZ; + else + sc->sc_rxbufsz = URE_8152_RX_BUFSZ; + + for (i = 0; i < URE_MAX_RX; i++) { + ure_config_rx[i] = (struct usb_config) { + .type = UE_BULK, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_IN, + .bufsize = sc->sc_rxbufsz, + .flags = {.pipe_bof = 1,.short_xfer_ok = 1,}, + .callback = ure_bulk_read_callback, + .timeout = 0, /* no timeout */ + }; + } error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_rx_xfer, - ure_config_rx, URE_N_TRANSFER, sc, &sc->sc_mtx); + ure_config_rx, URE_MAX_RX, sc, &sc->sc_mtx); if (error != 0) { device_printf(dev, "allocating USB RX transfers failed\n"); goto detach; } + for (i = 0; i < URE_MAX_TX; i++) { + ure_config_tx[i] = (struct usb_config) { + .type = UE_BULK, + .endpoint = UE_ADDR_ANY, + .direction = UE_DIR_OUT, + .bufsize = URE_TX_BUFSZ, + .flags = {.pipe_bof = 1,.force_short_xfer = 1,}, + .callback = ure_bulk_write_callback, + .timeout = 10000, /* 10 seconds */ + }; + } error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_tx_xfer, - ure_config_tx, URE_N_TRANSFER, sc, &sc->sc_mtx); + ure_config_tx, URE_MAX_TX, sc, &sc->sc_mtx); if (error != 0) { - usbd_transfer_unsetup(sc->sc_rx_xfer, URE_N_TRANSFER); + usbd_transfer_unsetup(sc->sc_rx_xfer, URE_MAX_RX); device_printf(dev, "allocating USB TX transfers failed\n"); goto detach; } @@ -605,8 +586,8 @@ ure_detach(device_t dev) struct ure_softc *sc = device_get_softc(dev); struct usb_ether *ue = &sc->sc_ue; - usbd_transfer_unsetup(sc->sc_tx_xfer, URE_N_TRANSFER); - usbd_transfer_unsetup(sc->sc_rx_xfer, URE_N_TRANSFER); + usbd_transfer_unsetup(sc->sc_tx_xfer, URE_MAX_TX); + usbd_transfer_unsetup(sc->sc_rx_xfer, URE_MAX_RX); uether_ifdetach(ue); mtx_destroy(&sc->sc_mtx); @@ -785,7 +766,7 @@ tr_setup: caps = if_getcapenable(ifp); pos = 0; - rem = URE_TRANSFER_SIZE; + rem = URE_TX_BUFSZ; while (rem > sizeof(txpkt)) { IFQ_DRV_DEQUEUE(&ifp->if_snd, m); if (m == NULL) @@ -895,21 +876,51 @@ ure_read_chipver(struct ure_softc *sc) switch (ver) { case 0x4c00: sc->sc_chip |= URE_CHIP_VER_4C00; + sc->sc_flags = URE_FLAG_8152; break; case 0x4c10: sc->sc_chip |= URE_CHIP_VER_4C10; + sc->sc_flags = URE_FLAG_8152; break; case 0x5c00: sc->sc_chip |= URE_CHIP_VER_5C00; + sc->sc_flags = URE_FLAG_8153; break; case 0x5c10: sc->sc_chip |= URE_CHIP_VER_5C10; + sc->sc_flags = URE_FLAG_8153; break; case 0x5c20: sc->sc_chip |= URE_CHIP_VER_5C20; + sc->sc_flags = URE_FLAG_8153; break; case 0x5c30: sc->sc_chip |= URE_CHIP_VER_5C30; + sc->sc_flags = URE_FLAG_8153; + break; + case 0x6000: + sc->sc_flags = URE_FLAG_8153B; + sc->sc_chip |= URE_CHIP_VER_6000; + break; + case 0x6010: + sc->sc_flags = URE_FLAG_8153B; + sc->sc_chip |= URE_CHIP_VER_6010; + break; + case 0x7020: + sc->sc_flags = URE_FLAG_8156; + sc->sc_chip |= URE_CHIP_VER_7020; + break; + case 0x7030: + sc->sc_flags = URE_FLAG_8156; + sc->sc_chip |= URE_CHIP_VER_7030; + break; + case 0x7400: + sc->sc_flags = URE_FLAG_8156B; + sc->sc_chip |= URE_CHIP_VER_7400; + break; + case 0x7410: + sc->sc_flags = URE_FLAG_8156B; + sc->sc_chip |= URE_CHIP_VER_7410; break; default: device_printf(sc->sc_ue.ue_dev, @@ -949,6 +960,8 @@ ure_attach_post(struct usb_ether *ue) /* Initialize controller and get station address. */ if (sc->sc_flags & URE_FLAG_8152) ure_rtl8152_init(sc); + else if (sc->sc_flags & (URE_FLAG_8153B | URE_FLAG_8156 | URE_FLAG_8156B)) + ure_rtl8153b_init(sc); else ure_rtl8153_init(sc); @@ -972,7 +985,7 @@ static int ure_attach_post_sub(struct usb_ether *ue) { struct sysctl_ctx_list *sctx; - struct sysctl_oid *soid; + struct sysctl_oid *soid; struct ure_softc *sc; struct ifnet *ifp; int error; @@ -1001,9 +1014,19 @@ ure_attach_post_sub(struct usb_ether *ue) if_setcapenable(ifp, if_getcapabilities(ifp)); mtx_lock(&Giant); - error = mii_attach(ue->ue_dev, &ue->ue_miibus, ifp, - uether_ifmedia_upd, ue->ue_methods->ue_mii_sts, - BMSR_DEFCAPMASK, sc->sc_phyno, MII_OFFSET_ANY, 0); + if (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B)) { + ifmedia_init(&sc->sc_ifmedia, IFM_IMASK, ure_ifmedia_upd, + ure_ifmedia_sts); + ure_add_media_types(sc); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_AUTO, 0, NULL); + ifmedia_set(&sc->sc_ifmedia, IFM_ETHER | IFM_AUTO); + sc->sc_ifmedia.ifm_media = IFM_ETHER | IFM_AUTO; + error = 0; + } else { + error = mii_attach(ue->ue_dev, &ue->ue_miibus, ifp, + uether_ifmedia_upd, ue->ue_methods->ue_mii_sts, + BMSR_DEFCAPMASK, sc->sc_phyno, MII_OFFSET_ANY, 0); + } mtx_unlock(&Giant); sctx = device_get_sysctl_ctx(sc->sc_ue.ue_dev); @@ -1022,6 +1045,7 @@ ure_init(struct usb_ether *ue) struct ure_softc *sc = uether_getsc(ue); struct ifnet *ifp = uether_getifp(ue); uint16_t cpcr; + uint32_t reg; URE_LOCK_ASSERT(sc, MA_OWNED); @@ -1031,7 +1055,10 @@ ure_init(struct usb_ether *ue) /* Cancel pending I/O. */ ure_stop(ue); - ure_reset(sc); + if (sc->sc_flags & (URE_FLAG_8153B | URE_FLAG_8156 | URE_FLAG_8156B)) + ure_rtl8153b_nic_reset(sc); + else + ure_reset(sc); /* Set MAC address. */ ure_write_1(sc, URE_PLA_CRWECR, URE_MCU_TYPE_PLA, URE_CRWECR_CONFIG); @@ -1039,13 +1066,50 @@ ure_init(struct usb_ether *ue) IF_LLADDR(ifp), 8); ure_write_1(sc, URE_PLA_CRWECR, URE_MCU_TYPE_PLA, URE_CRWECR_NORAML); + /* Set RX EARLY timeout and size */ + if (sc->sc_flags & URE_FLAG_8153) { + switch (usbd_get_speed(sc->sc_ue.ue_udev)) { + case USB_SPEED_SUPER: + reg = URE_COALESCE_SUPER / 8; + break; + case USB_SPEED_HIGH: + reg = URE_COALESCE_HIGH / 8; + break; + default: + reg = URE_COALESCE_SLOW / 8; + break; + } + ure_write_2(sc, URE_USB_RX_EARLY_AGG, URE_MCU_TYPE_USB, reg); + reg = URE_8153_RX_BUFSZ - (URE_FRAMELEN(if_getmtu(ifp)) + + sizeof(struct ure_rxpkt) + URE_RXPKT_ALIGN); + ure_write_2(sc, URE_USB_RX_EARLY_SIZE, URE_MCU_TYPE_USB, reg / 4); + } else if (sc->sc_flags & URE_FLAG_8153B) { + ure_write_2(sc, URE_USB_RX_EARLY_AGG, URE_MCU_TYPE_USB, 158); + ure_write_2(sc, URE_USB_RX_EXTRA_AGG_TMR, URE_MCU_TYPE_USB, 1875); + reg = URE_8153_RX_BUFSZ - (URE_FRAMELEN(if_getmtu(ifp)) + + sizeof(struct ure_rxpkt) + URE_RXPKT_ALIGN); + ure_write_2(sc, URE_USB_RX_EARLY_SIZE, URE_MCU_TYPE_USB, reg / 8); + ure_write_1(sc, URE_USB_UPT_RXDMA_OWN, URE_MCU_TYPE_USB, + URE_OWN_UPDATE | URE_OWN_CLEAR); + } else if (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B)) { + ure_write_2(sc, URE_USB_RX_EARLY_AGG, URE_MCU_TYPE_USB, 80); + ure_write_2(sc, URE_USB_RX_EXTRA_AGG_TMR, URE_MCU_TYPE_USB, 1875); + reg = URE_8156_RX_BUFSZ - (URE_FRAMELEN(if_getmtu(ifp)) + + sizeof(struct ure_rxpkt) + URE_RXPKT_ALIGN); + ure_write_2(sc, URE_USB_RX_EARLY_SIZE, URE_MCU_TYPE_USB, reg / 8); + ure_write_1(sc, URE_USB_UPT_RXDMA_OWN, URE_MCU_TYPE_USB, + URE_OWN_UPDATE | URE_OWN_CLEAR); + } + + if (sc->sc_flags & URE_FLAG_8156B) { + URE_CLRBIT_2(sc, URE_USB_FW_TASK, URE_MCU_TYPE_USB, URE_FC_PATCH_TASK); + uether_pause(&sc->sc_ue, hz / 500); + URE_SETBIT_2(sc, URE_USB_FW_TASK, URE_MCU_TYPE_USB, URE_FC_PATCH_TASK); + } + /* Reset the packet filter. */ - ure_write_2(sc, URE_PLA_FMC, URE_MCU_TYPE_PLA, - ure_read_2(sc, URE_PLA_FMC, URE_MCU_TYPE_PLA) & - ~URE_FMC_FCR_MCU_EN); - ure_write_2(sc, URE_PLA_FMC, URE_MCU_TYPE_PLA, - ure_read_2(sc, URE_PLA_FMC, URE_MCU_TYPE_PLA) | - URE_FMC_FCR_MCU_EN); + URE_CLRBIT_2(sc, URE_PLA_FMC, URE_MCU_TYPE_PLA, URE_FMC_FCR_MCU_EN); + URE_SETBIT_2(sc, URE_PLA_FMC, URE_MCU_TYPE_PLA, URE_FMC_FCR_MCU_EN); /* Enable RX VLANs if enabled */ cpcr = ure_read_2(sc, URE_PLA_CPCR, URE_MCU_TYPE_PLA); @@ -1059,13 +1123,9 @@ ure_init(struct usb_ether *ue) ure_write_2(sc, URE_PLA_CPCR, URE_MCU_TYPE_PLA, cpcr); /* Enable transmit and receive. */ - ure_write_1(sc, URE_PLA_CR, URE_MCU_TYPE_PLA, - ure_read_1(sc, URE_PLA_CR, URE_MCU_TYPE_PLA) | URE_CR_RE | - URE_CR_TE); + URE_SETBIT_1(sc, URE_PLA_CR, URE_MCU_TYPE_PLA, URE_CR_RE | URE_CR_TE); - ure_write_2(sc, URE_PLA_MISC_1, URE_MCU_TYPE_PLA, - ure_read_2(sc, URE_PLA_MISC_1, URE_MCU_TYPE_PLA) & - ~URE_RXDY_GATED_EN); + URE_CLRBIT_2(sc, URE_PLA_MISC_1, URE_MCU_TYPE_PLA, URE_RXDY_GATED_EN); /* Configure RX filters. */ ure_rxfilter(ue); @@ -1084,26 +1144,31 @@ ure_tick(struct usb_ether *ue) { struct ure_softc *sc = uether_getsc(ue); struct ifnet *ifp = uether_getifp(ue); - struct mii_data *mii = GET_MII(sc); + struct mii_data *mii; URE_LOCK_ASSERT(sc, MA_OWNED); (void)ifp; - for (int i = 0; i < URE_N_TRANSFER; i++) + for (int i = 0; i < URE_MAX_RX; i++) DEVPRINTFN(13, sc->sc_ue.ue_dev, "rx[%d] = %d\n", i, USB_GET_STATE(sc->sc_rx_xfer[i])); - for (int i = 0; i < URE_N_TRANSFER; i++) + for (int i = 0; i < URE_MAX_TX; i++) DEVPRINTFN(13, sc->sc_ue.ue_dev, "tx[%d] = %d\n", i, USB_GET_STATE(sc->sc_tx_xfer[i])); - mii_tick(mii); - if ((sc->sc_flags & URE_FLAG_LINK) == 0 - && mii->mii_media_status & IFM_ACTIVE && - IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { - sc->sc_flags |= URE_FLAG_LINK; - sc->sc_rxstarted = 0; - ure_start(ue); + if (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B)) { + ure_link_state(sc); + } else { + mii = GET_MII(sc); + mii_tick(mii); + if ((sc->sc_flags & URE_FLAG_LINK) == 0 + && mii->mii_media_status & IFM_ACTIVE && + IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { + sc->sc_flags |= URE_FLAG_LINK; + sc->sc_rxstarted = 0; + ure_start(ue); + } } } @@ -1171,11 +1236,11 @@ ure_start(struct usb_ether *ue) if (!sc->sc_rxstarted) { sc->sc_rxstarted = 1; - for (i = 0; i != URE_N_TRANSFER; i++) + for (i = 0; i != URE_MAX_RX; i++) usbd_transfer_start(sc->sc_rx_xfer[i]); } - for (i = 0; i != URE_N_TRANSFER; i++) + for (i = 0; i != URE_MAX_TX; i++) usbd_transfer_start(sc->sc_tx_xfer[i]); } @@ -1203,12 +1268,73 @@ static int ure_ifmedia_upd(struct ifnet *ifp) { struct ure_softc *sc = ifp->if_softc; - struct mii_data *mii = GET_MII(sc); + struct ifmedia *ifm; + struct mii_data *mii; struct mii_softc *miisc; + int gig; + int reg; + int anar; + int locked; int error; - URE_LOCK_ASSERT(sc, MA_OWNED); + if (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B)) { + ifm = &sc->sc_ifmedia; + if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) + return (EINVAL); + + locked = mtx_owned(&sc->sc_mtx); + if (!locked) + URE_LOCK(sc); + reg = ure_ocp_reg_read(sc, 0xa5d4); + reg &= ~URE_ADV_2500TFDX; + + anar = gig = 0; + switch (IFM_SUBTYPE(ifm->ifm_media)) { + case IFM_AUTO: + anar |= ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10; + gig |= GTCR_ADV_1000TFDX | GTCR_ADV_1000THDX; + reg |= URE_ADV_2500TFDX; + break; + case IFM_2500_T: + anar |= ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10; + gig |= GTCR_ADV_1000TFDX | GTCR_ADV_1000THDX; + reg |= URE_ADV_2500TFDX; + ifp->if_baudrate = IF_Mbps(2500); + break; + case IFM_1000_T: + anar |= ANAR_TX_FD | ANAR_TX | ANAR_10_FD | ANAR_10; + gig |= GTCR_ADV_1000TFDX | GTCR_ADV_1000THDX; + ifp->if_baudrate = IF_Gbps(1); + break; + case IFM_100_TX: + anar |= ANAR_TX | ANAR_TX_FD; + ifp->if_baudrate = IF_Mbps(100); + break; + case IFM_10_T: + anar |= ANAR_10 | ANAR_10_FD; + ifp->if_baudrate = IF_Mbps(10); + break; + default: + device_printf(sc->sc_ue.ue_dev, "unsupported media type\n"); + if (!locked) + URE_UNLOCK(sc); + return (EINVAL); + } + + ure_ocp_reg_write(sc, URE_OCP_BASE_MII + MII_ANAR * 2, + anar | ANAR_PAUSE_ASYM | ANAR_FC); + ure_ocp_reg_write(sc, URE_OCP_BASE_MII + MII_100T2CR * 2, gig); + ure_ocp_reg_write(sc, 0xa5d4, reg); + ure_ocp_reg_write(sc, URE_OCP_BASE_MII + MII_BMCR, + BMCR_AUTOEN | BMCR_STARTNEG); + if (!locked) + URE_UNLOCK(sc); + return (0); + } + mii = GET_MII(sc); + + URE_LOCK_ASSERT(sc, MA_OWNED); LIST_FOREACH(miisc, &mii->mii_phys, mii_list) PHY_RESET(miisc); error = mii_mediachg(mii); @@ -1223,8 +1349,34 @@ ure_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { struct ure_softc *sc; struct mii_data *mii; + uint16_t status; sc = ifp->if_softc; + if (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B)) { + URE_LOCK(sc); + ifmr->ifm_status = IFM_AVALID; + if (ure_get_link_status(sc)) { + ifmr->ifm_status |= IFM_ACTIVE; + status = ure_read_2(sc, URE_PLA_PHYSTATUS, + URE_MCU_TYPE_PLA); + if ((status & URE_PHYSTATUS_FDX) || + (status & URE_PHYSTATUS_2500MBPS)) + ifmr->ifm_active |= IFM_FDX; + else + ifmr->ifm_active |= IFM_HDX; + if (status & URE_PHYSTATUS_10MBPS) + ifmr->ifm_active |= IFM_10_T; + else if (status & URE_PHYSTATUS_100MBPS) + ifmr->ifm_active |= IFM_100_TX; + else if (status & URE_PHYSTATUS_1000MBPS) + ifmr->ifm_active |= IFM_1000_T; + else if (status & URE_PHYSTATUS_2500MBPS) + ifmr->ifm_active |= IFM_2500_T; + } + URE_UNLOCK(sc); + return; + } + mii = GET_MII(sc); URE_LOCK(sc); @@ -1234,6 +1386,54 @@ ure_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) URE_UNLOCK(sc); } +static void +ure_add_media_types(struct ure_softc *sc) +{ + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_10_T, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_10_T | IFM_FDX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_100_TX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_100_TX | IFM_FDX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL); + ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_2500_T | IFM_FDX, 0, NULL); +} + +static void +ure_link_state(struct ure_softc *sc) +{ + struct ifnet *ifp = uether_getifp(&sc->sc_ue); + + if (ure_get_link_status(sc)) { + if (ifp->if_link_state != LINK_STATE_UP) { + if_link_state_change(ifp, LINK_STATE_UP); + /* Enable transmit and receive. */ + URE_SETBIT_1(sc, URE_PLA_CR, URE_MCU_TYPE_PLA, URE_CR_RE | URE_CR_TE); + + if (ure_read_2(sc, URE_PLA_PHYSTATUS, URE_MCU_TYPE_PLA) & + URE_PHYSTATUS_2500MBPS) + URE_CLRBIT_2(sc, URE_PLA_MAC_PWR_CTRL4, URE_MCU_TYPE_PLA, 0x40); + else + URE_SETBIT_2(sc, URE_PLA_MAC_PWR_CTRL4, URE_MCU_TYPE_PLA, 0x40); + } + } else { + if (ifp->if_link_state != LINK_STATE_DOWN) { + if_link_state_change(ifp, LINK_STATE_DOWN); + } + } +} + +static int +ure_get_link_status(struct ure_softc *sc) +{ + if (ure_read_2(sc, URE_PLA_PHYSTATUS, URE_MCU_TYPE_PLA) & + URE_PHYSTATUS_LINK) { + sc->sc_flags |= URE_FLAG_LINK; + return (1); + } else { + sc->sc_flags &= ~URE_FLAG_LINK; + return (0); + } +} + static int ure_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { @@ -1298,8 +1498,17 @@ ure_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) URE_UNLOCK(sc); break; + case SIOCGIFMEDIA: + case SIOCSIFMEDIA: + if (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B)) + error = ifmedia_ioctl(ifp, ifr, &sc->sc_ifmedia, cmd); + else + error = uether_ioctl(ifp, cmd, data); + break; + default: error = uether_ioctl(ifp, cmd, data); + break; } return (error); @@ -1310,27 +1519,18 @@ ure_rtl8152_init(struct ure_softc *sc) { uint32_t pwrctrl; - /* Disable ALDPS. */ - ure_ocp_reg_write(sc, URE_OCP_ALDPS_CONFIG, URE_ENPDNPS | URE_LINKENA | - URE_DIS_SDSAVE); - uether_pause(&sc->sc_ue, hz / 50); + ure_enable_aldps(sc, false); if (sc->sc_chip & URE_CHIP_VER_4C00) { - ure_write_2(sc, URE_PLA_LED_FEATURE, URE_MCU_TYPE_PLA, - ure_read_2(sc, URE_PLA_LED_FEATURE, URE_MCU_TYPE_PLA) & - ~URE_LED_MODE_MASK); + URE_CLRBIT_2(sc, URE_PLA_LED_FEATURE, URE_MCU_TYPE_PLA, URE_LED_MODE_MASK); } - ure_write_2(sc, URE_USB_UPS_CTRL, URE_MCU_TYPE_USB, - ure_read_2(sc, URE_USB_UPS_CTRL, URE_MCU_TYPE_USB) & - ~URE_POWER_CUT); - ure_write_2(sc, URE_USB_PM_CTRL_STATUS, URE_MCU_TYPE_USB, - ure_read_2(sc, URE_USB_PM_CTRL_STATUS, URE_MCU_TYPE_USB) & - ~URE_RESUME_INDICATE); + URE_CLRBIT_2(sc, URE_USB_UPS_CTRL, URE_MCU_TYPE_USB, URE_POWER_CUT); + + URE_CLRBIT_2(sc, URE_USB_PM_CTRL_STATUS, URE_MCU_TYPE_USB, URE_RESUME_INDICATE); + + URE_SETBIT_2(sc, URE_PLA_PHY_PWR, URE_MCU_TYPE_PLA, URE_TX_10M_IDLE_EN | URE_PFM_PWM_SWITCH); - ure_write_2(sc, URE_PLA_PHY_PWR, URE_MCU_TYPE_PLA, - ure_read_2(sc, URE_PLA_PHY_PWR, URE_MCU_TYPE_PLA) | - URE_TX_10M_IDLE_EN | URE_PFM_PWM_SWITCH); pwrctrl = ure_read_4(sc, URE_PLA_MAC_PWR_CTRL, URE_MCU_TYPE_PLA); pwrctrl &= ~URE_MCU_CLK_RATIO_MASK; pwrctrl |= URE_MCU_CLK_RATIO | URE_D3_CLK_GATED_EN; @@ -1340,16 +1540,11 @@ ure_rtl8152_init(struct ure_softc *sc) URE_SPDWN_LINKCHG_MSK); /* Enable Rx aggregation. */ - ure_write_2(sc, URE_USB_USB_CTRL, URE_MCU_TYPE_USB, - ure_read_2(sc, URE_USB_USB_CTRL, URE_MCU_TYPE_USB) & - ~URE_RX_AGG_DISABLE); + URE_CLRBIT_2(sc, URE_USB_USB_CTRL, URE_MCU_TYPE_USB, URE_RX_AGG_DISABLE | URE_RX_ZERO_EN); - /* Disable ALDPS. */ - ure_ocp_reg_write(sc, URE_OCP_ALDPS_CONFIG, URE_ENPDNPS | URE_LINKENA | - URE_DIS_SDSAVE); - uether_pause(&sc->sc_ue, hz / 50); + ure_enable_aldps(sc, false); - ure_init_fifo(sc); + ure_rtl8152_nic_reset(sc); ure_write_1(sc, URE_USB_TX_AGG, URE_MCU_TYPE_USB, URE_TX_AGG_MAX_THRESHOLD); @@ -1365,10 +1560,7 @@ ure_rtl8153_init(struct ure_softc *sc) uint8_t u1u2[8]; int i; - /* Disable ALDPS. */ - ure_ocp_reg_write(sc, URE_OCP_POWER_CFG, - ure_ocp_reg_read(sc, URE_OCP_POWER_CFG) & ~URE_EN_ALDPS); - uether_pause(&sc->sc_ue, hz / 50); + ure_enable_aldps(sc, false); memset(u1u2, 0x00, sizeof(u1u2)); ure_write_mem(sc, URE_USB_TOLERANCE, @@ -1395,9 +1587,7 @@ ure_rtl8153_init(struct ure_softc *sc) device_printf(sc->sc_ue.ue_dev, "timeout waiting for phy to stabilize\n"); - ure_write_2(sc, URE_USB_U2P3_CTRL, URE_MCU_TYPE_USB, - ure_read_2(sc, URE_USB_U2P3_CTRL, URE_MCU_TYPE_USB) & - ~URE_U2P3_ENABLE); + URE_CLRBIT_2(sc, URE_USB_U2P3_CTRL, URE_MCU_TYPE_USB, URE_U2P3_ENABLE); if (sc->sc_chip & URE_CHIP_VER_5C10) { val = ure_read_2(sc, URE_USB_SSPHYLINK2, URE_MCU_TYPE_USB); @@ -1405,14 +1595,10 @@ ure_rtl8153_init(struct ure_softc *sc) val |= URE_PWD_DN_SCALE(96); ure_write_2(sc, URE_USB_SSPHYLINK2, URE_MCU_TYPE_USB, val); - ure_write_1(sc, URE_USB_USB2PHY, URE_MCU_TYPE_USB, - ure_read_1(sc, URE_USB_USB2PHY, URE_MCU_TYPE_USB) | - URE_USB2PHY_L1 | URE_USB2PHY_SUSPEND); - } else if (sc->sc_chip & URE_CHIP_VER_5C20) { - ure_write_1(sc, URE_PLA_DMY_REG0, URE_MCU_TYPE_PLA, - ure_read_1(sc, URE_PLA_DMY_REG0, URE_MCU_TYPE_PLA) & - ~URE_ECM_ALDPS); - } + URE_SETBIT_1(sc, URE_USB_USB2PHY, URE_MCU_TYPE_USB, URE_USB2PHY_L1 | URE_USB2PHY_SUSPEND); + } else if (sc->sc_chip & URE_CHIP_VER_5C20) + URE_CLRBIT_1(sc, URE_PLA_DMY_REG0, URE_MCU_TYPE_PLA, URE_ECM_ALDPS); + if (sc->sc_chip & (URE_CHIP_VER_5C20 | URE_CHIP_VER_5C30)) { val = ure_read_1(sc, URE_USB_CSR_DUMMY1, URE_MCU_TYPE_USB); if (ure_read_2(sc, URE_USB_BURST_SIZE, URE_MCU_TYPE_USB) == @@ -1423,17 +1609,11 @@ ure_rtl8153_init(struct ure_softc *sc) ure_write_1(sc, URE_USB_CSR_DUMMY1, URE_MCU_TYPE_USB, val); } - ure_write_1(sc, URE_USB_CSR_DUMMY2, URE_MCU_TYPE_USB, - ure_read_1(sc, URE_USB_CSR_DUMMY2, URE_MCU_TYPE_USB) | - URE_EP4_FULL_FC); + URE_SETBIT_1(sc, URE_USB_CSR_DUMMY2, URE_MCU_TYPE_USB, URE_EP4_FULL_FC); - ure_write_2(sc, URE_USB_WDT11_CTRL, URE_MCU_TYPE_USB, - ure_read_2(sc, URE_USB_WDT11_CTRL, URE_MCU_TYPE_USB) & - ~URE_TIMER11_EN); + URE_CLRBIT_2(sc, URE_USB_WDT11_CTRL, URE_MCU_TYPE_USB, URE_TIMER11_EN); - ure_write_2(sc, URE_PLA_LED_FEATURE, URE_MCU_TYPE_PLA, - ure_read_2(sc, URE_PLA_LED_FEATURE, URE_MCU_TYPE_PLA) & - ~URE_LED_MODE_MASK); + URE_CLRBIT_2(sc, URE_PLA_LED_FEATURE, URE_MCU_TYPE_PLA, URE_LED_MODE_MASK); if ((sc->sc_chip & URE_CHIP_VER_5C10) && usbd_get_speed(sc->sc_ue.ue_udev) != USB_SPEED_SUPER) @@ -1450,12 +1630,9 @@ ure_rtl8153_init(struct ure_softc *sc) ure_write_2(sc, URE_USB_CONNECT_TIMER, URE_MCU_TYPE_USB, 0x0001); - ure_write_2(sc, URE_USB_POWER_CUT, URE_MCU_TYPE_USB, - ure_read_2(sc, URE_USB_POWER_CUT, URE_MCU_TYPE_USB) & - ~(URE_PWR_EN | URE_PHASE2_EN)); - ure_write_2(sc, URE_USB_MISC_0, URE_MCU_TYPE_USB, - ure_read_2(sc, URE_USB_MISC_0, URE_MCU_TYPE_USB) & - ~URE_PCUT_STATUS); + URE_CLRBIT_2(sc, URE_USB_POWER_CUT, URE_MCU_TYPE_USB, URE_PWR_EN | URE_PHASE2_EN); + + URE_CLRBIT_2(sc, URE_USB_MISC_0, URE_MCU_TYPE_USB, URE_PCUT_STATUS); memset(u1u2, 0xff, sizeof(u1u2)); ure_write_mem(sc, URE_USB_TOLERANCE, @@ -1484,17 +1661,41 @@ ure_rtl8153_init(struct ure_softc *sc) ure_write_mem(sc, URE_USB_TOLERANCE, URE_MCU_TYPE_USB | URE_BYTE_EN_SIX_BYTES, u1u2, sizeof(u1u2)); - /* Disable ALDPS. */ + ure_enable_aldps(sc, false); + + if (sc->sc_chip & (URE_CHIP_VER_5C00 | URE_CHIP_VER_5C10 | + URE_CHIP_VER_5C20)) { + ure_ocp_reg_write(sc, URE_OCP_ADC_CFG, + URE_CKADSEL_L | URE_ADC_EN | URE_EN_EMI_L); + } + if (sc->sc_chip & URE_CHIP_VER_5C00) { + ure_ocp_reg_write(sc, URE_OCP_EEE_CFG, + ure_ocp_reg_read(sc, URE_OCP_EEE_CFG) & + ~URE_CTAP_SHORT_EN); + } ure_ocp_reg_write(sc, URE_OCP_POWER_CFG, - ure_ocp_reg_read(sc, URE_OCP_POWER_CFG) & ~URE_EN_ALDPS); - uether_pause(&sc->sc_ue, hz / 50); + ure_ocp_reg_read(sc, URE_OCP_POWER_CFG) | + URE_EEE_CLKDIV_EN); + ure_ocp_reg_write(sc, URE_OCP_DOWN_SPEED, + ure_ocp_reg_read(sc, URE_OCP_DOWN_SPEED) | + URE_EN_10M_BGOFF); + ure_ocp_reg_write(sc, URE_OCP_POWER_CFG, + ure_ocp_reg_read(sc, URE_OCP_POWER_CFG) | + URE_EN_10M_PLLOFF); + ure_sram_write(sc, URE_SRAM_IMPEDANCE, 0x0b13); + URE_SETBIT_2(sc, URE_PLA_PHY_PWR, URE_MCU_TYPE_PLA, URE_PFM_PWM_SWITCH); + + /* Enable LPF corner auto tune. */ + ure_sram_write(sc, URE_SRAM_LPF_CFG, 0xf70f); - ure_init_fifo(sc); + /* Adjust 10M amplitude. */ + ure_sram_write(sc, URE_SRAM_10M_AMP1, 0x00af); + ure_sram_write(sc, URE_SRAM_10M_AMP2, 0x0208); + + ure_rtl8152_nic_reset(sc); /* Enable Rx aggregation. */ - ure_write_2(sc, URE_USB_USB_CTRL, URE_MCU_TYPE_USB, - ure_read_2(sc, URE_USB_USB_CTRL, URE_MCU_TYPE_USB) & - ~URE_RX_AGG_DISABLE); + URE_CLRBIT_2(sc, URE_USB_USB_CTRL, URE_MCU_TYPE_USB, URE_RX_AGG_DISABLE | URE_RX_ZERO_EN); val = ure_read_2(sc, URE_USB_U2P3_CTRL, URE_MCU_TYPE_USB); if (!(sc->sc_chip & (URE_CHIP_VER_5C00 | URE_CHIP_VER_5C10))) @@ -1508,6 +1709,266 @@ ure_rtl8153_init(struct ure_softc *sc) URE_MCU_TYPE_USB | URE_BYTE_EN_SIX_BYTES, u1u2, sizeof(u1u2)); } +static void +ure_rtl8153b_init(struct ure_softc *sc) +{ + uint16_t val; + int i; + + if (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B)) { + URE_CLRBIT_1(sc, 0xd26b, URE_MCU_TYPE_USB, 0x01); + ure_write_2(sc, 0xd32a, URE_MCU_TYPE_USB, 0); + URE_SETBIT_2(sc, 0xcfee, URE_MCU_TYPE_USB, 0x0020); + } + + if (sc->sc_flags & URE_FLAG_8156B) { + URE_SETBIT_2(sc, 0xb460, URE_MCU_TYPE_USB, 0x08); + } + + ure_enable_aldps(sc, false); + + /* Disable U1U2 */ + URE_CLRBIT_2(sc, URE_USB_LPM_CONFIG, URE_MCU_TYPE_USB, URE_LPM_U1U2_EN); + + /* Wait loading flash */ + if (sc->sc_chip == URE_CHIP_VER_7410) { + if ((ure_read_2(sc, 0xd3ae, URE_MCU_TYPE_PLA) & 0x0002) && + !(ure_read_2(sc, 0xd284, URE_MCU_TYPE_USB) & 0x0020)) { + for (i=0; i < 100; i++) { + if (ure_read_2(sc, 0xd284, URE_MCU_TYPE_USB) & 0x0004) + break; + uether_pause(&sc->sc_ue, hz / 1000); + } + } + } + + for (i = 0; i < URE_TIMEOUT; i++) { + if (ure_read_2(sc, URE_PLA_BOOT_CTRL, URE_MCU_TYPE_PLA) & + URE_AUTOLOAD_DONE) + break; + uether_pause(&sc->sc_ue, hz / 100); + } + if (i == URE_TIMEOUT) + device_printf(sc->sc_ue.ue_dev, + "timeout waiting for chip autoload\n"); + + val = ure_phy_status(sc, 0); + if ((val == URE_PHY_STAT_EXT_INIT) & + (sc->sc_flags & (URE_FLAG_8156 | URE_FLAG_8156B))) { + ure_ocp_reg_write(sc, 0xa468, + ure_ocp_reg_read(sc, 0xa468) & ~0x0a); + if (sc->sc_flags & URE_FLAG_8156B) + ure_ocp_reg_write(sc, 0xa466, + ure_ocp_reg_read(sc, 0xa466) & ~0x01); + } + + val = ure_ocp_reg_read(sc, URE_OCP_BASE_MII + MII_BMCR); + if (val & BMCR_PDOWN) { + val &= ~BMCR_PDOWN; + ure_ocp_reg_write(sc, URE_OCP_BASE_MII + MII_BMCR, val); + } + + ure_phy_status(sc, URE_PHY_STAT_LAN_ON); + + /* Disable U2P3 */ + URE_CLRBIT_2(sc, URE_USB_U2P3_CTRL, URE_MCU_TYPE_USB, URE_U2P3_ENABLE); + + /* MSC timer, 32760 ms. */ + ure_write_2(sc, URE_USB_MSC_TIMER, URE_MCU_TYPE_USB, 0x0fff); + + /* U1/U2/L1 idle timer, 500 us. */ + ure_write_2(sc, URE_USB_U1U2_TIMER, URE_MCU_TYPE_USB, 500); + + /* Disable power cut */ + URE_CLRBIT_2(sc, URE_USB_POWER_CUT, URE_MCU_TYPE_USB, URE_PWR_EN); + URE_CLRBIT_2(sc, URE_USB_MISC_0, URE_MCU_TYPE_USB, URE_PCUT_STATUS); + + /* Disable ups */ + URE_CLRBIT_1(sc, URE_USB_POWER_CUT, URE_MCU_TYPE_USB, URE_UPS_EN | URE_USP_PREWAKE); + URE_CLRBIT_1(sc, 0xcfff, URE_MCU_TYPE_USB, 0x01); + + /* Disable queue wake */ + URE_CLRBIT_1(sc, URE_PLA_INDICATE_FALG, URE_MCU_TYPE_USB, URE_UPCOMING_RUNTIME_D3); + URE_CLRBIT_1(sc, URE_PLA_SUSPEND_FLAG, URE_MCU_TYPE_USB, URE_LINK_CHG_EVENT); + URE_CLRBIT_2(sc, URE_PLA_EXTRA_STATUS, URE_MCU_TYPE_USB, URE_LINK_CHANGE_FLAG); + + /* Disable runtime suspend */ + ure_write_1(sc, URE_PLA_CRWECR, URE_MCU_TYPE_PLA, URE_CRWECR_CONFIG); + URE_CLRBIT_2(sc, URE_PLA_CONFIG34, URE_MCU_TYPE_USB, URE_LINK_OFF_WAKE_EN); + ure_write_1(sc, URE_PLA_CRWECR, URE_MCU_TYPE_PLA, URE_CRWECR_NORAML); + + /* Enable U1U2 */ + if (usbd_get_speed(sc->sc_ue.ue_udev) == USB_SPEED_SUPER) + URE_SETBIT_2(sc, URE_USB_LPM_CONFIG, URE_MCU_TYPE_USB, URE_LPM_U1U2_EN); + + if (sc->sc_flags & URE_FLAG_8156B) { + URE_CLRBIT_2(sc, 0xc010, URE_MCU_TYPE_PLA, 0x0800); + URE_SETBIT_2(sc, 0xe854, URE_MCU_TYPE_PLA, 0x0001); + *** 739 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Fri Jun 4 08:56:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3430D64A8E0; Fri, 4 Jun 2021 08:56:56 +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 4FxGpw0c37z4cNg; Fri, 4 Jun 2021 08:56:56 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E98501A0E0; Fri, 4 Jun 2021 08:56:55 +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 1548ut7i073162; Fri, 4 Jun 2021 08:56:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1548ut4M073161; Fri, 4 Jun 2021 08:56:55 GMT (envelope-from git) Date: Fri, 4 Jun 2021 08:56:55 GMT Message-Id: <202106040856.1548ut4M073161@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 9b236631b1ec - main - gitignore: Add .clangd and .ccls-cache MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9b236631b1ec50e90bef1995aff68fed65b21be5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 08:56:56 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=9b236631b1ec50e90bef1995aff68fed65b21be5 commit 9b236631b1ec50e90bef1995aff68fed65b21be5 Author: Ka Ho Ng AuthorDate: 2021-06-04 08:56:08 +0000 Commit: Ka Ho Ng CommitDate: 2021-06-04 08:56:08 +0000 gitignore: Add .clangd and .ccls-cache Add residues of clangd and ccls to prevent them from being accidentally included in a commit. clangd and ccls are two C/C++ Language Server implementations listed in https://microsoft.github.io/language-server-protocol/implementors/servers/ . Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: philip Differential Revision: https://reviews.freebsd.org/D26555 --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 2e735237b30f..a0ba64706603 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,5 @@ cscope.in.out cscope.out cscope.po.out compile_commands.json +.clangd +.ccls-cache From owner-dev-commits-src-main@freebsd.org Fri Jun 4 09:22:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2EB464B490; Fri, 4 Jun 2021 09:22:03 +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 4FxHMv4jGZz4dvc; Fri, 4 Jun 2021 09:22:03 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8ACD91A9EE; Fri, 4 Jun 2021 09:22:03 +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 1549M3nS012692; Fri, 4 Jun 2021 09:22:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1549M3WU012691; Fri, 4 Jun 2021 09:22:03 GMT (envelope-from git) Date: Fri, 4 Jun 2021 09:22:03 GMT Message-Id: <202106040922.1549M3WU012691@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 0345fd891fe1 - main - netgraph/ng_base: Renaming a node to the same name is a noop MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0345fd891fe13a191fc0fae9463ea9458bfaff5a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 09:22:03 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=0345fd891fe13a191fc0fae9463ea9458bfaff5a commit 0345fd891fe13a191fc0fae9463ea9458bfaff5a Author: Lutz Donnerhacke AuthorDate: 2021-05-04 19:20:39 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-06-04 09:20:19 +0000 netgraph/ng_base: Renaming a node to the same name is a noop Detailed analysis in https://github.com/genneko/freebsd-vimage-jails/issues/2 brought the problem down to a double call of ng_node_name() before and after a vnet move. Because the name of the node is already known (occupied by itself), the second call fails. PR: 241954 Reported by: Paul Armstrong MFC: 1 week Differential Revision: https://reviews.freebsd.org/D30110 --- sys/netgraph/ng_base.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index 63bc251f52f9..ae179cf13a45 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -855,6 +855,10 @@ ng_name_node(node_p node, const char *name) node_p node2; int i; + /* Rename without change is a noop */ + if (strcmp(NG_NODE_NAME(node), name) == 0) + return (0); + /* Check the name is valid */ for (i = 0; i < NG_NODESIZ; i++) { if (name[i] == '\0' || name[i] == '.' || name[i] == ':') From owner-dev-commits-src-main@freebsd.org Fri Jun 4 09:29:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01C5564B423; Fri, 4 Jun 2021 09:29:09 +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 4FxHX46Z1Xz4hSP; Fri, 4 Jun 2021 09:29:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C93251A872; Fri, 4 Jun 2021 09:29:08 +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 1549T81S013291; Fri, 4 Jun 2021 09:29:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1549T8ad013290; Fri, 4 Jun 2021 09:29:08 GMT (envelope-from git) Date: Fri, 4 Jun 2021 09:29:08 GMT Message-Id: <202106040929.1549T8ad013290@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Randall Stewart Subject: git: 4747500deaaa - main - tcp: A better fix for the previously attempted fix of the ack-war issue with tcp. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rrs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4747500deaaa7765ba1c0413197c23ddba4faf49 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 09:29:09 -0000 The branch main has been updated by rrs: URL: https://cgit.FreeBSD.org/src/commit/?id=4747500deaaa7765ba1c0413197c23ddba4faf49 commit 4747500deaaa7765ba1c0413197c23ddba4faf49 Author: Randall Stewart AuthorDate: 2021-06-04 09:26:43 +0000 Commit: Randall Stewart CommitDate: 2021-06-04 09:26:43 +0000 tcp: A better fix for the previously attempted fix of the ack-war issue with tcp. So it turns out that my fix before was not correct. It ended with us failing some of the "improved" SYN tests, since we are not in the correct states. With more digging I have figured out the root of the problem is that when we receive a SYN|FIN the reassembly code made it so we create a segq entry to hold the FIN. In the established state where we were not in order this would be correct i.e. a 0 len with a FIN would need to be accepted. But if you are in a front state we need to strip the FIN so we correctly handle the ACK but ignore the FIN. This gets us into the proper states and avoids the previous ack war. I back out some of the previous changes but then add a new change here in tcp_reass() that fixes the root cause of the issue. We still leave the rack panic fixes in place however. Reviewed by: mtuexen Sponsored by: Netflix Inc Differential Revision: https://reviews.freebsd.org/D30627 --- sys/netinet/tcp_input.c | 12 +++--------- sys/netinet/tcp_reass.c | 14 ++++++++++++++ sys/netinet/tcp_stacks/bbr.c | 12 +++--------- sys/netinet/tcp_stacks/rack.c | 13 ++++--------- sys/netinet/tcp_usrreq.c | 16 ---------------- 5 files changed, 24 insertions(+), 43 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 1dab2e511d95..e71a11bdef05 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -3191,15 +3191,9 @@ dodata: /* XXX */ * when trimming from the head. */ tcp_seq temp = save_start; - if (tlen || (th->th_seq != tp->rcv_nxt)) { - /* - * We add the th_seq != rcv_nxt to - * catch the case of a stand alone out - * of order FIN. - */ - thflags = tcp_reass(tp, th, &temp, &tlen, m); - tp->t_flags |= TF_ACKNOW; - } + + thflags = tcp_reass(tp, th, &temp, &tlen, m); + tp->t_flags |= TF_ACKNOW; } if ((tp->t_flags & TF_SACK_PERMIT) && (save_tlen > 0) && diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index 8e24e7412473..5b9255da3acf 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -571,6 +571,7 @@ tcp_reass(struct tcpcb *tp, struct tcphdr *th, tcp_seq *seq_start, * the rcv_nxt <-> rcv_wnd but thats * already done for us by the caller. */ +strip_fin: #ifdef TCP_REASS_COUNTERS counter_u64_add(tcp_zero_input, 1); #endif @@ -579,6 +580,19 @@ tcp_reass(struct tcpcb *tp, struct tcphdr *th, tcp_seq *seq_start, tcp_reass_log_dump(tp); #endif return (0); + } else if ((*tlenp == 0) && + (th->th_flags & TH_FIN) && + !TCPS_HAVEESTABLISHED(tp->t_state)) { + /* + * We have not established, and we + * have a FIN and no data. Lets treat + * this as the same as if the FIN were + * not present. We don't want to save + * the FIN bit in a reassembly buffer + * we want to get established first before + * we do that (the peer will retransmit). + */ + goto strip_fin; } /* * Will it fit? diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c index 5b97c3d7800f..f6388c39cad3 100644 --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -8320,15 +8320,9 @@ bbr_process_data(struct mbuf *m, struct tcphdr *th, struct socket *so, * trimming from the head. */ tcp_seq temp = save_start; - if (tlen || (th->th_seq != tp->rcv_nxt)) { - /* - * We add the th_seq != rcv_nxt to - * catch the case of a stand alone out - * of order FIN. - */ - thflags = tcp_reass(tp, th, &temp, &tlen, m); - tp->t_flags |= TF_ACKNOW; - } + + thflags = tcp_reass(tp, th, &temp, &tlen, m); + tp->t_flags |= TF_ACKNOW; } if ((tp->t_flags & TF_SACK_PERMIT) && (save_tlen > 0) && diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 1db09e30d968..98b8ff836ca5 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -10235,15 +10235,10 @@ rack_process_data(struct mbuf *m, struct tcphdr *th, struct socket *so, * trimming from the head. */ tcp_seq temp = save_start; - if (tlen || (th->th_seq != tp->rcv_nxt)) { - /* - * We add the th_seq != rcv_nxt to - * catch the case of a stand alone out - * of order FIN. - */ - thflags = tcp_reass(tp, th, &temp, &tlen, m); - tp->t_flags |= TF_ACKNOW; - } + + thflags = tcp_reass(tp, th, &temp, &tlen, m); + tp->t_flags |= TF_ACKNOW; + } if ((tp->t_flags & TF_SACK_PERMIT) && (save_tlen > 0) && diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 7f1b698408e5..b1fc584f93b2 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -2647,22 +2647,6 @@ tcp_usrclosed(struct tcpcb *tp) tcp_state_change(tp, TCPS_LAST_ACK); break; } - if ((tp->t_state == TCPS_LAST_ACK) && - (tp->t_flags & TF_SENTFIN)) { - /* - * If we have reached LAST_ACK, and - * we sent a FIN (e.g. via MSG_EOR), then - * we really should move to either FIN_WAIT_1 - * or FIN_WAIT_2 depending on snd_max/snd_una. - */ - if (tp->snd_una == tp->snd_max) { - /* The FIN is acked */ - tcp_state_change(tp, TCPS_FIN_WAIT_2); - } else { - /* The FIN is still outstanding */ - tcp_state_change(tp, TCPS_FIN_WAIT_1); - } - } if (tp->t_state >= TCPS_FIN_WAIT_2) { soisdisconnected(tp->t_inpcb->inp_socket); /* Prevent the connection hanging in FIN_WAIT_2 forever. */ From owner-dev-commits-src-main@freebsd.org Fri Jun 4 10:56:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 58F3C64C6FB; Fri, 4 Jun 2021 10:56: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 4FxKSv24Gsz3CKC; Fri, 4 Jun 2021 10:56:31 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 302B61BF38; Fri, 4 Jun 2021 10:56:31 +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 154AuVjK033430; Fri, 4 Jun 2021 10:56:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 154AuVLb033427; Fri, 4 Jun 2021 10:56:31 GMT (envelope-from git) Date: Fri, 4 Jun 2021 10:56:31 GMT Message-Id: <202106041056.154AuVLb033427@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: c8250c5ada85 - main - ipfw.8: synopsis misses nat show form MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c8250c5ada85fec8936e8eb8695d7cb80a3ce8ab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 10:56:31 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=c8250c5ada85fec8936e8eb8695d7cb80a3ce8ab commit c8250c5ada85fec8936e8eb8695d7cb80a3ce8ab Author: Lutz Donnerhacke AuthorDate: 2021-05-10 16:30:42 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-06-04 10:55:59 +0000 ipfw.8: synopsis misses nat show form Document the existing behavior, which is currently only available by reading third party documentation or the source code itself. PR: 254617 Submitted by: Oliver Kiddle MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30189 --- sbin/ipfw/ipfw.8 | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8 index 2380c6c344ec..6f11a24075b8 100644 --- a/sbin/ipfw/ipfw.8 +++ b/sbin/ipfw/ipfw.8 @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 11, 2021 +.Dd June 4, 2021 .Dt IPFW 8 .Os .Sh NAME @@ -105,6 +105,11 @@ in-kernel NAT. .Ar number .Cm config .Ar config-options +.Nm +.Cm nat +.Ar number +.Cm show +.Brq Cm config | log .Ss STATEFUL IPv6/IPv4 NETWORK ADDRESS AND PROTOCOL TRANSLATION .Nm .Oo Cm set Ar N Oc Cm nat64lsn Ar name Cm create Ar create-options @@ -922,7 +927,7 @@ This makes the .Xr netstat 1 entry look rather weird but is intended for use with transparent proxy servers. -.It Cm nat Ar nat_nr | tablearg +.It Cm nat Ar nat_nr | global | tablearg Pass packet to a nat instance (for network address translation, address redirect, etc.): @@ -3276,8 +3281,9 @@ Set the aliasing ports between the ranges given. Upper port has to be greater than lower. .El .Pp -Some specials value can be supplied instead of -.Va nat_number : +Some special values can be supplied instead of +.Va nat_number +in nat rule actions: .Bl -tag -width indent .It Cm global Looks up translation state in all configured nat instances. @@ -3303,7 +3309,7 @@ For more information about aliasing modes, refer to .Xr libalias 3 . See Section .Sx EXAMPLES -for some examples about nat usage. +for some examples of nat usage. .Ss REDIRECT AND LSNAT SUPPORT IN IPFW Redirect and LSNAT support follow closely the syntax used in .Xr natd 8 . From owner-dev-commits-src-main@freebsd.org Fri Jun 4 13:20:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6E3764E5B9; Fri, 4 Jun 2021 13:20:38 +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 4FxNgB4MlFz3QX1; Fri, 4 Jun 2021 13:20:38 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7E1B71D4FE; Fri, 4 Jun 2021 13:20:38 +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 154DKcsS028675; Fri, 4 Jun 2021 13:20:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 154DKcxT028674; Fri, 4 Jun 2021 13:20:38 GMT (envelope-from git) Date: Fri, 4 Jun 2021 13:20:38 GMT Message-Id: <202106041320.154DKcxT028674@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lutz Donnerhacke Subject: git: 24ea1dbf257a - main - tests/netgraph: Inital framework for testing libnetgraph MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: donner X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 24ea1dbf257aa6757f469bcd859f90e9ad851e59 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 13:20:38 -0000 The branch main has been updated by donner: URL: https://cgit.FreeBSD.org/src/commit/?id=24ea1dbf257aa6757f469bcd859f90e9ad851e59 commit 24ea1dbf257aa6757f469bcd859f90e9ad851e59 Author: Lutz Donnerhacke AuthorDate: 2021-06-02 22:29:46 +0000 Commit: Lutz Donnerhacke CommitDate: 2021-06-04 13:17:54 +0000 tests/netgraph: Inital framework for testing libnetgraph Provide a framework of functions to test various netgraph modules. Tests contain: - creating, renaming, and destroying nodes - connecting and removing hooks - sending and receiving data - sending ASCII messages - errors can be passed for indiviual inspection or fail the test Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30629 --- tests/sys/netgraph/Makefile | 6 +- tests/sys/netgraph/basic.c | 191 ++++++++++++++++++++++++++++++++++++ tests/sys/netgraph/util.c | 233 ++++++++++++++++++++++++++++++++++++++++++++ tests/sys/netgraph/util.h | 57 +++++++++++ 4 files changed, 486 insertions(+), 1 deletion(-) diff --git a/tests/sys/netgraph/Makefile b/tests/sys/netgraph/Makefile index aef190bbe178..9f220a620bbe 100644 --- a/tests/sys/netgraph/Makefile +++ b/tests/sys/netgraph/Makefile @@ -10,6 +10,10 @@ TAP_TESTS_SH+= ng_macfilter_test TEST_METADATA.ng_macfilter_test+= required_user="root" TEST_METADATA.ng_macfilter_test+= required_programs="perl" -MAN= +ATF_TESTS_C+= basic \ + +SRCS.basic= basic.c util.c + +LIBADD+= netgraph .include diff --git a/tests/sys/netgraph/basic.c b/tests/sys/netgraph/basic.c new file mode 100644 index 000000000000..6f2e085e4a83 --- /dev/null +++ b/tests/sys/netgraph/basic.c @@ -0,0 +1,191 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright 2021 Lutz Donnerhacke + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#include +#include +#include + +#include "util.h" + +static void get_data(void *data, size_t len, void *ctx); + +ATF_TC(send_recv); +ATF_TC_HEAD(send_recv, conf) +{ + atf_tc_set_md_var(conf, "require.user", "root"); +} +ATF_TC_BODY(send_recv, dummy) +{ + char msg[] = "test"; + int received; + + ng_init(); + ng_connect(".", "a", ".", "b"); + ng_register_data("b", get_data); + ng_send_data("a", msg, sizeof(msg)); + + received = 0; + ng_handle_events(50, &received); + ATF_CHECK(received == 1); +} + +ATF_TC(node); +ATF_TC_HEAD(node, conf) +{ + atf_tc_set_md_var(conf, "require.user", "root"); +} +ATF_TC_BODY(node, dummy) +{ + char msg[] = "test"; + int received; + + ng_init(); + ng_mkpeer(".", "a", "hub", "a"); + ng_name("a", "test hub"); + + + ng_connect(".", "b", "test hub:", "b"); + ng_connect(".", "c", "test hub:", "c"); + ng_register_data("a", get_data); + ng_register_data("b", get_data); + ng_register_data("c", get_data); + + received = 0; + ng_send_data("a", msg, sizeof(msg)); + ng_handle_events(50, &received); + ATF_CHECK(received == 2); + + ng_rmhook(".", "b"); + received = 0; + ng_send_data("a", msg, sizeof(msg)); + ng_handle_events(50, &received); + ATF_CHECK(received == 1); + + ng_shutdown("test hub:"); +} + +ATF_TC(message); +ATF_TC_HEAD(message, conf) +{ + atf_tc_set_md_var(conf, "require.user", "root"); +} +ATF_TC_BODY(message, dummy) +{ + ng_init(); + ng_mkpeer(".", "a", "hub", "a"); + ng_name("a", "test hub"); + + ng_send_msg("test hub:", "setpersistent"); + ng_rmhook(".", "a"); + + ng_shutdown("test hub:"); +} + +ATF_TC(same_name); +ATF_TC_HEAD(same_name, conf) +{ + atf_tc_set_md_var(conf, "require.user", "root"); +} +ATF_TC_BODY(same_name, dummy) +{ + ng_init(); + ng_mkpeer(".", "a", "hub", "a"); + ng_name("a", "test"); + + ng_errors(PASS); + ng_connect(".", "a", ".", "b"); + ATF_CHECK_ERRNO(EEXIST, 1); + ng_connect(".", "b", ".", "b"); + ATF_CHECK_ERRNO(EEXIST, 1); + ng_name(".", "test"); + ATF_CHECK_ERRNO(EADDRINUSE, 1); + + ng_errors(FAIL); + ng_shutdown("test:"); +} + +ATF_TC(queuelimit); +ATF_TC_HEAD(queuelimit, conf) +{ + atf_tc_set_md_var(conf, "require.user", "root"); +} +ATF_TC_BODY(queuelimit, dummy) +{ + int received, i; + char msg[] = "test"; + const int MAX = 1000; + + ng_init(); + ng_connect(".", "a", ".", "b"); + ng_register_data("b", get_data); + + ng_errors(PASS); + for (i = 0; i < MAX; i++) { + ng_send_data("a", msg, sizeof(msg)); + if (errno != 0) + break; + /* no ng_handle_events -> messages stall */ + } + ng_errors(FAIL); + printf("queued %d\n", i); + sleep(3); + + received = 0; + ng_handle_events(50, &received); + ATF_CHECK(received > 100); + ATF_CHECK(received == i); + atf_tc_expect_fail("Queue full (%d)", i); + ATF_CHECK(received == MAX); + atf_tc_expect_pass(); +} + +ATF_TP_ADD_TCS(basic) +{ + ATF_TP_ADD_TC(basic, send_recv); + ATF_TP_ADD_TC(basic, node); + ATF_TP_ADD_TC(basic, message); + ATF_TP_ADD_TC(basic, same_name); + ATF_TP_ADD_TC(basic, queuelimit); + + return atf_no_error(); +} + +static void +get_data(void *data, size_t len, void *ctx) +{ + int *cnt = ctx; + + (void)data; + printf("Got %zu bytes of data.\n", len); + (*cnt)++; +} diff --git a/tests/sys/netgraph/util.c b/tests/sys/netgraph/util.c new file mode 100644 index 000000000000..37d005393e91 --- /dev/null +++ b/tests/sys/netgraph/util.c @@ -0,0 +1,233 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright 2021 Lutz Donnerhacke + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#include +#include +#include +#include +#include + +#include +#include + +#include "util.h" + + +static int cs = -1, ds = -1; +static ng_error_t error_handling = FAIL; + +#define CHECK(r, x) do { \ + if (error_handling == FAIL) \ + ATF_REQUIRE(x); \ + else if(!(x)) \ + return r; \ +} while(0) + +struct data_handler { + char const *hook; + ng_data_handler_t handler; + SLIST_ENTRY(data_handler) next; +}; +static SLIST_HEAD(, data_handler) data_head = SLIST_HEAD_INITIALIZER(data_head); + +static void handle_data(void *ctx); +static void handle_msg(void); + +void +ng_connect(char const *path1, char const *hook1, + char const *path2, char const *hook2) +{ + struct ngm_connect c; + + strncpy(c.ourhook, hook1, sizeof(c.ourhook)); + strncpy(c.peerhook, hook2, sizeof(c.peerhook)); + strncpy(c.path, path2, sizeof(c.path)); + + CHECK(, -1 != NgSendMsg(cs, path1, + NGM_GENERIC_COOKIE, NGM_CONNECT, + &c, sizeof(c))); +} + +void +ng_mkpeer(char const *path1, char const *hook1, + char const *type, char const *hook2) +{ + struct ngm_mkpeer p; + + strncpy(p.ourhook, hook1, sizeof(p.ourhook)); + strncpy(p.peerhook, hook2, sizeof(p.peerhook)); + strncpy(p.type, type, sizeof(p.type)); + + CHECK(, -1 != NgSendMsg(cs, path1, + NGM_GENERIC_COOKIE, NGM_MKPEER, + &p, sizeof(p))); +} + +void +ng_rmhook(char const *path, char const *hook) +{ + struct ngm_rmhook h; + + strncpy(h.ourhook, hook, sizeof(h.ourhook)); + + CHECK(, -1 != NgSendMsg(cs, path, + NGM_GENERIC_COOKIE, NGM_RMHOOK, + &h, sizeof(h))); +} + +void +ng_name(char const *path, char const *name) +{ + struct ngm_name n; + + strncpy(n.name, name, sizeof(n.name)); + + CHECK(, -1 != NgSendMsg(cs, path, + NGM_GENERIC_COOKIE, NGM_NAME, + &n, sizeof(n))); +} + +void +ng_shutdown(char const *path) +{ + CHECK(, -1 != NgSendMsg(cs, path, + NGM_GENERIC_COOKIE, NGM_SHUTDOWN, + NULL, 0)); +} + +void +ng_register_data(char const *hook, ng_data_handler_t proc) +{ + struct data_handler *p; + + ATF_REQUIRE(NULL != (p = calloc(1, sizeof(struct data_handler)))); + ATF_REQUIRE(NULL != (p->hook = strdup(hook))); + ATF_REQUIRE(NULL != (p->handler = proc)); + SLIST_INSERT_HEAD(&data_head, p, next); +} + +void +ng_send_data(char const *hook, + void const *data, size_t len) +{ + CHECK(, -1 != NgSendData(ds, hook, data, len)); +} + +static void +handle_msg(void) { + struct ng_mesg *m; + char path[NG_PATHSIZ]; + + ATF_REQUIRE(-1 != NgAllocRecvMsg(cs, &m, path)); + + printf("Got message from %s\n", path); + free(m); +} + +static void +handle_data(void *ctx) { + char hook[NG_HOOKSIZ]; + struct data_handler *hnd; + u_char *data; + int len; + + ATF_REQUIRE(0 < (len = NgAllocRecvData(ds, &data, hook))); + SLIST_FOREACH(hnd, &data_head, next) + if (0 == strcmp(hnd->hook, hook)) + break; + + if (hnd != NULL) + (*(hnd->handler))(data, len, ctx); + + free(data); +} + +int +ng_handle_event(unsigned int ms, void *context) +{ + fd_set fds; + int maxfd = (ds < cs) ? cs : ds; + struct timeval timeout = { 0, ms * 1000lu }; + + FD_ZERO(&fds); + FD_SET(cs, &fds); + FD_SET(ds, &fds); +retry: + switch (select(maxfd+1, &fds, NULL, NULL, &timeout)) { + case -1: + ATF_REQUIRE_ERRNO(EINTR, 1); + goto retry; + case 0: /* timeout */ + return 0; + default: /* something to do */ + if (FD_ISSET(cs, &fds)) + handle_msg(); + if (FD_ISSET(ds, &fds)) + handle_data(context); + return 1; + } +} + +void +ng_handle_events(unsigned int ms, void *context) +{ + while(ng_handle_event(ms, context)) + ; +} + +int +ng_send_msg(char const *path, char const *msg) +{ + int res; + + CHECK(-1, -1 != (res = NgSendAsciiMsg(cs, path, "%s", msg))); + return (res); +} + +ng_error_t +ng_errors(ng_error_t n) +{ + ng_error_t o = error_handling; + + error_handling = n; + return (o); +} + +void +ng_init(void) { + if (cs >= 0) /* prevent reinit */ + return; + + ATF_REQUIRE(0 == NgMkSockNode(NULL, &cs, &ds)); + NgSetDebug(3); +} diff --git a/tests/sys/netgraph/util.h b/tests/sys/netgraph/util.h new file mode 100644 index 000000000000..73afa5a24805 --- /dev/null +++ b/tests/sys/netgraph/util.h @@ -0,0 +1,57 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright 2021 Lutz Donnerhacke + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +void ng_connect (char const *path1, char const *hook1, + char const *path2, char const *hook2); +void ng_mkpeer (char const *path1, char const *hook1, + char const *type, char const *hook2); +void ng_shutdown(char const *path); +void ng_rmhook (char const *path, char const *hook); +void ng_name (char const *path, char const *name); + +typedef void (*ng_data_handler_t)(void *, size_t, void *ctx); +void ng_register_data(char const *hook, ng_data_handler_t proc); +void ng_send_data(char const *hook, void const *, size_t); + +int ng_send_msg(char const *path, char const *msg); + +int ng_handle_event (unsigned int ms, void *ctx); +void ng_handle_events(unsigned int ms, void *ctx); + +typedef enum { FAIL, PASS } ng_error_t; +ng_error_t ng_errors(ng_error_t); + +void ng_init(void); From owner-dev-commits-src-main@freebsd.org Fri Jun 4 13:53:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3FEA264F362; Fri, 4 Jun 2021 13:53:22 +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 4FxPNy166bz3hmJ; Fri, 4 Jun 2021 13:53:22 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0E8F71E68F; Fri, 4 Jun 2021 13:53:22 +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 154DrLAg073015; Fri, 4 Jun 2021 13:53:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 154DrLOq073014; Fri, 4 Jun 2021 13:53:21 GMT (envelope-from git) Date: Fri, 4 Jun 2021 13:53:21 GMT Message-Id: <202106041353.154DrLOq073014@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: dab84426a68d - main - Narrow down the probe range for if_ure(4) compatible devices to only match the first vendor specific interface, if any. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dab84426a68d43efaede62ccf86ca3ef852f8ae3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 13:53:22 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=dab84426a68d43efaede62ccf86ca3ef852f8ae3 commit dab84426a68d43efaede62ccf86ca3ef852f8ae3 Author: Hans Petter Selasky AuthorDate: 2021-06-04 13:48:15 +0000 Commit: Hans Petter Selasky CommitDate: 2021-06-04 13:51:01 +0000 Narrow down the probe range for if_ure(4) compatible devices to only match the first vendor specific interface, if any. PR: 253374 MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/usb/net/if_ure.c | 7 ++++--- sys/dev/usb/usb.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/dev/usb/net/if_ure.c b/sys/dev/usb/net/if_ure.c index 2e4053a0e0c6..6439a0bfd71d 100644 --- a/sys/dev/usb/net/if_ure.c +++ b/sys/dev/usb/net/if_ure.c @@ -95,7 +95,10 @@ SYSCTL_INT(_hw_usb_ure, OID_AUTO, debug, CTLFLAG_RWTUN, &ure_debug, 0, * Various supported device vendors/products. */ static const STRUCT_USB_HOST_ID ure_devs[] = { -#define URE_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } +#define URE_DEV(v,p,i) { \ + USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i), \ + USB_IFACE_CLASS(UICLASS_VENDOR), \ + USB_IFACE_SUBCLASS(UISUBCLASS_VENDOR) } URE_DEV(LENOVO, RTL8153, URE_FLAG_8153), URE_DEV(LENOVO, TBT3LAN, 0), URE_DEV(LENOVO, TBT3LANGEN2, 0), @@ -488,8 +491,6 @@ ure_probe(device_t dev) uaa = device_get_ivars(dev); if (uaa->usb_mode != USB_MODE_HOST) return (ENXIO); - if (uaa->info.bConfigIndex != URE_CONFIG_IDX) - return (ENXIO); if (uaa->info.bIfaceIndex != URE_IFACE_IDX) return (ENXIO); diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h index dcdb62114d63..ad0381366f98 100644 --- a/sys/dev/usb/usb.h +++ b/sys/dev/usb/usb.h @@ -520,6 +520,7 @@ typedef struct usb_interface_assoc_descriptor usb_interface_assoc_descriptor_t; #define UICLASS_VENDOR 0xff #define UISUBCLASS_XBOX360_CONTROLLER 0x5d +#define UISUBCLASS_VENDOR 0xff #define UIPROTO_XBOX360_GAMEPAD 0x01 struct usb_endpoint_descriptor { From owner-dev-commits-src-main@freebsd.org Fri Jun 4 17:18:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD7F26516CD; Fri, 4 Jun 2021 17:18:24 +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 4FxTxX4FQFz4Tc3; Fri, 4 Jun 2021 17:18:24 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 79DEF20EF6; Fri, 4 Jun 2021 17:18: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 154HIOmC039137; Fri, 4 Jun 2021 17:18:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 154HIOgS039136; Fri, 4 Jun 2021 17:18:24 GMT (envelope-from git) Date: Fri, 4 Jun 2021 17:18:24 GMT Message-Id: <202106041718.154HIOgS039136@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Stone Subject: git: 2290dfb40fce - main - Enter the net epoch before calling ip6_setpktopts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rstone X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2290dfb40fce0ab46d91244282014173c7316e42 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 17:18:24 -0000 The branch main has been updated by rstone: URL: https://cgit.FreeBSD.org/src/commit/?id=2290dfb40fce0ab46d91244282014173c7316e42 commit 2290dfb40fce0ab46d91244282014173c7316e42 Author: Ryan Stone AuthorDate: 2021-05-19 19:10:03 +0000 Commit: Ryan Stone CommitDate: 2021-06-04 17:18:11 +0000 Enter the net epoch before calling ip6_setpktopts ip6_setpktopts() can look up ifnets via ifnet_by_index(), which is only safe in the net epoch. Ensure that callers are in the net epoch before calling this function. Sponsored by: Dell EMC Isilon MFC after: 4 weeks Reviewed by: donner, kp Differential Revision: https://reviews.freebsd.org/D30630 --- sys/netinet6/ip6_output.c | 10 ++++++++++ sys/netinet6/raw_ip6.c | 8 ++++++-- sys/netinet6/udp6_usrreq.c | 9 ++------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 2b49a9f7c351..71c5c4e5a501 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -2496,6 +2496,7 @@ ip6_pcbopts(struct ip6_pktopts **pktopt, struct mbuf *m, struct ip6_pktopts *opt = *pktopt; int error = 0; struct thread *td = sopt->sopt_td; + struct epoch_tracker et; /* turn off any old options. */ if (opt) { @@ -2523,12 +2524,15 @@ ip6_pcbopts(struct ip6_pktopts **pktopt, struct mbuf *m, } /* set options specified by user. */ + NET_EPOCH_ENTER(et); if ((error = ip6_setpktopts(m, opt, NULL, (td != NULL) ? td->td_ucred : NULL, so->so_proto->pr_protocol)) != 0) { ip6_clearpktopts(opt, -1); /* XXX: discard all options */ free(opt, M_IP6OPT); + NET_EPOCH_EXIT(et); return (error); } + NET_EPOCH_EXIT(et); *pktopt = opt; return (0); } @@ -2824,6 +2828,12 @@ ip6_setpktopts(struct mbuf *control, struct ip6_pktopts *opt, if (control == NULL || opt == NULL) return (EINVAL); + /* + * ip6_setpktopt can call ifnet_by_index(), so it's imperative that we are + * in the net epoch here. + */ + NET_EPOCH_ASSERT(); + ip6_initpktopts(opt); if (stickyopt) { int error; diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index a369abb04bfc..ad64429b5890 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -417,9 +417,13 @@ rip6_output(struct mbuf *m, struct socket *so, ...) INP_WLOCK(inp); if (control != NULL) { - if ((error = ip6_setpktopts(control, &opt, + NET_EPOCH_ENTER(et); + error = ip6_setpktopts(control, &opt, inp->in6p_outputopts, so->so_cred, - so->so_proto->pr_protocol)) != 0) { + so->so_proto->pr_protocol); + NET_EPOCH_EXIT(et); + + if (error != 0) { goto bad; } optp = &opt; diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 7c573d095d77..5841988f6113 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -810,21 +810,16 @@ udp6_output(struct socket *so, int flags_arg, struct mbuf *m, return (EINVAL); } + NET_EPOCH_ENTER(et); if (control) { if ((error = ip6_setpktopts(control, &opt, inp->in6p_outputopts, td->td_ucred, nxt)) != 0) { - INP_UNLOCK(inp); - ip6_clearpktopts(&opt, -1); - if (control) - m_freem(control); - m_freem(m); - return (error); + goto release; } optp = &opt; } else optp = inp->in6p_outputopts; - NET_EPOCH_ENTER(et); if (sin6) { /* * Since we saw no essential reason for calling in_pcbconnect, From owner-dev-commits-src-main@freebsd.org Fri Jun 4 17:25:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CDB176517A4 for ; Fri, 4 Jun 2021 17:25:53 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FxV694xngz4V3K for ; Fri, 4 Jun 2021 17:25:53 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-yb1-xb35.google.com with SMTP id i4so14762991ybe.2 for ; Fri, 04 Jun 2021 10:25:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=e/alwdZCkY2h5t/0QE76NPYO6PUg57z/n+2NyR8ug9w=; b=luRNktFMITVdnk1wc0aGPBXS0VMJY5/IvNiXdAtkS0rXph5R1c2EvdMek+ZwAt2Wlk 9WTGzZjpKOUpD9yfK3PC++glYbOI7jFEJcg+uec8o04Ws99WXFtW4DNeEYjb20gSy+nE 9kPFe98+NCIva1nFoYliXhrxcqGa5bv1EKSYI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=e/alwdZCkY2h5t/0QE76NPYO6PUg57z/n+2NyR8ug9w=; b=Oa/LPWGf+e+kg2mROdNxtCqR7oJY7Ei/Px8c2VLy8S3H5kspHfub/B4g0qTg4ud/2v pG+J50WiOIjoSX9P/3YOJFibkPNYSKR90VlHWQIyAnwEnSep+2OjmQHctgNPzKRe5a/x 2Ecbm0O+v6BJZLsazSMmbx+0xKpbyWwUCiYL3UTBVdB9AXdz9DD+xQoUgqSOelK1Y3tn WqLE3jSGXEinZFmviL5i0lDBiE/SfmsWwBRGj4F0EMc7BXQWuOvadF5YJyYAh/vFr4dE duzBjij3WO8xp6zqbDaremoxOXkSB3R7E8PM9oDS+nLzUgFqOtSFBUB4WY0TiIvppkWA jBcA== X-Gm-Message-State: AOAM530Vb4kXJ7eucrr3iezsYNRbSTU+czoN+U1Cl3LsXMJJT627U+0Y odYlTUcPXqAJenMbE2ueDOeQuH+renhH6zzbHNZzMw== X-Google-Smtp-Source: ABdhPJwuBp19ApiYm2EHZOPjz4xJ8aWSeH7bgpN0Q48wV1m44dJsA3xc2qtOjbNeDCoydNm4HaVfSgAL78npbJ0vteI= X-Received: by 2002:a25:ba10:: with SMTP id t16mr6657726ybg.87.1622827552472; Fri, 04 Jun 2021 10:25:52 -0700 (PDT) MIME-Version: 1.0 References: <202106040929.1549T8ad013290@gitrepo.freebsd.org> In-Reply-To: <202106040929.1549T8ad013290@gitrepo.freebsd.org> From: Kevin Bowling Date: Fri, 4 Jun 2021 10:25:40 -0700 Message-ID: Subject: Re: git: 4747500deaaa - main - tcp: A better fix for the previously attempted fix of the ack-war issue with tcp. To: Randall Stewart Cc: src-committers , "" , "dev-commits-src-main@FreeBSD.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4FxV694xngz4V3K X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 17:25:53 -0000 Will you MFC this? On Fri, Jun 4, 2021 at 2:29 AM Randall Stewart wrote: > > The branch main has been updated by rrs: > > URL: https://cgit.FreeBSD.org/src/commit/?id=4747500deaaa7765ba1c0413197c23ddba4faf49 > > commit 4747500deaaa7765ba1c0413197c23ddba4faf49 > Author: Randall Stewart > AuthorDate: 2021-06-04 09:26:43 +0000 > Commit: Randall Stewart > CommitDate: 2021-06-04 09:26:43 +0000 > > tcp: A better fix for the previously attempted fix of the ack-war issue with tcp. > > So it turns out that my fix before was not correct. It ended with us failing > some of the "improved" SYN tests, since we are not in the correct states. > With more digging I have figured out the root of the problem is that when > we receive a SYN|FIN the reassembly code made it so we create a segq entry > to hold the FIN. In the established state where we were not in order this > would be correct i.e. a 0 len with a FIN would need to be accepted. But > if you are in a front state we need to strip the FIN so we correctly handle > the ACK but ignore the FIN. This gets us into the proper states > and avoids the previous ack war. > > I back out some of the previous changes but then add a new change > here in tcp_reass() that fixes the root cause of the issue. We still > leave the rack panic fixes in place however. > > Reviewed by: mtuexen > Sponsored by: Netflix Inc > Differential Revision: https://reviews.freebsd.org/D30627 > --- > sys/netinet/tcp_input.c | 12 +++--------- > sys/netinet/tcp_reass.c | 14 ++++++++++++++ > sys/netinet/tcp_stacks/bbr.c | 12 +++--------- > sys/netinet/tcp_stacks/rack.c | 13 ++++--------- > sys/netinet/tcp_usrreq.c | 16 ---------------- > 5 files changed, 24 insertions(+), 43 deletions(-) > > diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c > index 1dab2e511d95..e71a11bdef05 100644 > --- a/sys/netinet/tcp_input.c > +++ b/sys/netinet/tcp_input.c > @@ -3191,15 +3191,9 @@ dodata: /* XXX */ > * when trimming from the head. > */ > tcp_seq temp = save_start; > - if (tlen || (th->th_seq != tp->rcv_nxt)) { > - /* > - * We add the th_seq != rcv_nxt to > - * catch the case of a stand alone out > - * of order FIN. > - */ > - thflags = tcp_reass(tp, th, &temp, &tlen, m); > - tp->t_flags |= TF_ACKNOW; > - } > + > + thflags = tcp_reass(tp, th, &temp, &tlen, m); > + tp->t_flags |= TF_ACKNOW; > } > if ((tp->t_flags & TF_SACK_PERMIT) && > (save_tlen > 0) && > diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c > index 8e24e7412473..5b9255da3acf 100644 > --- a/sys/netinet/tcp_reass.c > +++ b/sys/netinet/tcp_reass.c > @@ -571,6 +571,7 @@ tcp_reass(struct tcpcb *tp, struct tcphdr *th, tcp_seq *seq_start, > * the rcv_nxt <-> rcv_wnd but thats > * already done for us by the caller. > */ > +strip_fin: > #ifdef TCP_REASS_COUNTERS > counter_u64_add(tcp_zero_input, 1); > #endif > @@ -579,6 +580,19 @@ tcp_reass(struct tcpcb *tp, struct tcphdr *th, tcp_seq *seq_start, > tcp_reass_log_dump(tp); > #endif > return (0); > + } else if ((*tlenp == 0) && > + (th->th_flags & TH_FIN) && > + !TCPS_HAVEESTABLISHED(tp->t_state)) { > + /* > + * We have not established, and we > + * have a FIN and no data. Lets treat > + * this as the same as if the FIN were > + * not present. We don't want to save > + * the FIN bit in a reassembly buffer > + * we want to get established first before > + * we do that (the peer will retransmit). > + */ > + goto strip_fin; > } > /* > * Will it fit? > diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c > index 5b97c3d7800f..f6388c39cad3 100644 > --- a/sys/netinet/tcp_stacks/bbr.c > +++ b/sys/netinet/tcp_stacks/bbr.c > @@ -8320,15 +8320,9 @@ bbr_process_data(struct mbuf *m, struct tcphdr *th, struct socket *so, > * trimming from the head. > */ > tcp_seq temp = save_start; > - if (tlen || (th->th_seq != tp->rcv_nxt)) { > - /* > - * We add the th_seq != rcv_nxt to > - * catch the case of a stand alone out > - * of order FIN. > - */ > - thflags = tcp_reass(tp, th, &temp, &tlen, m); > - tp->t_flags |= TF_ACKNOW; > - } > + > + thflags = tcp_reass(tp, th, &temp, &tlen, m); > + tp->t_flags |= TF_ACKNOW; > } > if ((tp->t_flags & TF_SACK_PERMIT) && > (save_tlen > 0) && > diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c > index 1db09e30d968..98b8ff836ca5 100644 > --- a/sys/netinet/tcp_stacks/rack.c > +++ b/sys/netinet/tcp_stacks/rack.c > @@ -10235,15 +10235,10 @@ rack_process_data(struct mbuf *m, struct tcphdr *th, struct socket *so, > * trimming from the head. > */ > tcp_seq temp = save_start; > - if (tlen || (th->th_seq != tp->rcv_nxt)) { > - /* > - * We add the th_seq != rcv_nxt to > - * catch the case of a stand alone out > - * of order FIN. > - */ > - thflags = tcp_reass(tp, th, &temp, &tlen, m); > - tp->t_flags |= TF_ACKNOW; > - } > + > + thflags = tcp_reass(tp, th, &temp, &tlen, m); > + tp->t_flags |= TF_ACKNOW; > + > } > if ((tp->t_flags & TF_SACK_PERMIT) && > (save_tlen > 0) && > diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c > index 7f1b698408e5..b1fc584f93b2 100644 > --- a/sys/netinet/tcp_usrreq.c > +++ b/sys/netinet/tcp_usrreq.c > @@ -2647,22 +2647,6 @@ tcp_usrclosed(struct tcpcb *tp) > tcp_state_change(tp, TCPS_LAST_ACK); > break; > } > - if ((tp->t_state == TCPS_LAST_ACK) && > - (tp->t_flags & TF_SENTFIN)) { > - /* > - * If we have reached LAST_ACK, and > - * we sent a FIN (e.g. via MSG_EOR), then > - * we really should move to either FIN_WAIT_1 > - * or FIN_WAIT_2 depending on snd_max/snd_una. > - */ > - if (tp->snd_una == tp->snd_max) { > - /* The FIN is acked */ > - tcp_state_change(tp, TCPS_FIN_WAIT_2); > - } else { > - /* The FIN is still outstanding */ > - tcp_state_change(tp, TCPS_FIN_WAIT_1); > - } > - } > if (tp->t_state >= TCPS_FIN_WAIT_2) { > soisdisconnected(tp->t_inpcb->inp_socket); > /* Prevent the connection hanging in FIN_WAIT_2 forever. */ > _______________________________________________ > dev-commits-src-main@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main > To unsubscribe, send any mail to "dev-commits-src-main-unsubscribe@freebsd.org" From owner-dev-commits-src-main@freebsd.org Fri Jun 4 19:19:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A8E0E653708; Fri, 4 Jun 2021 19:19: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 4FxXdH48Dmz4g7n; Fri, 4 Jun 2021 19:19:31 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7317622BB9; Fri, 4 Jun 2021 19:19:31 +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 154JJVD3005925; Fri, 4 Jun 2021 19:19:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 154JJVGk005924; Fri, 4 Jun 2021 19:19:31 GMT (envelope-from git) Date: Fri, 4 Jun 2021 19:19:31 GMT Message-Id: <202106041919.154JJVGk005924@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: bb877c062034 - main - cxgbe(4): Empty the clib_db before trying to destroy it. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bb877c0620347eb86f25f4382c42d58685c348d4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 19:19:31 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=bb877c0620347eb86f25f4382c42d58685c348d4 commit bb877c0620347eb86f25f4382c42d58685c348d4 Author: Navdeep Parhar AuthorDate: 2021-06-04 19:01:14 +0000 Commit: Navdeep Parhar CommitDate: 2021-06-04 19:01:14 +0000 cxgbe(4): Empty the clib_db before trying to destroy it. This fixes a panic on driver unload. Reported by: Jithesh Arakkan @ Chelsio MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/t4_clip.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/dev/cxgbe/t4_clip.c b/sys/dev/cxgbe/t4_clip.c index 98734d6d11ce..5f4fbd0f07a6 100644 --- a/sys/dev/cxgbe/t4_clip.c +++ b/sys/dev/cxgbe/t4_clip.c @@ -854,8 +854,21 @@ t4_clip_modload(void) void t4_clip_modunload(void) { + struct clip_db_entry *cde; + int i; + EVENTHANDLER_DEREGISTER(ifaddr_event_ext, ifaddr_evhandler); taskqueue_drain(taskqueue_thread, &clip_db_task); + mtx_lock(&clip_db_lock); + for (i = 0; i <= clip_db_mask; i++) { + while ((cde = LIST_FIRST(&clip_db[i])) != NULL) { + MPASS(cde->tmp_ref == 0); + MPASS(cde->adp_ref == 0); + LIST_REMOVE(cde, link); + free(cde, M_CXGBE); + } + } + mtx_unlock(&clip_db_lock); hashdestroy(clip_db, M_CXGBE, clip_db_mask); mtx_destroy(&clip_db_lock); } From owner-dev-commits-src-main@freebsd.org Fri Jun 4 20:35:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2919965447E; Fri, 4 Jun 2021 20:35:00 +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 4FxZJN0Mhmz4nx1; Fri, 4 Jun 2021 20:35:00 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E5F4223E0A; Fri, 4 Jun 2021 20:34:59 +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 154KYxeI018425; Fri, 4 Jun 2021 20:34:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 154KYxuM018424; Fri, 4 Jun 2021 20:34:59 GMT (envelope-from git) Date: Fri, 4 Jun 2021 20:34:59 GMT Message-Id: <202106042034.154KYxuM018424@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: f13d72fd0b74 - main - cxgb(4): Report proper TSO limits. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f13d72fd0b743a1fd97dd31f4abf19e8814c420b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 20:35:00 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=f13d72fd0b743a1fd97dd31f4abf19e8814c420b commit f13d72fd0b743a1fd97dd31f4abf19e8814c420b Author: Navdeep Parhar AuthorDate: 2021-06-04 20:30:28 +0000 Commit: Navdeep Parhar CommitDate: 2021-06-04 20:30:28 +0000 cxgb(4): Report proper TSO limits. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgb/cxgb_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/dev/cxgb/cxgb_main.c b/sys/dev/cxgb/cxgb_main.c index ab835b0c1853..5c0bdd569fab 100644 --- a/sys/dev/cxgb/cxgb_main.c +++ b/sys/dev/cxgb/cxgb_main.c @@ -1042,6 +1042,9 @@ cxgb_port_attach(device_t dev) ifp->if_capenable = CXGB_CAP_ENABLE; ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO | CSUM_UDP_IPV6 | CSUM_TCP_IPV6; + ifp->if_hw_tsomax = IP_MAXPACKET; + ifp->if_hw_tsomaxsegcount = 36; + ifp->if_hw_tsomaxsegsize = 65536; /* * Disable TSO on 4-port - it isn't supported by the firmware. From owner-dev-commits-src-main@freebsd.org Fri Jun 4 22:47:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7BEF36567AB; Fri, 4 Jun 2021 22:47:49 +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 4FxdFd3181z3GG0; Fri, 4 Jun 2021 22:47:49 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 33B5625897; Fri, 4 Jun 2021 22:47:49 +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 154MlmlL092770; Fri, 4 Jun 2021 22:47:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 154MlmIA092769; Fri, 4 Jun 2021 22:47:48 GMT (envelope-from git) Date: Fri, 4 Jun 2021 22:47:48 GMT Message-Id: <202106042247.154MlmIA092769@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 1b5bc3a54b60 - main - usbdump: style: Sort case statements alphabetically 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/main X-Git-Reftype: branch X-Git-Commit: 1b5bc3a54b60f6476cce7191a7618a9d52b95d7f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jun 2021 22:47:49 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1b5bc3a54b60f6476cce7191a7618a9d52b95d7f commit 1b5bc3a54b60f6476cce7191a7618a9d52b95d7f Author: Warner Losh AuthorDate: 2021-06-04 22:42:18 +0000 Commit: Warner Losh CommitDate: 2021-06-04 22:47:28 +0000 usbdump: style: Sort case statements alphabetically Switch case statement for getopt args should be sorted alphabetically. Sponsored by: Netflix --- usr.sbin/usbdump/usbdump.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/usr.sbin/usbdump/usbdump.c b/usr.sbin/usbdump/usbdump.c index 00d3b8e8913b..3c4f93f80c72 100644 --- a/usr.sbin/usbdump/usbdump.c +++ b/usr.sbin/usbdump/usbdump.c @@ -834,6 +834,9 @@ main(int argc, char *argv[]) optstring = "b:d:hi:r:s:vw:f:"; while ((o = getopt(argc, argv, optstring)) != -1) { switch (o) { + case 'b': + b_arg = optarg; + break; case 'd': pp = optarg; if (pp[0] == 'u' && pp[1] == 'g' && pp[2] == 'e' && pp[3] == 'n') @@ -866,6 +869,20 @@ main(int argc, char *argv[]) } } break; + case 'f': + filt_unit = strtol(optarg, &pp, 10); + filt_ep = -1; + if (pp != NULL) { + if (*pp == '.') { + filt_ep = strtol(pp + 1, &pp, 10); + if (pp != NULL && *pp != 0) + usage(); + } else if (*pp != 0) { + usage(); + } + } + add_filter(filt_unit, filt_ep); + break; case 'i': i_arg = optarg; break; @@ -884,9 +901,6 @@ main(int argc, char *argv[]) if (snapshot == 0) snapshot = -1; break; - case 'b': - b_arg = optarg; - break; case 'v': verbose++; break; @@ -894,20 +908,6 @@ main(int argc, char *argv[]) w_arg = optarg; init_wfile(p); break; - case 'f': - filt_unit = strtol(optarg, &pp, 10); - filt_ep = -1; - if (pp != NULL) { - if (*pp == '.') { - filt_ep = strtol(pp + 1, &pp, 10); - if (pp != NULL && *pp != 0) - usage(); - } else if (*pp != 0) { - usage(); - } - } - add_filter(filt_unit, filt_ep); - break; default: usage(); /* NOTREACHED */ From owner-dev-commits-src-main@freebsd.org Sat Jun 5 03:34:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9EB6363A732; Sat, 5 Jun 2021 03:34:28 +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 4FxlcN2GMZz3qfm; Sat, 5 Jun 2021 03:34:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 36AC8143E; Sat, 5 Jun 2021 03:34:28 +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 1553YSwH077177; Sat, 5 Jun 2021 03:34:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1553YSVA077176; Sat, 5 Jun 2021 03:34:28 GMT (envelope-from git) Date: Sat, 5 Jun 2021 03:34:28 GMT Message-Id: <202106050334.1553YSVA077176@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 56e9d8e38e7e - main - nfsd: Fix NFSv4.1/4.2 Secinfo_no_name when security flavors empty MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 56e9d8e38e7eed84901acddca24170eb352d2ed6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2021 03:34:28 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=56e9d8e38e7eed84901acddca24170eb352d2ed6 commit 56e9d8e38e7eed84901acddca24170eb352d2ed6 Author: Rick Macklem AuthorDate: 2021-06-05 03:31:20 +0000 Commit: Rick Macklem CommitDate: 2021-06-05 03:31:20 +0000 nfsd: Fix NFSv4.1/4.2 Secinfo_no_name when security flavors empty Commit 947bd2479ba9 added support for the Secinfo_no_name operation. When a non-exported file system is being traversed, the list of security flavors is empty. It turns out that the Linux client mount attempt fails when the security flavors list in the Secinfo_no_name reply is empty. This patch modifies Secinfo/Secinfo_no_name so that it replies with all four security flavors when the list is empty. This fixes Linux NFSv4.1/4.2 mounts when the file system at the NFSv4 root (as specified on a V4: exports(5) line) is not exported. MFC after: 2 weeks --- sys/fs/nfsserver/nfs_nfsdserv.c | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index f4d6dbe42a21..d7049ba1fed8 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -3709,6 +3709,31 @@ nfsrvd_secinfo(struct nfsrv_descript *nd, int isdgram, */ len = 0; NFSM_BUILD(sizp, u_int32_t *, NFSX_UNSIGNED); + + /* If nes_numsecflavor == 0, all are allowed. */ + if (retnes.nes_numsecflavor == 0) { + NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(RPCAUTH_UNIX); + *tl = txdr_unsigned(RPCAUTH_GSS); + nfsm_strtom(nd, nfsgss_mechlist[KERBV_MECH].str, + nfsgss_mechlist[KERBV_MECH].len); + NFSM_BUILD(tl, uint32_t *, 3 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(GSS_KERBV_QOP); + *tl++ = txdr_unsigned(RPCAUTHGSS_SVCNONE); + *tl = txdr_unsigned(RPCAUTH_GSS); + nfsm_strtom(nd, nfsgss_mechlist[KERBV_MECH].str, + nfsgss_mechlist[KERBV_MECH].len); + NFSM_BUILD(tl, uint32_t *, 3 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(GSS_KERBV_QOP); + *tl++ = txdr_unsigned(RPCAUTHGSS_SVCINTEGRITY); + *tl = txdr_unsigned(RPCAUTH_GSS); + nfsm_strtom(nd, nfsgss_mechlist[KERBV_MECH].str, + nfsgss_mechlist[KERBV_MECH].len); + NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(GSS_KERBV_QOP); + *tl = txdr_unsigned(RPCAUTHGSS_SVCPRIVACY); + len = 4; + } for (i = 0; i < retnes.nes_numsecflavor; i++) { if (retnes.nes_secflavors[i] == AUTH_SYS) { NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); @@ -3819,6 +3844,31 @@ nfsrvd_secinfononame(struct nfsrv_descript *nd, int isdgram, */ len = 0; NFSM_BUILD(sizp, uint32_t *, NFSX_UNSIGNED); + + /* If nes_numsecflavor == 0, all are allowed. */ + if (retnes.nes_numsecflavor == 0) { + NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(RPCAUTH_UNIX); + *tl = txdr_unsigned(RPCAUTH_GSS); + nfsm_strtom(nd, nfsgss_mechlist[KERBV_MECH].str, + nfsgss_mechlist[KERBV_MECH].len); + NFSM_BUILD(tl, uint32_t *, 3 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(GSS_KERBV_QOP); + *tl++ = txdr_unsigned(RPCAUTHGSS_SVCNONE); + *tl = txdr_unsigned(RPCAUTH_GSS); + nfsm_strtom(nd, nfsgss_mechlist[KERBV_MECH].str, + nfsgss_mechlist[KERBV_MECH].len); + NFSM_BUILD(tl, uint32_t *, 3 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(GSS_KERBV_QOP); + *tl++ = txdr_unsigned(RPCAUTHGSS_SVCINTEGRITY); + *tl = txdr_unsigned(RPCAUTH_GSS); + nfsm_strtom(nd, nfsgss_mechlist[KERBV_MECH].str, + nfsgss_mechlist[KERBV_MECH].len); + NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); + *tl++ = txdr_unsigned(GSS_KERBV_QOP); + *tl = txdr_unsigned(RPCAUTHGSS_SVCPRIVACY); + len = 4; + } for (i = 0; i < retnes.nes_numsecflavor; i++) { if (retnes.nes_secflavors[i] == AUTH_SYS) { NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED); From owner-dev-commits-src-main@freebsd.org Sat Jun 5 04:42:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 178BB63B90E; Sat, 5 Jun 2021 04:42:37 +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 4Fxn70608Mz3tdn; Sat, 5 Jun 2021 04:42:36 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B444625AD; Sat, 5 Jun 2021 04:42:36 +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 1554gaxS070506; Sat, 5 Jun 2021 04:42:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1554galB070505; Sat, 5 Jun 2021 04:42:36 GMT (envelope-from git) Date: Sat, 5 Jun 2021 04:42:36 GMT Message-Id: <202106050442.1554galB070505@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ganbold Tsagaankhuu Subject: git: 295855e80f9d - main - dtb: rockchip: Add NanoPI-R2S to the build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ganbold X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 295855e80f9d4c5caffe30ec8ac95e5f8a457daf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2021 04:42:37 -0000 The branch main has been updated by ganbold: URL: https://cgit.FreeBSD.org/src/commit/?id=295855e80f9d4c5caffe30ec8ac95e5f8a457daf commit 295855e80f9d4c5caffe30ec8ac95e5f8a457daf Author: Ganbold Tsagaankhuu AuthorDate: 2021-06-05 04:40:34 +0000 Commit: Ganbold Tsagaankhuu CommitDate: 2021-06-05 04:40:34 +0000 dtb: rockchip: Add NanoPI-R2S to the build --- sys/modules/dtb/rockchip/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/modules/dtb/rockchip/Makefile b/sys/modules/dtb/rockchip/Makefile index 20df656bd148..2bd86ec3cc7d 100644 --- a/sys/modules/dtb/rockchip/Makefile +++ b/sys/modules/dtb/rockchip/Makefile @@ -10,6 +10,7 @@ DTS= \ rockchip/rk3399-khadas-edge-captain.dts \ rockchip/rk3399-khadas-edge.dts \ rockchip/rk3399-khadas-edge-v.dts \ + rockchip/rk3328-nanopi-r2s.dts \ rockchip/rk3399-rock-pi-4.dts \ rockchip/rk3328-rock64.dts \ rockchip/rk3399-firefly.dts \ From owner-dev-commits-src-main@freebsd.org Sat Jun 5 05:59:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BFBB63C34C; Sat, 5 Jun 2021 05:59: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 4Fxpqk5KSPz4SQ8; Sat, 5 Jun 2021 05:59:30 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 16D81325A; Sat, 5 Jun 2021 05:59: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 1555xTIO063965; Sat, 5 Jun 2021 05:59:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1555xSBH063964; Sat, 5 Jun 2021 05:59:28 GMT (envelope-from git) Date: Sat, 5 Jun 2021 05:59:28 GMT Message-Id: <202106050559.1555xSBH063964@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jung-uk Kim Subject: git: 1970d6930394 - main - Import ACPICA 20210604 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1970d69303946116e6c88ab5b903ae4b65efddc5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2021 05:59:31 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=1970d69303946116e6c88ab5b903ae4b65efddc5 commit 1970d69303946116e6c88ab5b903ae4b65efddc5 Author: Jung-uk Kim AuthorDate: 2021-06-05 04:00:36 +0000 Commit: Jung-uk Kim CommitDate: 2021-06-05 05:58:00 +0000 Import ACPICA 20210604 (cherry picked from commit 395770967c3664ec744e63fa47acc19670d32f47) --- sys/contrib/dev/acpica/changes.txt | 42 ++++ sys/contrib/dev/acpica/common/ahtable.c | 42 ++-- sys/contrib/dev/acpica/common/dmtable.c | 116 ++++++++- sys/contrib/dev/acpica/common/dmtbdump2.c | 230 +++++++++++++++-- sys/contrib/dev/acpica/common/dmtbdump3.c | 60 +++++ sys/contrib/dev/acpica/common/dmtbinfo1.c | 13 + sys/contrib/dev/acpica/common/dmtbinfo2.c | 211 +++++++++++++--- sys/contrib/dev/acpica/common/dmtbinfo3.c | 24 ++ sys/contrib/dev/acpica/compiler/aslcompiler.h | 4 + sys/contrib/dev/acpica/compiler/aslmessages.c | 6 +- sys/contrib/dev/acpica/compiler/aslmessages.h | 4 +- sys/contrib/dev/acpica/compiler/aslutils.c | 40 +++ sys/contrib/dev/acpica/compiler/asluuid.c | 47 ---- sys/contrib/dev/acpica/compiler/dtcompiler.h | 16 ++ sys/contrib/dev/acpica/compiler/dtfield.c | 4 +- sys/contrib/dev/acpica/compiler/dtio.c | 6 +- sys/contrib/dev/acpica/compiler/dttable1.c | 274 ++++++++++++++++----- sys/contrib/dev/acpica/compiler/dttable2.c | 169 +++++++++++++ sys/contrib/dev/acpica/compiler/dttemplate.h | 212 ++++++++++++++-- sys/contrib/dev/acpica/compiler/dtutils.c | 19 ++ .../dev/acpica/components/executer/exfield.c | 6 +- .../dev/acpica/components/executer/exserial.c | 12 + .../dev/acpica/components/namespace/nsrepair2.c | 7 + .../dev/acpica/components/utilities/utdelete.c | 8 + .../dev/acpica/components/utilities/utuuid.c | 48 ++++ sys/contrib/dev/acpica/include/acbuffer.h | 9 + sys/contrib/dev/acpica/include/acconfig.h | 1 + sys/contrib/dev/acpica/include/acdisasm.h | 37 ++- sys/contrib/dev/acpica/include/acpixf.h | 2 +- sys/contrib/dev/acpica/include/actbinfo.h | 9 + sys/contrib/dev/acpica/include/actbl1.h | 43 +++- sys/contrib/dev/acpica/include/actbl2.h | 156 ++++++++++++ sys/contrib/dev/acpica/include/acutils.h | 5 + 33 files changed, 1645 insertions(+), 237 deletions(-) diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index 0b71b266a6ba..31b4eaff62fb 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/changes.txt @@ -1,3 +1,45 @@ +---------------------------------------- +04 June 2021. Summary of changes for version 20210604: + +1) ACPICA kernel-resident subsystem: + +Cleaned up (delete) the context mutex during local address handler object +deletion. + +Fixed a memory leak caused by the _CID repair function. + +Added support for PlatformRtMechanism OperationRegion handler. Adds a new +utility function, AcpiUtConvertUuidToString. Writing a buffer to a +PlatformRtMechanism fieldunit invokes a bidirectional transaction. The +input buffer contains 26 bytes containing 9 bytes of status, a command +byte and a 16-byte UUID. This change will simply pass this incoming +buffer to a handler registered by the OS. + +2) iASL Compiler/Disassembler and ACPICA tools: + +Added full support for the PRMT ACPI table (Platform Runtime Mechanism +Table). Includes support in the iASL compiler, the disassembler, and the +template generator. + +Added full support for the BDAT (BIOS Data ACPI Table) ACPI table. + +Added full support for the RGRT (Regulatory Graphics Resource Table) ACPI +table. + +Added full support for the SVKL (Storage Volume Key Location Table) ACPI +table. Header file support from Kuppuswamy Sathyanarayanan +. + +Completed full support for the IVRS (I/O Virtualization Reporting +Structure) ACPI table. Added compiler support for IVRS, updated +disassembler support. Adds a new utility, UtIsIdInteger, to determine if +a HID/CID is an integer or a string. + +Headers: Added more structs to the CEDT table: CXL fixed memory window +structure. + +ACPI 6.4: MADT: added Multiprocessor Wakeup Mailbox Structure. + ---------------------------------------- 31 March 2021. Summary of changes for version 20210331: diff --git a/sys/contrib/dev/acpica/common/ahtable.c b/sys/contrib/dev/acpica/common/ahtable.c index 3d3eee5b41b4..b1da441deda4 100644 --- a/sys/contrib/dev/acpica/common/ahtable.c +++ b/sys/contrib/dev/acpica/common/ahtable.c @@ -199,20 +199,21 @@ AcpiAhGetTableInfo ( */ const AH_TABLE AcpiGbl_SupportedTables[] = { - {ACPI_SIG_ASF, "Alert Standard Format table"}, + {ACPI_SIG_ASF, "Alert Standard Format Table"}, + {ACPI_SIG_BDAT, "BIOS Data ACPI Table"}, {ACPI_SIG_BERT, "Boot Error Record Table"}, {ACPI_SIG_BGRT, "Boot Graphics Resource Table"}, {ACPI_SIG_BOOT, "Simple Boot Flag Table"}, {ACPI_SIG_CEDT, "CXL Early Discovery Table"}, - {ACPI_SIG_CPEP, "Corrected Platform Error Polling table"}, + {ACPI_SIG_CPEP, "Corrected Platform Error Polling Table"}, {ACPI_SIG_CSRT, "Core System Resource Table"}, - {ACPI_SIG_DBG2, "Debug Port table type 2"}, - {ACPI_SIG_DBGP, "Debug Port table"}, - {ACPI_SIG_DMAR, "DMA Remapping table"}, - {ACPI_SIG_DRTM, "Dynamic Root of Trust for Measurement table"}, + {ACPI_SIG_DBG2, "Debug Port Table type 2"}, + {ACPI_SIG_DBGP, "Debug Port Table"}, + {ACPI_SIG_DMAR, "DMA Remapping Table"}, + {ACPI_SIG_DRTM, "Dynamic Root of Trust for Measurement Table"}, {ACPI_SIG_DSDT, "Differentiated System Description Table (AML table)"}, {ACPI_SIG_ECDT, "Embedded Controller Boot Resources Table"}, - {ACPI_SIG_EINJ, "Error Injection table"}, + {ACPI_SIG_EINJ, "Error Injection Table"}, {ACPI_SIG_ERST, "Error Record Serialization Table"}, {ACPI_SIG_FACS, "Firmware ACPI Control Structure"}, {ACPI_SIG_FADT, "Fixed ACPI Description Table (FADT)"}, @@ -220,38 +221,41 @@ const AH_TABLE AcpiGbl_SupportedTables[] = {ACPI_SIG_GTDT, "Generic Timer Description Table"}, {ACPI_SIG_HEST, "Hardware Error Source Table"}, {ACPI_SIG_HMAT, "Heterogeneous Memory Attributes Table"}, - {ACPI_SIG_HPET, "High Precision Event Timer table"}, + {ACPI_SIG_HPET, "High Precision Event Timer Table"}, {ACPI_SIG_IORT, "IO Remapping Table"}, {ACPI_SIG_IVRS, "I/O Virtualization Reporting Structure"}, {ACPI_SIG_LPIT, "Low Power Idle Table"}, {ACPI_SIG_MADT, "Multiple APIC Description Table (MADT)"}, - {ACPI_SIG_MCFG, "Memory Mapped Configuration table"}, - {ACPI_SIG_MCHI, "Management Controller Host Interface table"}, + {ACPI_SIG_MCFG, "Memory Mapped Configuration Table"}, + {ACPI_SIG_MCHI, "Management Controller Host Interface Table"}, {ACPI_SIG_MPST, "Memory Power State Table"}, {ACPI_SIG_MSCT, "Maximum System Characteristics Table"}, - {ACPI_SIG_MSDM, "Microsoft Data Management table"}, + {ACPI_SIG_MSDM, "Microsoft Data Management Table"}, {ACPI_SIG_NFIT, "NVDIMM Firmware Interface Table"}, {ACPI_SIG_PCCT, "Platform Communications Channel Table"}, - {ACPI_SIG_PHAT, "Platform Health Assessment Table"}, {ACPI_SIG_PDTT, "Platform Debug Trigger Table"}, + {ACPI_SIG_PHAT, "Platform Health Assessment Table"}, {ACPI_SIG_PMTT, "Platform Memory Topology Table"}, {ACPI_SIG_PPTT, "Processor Properties Topology Table"}, + {ACPI_SIG_PRMT, "Platform Runtime Mechanism Table"}, {ACPI_SIG_RASF, "RAS Features Table"}, + {ACPI_SIG_RGRT, "Regulatory Graphics Resource Table"}, {ACPI_RSDP_NAME,"Root System Description Pointer"}, {ACPI_SIG_RSDT, "Root System Description Table"}, {ACPI_SIG_S3PT, "S3 Performance Table"}, {ACPI_SIG_SBST, "Smart Battery Specification Table"}, {ACPI_SIG_SDEI, "Software Delegated Exception Interface Table"}, - {ACPI_SIG_SDEV, "Secure Devices table"}, + {ACPI_SIG_SDEV, "Secure Devices Table"}, {ACPI_SIG_SLIC, "Software Licensing Description Table"}, {ACPI_SIG_SLIT, "System Locality Information Table"}, - {ACPI_SIG_SPCR, "Serial Port Console Redirection table"}, - {ACPI_SIG_SPMI, "Server Platform Management Interface table"}, + {ACPI_SIG_SPCR, "Serial Port Console Redirection Table"}, + {ACPI_SIG_SPMI, "Server Platform Management Interface Table"}, {ACPI_SIG_SRAT, "System Resource Affinity Table"}, {ACPI_SIG_SSDT, "Secondary System Description Table (AML table)"}, - {ACPI_SIG_STAO, "Status Override table"}, - {ACPI_SIG_TCPA, "Trusted Computing Platform Alliance table"}, - {ACPI_SIG_TPM2, "Trusted Platform Module hardware interface table"}, + {ACPI_SIG_STAO, "Status Override Table"}, + {ACPI_SIG_SVKL, "Storage Volume Key Location Table"}, + {ACPI_SIG_TCPA, "Trusted Computing Platform Alliance Table"}, + {ACPI_SIG_TPM2, "Trusted Platform Module hardware interface Table"}, {ACPI_SIG_UEFI, "UEFI Boot Optimization Table"}, {ACPI_SIG_VIOT, "Virtual I/O Translation Table"}, {ACPI_SIG_WAET, "Windows ACPI Emulated Devices Table"}, @@ -260,7 +264,7 @@ const AH_TABLE AcpiGbl_SupportedTables[] = {ACPI_SIG_WDRT, "Watchdog Resource Table"}, {ACPI_SIG_WPBT, "Windows Platform Binary Table"}, {ACPI_SIG_WSMT, "Windows SMM Security Mitigations Table"}, - {ACPI_SIG_XENV, "Xen Environment table"}, + {ACPI_SIG_XENV, "Xen Environment Table"}, {ACPI_SIG_XSDT, "Extended System Description Table"}, {NULL, NULL} }; diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c index 6f34e82c1b62..cc72fa0512a8 100644 --- a/sys/contrib/dev/acpica/common/dmtable.c +++ b/sys/contrib/dev/acpica/common/dmtable.c @@ -187,6 +187,7 @@ static const char *AcpiDmAsfSubnames[] = static const char *AcpiDmCedtSubnames[] = { "CXL Host Bridge Structure", + "CXL Fixed Memory Window Structure", "Unknown Subtable Type" /* Reserved */ }; @@ -350,6 +351,7 @@ static const char *AcpiDmMadtSubnames[] = "Generic MSI Frame", /* ACPI_MADT_GENERIC_MSI_FRAME */ "Generic Interrupt Redistributor", /* ACPI_MADT_GENERIC_REDISTRIBUTOR */ "Generic Interrupt Translator", /* ACPI_MADT_GENERIC_TRANSLATOR */ + "Mutiprocessor Wakeup", /* ACPI_MADT_TYPE_MULTIPROC_WAKEUP */ "Unknown Subtable Type" /* Reserved */ }; @@ -401,6 +403,12 @@ static const char *AcpiDmPpttSubnames[] = "Unknown Subtable Type" /* Reserved */ }; +static const char *AcpiDmRgrtSubnames[] = +{ + "Unknown/Reserved Image Type", /* ACPI_RGRT_TYPE_RESERVED0 */ + "Type PNG" /* ACPI_RGRT_IMAGE_TYPE_PNG */ +}; + static const char *AcpiDmSdevSubnames[] = { "Namespace Device", /* ACPI_SDEV_TYPE_NAMESPACE_DEVICE */ @@ -438,9 +446,28 @@ static const char *AcpiDmTpm2Subnames[] = static const char *AcpiDmIvrsSubnames[] = { - "Hardware Definition Block", - "Memory Definition Block", - "Unknown Subtable Type" /* Reserved */ + "Hardware Definition Block (IVHD)", + "Hardware Definition Block - Mixed Format (IVHD)", + "Memory Definition Block (IVMD)", + "Unknown/Reserved Subtable Type" /* Reserved */ +}; + +static const char *AcpiDmIvrsDevEntryNames[] = +{ + "Unknown/Reserved Device Entry Type", /* 0- Reserved */ + "Device Entry: Select All Devices", /* 1 */ + "Device Entry: Select One Device", /* 2 */ + "Device Entry: Start of Range", /* 3 */ + "Device Entry: End of Range", /* 4 */ + "Device Entry: Alias Select", /* 66 */ + "Device Entry: Alias Start of Range", /* 67 */ + "Unknown/Reserved Device Entry Type", /* 68- Reserved */ + "Unknown/Reserved Device Entry Type", /* 69- Reserved */ + "Device Entry: Extended Select", /* 70 */ + "Device Entry: Extended Start of Range", /* 71 */ + "Device Entry: Special Device", /* 72 */ + "Device Entry: ACPI HID Named Device", /* 240 */ + "Unknown/Reserved Device Entry Type" /* Reserved */ }; static const char *AcpiDmLpitSubnames[] = @@ -507,6 +534,7 @@ static const char *AcpiDmGasAccessWidth[] = const ACPI_DMTABLE_DATA AcpiDmTableData[] = { {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf}, + {ACPI_SIG_BDAT, AcpiDmTableInfoBdat, NULL, NULL, TemplateBdat}, {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert}, {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt, NULL, NULL, TemplateBgrt}, {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot}, @@ -541,7 +569,9 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_PHAT, NULL, AcpiDmDumpPhat, DtCompilePhat, TemplatePhat}, {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt}, {ACPI_SIG_PPTT, NULL, AcpiDmDumpPptt, DtCompilePptt, TemplatePptt}, + {ACPI_SIG_PRMT, NULL, AcpiDmDumpPrmt, DtCompilePrmt, TemplatePrmt}, {ACPI_SIG_RASF, AcpiDmTableInfoRasf, NULL, NULL, TemplateRasf}, + {ACPI_SIG_RGRT, NULL, AcpiDmDumpRgrt, DtCompileRgrt, TemplateRgrt}, {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt}, {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt}, {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst}, @@ -553,6 +583,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi}, {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat}, {ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao}, + {ACPI_SIG_SVKL, AcpiDmTableInfoSvkl, AcpiDmDumpSvkl, DtCompileSvkl, TemplateSvkl}, {ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa}, {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, AcpiDmDumpTpm2, DtCompileTpm2, TemplateTpm2}, {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi}, @@ -940,8 +971,8 @@ AcpiDmDumpTable ( if (SubtableLength && (Info->Offset >= SubtableLength)) { AcpiOsPrintf ( - "/**** ACPI subtable terminates early - " - "may be older version (dump table) */\n"); + "/**** ACPI subtable terminates early (Len %u) - " + "may be older version (dump table) */\n", SubtableLength); /* Move on to next subtable */ @@ -966,11 +997,13 @@ AcpiDmDumpTable ( case ACPI_DMT_ACCWIDTH: case ACPI_DMT_CEDT: case ACPI_DMT_IVRS: + case ACPI_DMT_IVRS_DE: case ACPI_DMT_GTDT: case ACPI_DMT_MADT: case ACPI_DMT_PCCT: case ACPI_DMT_PMTT: case ACPI_DMT_PPTT: + case ACPI_DMT_RGRT: case ACPI_DMT_SDEV: case ACPI_DMT_SRAT: case ACPI_DMT_ASF: @@ -1077,6 +1110,11 @@ AcpiDmDumpTable ( ByteLength = strlen (ACPI_CAST_PTR (char, Target)) + 1; break; + case ACPI_DMT_IVRS_UNTERMINATED_STRING: + + ByteLength = ((ACPI_CAST_PTR (ACPI_IVRS_DEVICE_HID, Target) -1)->UidLength); + break; + case ACPI_DMT_GAS: if (!LastOutputBlankLine) @@ -1273,7 +1311,7 @@ AcpiDmDumpTable ( /* Convert 16-byte UUID buffer to 36-byte formatted UUID string */ - (void) AuConvertUuidToString ((char *) Target, AslGbl_MsgBuffer); + (void) AcpiUtConvertUuidToString ((char *) Target, AslGbl_MsgBuffer); AcpiOsPrintf ("%s\n", AslGbl_MsgBuffer); break; @@ -1283,6 +1321,11 @@ AcpiDmDumpTable ( AcpiOsPrintf ("\"%s\"\n", ACPI_CAST_PTR (char, Target)); break; + case ACPI_DMT_IVRS_UNTERMINATED_STRING: + + AcpiOsPrintf ("\"%.*s\"\n", ByteLength, ACPI_CAST_PTR (char, Target)); + break; + /* Fixed length ASCII name fields */ case ACPI_DMT_SIG: @@ -1684,6 +1727,20 @@ AcpiDmDumpTable ( AcpiDmDumpBuffer (Target, 0, ByteLength, 0, NULL); break; + case ACPI_DMT_RGRT: + + /* RGRT subtable types */ + + Temp8 = *Target; + if (Temp8 >= ACPI_RGRT_TYPE_RESERVED) + { + Temp8 = ACPI_RGRT_TYPE_RESERVED0; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmRgrtSubnames[Temp8]); + break; + case ACPI_DMT_SDEV: /* SDEV subtable types */ @@ -1750,21 +1807,62 @@ AcpiDmDumpTable ( { case ACPI_IVRS_TYPE_HARDWARE1: case ACPI_IVRS_TYPE_HARDWARE2: - case ACPI_IVRS_TYPE_HARDWARE3: Name = AcpiDmIvrsSubnames[0]; break; + case ACPI_IVRS_TYPE_HARDWARE3: + + Name = AcpiDmIvrsSubnames[1]; + break; + case ACPI_IVRS_TYPE_MEMORY1: case ACPI_IVRS_TYPE_MEMORY2: case ACPI_IVRS_TYPE_MEMORY3: - Name = AcpiDmIvrsSubnames[1]; + Name = AcpiDmIvrsSubnames[2]; break; default: - Name = AcpiDmIvrsSubnames[2]; + Name = AcpiDmIvrsSubnames[3]; + break; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, Name); + break; + + case ACPI_DMT_IVRS_DE: + + /* IVRS device entry types */ + + Temp8 = *Target; + switch (Temp8) + { + case ACPI_IVRS_TYPE_ALL: + case ACPI_IVRS_TYPE_SELECT: + case ACPI_IVRS_TYPE_START: + case ACPI_IVRS_TYPE_END: + + Name = AcpiDmIvrsDevEntryNames[Temp8]; + break; + + case ACPI_IVRS_TYPE_ALIAS_SELECT: + case ACPI_IVRS_TYPE_ALIAS_START: + case ACPI_IVRS_TYPE_EXT_SELECT: + case ACPI_IVRS_TYPE_EXT_START: + case ACPI_IVRS_TYPE_SPECIAL: + + Name = AcpiDmIvrsDevEntryNames[Temp8 - 61]; + break; + + case ACPI_IVRS_TYPE_HID: + + Name = AcpiDmIvrsDevEntryNames[Temp8 - 228]; + break; + + default: + Name = AcpiDmIvrsDevEntryNames[0]; /* Unknown/Reserved */ break; } diff --git a/sys/contrib/dev/acpica/common/dmtbdump2.c b/sys/contrib/dev/acpica/common/dmtbdump2.c index e3ab39b53078..a13e77e5c03b 100644 --- a/sys/contrib/dev/acpica/common/dmtbdump2.c +++ b/sys/contrib/dev/acpica/common/dmtbdump2.c @@ -153,6 +153,7 @@ #include #include #include +#include /* This module used for application-level code only */ @@ -483,7 +484,18 @@ NextSubtable: * * RETURN: None * - * DESCRIPTION: Format the contents of a IVRS + * DESCRIPTION: Format the contents of a IVRS. Notes: + * The IVRS is essentially a flat table, with the following + * structure: + *
+ *
+ * + * + * ... + * + * + * + * ... * ******************************************************************************/ @@ -513,36 +525,36 @@ AcpiDmDumpIvrs ( /* Subtables */ Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset); + while (Offset < Table->Length) { - /* Common subtable header */ - - AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, - Subtable->Length, AcpiDmTableInfoIvrsHdr); - if (ACPI_FAILURE (Status)) - { - return; - } - switch (Subtable->Type) { + /* Type 10h, IVHD (I/O Virtualization Hardware Definition) */ + case ACPI_IVRS_TYPE_HARDWARE1: - InfoTable = AcpiDmTableInfoIvrs0; + AcpiOsPrintf ("\n"); + InfoTable = AcpiDmTableInfoIvrsHware1; break; + /* Types 11h, 40h, IVHD (I/O Virtualization Hardware Definition) */ + case ACPI_IVRS_TYPE_HARDWARE2: case ACPI_IVRS_TYPE_HARDWARE3: - InfoTable = AcpiDmTableInfoIvrs01; + AcpiOsPrintf ("\n"); + InfoTable = AcpiDmTableInfoIvrsHware23; break; + /* Types 20h-22h, IVMD (I/O Virtualization Memory Definition Block) */ + case ACPI_IVRS_TYPE_MEMORY1: case ACPI_IVRS_TYPE_MEMORY2: case ACPI_IVRS_TYPE_MEMORY3: - InfoTable = AcpiDmTableInfoIvrs1; + AcpiOsPrintf ("\n"); + InfoTable = AcpiDmTableInfoIvrsMemory; break; default: @@ -562,7 +574,6 @@ AcpiDmDumpIvrs ( /* Dump the subtable */ - AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, Subtable->Length, InfoTable); if (ACPI_FAILURE (Status)) @@ -570,7 +581,7 @@ AcpiDmDumpIvrs ( return; } - /* The hardware subtable can contain multiple device entries */ + /* The hardware subtables (IVHD) can contain multiple device entries */ if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1 || Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2 || @@ -584,16 +595,19 @@ AcpiDmDumpIvrs ( } else { - /* ACPI_IVRS_TYPE_HARDWARE2 subtable type */ + /* ACPI_IVRS_TYPE_HARDWARE2, HARDWARE3 subtable types */ EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE2); DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable, sizeof (ACPI_IVRS_HARDWARE2)); } + /* Process all of the Device Entries */ + while (EntryOffset < (Offset + Subtable->Length)) { AcpiOsPrintf ("\n"); + /* * Upper 2 bits of Type encode the length of the device entry * @@ -645,7 +659,7 @@ AcpiDmDumpIvrs ( case ACPI_IVRS_TYPE_HID: - EntryLength = 22; + EntryLength = 4; InfoTable = AcpiDmTableInfoIvrsHid; break; @@ -669,21 +683,87 @@ AcpiDmDumpIvrs ( HidSubtable = ACPI_CAST_PTR (ACPI_IVRS_DEVICE_HID, DeviceEntry); EntryOffset += EntryLength; - DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, DeviceEntry, + DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, HidSubtable, EntryLength); if (EntryType == ACPI_IVRS_TYPE_HID) { - EntryLength = HidSubtable->UidLength; - Status = AcpiDmDumpTable (Table->Length, EntryOffset, - Table, EntryLength, AcpiDmTableInfoIvrsHid1); + /* + * Determine if the HID is an integer or a string. + * An integer is defined to be 32 bits, with the upper 32 bits + * set to zero. (from the ACPI Spec): "The HID can be a 32-bit + * integer or a character string. If an integer, the lower + * 4 bytes of the field contain the integer and the upper + * 4 bytes are padded with 0". + */ + if (UtIsIdInteger ((UINT8 *) &HidSubtable->AcpiHid)) + { + Status = AcpiDmDumpTable (Table->Length, EntryOffset, + &HidSubtable->AcpiHid, 8, AcpiDmTableInfoIvrsHidInteger); + } + else + { + Status = AcpiDmDumpTable (Table->Length, EntryOffset, + &HidSubtable->AcpiHid, 8, AcpiDmTableInfoIvrsHidString); + } if (ACPI_FAILURE (Status)) { return; } - EntryOffset += EntryLength; + + EntryOffset += 8; + + /* + * Determine if the CID is an integer or a string. The format + * of the CID is the same as the HID above. From ACPI Spec: + * "If present, CID must be a single Compatible Device ID + * following the same format as the HID field." + */ + if (UtIsIdInteger ((UINT8 *) &HidSubtable->AcpiCid)) + { + Status = AcpiDmDumpTable (Table->Length, EntryOffset, + &HidSubtable->AcpiCid, 8, AcpiDmTableInfoIvrsCidInteger); + } + else + { + Status = AcpiDmDumpTable (Table->Length, EntryOffset, + &HidSubtable->AcpiCid, 8, AcpiDmTableInfoIvrsCidString); + } + if (ACPI_FAILURE (Status)) + { + return; + } + + EntryOffset += 8; + EntryLength = HidSubtable->UidLength; + + if (EntryLength > ACPI_IVRS_UID_NOT_PRESENT) + { + /* Dump the UID based upon the UidType field (String or Integer) */ + + if (HidSubtable->UidType == ACPI_IVRS_UID_IS_STRING) + { + Status = AcpiDmDumpTable (Table->Length, EntryOffset, + &HidSubtable->UidType, EntryLength, AcpiDmTableInfoIvrsUidString); + if (ACPI_FAILURE (Status)) + { + return; + } + } + else /* ACPI_IVRS_UID_IS_INTEGER */ + { + Status = AcpiDmDumpTable (Table->Length, EntryOffset, + &HidSubtable->UidType, EntryLength, AcpiDmTableInfoIvrsUidInteger); + if (ACPI_FAILURE (Status)) + { + return; + } + } + } + + EntryOffset += EntryLength+2; DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, - DeviceEntry, EntryLength); + Table, EntryOffset); } } } @@ -1923,6 +2003,108 @@ NextSubtable: } +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpPrmt + * + * PARAMETERS: Table - A PRMT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a PRMT. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpPrmt ( + ACPI_TABLE_HEADER *Table) +{ + UINT32 CurrentOffset = sizeof (ACPI_TABLE_HEADER); + ACPI_TABLE_PRMT_HEADER *PrmtHeader; + ACPI_PRMT_MODULE_INFO *PrmtModuleInfo; + ACPI_PRMT_HANDLER_INFO *PrmtHandlerInfo; + ACPI_STATUS Status; + UINT32 i, j; + + + /* Main table header */ + + PrmtHeader = ACPI_ADD_PTR (ACPI_TABLE_PRMT_HEADER, Table, CurrentOffset); + Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtHeader, + sizeof (ACPI_TABLE_PRMT_HEADER), AcpiDmTableInfoPrmtHdr); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("Invalid PRMT header\n"); + return; + } + + CurrentOffset += sizeof (ACPI_TABLE_PRMT_HEADER); + + /* PRM Module Information Structure array */ + + for (i = 0; i < PrmtHeader->ModuleInfoCount; ++i) + { + PrmtModuleInfo = ACPI_ADD_PTR (ACPI_PRMT_MODULE_INFO, Table, CurrentOffset); + Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtModuleInfo, + sizeof (ACPI_PRMT_MODULE_INFO), AcpiDmTableInfoPrmtModule); + + CurrentOffset += sizeof (ACPI_PRMT_MODULE_INFO); + + /* PRM handler information structure array */ + + for (j = 0; j < PrmtModuleInfo->HandlerInfoCount; ++j) + { + PrmtHandlerInfo = ACPI_ADD_PTR (ACPI_PRMT_HANDLER_INFO, Table, CurrentOffset); + Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtHandlerInfo, + sizeof (ACPI_PRMT_HANDLER_INFO), AcpiDmTableInfoPrmtHandler); + + CurrentOffset += sizeof (ACPI_PRMT_HANDLER_INFO); + } + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpRgrt + * + * PARAMETERS: Table - A RGRT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a RGRT + * + ******************************************************************************/ + +void +AcpiDmDumpRgrt ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_TABLE_RGRT *Subtable = ACPI_CAST_PTR (ACPI_TABLE_RGRT, Table); + UINT32 Offset = sizeof (ACPI_TABLE_RGRT); + + + /* Main table */ + + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoRgrt); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Dump the binary image as a subtable */ + + Status = AcpiDmDumpTable (Table->Length, Offset, &Subtable->Image, + Table->Length - Offset, AcpiDmTableInfoRgrt0); + if (ACPI_FAILURE (Status)) + { + return; + } +} + + /******************************************************************************* * * FUNCTION: AcpiDmDumpS3pt diff --git a/sys/contrib/dev/acpica/common/dmtbdump3.c b/sys/contrib/dev/acpica/common/dmtbdump3.c index 6f3b8f17e039..38404bc3317c 100644 --- a/sys/contrib/dev/acpica/common/dmtbdump3.c +++ b/sys/contrib/dev/acpica/common/dmtbdump3.c @@ -420,6 +420,65 @@ AcpiDmDumpStao ( } +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpSvkl + * + * PARAMETERS: Table - A SVKL table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a SVKL. This is a variable-length + * table that contains an open-ended number of key subtables at + * the end of the header. + * + * NOTES: SVKL is essentially a flat table, with a small main table and + * a variable number of a single type of subtable. + * + ******************************************************************************/ + +void +AcpiDmDumpSvkl ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_SVKL); + ACPI_SVKL_KEY *Subtable; + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSvkl); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* The rest of the table consists of subtables (single type) */ + + Subtable = ACPI_ADD_PTR (ACPI_SVKL_KEY, Table, Offset); + while (Offset < Table->Length) + { + /* Dump the subtable */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + sizeof (ACPI_SVKL_KEY), AcpiDmTableInfoSvkl0); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next subtable */ + + Offset += sizeof (ACPI_SVKL_KEY); + Subtable = ACPI_ADD_PTR (ACPI_SVKL_KEY, Subtable, + sizeof (ACPI_SVKL_KEY)); + } +} + + /******************************************************************************* * * FUNCTION: AcpiDmDumpTcpa @@ -502,6 +561,7 @@ AcpiDmDumpTcpa ( * DESCRIPTION: Format the contents of a TPM2. * ******************************************************************************/ + static void AcpiDmDumpTpm2Rev3 ( ACPI_TABLE_HEADER *Table) diff --git a/sys/contrib/dev/acpica/common/dmtbinfo1.c b/sys/contrib/dev/acpica/common/dmtbinfo1.c index 1e4eb0542d71..a6c46e55bf0a 100644 --- a/sys/contrib/dev/acpica/common/dmtbinfo1.c +++ b/sys/contrib/dev/acpica/common/dmtbinfo1.c @@ -295,6 +295,19 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[] = }; +/******************************************************************************* + * + * BDAT - BIOS Data ACPI Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoBdat[] = +{ + {ACPI_DMT_GAS, ACPI_BDAT_OFFSET (Gas), "BDAT Generic Address", 0}, + ACPI_DMT_TERMINATOR +}; + + /******************************************************************************* * * BERT - Boot Error Record table diff --git a/sys/contrib/dev/acpica/common/dmtbinfo2.c b/sys/contrib/dev/acpica/common/dmtbinfo2.c index b51acd654997..3eb4e44902d3 100644 --- a/sys/contrib/dev/acpica/common/dmtbinfo2.c +++ b/sys/contrib/dev/acpica/common/dmtbinfo2.c @@ -414,23 +414,24 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs[] = ACPI_DMT_TERMINATOR }; -/* Common Subtable header (one per Subtable) */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsHdr[] = -{ - {ACPI_DMT_IVRS, ACPI_IVRSH_OFFSET (Type), "Subtable Type", 0}, - {ACPI_DMT_UINT8, ACPI_IVRSH_OFFSET (Flags), "Flags", 0}, - {ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (Length), "Length", DT_LENGTH}, - {ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (DeviceId), "DeviceId", 0}, - ACPI_DMT_TERMINATOR -}; - /* IVRS subtables */ /* 0x10: I/O Virtualization Hardware Definition (IVHD) Block */ -ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs0[] = +ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsHware1[] = { + {ACPI_DMT_IVRS, ACPI_IVRSH_OFFSET (Type), "Subtable Type", 0}, + {ACPI_DMT_UINT8, ACPI_IVRSH_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_IVRS_FLAG_OFFSET (Flags,0), "HtTunEn", 0}, + {ACPI_DMT_FLAG1, ACPI_IVRS_FLAG_OFFSET (Flags,0), "PassPW", 0}, + {ACPI_DMT_FLAG2, ACPI_IVRS_FLAG_OFFSET (Flags,0), "ResPassPW", 0}, + {ACPI_DMT_FLAG3, ACPI_IVRS_FLAG_OFFSET (Flags,0), "Isoc Control", 0}, + {ACPI_DMT_FLAG4, ACPI_IVRS_FLAG_OFFSET (Flags,0), "Iotlb Support", 0}, + {ACPI_DMT_FLAG5, ACPI_IVRS_FLAG_OFFSET (Flags,0), "Coherent", 0}, + {ACPI_DMT_FLAG6, ACPI_IVRS_FLAG_OFFSET (Flags,0), "Prefetch Support", 0}, + {ACPI_DMT_FLAG7, ACPI_IVRS_FLAG_OFFSET (Flags,0), "PPR Support", 0}, + {ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (Length), "Length", DT_LENGTH}, + {ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (DeviceId), "DeviceId", 0}, {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (CapabilityOffset), "Capability Offset", 0}, {ACPI_DMT_UINT64, ACPI_IVRS0_OFFSET (BaseAddress), "Base Address", 0}, {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (PciSegmentGroup), "PCI Segment Group", 0}, @@ -439,24 +440,44 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs0[] = ACPI_DMT_TERMINATOR }; -/* 0x10: I/O Virtualization Hardware Definition (IVHD) Block */ +/* 0x11, 0x40: I/O Virtualization Hardware Definition (IVHD) Block */ -ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs01[] = +ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsHware23[] = { - {ACPI_DMT_UINT16, ACPI_IVRS01_OFFSET (CapabilityOffset), "Capability Offset", 0}, - {ACPI_DMT_UINT64, ACPI_IVRS01_OFFSET (BaseAddress), "Base Address", 0}, - {ACPI_DMT_UINT16, ACPI_IVRS01_OFFSET (PciSegmentGroup), "PCI Segment Group", 0}, - {ACPI_DMT_UINT16, ACPI_IVRS01_OFFSET (Info), "Virtualization Info", 0}, - {ACPI_DMT_UINT32, ACPI_IVRS01_OFFSET (Attributes), "Attributes", 0}, - {ACPI_DMT_UINT64, ACPI_IVRS01_OFFSET (EfrRegisterImage), "EFR Image", 0}, - {ACPI_DMT_UINT64, ACPI_IVRS01_OFFSET (Reserved), "Reserved", 0}, - ACPI_DMT_TERMINATOR -}; - -/* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition (IVMD) Block */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs1[] = + {ACPI_DMT_IVRS, ACPI_IVRSH_OFFSET (Type), "Subtable Type", 0}, + {ACPI_DMT_UINT8, ACPI_IVRSH_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_IVRS_FLAG_OFFSET (Flags,0), "HtTunEn", 0}, + {ACPI_DMT_FLAG1, ACPI_IVRS_FLAG_OFFSET (Flags,0), "PassPW", 0}, + {ACPI_DMT_FLAG2, ACPI_IVRS_FLAG_OFFSET (Flags,0), "ResPassPW", 0}, + {ACPI_DMT_FLAG3, ACPI_IVRS_FLAG_OFFSET (Flags,0), "Isoc Control", 0}, + {ACPI_DMT_FLAG4, ACPI_IVRS_FLAG_OFFSET (Flags,0), "Iotlb Support", 0}, + {ACPI_DMT_FLAG5, ACPI_IVRS_FLAG_OFFSET (Flags,0), "Coherent", 0}, + {ACPI_DMT_FLAG6, ACPI_IVRS_FLAG_OFFSET (Flags,0), "Prefetch Support", 0}, + {ACPI_DMT_FLAG7, ACPI_IVRS_FLAG_OFFSET (Flags,0), "PPR Support", 0}, + {ACPI_DMT_UINT16, ACPI_IVRS01_OFFSET (Header.Length), "Length", DT_LENGTH}, + {ACPI_DMT_UINT16, ACPI_IVRS01_OFFSET (Header.DeviceId), "DeviceId", 0}, + {ACPI_DMT_UINT16, ACPI_IVRS01_OFFSET (CapabilityOffset), "Capability Offset", 0}, + {ACPI_DMT_UINT64, ACPI_IVRS01_OFFSET (BaseAddress), "Base Address", 0}, + {ACPI_DMT_UINT16, ACPI_IVRS01_OFFSET (PciSegmentGroup), "PCI Segment Group", 0}, + {ACPI_DMT_UINT16, ACPI_IVRS01_OFFSET (Info), "Virtualization Info", 0}, + {ACPI_DMT_UINT32, ACPI_IVRS01_OFFSET (Attributes), "Attributes", 0}, + {ACPI_DMT_UINT64, ACPI_IVRS01_OFFSET (EfrRegisterImage), "EFR Image", 0}, + {ACPI_DMT_UINT64, ACPI_IVRS01_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition (IVMD) Device Entry Block */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsMemory[] = { + {ACPI_DMT_IVRS, ACPI_IVRSH_OFFSET (Type), "Subtable Type", 0}, + {ACPI_DMT_UINT8, ACPI_IVRSH_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_IVRS_FLAG_OFFSET (Flags,0), "Unity", 0}, + {ACPI_DMT_FLAG1, ACPI_IVRS_FLAG_OFFSET (Flags,0), "Readable", 0}, + {ACPI_DMT_FLAG2, ACPI_IVRS_FLAG_OFFSET (Flags,0), "Writeable", 0}, + {ACPI_DMT_FLAG3, ACPI_IVRS_FLAG_OFFSET (Flags,0), "Exclusion Range", 0}, + {ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (Length), "Length", DT_LENGTH}, + {ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (DeviceId), "DeviceId", 0}, {ACPI_DMT_UINT16, ACPI_IVRS1_OFFSET (AuxData), "Auxiliary Data", 0}, {ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (StartAddress), "Start Address", 0}, @@ -467,19 +488,26 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs1[] = /* Device entry header for IVHD block */ #define ACPI_DMT_IVRS_DE_HEADER \ - {ACPI_DMT_UINT8, ACPI_IVRSD_OFFSET (Type), "Entry Type", 0}, \ + {ACPI_DMT_IVRS_DE, ACPI_IVRSD_OFFSET (Type), "Subtable Type", 0}, \ {ACPI_DMT_UINT16, ACPI_IVRSD_OFFSET (Id), "Device ID", 0}, \ - {ACPI_DMT_UINT8, ACPI_IVRSD_OFFSET (DataSetting), "Data Setting", 0} + {ACPI_DMT_UINT8, ACPI_IVRSD_OFFSET (DataSetting), "Data Setting (decoded below)", 0}, \ + {ACPI_DMT_FLAG0, ACPI_IVRSDE_FLAG_OFFSET (DataSetting, 0), "INITPass", 0}, \ + {ACPI_DMT_FLAG1, ACPI_IVRSDE_FLAG_OFFSET (DataSetting, 0), "EIntPass", 0}, \ + {ACPI_DMT_FLAG2, ACPI_IVRSDE_FLAG_OFFSET (DataSetting, 0), "NMIPass", 0}, \ + {ACPI_DMT_FLAG3, ACPI_IVRSDE_FLAG_OFFSET (DataSetting, 0), "Reserved", 0}, \ + {ACPI_DMT_FLAGS4, ACPI_IVRSDE_FLAG_OFFSET (DataSetting, 0), "System MGMT", 0}, \ + {ACPI_DMT_FLAG6, ACPI_IVRSDE_FLAG_OFFSET (DataSetting, 0), "LINT0 Pass", 0}, \ + {ACPI_DMT_FLAG7, ACPI_IVRSDE_FLAG_OFFSET (DataSetting, 0), "LINT1 Pass", 0} -/* 4-byte device entry */ +/* 4-byte device entry (Types 1,2,3,4) */ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs4[] = { *** 1983 LINES SKIPPED *** From owner-dev-commits-src-main@freebsd.org Sat Jun 5 12:37:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 175CD64275C; Sat, 5 Jun 2021 12:37:10 +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 4FxzfZ0C1Wz4tjG; Sat, 5 Jun 2021 12:37:10 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E343E10B23; Sat, 5 Jun 2021 12:37:09 +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 155Cb9Oo089502; Sat, 5 Jun 2021 12:37:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 155Cb9jb089501; Sat, 5 Jun 2021 12:37:09 GMT (envelope-from git) Date: Sat, 5 Jun 2021 12:37:09 GMT Message-Id: <202106051237.155Cb9jb089501@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Moeller Subject: git: 94dc57159532 - main - libcasper: Create a minimal cap_netdb service MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 94dc57159532d7bbf94d109e79fd202a57150562 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2021 12:37:10 -0000 The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=94dc57159532d7bbf94d109e79fd202a57150562 commit 94dc57159532d7bbf94d109e79fd202a57150562 Author: Ryan Moeller AuthorDate: 2021-03-26 19:40:19 +0000 Commit: Ryan Moeller CommitDate: 2021-06-05 12:36:53 +0000 libcasper: Create a minimal cap_netdb service Create a casper service for netdb functions. Initially only cap_getprotobyname is implemented. This is needed for capsicumizing sockstat. Reviewed by: oshogbo, bcr (manpages) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D24832 --- lib/libcasper/services/Makefile | 1 + lib/libcasper/services/cap_netdb/Makefile | 32 +++++ lib/libcasper/services/cap_netdb/cap_netdb.3 | 90 ++++++++++++ lib/libcasper/services/cap_netdb/cap_netdb.c | 155 +++++++++++++++++++++ lib/libcasper/services/cap_netdb/cap_netdb.h | 49 +++++++ lib/libcasper/services/cap_netdb/tests/Makefile | 14 ++ .../services/cap_netdb/tests/netdb_test.c | 94 +++++++++++++ share/mk/src.libnames.mk | 1 + 8 files changed, 436 insertions(+) diff --git a/lib/libcasper/services/Makefile b/lib/libcasper/services/Makefile index 8fcb2e1e5c64..dfd4aaa76653 100644 --- a/lib/libcasper/services/Makefile +++ b/lib/libcasper/services/Makefile @@ -6,6 +6,7 @@ SUBDIR= cap_dns SUBDIR+= cap_fileargs SUBDIR+= cap_grp SUBDIR+= cap_net +SUBDIR+= cap_netdb SUBDIR+= cap_pwd SUBDIR+= cap_sysctl SUBDIR+= cap_syslog diff --git a/lib/libcasper/services/cap_netdb/Makefile b/lib/libcasper/services/cap_netdb/Makefile new file mode 100644 index 000000000000..5070976d2e25 --- /dev/null +++ b/lib/libcasper/services/cap_netdb/Makefile @@ -0,0 +1,32 @@ +# $FreeBSD$ + +SHLIBDIR?= /lib/casper + +.include + +PACKAGE= runtime + +SHLIB_MAJOR= 1 +INCSDIR?= ${INCLUDEDIR}/casper + +.if ${MK_CASPER} != "no" +SHLIB= cap_netdb + +SRCS= cap_netdb.c +.endif + +INCS= cap_netdb.h + +LIBADD= nv + +CFLAGS+=-I${.CURDIR} + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests + +MAN+= cap_netdb.3 + +MLINKS+=cap_netdb.3 libcap_netdb.3 +MLINKS+=cap_netdb.3 cap_getprotobyname.3 + +.include diff --git a/lib/libcasper/services/cap_netdb/cap_netdb.3 b/lib/libcasper/services/cap_netdb/cap_netdb.3 new file mode 100644 index 000000000000..6df34559224c --- /dev/null +++ b/lib/libcasper/services/cap_netdb/cap_netdb.3 @@ -0,0 +1,90 @@ +.\" Copyright (c) 2020 Ryan Moeller +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd May 12, 2020 +.Dt CAP_NETDB 3 +.Os +.Sh NAME +.Nm cap_getprotobyname , +.Nd "library for getting network proto entry in capability mode" +.Sh LIBRARY +.Lb libcap_netdb +.Sh SYNOPSIS +.In sys/nv.h +.In libcasper.h +.In casper/cap_netdb.h +.Ft "struct protoent *" +.Fn cap_getprotobyname "const cap_channel_t *chan" "const char *name" +.Sh DESCRIPTION +.Bf -symbolic +The function +.Fn cap_getprotobyname +is equivalent to +.Xr getprotobyname 3 +except that the connection to the +.Nm system.netdb +service needs to be provided. +.Sh EXAMPLES +The following example first opens a capability to casper and then uses this +capability to create the +.Nm system.netdb +casper service and uses it to look up a protocol by name. +.Bd -literal +cap_channel_t *capcas, *capnetdb; +struct protoent *ent; + +/* Open capability to Casper. */ +capcas = cap_init(); +if (capcas == NULL) + err(1, "Unable to contact Casper"); + +/* Enter capability mode sandbox. */ +if (caph_enter() < 0) + err(1, "Unable to enter capability mode"); + +/* Use Casper capability to create capability to the system.netdb service. */ +capnetdb = cap_service_open(capcas, "system.netdb"); +if (capnetdb == NULL) + err(1, "Unable to open system.netdb service"); + +/* Close Casper capability, we don't need it anymore. */ +cap_close(capcas); + +ent = cap_getprotobyname(capnetdb, "http"); +if (ent == NULL) + errx(1, "cap_getprotobyname failed to find http proto"); +.Ed +.Sh SEE ALSO +.Xr cap_enter 2 , +.Xr caph_enter 3 , +.Xr err 3 , +.Xr getprotobyname 3 , +.Xr capsicum 4 , +.Xr nv 9 +.Sh AUTHORS +The +.Nm cap_netdb +service was implemented by +.An Ryan Moeller Aq Mt freqlabs@FreeBSD.org . diff --git a/lib/libcasper/services/cap_netdb/cap_netdb.c b/lib/libcasper/services/cap_netdb/cap_netdb.c new file mode 100644 index 000000000000..e07deb93a798 --- /dev/null +++ b/lib/libcasper/services/cap_netdb/cap_netdb.c @@ -0,0 +1,155 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Ryan Moeller + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "cap_netdb.h" + +static struct protoent * +protoent_unpack(nvlist_t *nvl) +{ + struct protoent *pp; + char **aliases; + size_t n; + + pp = malloc(sizeof(*pp)); + if (pp == NULL) { + nvlist_destroy(nvl); + return (NULL); + } + + pp->p_name = nvlist_take_string(nvl, "name"); + + aliases = nvlist_take_string_array(nvl, "aliases", &n); + pp->p_aliases = realloc(aliases, sizeof(char *) * (n + 1)); + if (pp->p_aliases == NULL) { + while (n-- > 0) + free(aliases[n]); + free(aliases); + free(pp->p_name); + free(pp); + nvlist_destroy(nvl); + return (NULL); + } + pp->p_aliases[n] = NULL; + + pp->p_proto = (int)nvlist_take_number(nvl, "proto"); + + nvlist_destroy(nvl); + return (pp); +} + +struct protoent * +cap_getprotobyname(cap_channel_t *chan, const char *name) +{ + nvlist_t *nvl; + + nvl = nvlist_create(0); + nvlist_add_string(nvl, "cmd", "getprotobyname"); + nvlist_add_string(nvl, "name", name); + nvl = cap_xfer_nvlist(chan, nvl); + if (nvl == NULL) + return (NULL); + if (dnvlist_get_number(nvl, "error", 0) != 0) { + nvlist_destroy(nvl); + return (NULL); + } + return (protoent_unpack(nvl)); +} + +static void +protoent_pack(const struct protoent *pp, nvlist_t *nvl) +{ + int n = 0; + + nvlist_add_string(nvl, "name", pp->p_name); + + while (pp->p_aliases[n] != NULL) + ++n; + nvlist_add_string_array(nvl, "aliases", + (const char * const *)pp->p_aliases, n); + + nvlist_add_number(nvl, "proto", (uint64_t)pp->p_proto); +} + +static int +netdb_getprotobyname(const nvlist_t *limits __unused, const nvlist_t *nvlin, + nvlist_t *nvlout) +{ + const char *name; + struct protoent *pp; + + name = dnvlist_get_string(nvlin, "name", NULL); + if (name == NULL) + return (EDOOFUS); + + pp = getprotobyname(name); + if (pp == NULL) + return (EINVAL); + + protoent_pack(pp, nvlout); + return (0); +} + +static int +netdb_limit(const nvlist_t *oldlimits __unused, + const nvlist_t *newlimits __unused) +{ + + return (0); +} + +static int +netdb_command(const char *cmd, const nvlist_t *limits, nvlist_t *nvlin, + nvlist_t *nvlout) +{ + int error; + + if (strcmp(cmd, "getprotobyname") == 0) + error = netdb_getprotobyname(limits, nvlin, nvlout); + else + error = NO_RECOVERY; + + return (error); +} + +CREATE_SERVICE("system.netdb", netdb_limit, netdb_command, 0); diff --git a/lib/libcasper/services/cap_netdb/cap_netdb.h b/lib/libcasper/services/cap_netdb/cap_netdb.h new file mode 100644 index 000000000000..4dc33c351520 --- /dev/null +++ b/lib/libcasper/services/cap_netdb/cap_netdb.h @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2020 Ryan Moeller + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _CAP_NETDB_H_ +#define _CAP_NETDB_H_ + +#ifdef HAVE_CASPER +#define WITH_CASPER +#endif + +#include + +#include + +#ifdef WITH_CASPER +__BEGIN_DECLS + +struct protoent *cap_getprotobyname(cap_channel_t *chan, const char *name); + +__END_DECLS +#else +#define cap_getprotobyname(chan, name) getprotobyname(name) +#endif + +#endif /* !_CAP_NETDB_H_ */ diff --git a/lib/libcasper/services/cap_netdb/tests/Makefile b/lib/libcasper/services/cap_netdb/tests/Makefile new file mode 100644 index 000000000000..eb7bc45d960d --- /dev/null +++ b/lib/libcasper/services/cap_netdb/tests/Makefile @@ -0,0 +1,14 @@ +# $FreeBSD$ + +.include + +ATF_TESTS_C= netdb_test + +.if ${MK_CASPER} != "no" +LIBADD+= casper +LIBADD+= cap_netdb +CFLAGS+=-DWITH_CASPER +.endif +LIBADD+= nv + +.include diff --git a/lib/libcasper/services/cap_netdb/tests/netdb_test.c b/lib/libcasper/services/cap_netdb/tests/netdb_test.c new file mode 100644 index 000000000000..afe43b575572 --- /dev/null +++ b/lib/libcasper/services/cap_netdb/tests/netdb_test.c @@ -0,0 +1,94 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Ryan Moeller + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +static cap_channel_t * +initcap(void) +{ + cap_channel_t *capcas, *capnetdb; + + capcas = cap_init(); + ATF_REQUIRE(capcas != NULL); + + capnetdb = cap_service_open(capcas, "system.netdb"); + ATF_REQUIRE(capnetdb != NULL); + + cap_close(capcas); + + return (capnetdb); +} + +ATF_TC_WITHOUT_HEAD(cap_netdb__getprotobyname); +ATF_TC_BODY(cap_netdb__getprotobyname, tc) +{ + cap_channel_t *capnetdb; + struct protoent *pp; + size_t n = 0; + + capnetdb = initcap(); + + pp = cap_getprotobyname(capnetdb, "tcp"); + ATF_REQUIRE(pp != NULL); + + ATF_REQUIRE(pp->p_name != NULL); + ATF_REQUIRE(pp->p_aliases != NULL); + while (pp->p_aliases[n] != NULL) + ++n; + ATF_REQUIRE(n > 0); + ATF_REQUIRE(pp->p_proto != 0); + + cap_close(capnetdb); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, cap_netdb__getprotobyname); + + return (atf_no_error()); +} diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index db76fdd0486c..61373dceb4d1 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -107,6 +107,7 @@ _LIBRARIES= \ cap_fileargs \ cap_grp \ cap_net \ + cap_netdb \ cap_pwd \ cap_sysctl \ cap_syslog \ From owner-dev-commits-src-main@freebsd.org Sat Jun 5 12:37:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CF1B6427FD; Sat, 5 Jun 2021 12:37:11 +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 4Fxzfb0psbz4tlv; Sat, 5 Jun 2021 12:37:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0289A10B24; Sat, 5 Jun 2021 12:37:11 +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 155CbAkM089530; Sat, 5 Jun 2021 12:37:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 155CbAbw089529; Sat, 5 Jun 2021 12:37:10 GMT (envelope-from git) Date: Sat, 5 Jun 2021 12:37:10 GMT Message-Id: <202106051237.155CbAbw089529@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Moeller Subject: git: c5a2d8c5f517 - main - sockstat: Use libcasper to capsicumize MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c5a2d8c5f517b056bed2af64e6134481367773d4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2021 12:37:11 -0000 The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=c5a2d8c5f517b056bed2af64e6134481367773d4 commit c5a2d8c5f517b056bed2af64e6134481367773d4 Author: Ryan Moeller AuthorDate: 2021-03-26 19:42:19 +0000 Commit: Ryan Moeller CommitDate: 2021-06-05 12:36:55 +0000 sockstat: Use libcasper to capsicumize Drop rights we do not need. This has to be done after jail_attach. Reviewed by: oshogbo Relnotes: yes Differential Revision: https://reviews.freebsd.org/D26958 --- usr.bin/sockstat/Makefile | 10 ++++++ usr.bin/sockstat/sockstat.c | 80 +++++++++++++++++++++++++++++++++------------ 2 files changed, 69 insertions(+), 21 deletions(-) diff --git a/usr.bin/sockstat/Makefile b/usr.bin/sockstat/Makefile index 2f8f9655e8db..6d0de7dc22d0 100644 --- a/usr.bin/sockstat/Makefile +++ b/usr.bin/sockstat/Makefile @@ -1,7 +1,17 @@ # $FreeBSD$ +.include + PROG= sockstat LIBADD= jail +.if ${MK_CASPER} != "no" +LIBADD+= casper +LIBADD+= cap_net +LIBADD+= cap_netdb +LIBADD+= cap_sysctl +CFLAGS+= -DWITH_CASPER +.endif + .include diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c index 109b254b7438..7dc5e4904deb 100644 --- a/usr.bin/sockstat/sockstat.c +++ b/usr.bin/sockstat/sockstat.c @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -67,6 +68,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include + #define sstosin(ss) ((struct sockaddr_in *)(ss)) #define sstosin6(ss) ((struct sockaddr_in6 *)(ss)) #define sstosun(ss) ((struct sockaddr_un *)(ss)) @@ -132,6 +138,10 @@ static struct sock *sockhash[HASHSIZE]; static struct xfile *xfiles; static int nxfiles; +static cap_channel_t *capnet; +static cap_channel_t *capnetdb; +static cap_channel_t *capsysctl; + static int xprintf(const char *fmt, ...) { @@ -153,9 +163,9 @@ get_proto_type(const char *proto) if (strlen(proto) == 0) return (0); - pent = getprotobyname(proto); + pent = cap_getprotobyname(capnetdb, proto); if (pent == NULL) { - warn("getprotobyname"); + warn("cap_getprotobyname"); return (-1); } return (pent->p_proto); @@ -321,17 +331,17 @@ gather_sctp(void) vflag |= INP_IPV6; varname = "net.inet.sctp.assoclist"; - if (sysctlbyname(varname, 0, &len, 0, 0) < 0) { + if (cap_sysctlbyname(capsysctl, varname, 0, &len, 0, 0) < 0) { if (errno != ENOENT) - err(1, "sysctlbyname()"); + err(1, "cap_sysctlbyname()"); return; } if ((buf = (char *)malloc(len)) == NULL) { err(1, "malloc()"); return; } - if (sysctlbyname(varname, buf, &len, 0, 0) < 0) { - err(1, "sysctlbyname()"); + if (cap_sysctlbyname(capsysctl, varname, buf, &len, 0, 0) < 0) { + err(1, "cap_sysctlbyname()"); free(buf); return; } @@ -618,12 +628,13 @@ gather_inet(int proto) if ((buf = realloc(buf, bufsize)) == NULL) err(1, "realloc()"); len = bufsize; - if (sysctlbyname(varname, buf, &len, NULL, 0) == 0) + if (cap_sysctlbyname(capsysctl, varname, buf, &len, + NULL, 0) == 0) break; if (errno == ENOENT) goto out; if (errno != ENOMEM || len != bufsize) - err(1, "sysctlbyname()"); + err(1, "cap_sysctlbyname()"); bufsize *= 2; } xig = (struct xinpgen *)buf; @@ -768,10 +779,11 @@ gather_unix(int proto) if ((buf = realloc(buf, bufsize)) == NULL) err(1, "realloc()"); len = bufsize; - if (sysctlbyname(varname, buf, &len, NULL, 0) == 0) + if (cap_sysctlbyname(capsysctl, varname, buf, &len, + NULL, 0) == 0) break; if (errno != ENOMEM || len != bufsize) - err(1, "sysctlbyname()"); + err(1, "cap_sysctlbyname()"); bufsize *= 2; } xug = (struct xunpgen *)buf; @@ -835,9 +847,10 @@ getfiles(void) olen = len = sizeof(*xfiles); if ((xfiles = malloc(len)) == NULL) err(1, "malloc()"); - while (sysctlbyname("kern.file", xfiles, &len, 0, 0) == -1) { + while (cap_sysctlbyname(capsysctl, "kern.file", xfiles, &len, 0, 0) + == -1) { if (errno != ENOMEM || len != olen) - err(1, "sysctlbyname()"); + err(1, "cap_sysctlbyname()"); olen = len *= 2; if ((xfiles = realloc(xfiles, len)) == NULL) err(1, "realloc()"); @@ -871,10 +884,10 @@ printaddr(struct sockaddr_storage *ss) return (xprintf("%.*s", sun->sun_len - off, sun->sun_path)); } if (addrstr[0] == '\0') { - error = getnameinfo(sstosa(ss), ss->ss_len, addrstr, - sizeof(addrstr), NULL, 0, NI_NUMERICHOST); + error = cap_getnameinfo(capnet, sstosa(ss), ss->ss_len, + addrstr, sizeof(addrstr), NULL, 0, NI_NUMERICHOST); if (error) - errx(1, "getnameinfo()"); + errx(1, "cap_getnameinfo()"); } if (port == 0) return xprintf("%s:*", addrstr); @@ -894,10 +907,11 @@ getprocname(pid_t pid) mib[2] = KERN_PROC_PID; mib[3] = (int)pid; len = sizeof(proc); - if (sysctl(mib, nitems(mib), &proc, &len, NULL, 0) == -1) { + if (cap_sysctl(capsysctl, mib, nitems(mib), &proc, &len, NULL, 0) + == -1) { /* Do not warn if the process exits before we get its name. */ if (errno != ESRCH) - warn("sysctl()"); + warn("cap_sysctl()"); return ("??"); } return (proc.ki_comm); @@ -915,10 +929,11 @@ getprocjid(pid_t pid) mib[2] = KERN_PROC_PID; mib[3] = (int)pid; len = sizeof(proc); - if (sysctl(mib, nitems(mib), &proc, &len, NULL, 0) == -1) { + if (cap_sysctl(capsysctl, mib, nitems(mib), &proc, &len, NULL, 0) + == -1) { /* Do not warn if the process exits before we get its jid. */ if (errno != ESRCH) - warn("sysctl()"); + warn("cap_sysctl()"); return (-1); } return (proc.ki_jid); @@ -1254,9 +1269,9 @@ set_default_protos(void) for (pindex = 0; pindex < default_numprotos; pindex++) { pname = default_protos[pindex]; - prot = getprotobyname(pname); + prot = cap_getprotobyname(capnetdb, pname); if (prot == NULL) - err(1, "getprotobyname: %s", pname); + err(1, "cap_getprotobyname: %s", pname); protos[pindex] = prot->p_proto; } numprotos = pindex; @@ -1306,6 +1321,8 @@ usage(void) int main(int argc, char *argv[]) { + cap_channel_t *capcas; + cap_net_limit_t *limit; int protos_defined = -1; int o, i; @@ -1390,6 +1407,27 @@ main(int argc, char *argv[]) } } + capcas = cap_init(); + if (capcas == NULL) + err(1, "Unable to contact Casper"); + if (caph_enter_casper() < 0) + err(1, "Unable to enter capability mode"); + capnet = cap_service_open(capcas, "system.net"); + if (capnet == NULL) + err(1, "Unable to open system.net service"); + capnetdb = cap_service_open(capcas, "system.netdb"); + if (capnetdb == NULL) + err(1, "Unable to open system.netdb service"); + capsysctl = cap_service_open(capcas, "system.sysctl"); + if (capsysctl == NULL) + err(1, "Unable to open system.sysctl service"); + cap_close(capcas); + limit = cap_net_limit_init(capnet, CAPNET_ADDR2NAME); + if (limit == NULL) + err(1, "Unable to init cap_net limits"); + if (cap_net_limit(limit) < 0) + err(1, "Unable to apply limits"); + if ((!opt_4 && !opt_6) && protos_defined != -1) opt_4 = opt_6 = 1; if (!opt_4 && !opt_6 && !opt_u) From owner-dev-commits-src-main@freebsd.org Sat Jun 5 14:32:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2011E644006; Sat, 5 Jun 2021 14:32: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 4Fy2D50S9vz3HBk; Sat, 5 Jun 2021 14:32:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 ECD68120BA; Sat, 5 Jun 2021 14:32: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 155EWqrC049236; Sat, 5 Jun 2021 14:32:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 155EWqWP049235; Sat, 5 Jun 2021 14:32:52 GMT (envelope-from git) Date: Sat, 5 Jun 2021 14:32:52 GMT Message-Id: <202106051432.155EWqWP049235@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Allan Jude Subject: git: c6a311678d66 - main - nextboot: Improve the shell code used to figure out the zpool name MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: allanjude X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c6a311678d667cb1e7b5417edb6567b7f07d148d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2021 14:32:53 -0000 The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=c6a311678d667cb1e7b5417edb6567b7f07d148d commit c6a311678d667cb1e7b5417edb6567b7f07d148d Author: Allan Jude AuthorDate: 2021-06-04 22:09:43 +0000 Commit: Allan Jude CommitDate: 2021-06-05 14:32:18 +0000 nextboot: Improve the shell code used to figure out the zpool name Reported by: imp Reviewed by: imp, tsoome Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D30650 --- sbin/reboot/nextboot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/reboot/nextboot.sh b/sbin/reboot/nextboot.sh index 849d7a377714..2350c42516bf 100644 --- a/sbin/reboot/nextboot.sh +++ b/sbin/reboot/nextboot.sh @@ -109,7 +109,7 @@ fi zfs=$(df -Tn "/boot/" 2>/dev/null | while read _fs _type _other ; do [ "zfs" = "${_type}" ] || continue - echo "${_fs%/ROOT/*}" + echo "${_fs%%/*}" done) set -e From owner-dev-commits-src-main@freebsd.org Sat Jun 5 15:03:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A37C6445C6; Sat, 5 Jun 2021 15:03:51 +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 4Fy2vq1039z3JlT; Sat, 5 Jun 2021 15:03:51 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0AA02128B6; Sat, 5 Jun 2021 15:03:51 +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 155F3oGU089167; Sat, 5 Jun 2021 15:03:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 155F3o3R089166; Sat, 5 Jun 2021 15:03:50 GMT (envelope-from git) Date: Sat, 5 Jun 2021 15:03:50 GMT Message-Id: <202106051503.155F3o3R089166@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: fe7d7ac40881 - main - hyperv: register intr handler as usermode-mapped if loaded as module MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fe7d7ac40881c9d01a54bf57fff71a3af199f237 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2021 15:03:51 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fe7d7ac40881c9d01a54bf57fff71a3af199f237 commit fe7d7ac40881c9d01a54bf57fff71a3af199f237 Author: Konstantin Belousov AuthorDate: 2021-01-12 16:35:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-05 15:03:18 +0000 hyperv: register intr handler as usermode-mapped if loaded as module Normally raw interrupt handler is provided by the kernel text. But vmbus module registers its own handler that needs to be mapped into userspace mapping on PTI kernels. Reported and reviewed by: whu Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D30310 --- sys/dev/hyperv/vmbus/vmbus.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c index d3568494405e..929eff33e7c9 100644 --- a/sys/dev/hyperv/vmbus/vmbus.c +++ b/sys/dev/hyperv/vmbus/vmbus.c @@ -45,6 +45,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include #include @@ -139,6 +143,7 @@ SYSCTL_INT(_hw_vmbus, OID_AUTO, pin_evttask, CTLFLAG_RDTUN, &vmbus_pin_evttask, 0, "Pin event tasks to their respective CPU"); extern inthand_t IDTVEC(vmbus_isr), IDTVEC(vmbus_isr_pti); +#define VMBUS_ISR_ADDR trunc_page((uintptr_t)IDTVEC(vmbus_isr_pti)) uint32_t vmbus_current_version; @@ -980,6 +985,10 @@ vmbus_intr_setup(struct vmbus_softc *sc) vmbus_msg_task, sc); } +#if defined(__amd64__) && defined(KLD_MODULE) + pmap_pti_add_kva(VMBUS_ISR_ADDR, VMBUS_ISR_ADDR + PAGE_SIZE, true); +#endif + /* * All Hyper-V ISR required resources are setup, now let's find a * free IDT vector for Hyper-V ISR and set it up. @@ -987,6 +996,9 @@ vmbus_intr_setup(struct vmbus_softc *sc) sc->vmbus_idtvec = lapic_ipi_alloc(pti ? IDTVEC(vmbus_isr_pti) : IDTVEC(vmbus_isr)); if (sc->vmbus_idtvec < 0) { +#if defined(__amd64__) && defined(KLD_MODULE) + pmap_pti_remove_kva(VMBUS_ISR_ADDR, VMBUS_ISR_ADDR + PAGE_SIZE); +#endif device_printf(sc->vmbus_dev, "cannot find free IDT vector\n"); return ENXIO; } @@ -1007,6 +1019,10 @@ vmbus_intr_teardown(struct vmbus_softc *sc) sc->vmbus_idtvec = -1; } +#if defined(__amd64__) && defined(KLD_MODULE) + pmap_pti_remove_kva(VMBUS_ISR_ADDR, VMBUS_ISR_ADDR + PAGE_SIZE); +#endif + CPU_FOREACH(cpu) { if (VMBUS_PCPU_GET(sc, event_tq, cpu) != NULL) { taskqueue_free(VMBUS_PCPU_GET(sc, event_tq, cpu)); From owner-dev-commits-src-main@freebsd.org Sat Jun 5 15:33:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B83F9645683; Sat, 5 Jun 2021 15:33: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 4Fy3ZT4c0Xz3LVJ; Sat, 5 Jun 2021 15:33:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 862D412F29; Sat, 5 Jun 2021 15:33:53 +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 155FXrhL028772; Sat, 5 Jun 2021 15:33:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 155FXr6L028771; Sat, 5 Jun 2021 15:33:53 GMT (envelope-from git) Date: Sat, 5 Jun 2021 15:33:53 GMT Message-Id: <202106051533.155FXr6L028771@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 65a226b41d8f - main - dtb: rockchip: Add NanoPC-T4 to the build. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 65a226b41d8ff12c6b9d0b0133a099253767d7c1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2021 15:33:53 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=65a226b41d8ff12c6b9d0b0133a099253767d7c1 commit 65a226b41d8ff12c6b9d0b0133a099253767d7c1 Author: Bjoern A. Zeeb AuthorDate: 2021-06-05 15:19:26 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-06-05 15:19:26 +0000 dtb: rockchip: Add NanoPC-T4 to the build. --- sys/modules/dtb/rockchip/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/modules/dtb/rockchip/Makefile b/sys/modules/dtb/rockchip/Makefile index 2bd86ec3cc7d..4d665f503526 100644 --- a/sys/modules/dtb/rockchip/Makefile +++ b/sys/modules/dtb/rockchip/Makefile @@ -10,6 +10,7 @@ DTS= \ rockchip/rk3399-khadas-edge-captain.dts \ rockchip/rk3399-khadas-edge.dts \ rockchip/rk3399-khadas-edge-v.dts \ + rockchip/rk3399-nanopc-t4.dts \ rockchip/rk3328-nanopi-r2s.dts \ rockchip/rk3399-rock-pi-4.dts \ rockchip/rk3328-rock64.dts \ From owner-dev-commits-src-main@freebsd.org Sat Jun 5 16:34:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3978D646585; Sat, 5 Jun 2021 16:34: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 4Fy4vt18cdz3QQq; Sat, 5 Jun 2021 16:34:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0FC2C13B44; Sat, 5 Jun 2021 16:34: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 155GY2XR008778; Sat, 5 Jun 2021 16:34:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 155GY1is008777; Sat, 5 Jun 2021 16:34:01 GMT (envelope-from git) Date: Sat, 5 Jun 2021 16:34:01 GMT Message-Id: <202106051634.155GY1is008777@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 57af163c8e7e - main - arm64/rk_pcie_phy: handle assigned-clock* MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 57af163c8e7ecdefbac00ab7354122c1225e2c70 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2021 16:34:02 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=57af163c8e7ecdefbac00ab7354122c1225e2c70 commit 57af163c8e7ecdefbac00ab7354122c1225e2c70 Author: Bjoern A. Zeeb AuthorDate: 2021-05-20 16:48:10 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-06-05 16:16:29 +0000 arm64/rk_pcie_phy: handle assigned-clock* Nanopi4 based SoCs (NanoPC-T4, NanoPi M4*, and NanoPi Neo4) have assigned-clock* in the pcie_phy node. Handle them but only fail in case clk_set_assigned() returns an error other than "no assigned-clock*" (as it would for all other SoCs). Reviewed by: manu MFC After: 2 weeks Differential Revision: https://reviews.freebsd.org/D30363 --- sys/arm64/rockchip/rk_pcie_phy.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/arm64/rockchip/rk_pcie_phy.c b/sys/arm64/rockchip/rk_pcie_phy.c index 75bd213bfd23..eaa7619e15c3 100644 --- a/sys/arm64/rockchip/rk_pcie_phy.c +++ b/sys/arm64/rockchip/rk_pcie_phy.c @@ -297,6 +297,13 @@ static int goto fail; } + rv = clk_set_assigned(dev, ofw_bus_get_node(dev)); + if (rv != 0 && rv != ENOENT) { + device_printf(dev, "clk_set_assigned failed: %d\n", rv); + rv = ENXIO; + goto fail; + } + rv = clk_get_by_ofw_name(sc->dev, 0, "refclk", &sc->clk_ref); if (rv != 0) { device_printf(sc->dev, "Cannot get 'refclk' clock\n"); From owner-dev-commits-src-main@freebsd.org Sat Jun 5 16:35:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F18F6462CB; Sat, 5 Jun 2021 16:35:52 +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 4Fy4xz738Xz3Q4q; Sat, 5 Jun 2021 16:35:51 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DA958138F2; Sat, 5 Jun 2021 16:35:51 +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 155GZp0C009042; Sat, 5 Jun 2021 16:35:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 155GZpgA009041; Sat, 5 Jun 2021 16:35:51 GMT (envelope-from git) Date: Sat, 5 Jun 2021 16:35:51 GMT Message-Id: <202106051635.155GZpgA009041@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: b5d37e5a20ab - main - net80211/LinuxKPI: add more radiotap definitions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b5d37e5a20ab1b189499e2824dc269d998c31989 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2021 16:35:52 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b5d37e5a20ab1b189499e2824dc269d998c31989 commit b5d37e5a20ab1b189499e2824dc269d998c31989 Author: Bjoern A. Zeeb AuthorDate: 2021-06-04 17:38:38 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-06-05 16:21:49 +0000 net80211/LinuxKPI: add more radiotap definitions Add more raditap definitions based on "names" found in actual drivers and based on documentation from radiotap.org (where avail). Leave one specific "duplicate" in the LinuxKPI implementation but otherwise manage it all in net80211. Sponsored by: The FreeBSD Foundation MFC after: 10 days Reviewed by: hselasky, adrian, sam Differential Revision: https://reviews.freebsd.org/D30641 --- .../common/include/net/ieee80211_radiotap.h | 55 +++++++++ sys/net80211/ieee80211_radiotap.h | 134 +++++++++++++++++++++ 2 files changed, 189 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/net/ieee80211_radiotap.h b/sys/compat/linuxkpi/common/include/net/ieee80211_radiotap.h new file mode 100644 index 000000000000..9c22e3e06988 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/net/ieee80211_radiotap.h @@ -0,0 +1,55 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020-2021 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_NET_IEEE80211_RADIOTAP_H +#define __LKPI_NET_IEEE80211_RADIOTAP_H + +/* Any possibly duplicate content is only maintained in one place now. */ +#include + +/* + * This structure deviates from + * 'https://www.radiotap.org/fields/Vendor%20Namespace.html' + * and the net80211::ieee80211_radiotap_vendor_header version. + * We consider it LinuxKPI specific so it stays here. + */ +struct ieee80211_vendor_radiotap { + u32 present; + u8 align; + u8 oui[3]; + u8 subns; + u8 pad; + __le16 len; + u8 data[0]; +}; + +#endif /* __LKPI_NET_IEEE80211_RADIOTAP_H */ diff --git a/sys/net80211/ieee80211_radiotap.h b/sys/net80211/ieee80211_radiotap.h index f6e76e9fe8aa..bee1c633b53c 100644 --- a/sys/net80211/ieee80211_radiotap.h +++ b/sys/net80211/ieee80211_radiotap.h @@ -367,4 +367,138 @@ enum ieee80211_radiotap_type { #define IEEE80211_RADIOTAP_VHT_BW_20UUL 24 #define IEEE80211_RADIOTAP_VHT_BW_20UUU 25 +/* + * These are found in various drivers already so use them rather than + * going by our own names and changing everything. + */ + +/* https://www.radiotap.org/fields/VHT.html */ +#define IEEE80211_RADIOTAP_VHT_KNOWN_STBC 0x0001 /* net80211::IEEE80211_RADIOTAP_VHT_HAVE_STBC */ +#define IEEE80211_RADIOTAP_VHT_KNOWN_BEAMFORMED 0x0020 /* net80211::IEEE80211_RADIOTAP_VHT_HAVE_BF */ + +/* https://www.radiotap.org/fields/0-length-PSDU.html */ +#define IEEE80211_RADIOTAP_ZERO_LEN_PSDU_SOUNDING 0x00 +#define IEEE80211_RADIOTAP_ZERO_LEN_PSDU_NOT_CAPTURED 0x01 +#define IEEE80211_RADIOTAP_ZERO_LEN_PSDU_VENDOR 0xFF + +/* https://www.radiotap.org/fields/HE.html */ +struct ieee80211_radiotap_he { + uint16_t data1, data2, data3, data4, data5, data6; +}; + +#define IEEE80211_RADIOTAP_HE_DATA1_FORMAT_SU 0x0000 +#define IEEE80211_RADIOTAP_HE_DATA1_FORMAT_EXT_SU 0x0001 +#define IEEE80211_RADIOTAP_HE_DATA1_FORMAT_MU 0x0002 +#define IEEE80211_RADIOTAP_HE_DATA1_FORMAT_TRIG 0x0003 +#define IEEE80211_RADIOTAP_HE_DATA1_BSS_COLOR_KNOWN 0x0004 +#define IEEE80211_RADIOTAP_HE_DATA1_BEAM_CHANGE_KNOWN 0x0008 +#define IEEE80211_RADIOTAP_HE_DATA1_UL_DL_KNOWN 0x0010 +#define IEEE80211_RADIOTAP_HE_DATA1_DATA_MCS_KNOWN 0x0020 +#define IEEE80211_RADIOTAP_HE_DATA1_DATA_DCM_KNOWN 0x0040 +#define IEEE80211_RADIOTAP_HE_DATA1_CODING_KNOWN 0x0080 +#define IEEE80211_RADIOTAP_HE_DATA1_LDPC_XSYMSEG_KNOWN 0x0100 +#define IEEE80211_RADIOTAP_HE_DATA1_STBC_KNOWN 0x0200 +#define IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE_KNOWN 0x0400 +#define IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE2_KNOWN 0x0800 +#define IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE3_KNOWN 0x1000 +#define IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE4_KNOWN 0x2000 +#define IEEE80211_RADIOTAP_HE_DATA1_BW_RU_ALLOC_KNOWN 0x4000 +#define IEEE80211_RADIOTAP_HE_DATA1_DOPPLER_KNOWN 0x8000 + +#define IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_KNOWN 0x0001 +#define IEEE80211_RADIOTAP_HE_DATA2_GI_KNOWN 0x0002 +#define IEEE80211_RADIOTAP_HE_DATA2_NUM_LTF_SYMS_KNOWN 0x0004 +#define IEEE80211_RADIOTAP_HE_DATA2_PRE_FEC_PAD_KNOWN 0x0008 +#define IEEE80211_RADIOTAP_HE_DATA2_TXBF_KNOWN 0x0010 +#define IEEE80211_RADIOTAP_HE_DATA2_PE_DISAMBIG_KNOWN 0x0020 +#define IEEE80211_RADIOTAP_HE_DATA2_TXOP_KNOWN 0x0040 +/* #define IEEE80211_RADIOTAP_HE_DATA2_ midamble periodicity _KNOWN 0x0080 */ +#define IEEE80211_RADIOTAP_HE_DATA2_RU_OFFSET 0x3F00 +#define IEEE80211_RADIOTAP_HE_DATA2_RU_OFFSET_KNOWN 0x4000 +#define IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_SEC 0x8000 + +#define IEEE80211_RADIOTAP_HE_DATA3_BSS_COLOR 0x003F +#define IEEE80211_RADIOTAP_HE_DATA3_BEAM_CHANGE 0x0040 +#define IEEE80211_RADIOTAP_HE_DATA3_UL_DL 0x0080 +/* #deifne IEEE80211_RADIOTAP_HE_DATA3_data_MCS 0x0F00 */ +/* #define IEEE80211_RADIOTAP_HE_DATA3_data_DCM 0x1000 */ +/* #define IEEE80211_RADIOTAP_HE_DATA3_Coding 0x2000 */ +#define IEEE80211_RADIOTAP_HE_DATA3_LDPC_XSYMSEG 0x4000 +/* #define IEEE80211_RADIOTAP_HE_DATA3_STBC 0x8000 */ + +#define IEEE80211_RADIOTAP_HE_DATA4_SU_MU_SPTL_REUSE 0x000F +#define IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE1 0x000F +#define IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE2 0x00F0 +#define IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE3 0x0F00 +#define IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE4 0xF000 + +#define IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE 0x00C0 +#define IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE_1X 0x1 +#define IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE_2X 0x2 +#define IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE_4X 0x3 +#define IEEE80211_RADIOTAP_HE_DATA5_NUM_LTF_SYMS 0x0700 +#define IEEE80211_RADIOTAP_HE_DATA5_PRE_FEC_PAD 0x3000 +#define IEEE80211_RADIOTAP_HE_DATA5_TXBF 0x4000 +#define IEEE80211_RADIOTAP_HE_DATA5_PE_DISAMBIG 0x8000 + +#define IEEE80211_RADIOTAP_HE_DATA6_DOPPLER 0x0010 +/* 0x00e0 (reserved) ; use these for the following undocumented. */ +#define IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_KNOWN 0x0020 +#define IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW 0x00C0 +#define IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_20MHZ 0x0 +#define IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_40MHZ 0x1 +#define IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_80MHZ 0x2 +#define IEEE80211_RADIOTAP_HE_DATA6_TB_PPDU_BW_160MHZ 0x3 +#define IEEE80211_RADIOTAP_HE_DATA6_TXOP 0x7F00 + +/* https://www.radiotap.org/fields/HE-MU.html */ +struct ieee80211_radiotap_he_mu { + uint16_t flags1; + uint16_t flags2; + uint8_t ru_ch1[4]; + uint8_t ru_ch2[4]; +}; + +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_MCS 0x000F +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_MCS_KNOWN 0x0010 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_DCM 0x0020 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_DCM_KNOWN 0x0040 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH2_CTR_26T_RU_KNOWN 0x0080 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_RU_KNOWN 0x0100 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH2_RU_KNOWN 0x0200 +/* reserved 0x0C00 */ +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_CTR_26T_RU_KNOWN 0x1000 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_CTR_26T_RU 0x2000 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_COMP_KNOWN 0x4000 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_SYMS_USERS_KNOWN 0x8000 + +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW 0x0003 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_20MHZ 0x0000 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_40MHZ 0x0001 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_80MHZ 0x0002 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_160MHZ 0x0003 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_BW_FROM_SIG_A_BW_KNOWN 0x0004 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_SIG_B_COMP 0x0008 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_SIG_B_SYMS_USERS 0x00F0 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_PUNC_FROM_SIG_A_BW 0x0300 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_PUNC_FROM_SIG_A_BW_KNOWN 0x0400 +#define IEEE80211_RADIOTAP_HE_MU_FLAGS2_CH2_CTR_26T_RU 0x0800 + +/* https://www.radiotap.org/fields/L-SIG.html */ +struct ieee80211_radiotap_lsig { + uint16_t data1; + uint16_t data2; +}; +#define IEEE80211_RADIOTAP_LSIG_DATA1_LENGTH_KNOWN 0x0002 + +#define IEEE80211_RADIOTAP_LSIG_DATA2_LENGTH 0xFFF0 + +/* https://www.radiotap.org/fields/MCS.html */ +#define IEEE80211_RADIOTAP_MCS_HAVE_FEC 0x10 +#define IEEE80211_RADIOTAP_MCS_HAVE_STBC 0x20 + +/* https://www.radiotap.org/fields/timestamp.html */ +#define IEEE80211_RADIOTAP_TIMESTAMP_UNIT_US 0x01 +#define IEEE80211_RADIOTAP_TIMESTAMP_SPOS_PLCP_SIG_ACQ 0x10 + #endif /* !_NET80211_IEEE80211_RADIOTAP_H_ */ From owner-dev-commits-src-main@freebsd.org Sat Jun 5 17:24:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E2E56474EA; Sat, 5 Jun 2021 17:24:30 +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 4Fy6263WgHz3k0j; Sat, 5 Jun 2021 17:24:30 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 615A2146F0; Sat, 5 Jun 2021 17:24: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 155HOUka075864; Sat, 5 Jun 2021 17:24:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 155HOUaA075863; Sat, 5 Jun 2021 17:24:30 GMT (envelope-from git) Date: Sat, 5 Jun 2021 17:24:30 GMT Message-Id: <202106051724.155HOUaA075863@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 002cbc89c36e - main - arm64/rk805: remove RTC Set logging MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 002cbc89c36e9e80e96bd461db4726efca3aa4dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2021 17:24:30 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=002cbc89c36e9e80e96bd461db4726efca3aa4dc commit 002cbc89c36e9e80e96bd461db4726efca3aa4dc Author: Bjoern A. Zeeb AuthorDate: 2021-05-20 16:40:10 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-06-05 17:07:56 +0000 arm64/rk805: remove RTC Set logging When ntpd is synchronizing the system time, it also periodically (30m) syncs the the RTC time. Remove printf in rk805_settime which triggers every 30m, as settime_task_func() will log errors under bootverbose. We leave the RTC Read logging, which should happen only once at boot. Commit message by: imp Reviewed by: manu, imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30361 --- sys/arm64/rockchip/rk805.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/arm64/rockchip/rk805.c b/sys/arm64/rockchip/rk805.c index 2d5635fee72a..a2ee53b35a07 100644 --- a/sys/arm64/rockchip/rk805.c +++ b/sys/arm64/rockchip/rk805.c @@ -841,12 +841,6 @@ rk805_settime(device_t dev, struct timespec *ts) ctrl &= ~RK805_RTC_CTRL_STOP; rk805_write(dev, RK805_RTC_CTRL, &ctrl, 1); - if (bootverbose) - device_printf(dev, - "Set RTC at %04x-%02x-%02x %02x:%02x:%02x[.%09ld]\n", - bct.year, bct.mon, bct.day, bct.hour, bct.min, bct.sec, - bct.nsec); - return (error); } From owner-dev-commits-src-main@freebsd.org Sat Jun 5 23:58:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C511764CBD2; Sat, 5 Jun 2021 23:58:08 +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 4FyGmJ55FDz4n13; Sat, 5 Jun 2021 23:58:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 977A719C60; Sat, 5 Jun 2021 23:58:08 +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 155Nw82W092672; Sat, 5 Jun 2021 23:58:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 155Nw8RW092670; Sat, 5 Jun 2021 23:58:08 GMT (envelope-from git) Date: Sat, 5 Jun 2021 23:58:08 GMT Message-Id: <202106052358.155Nw8RW092670@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: a5df139ec614 - main - nfsd: Fix when NFSERR_WRONGSEC may be replied to NFSv4 clients MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a5df139ec614c34f505bce9de3447fe7b49016e6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2021 23:58:08 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=a5df139ec614c34f505bce9de3447fe7b49016e6 commit a5df139ec614c34f505bce9de3447fe7b49016e6 Author: Rick Macklem AuthorDate: 2021-06-05 23:53:07 +0000 Commit: Rick Macklem CommitDate: 2021-06-05 23:53:07 +0000 nfsd: Fix when NFSERR_WRONGSEC may be replied to NFSv4 clients Commit d224f05fcfc1 pre-parsed the next operation number for the put file handle operations. This patch uses this next operation number, plus the type of the file handle being set by the put file handle operation, to implement the rules in RFC5661 Sec. 2.6 with respect to replying NFSERR_WRONGSEC. This patch also adds a check to see if NFSERR_WRONGSEC should be replied when about to perform Lookup, Lookupp or Open with a file name component, so that the NFSERR_WRONGSEC reply is done for these operations, as required by RFC5661 Sec. 2.6. This patch does not have any practical effect for the FreeBSD NFSv4 client and I believe that the same is true for the Linux client, since NFSERR_WRONGSEC is considered a fatal error at this time. MFC after: 2 weeks --- sys/fs/nfs/nfs_var.h | 6 ++- sys/fs/nfsserver/nfs_nfsdport.c | 91 ++++++++++++++++++++++++++------------- sys/fs/nfsserver/nfs_nfsdserv.c | 19 ++++++-- sys/fs/nfsserver/nfs_nfsdsocket.c | 53 ++++++++++++++--------- 4 files changed, 114 insertions(+), 55 deletions(-) diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index c1ca7c03af39..9db8b92f44e7 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -381,8 +381,9 @@ int nfscl_request(struct nfsrv_descript *, vnode_t, /* nfs_nfsdsubs.c */ void nfsd_fhtovp(struct nfsrv_descript *, struct nfsrvfh *, int, - vnode_t *, struct nfsexstuff *, mount_t *, int); -int nfsd_excred(struct nfsrv_descript *, struct nfsexstuff *, struct ucred *); + vnode_t *, struct nfsexstuff *, mount_t *, int, int); +int nfsd_excred(struct nfsrv_descript *, struct nfsexstuff *, struct ucred *, + bool); int nfsrv_mtofh(struct nfsrv_descript *, struct nfsrvfh *); int nfsrv_putattrbit(struct nfsrv_descript *, nfsattrbit_t *); void nfsrv_wcc(struct nfsrv_descript *, int, struct nfsvattr *, int, @@ -759,6 +760,7 @@ int nfsvno_listxattr(struct vnode *, uint64_t, struct ucred *, struct thread *, u_char **, uint32_t *, bool *); void nfsm_trimtrailing(struct nfsrv_descript *, struct mbuf *, char *, int, int); +bool nfsrv_checkwrongsec(struct nfsrv_descript *, int, enum vtype); /* nfs_commonkrpc.c */ int newnfs_nmcancelreqs(struct nfsmount *); diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c index 4d19c73dfa06..7bcbc738d61b 100644 --- a/sys/fs/nfsserver/nfs_nfsdport.c +++ b/sys/fs/nfsserver/nfs_nfsdport.c @@ -3103,9 +3103,9 @@ nfsmout: */ int nfsd_excred(struct nfsrv_descript *nd, struct nfsexstuff *exp, - struct ucred *credanon) + struct ucred *credanon, bool testsec) { - int error = 0; + int error; /* * Check/setup credentials. @@ -3115,18 +3115,12 @@ nfsd_excred(struct nfsrv_descript *nd, struct nfsexstuff *exp, /* * Check to see if the operation is allowed for this security flavor. - * RFC2623 suggests that the NFSv3 Fsinfo RPC be allowed to - * AUTH_NONE or AUTH_SYS for file systems requiring RPCSEC_GSS. - * Also, allow Secinfo, so that it can acquire the correct flavor(s). */ - if (nfsvno_testexp(nd, exp) && - nd->nd_procnum != NFSV4OP_SECINFO && - nd->nd_procnum != NFSPROC_FSINFO) { - if (nd->nd_flag & ND_NFSV4) - error = NFSERR_WRONGSEC; - else - error = (NFSERR_AUTHERR | AUTH_TOOWEAK); - goto out; + error = 0; + if (testsec) { + error = nfsvno_testexp(nd, exp); + if (error != 0) + goto out; } /* @@ -3246,7 +3240,7 @@ nfsvno_fhtovp(struct mount *mp, fhandle_t *fhp, struct sockaddr *nam, void nfsd_fhtovp(struct nfsrv_descript *nd, struct nfsrvfh *nfp, int lktype, struct vnode **vpp, struct nfsexstuff *exp, - struct mount **mpp, int startwrite) + struct mount **mpp, int startwrite, int nextop) { struct mount *mp, *mpw; struct ucred *credanon; @@ -3292,19 +3286,6 @@ nfsd_fhtovp(struct nfsrv_descript *nd, struct nfsrvfh *nfp, int lktype, nd->nd_repstat = EACCES; } - /* - * If TLS is required by the export, check the flags in nd_flag. - */ - if (nd->nd_repstat == 0 && ((NFSVNO_EXTLS(exp) && - (nd->nd_flag & ND_TLS) == 0) || - (NFSVNO_EXTLSCERT(exp) && - (nd->nd_flag & ND_TLSCERT) == 0) || - (NFSVNO_EXTLSCERTUSER(exp) && - (nd->nd_flag & ND_TLSCERTUSER) == 0))) { - vput(*vpp); - nd->nd_repstat = NFSERR_ACCES; - } - /* * Personally, I've never seen any point in requiring a * reserved port#, since only in the rare case where the @@ -3342,7 +3323,8 @@ nfsd_fhtovp(struct nfsrv_descript *nd, struct nfsrvfh *nfp, int lktype, */ if (!nd->nd_repstat) { nd->nd_saveduid = nd->nd_cred->cr_uid; - nd->nd_repstat = nfsd_excred(nd, exp, credanon); + nd->nd_repstat = nfsd_excred(nd, exp, credanon, + nfsrv_checkwrongsec(nd, nextop, (*vpp)->v_type)); if (nd->nd_repstat) vput(*vpp); } @@ -3981,6 +3963,24 @@ nfsvno_testexp(struct nfsrv_descript *nd, struct nfsexstuff *exp) { int i; + /* + * Allow NFSv3 Fsinfo per RFC2623. + */ + if (((nd->nd_flag & ND_NFSV4) != 0 || + nd->nd_procnum != NFSPROC_FSINFO) && + ((NFSVNO_EXTLS(exp) && (nd->nd_flag & ND_TLS) == 0) || + (NFSVNO_EXTLSCERT(exp) && + (nd->nd_flag & ND_TLSCERT) == 0) || + (NFSVNO_EXTLSCERTUSER(exp) && + (nd->nd_flag & ND_TLSCERTUSER) == 0))) { + if ((nd->nd_flag & ND_NFSV4) != 0) + return (NFSERR_WRONGSEC); + else if ((nd->nd_flag & ND_TLS) == 0) + return (NFSERR_AUTHERR | AUTH_NEEDS_TLS); + else + return (NFSERR_AUTHERR | AUTH_NEEDS_TLS_MUTUAL_HOST); + } + /* * This seems odd, but allow the case where the security flavor * list is empty. This happens when NFSv4 is traversing non-exported @@ -4008,7 +4008,9 @@ nfsvno_testexp(struct nfsrv_descript *nd, struct nfsexstuff *exp) (nd->nd_flag & ND_GSS) == 0) return (0); } - return (1); + if ((nd->nd_flag & ND_NFSV4) != 0) + return (NFSERR_WRONGSEC); + return (NFSERR_AUTHERR | AUTH_TOOWEAK); } /* @@ -6616,6 +6618,37 @@ nfsm_trimtrailing(struct nfsrv_descript *nd, struct mbuf *mb, char *bpos, nd->nd_bpos = bpos; } + +/* + * Check to see if a put file handle operation should test for + * NFSERR_WRONGSEC, although NFSv3 actually returns NFSERR_AUTHERR. + * When Open is the next operation, NFSERR_WRONGSEC cannot be + * replied for the Open cases that use a component. Thia can + * be identified by the fact that the file handle's type is VDIR. + */ +bool +nfsrv_checkwrongsec(struct nfsrv_descript *nd, int nextop, enum vtype vtyp) +{ + + if ((nd->nd_flag & ND_NFSV4) == 0) { + if (nd->nd_procnum == NFSPROC_FSINFO) + return (false); + return (true); + } + + if ((nd->nd_flag & ND_LASTOP) != 0) + return (false); + + if (nextop == NFSV4OP_PUTROOTFH || nextop == NFSV4OP_PUTFH || + nextop == NFSV4OP_PUTPUBFH || nextop == NFSV4OP_RESTOREFH || + nextop == NFSV4OP_LOOKUP || nextop == NFSV4OP_LOOKUPP || + nextop == NFSV4OP_SECINFO || nextop == NFSV4OP_SECINFONONAME) + return (false); + if (nextop == NFSV4OP_OPEN && vtyp == VDIR) + return (false); + return (true); +} + extern int (*nfsd_call_nfsd)(struct thread *, struct nfssvc_args *); /* diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index d7049ba1fed8..e564a6a48b79 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -1669,7 +1669,7 @@ nfsrvd_rename(struct nfsrv_descript *nd, int isdgram, NFSVOPUNLOCK(dp); nd->nd_cred->cr_uid = nd->nd_saveduid; nfsd_fhtovp(nd, &tfh, LK_EXCLUSIVE, &tdp, &tnes, NULL, - 0); /* Locks tdp. */ + 0, -1); /* Locks tdp. */ if (tdp) { tdirfor_ret = nfsvno_getattr(tdp, &tdirfor, nd, p, 1, NULL); @@ -1800,7 +1800,8 @@ nfsrvd_link(struct nfsrv_descript *nd, int isdgram, /* tovp is always NULL unless NFSv4 */ goto out; } - nfsd_fhtovp(nd, &dfh, LK_EXCLUSIVE, &dp, &tnes, NULL, 0); + nfsd_fhtovp(nd, &dfh, LK_EXCLUSIVE, &dp, &tnes, NULL, + 0, -1); if (dp) NFSVOPUNLOCK(dp); } @@ -3695,7 +3696,12 @@ nfsrvd_secinfo(struct nfsrv_descript *nd, int isdgram, vput(vp); savflag = nd->nd_flag; if (!nd->nd_repstat) { - nfsd_fhtovp(nd, &fh, LK_SHARED, &vp, &retnes, NULL, 0); + /* + * Pretend the next op is Secinfo, so that no wrongsec + * test will be done. + */ + nfsd_fhtovp(nd, &fh, LK_SHARED, &vp, &retnes, NULL, 0, + NFSV4OP_SECINFO); if (vp) vput(vp); } @@ -3830,7 +3836,12 @@ nfsrvd_secinfononame(struct nfsrv_descript *nd, int isdgram, vput(vp); savflag = nd->nd_flag; if (nd->nd_repstat == 0) { - nfsd_fhtovp(nd, &fh, LK_SHARED, &vp, &retnes, NULL, 0); + /* + * Pretend the next op is Secinfo, so that no wrongsec + * test will be done. + */ + nfsd_fhtovp(nd, &fh, LK_SHARED, &vp, &retnes, NULL, 0, + NFSV4OP_SECINFO); if (vp != NULL) vput(vp); } diff --git a/sys/fs/nfsserver/nfs_nfsdsocket.c b/sys/fs/nfsserver/nfs_nfsdsocket.c index f40569da0097..85771974be2f 100644 --- a/sys/fs/nfsserver/nfs_nfsdsocket.c +++ b/sys/fs/nfsserver/nfs_nfsdsocket.c @@ -584,10 +584,10 @@ tryagain: lktype = LK_EXCLUSIVE; if (nd->nd_flag & ND_PUBLOOKUP) nfsd_fhtovp(nd, &nfs_pubfh, lktype, &vp, &nes, - &mp, nfsrv_writerpc[nd->nd_procnum]); + &mp, nfsrv_writerpc[nd->nd_procnum], -1); else nfsd_fhtovp(nd, &fh, lktype, &vp, &nes, - &mp, nfsrv_writerpc[nd->nd_procnum]); + &mp, nfsrv_writerpc[nd->nd_procnum], -1); if (nd->nd_repstat == NFSERR_PROGNOTV4) goto out; } @@ -702,7 +702,7 @@ static void nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag, int taglen, u_int32_t minorvers) { - int i, lktype, op, op0 = 0, statsinprog = 0; + int i, lktype, op, op0 = 0, rstat, statsinprog = 0; u_int32_t *tl; struct nfsclient *clp, *nclp; int error = 0, igotlock, nextop, numops, savefhcnt; @@ -983,7 +983,7 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag, } if (!nd->nd_repstat) nfsd_fhtovp(nd, &fh, LK_SHARED, &nvp, &nes, - NULL, 0); + NULL, 0, nextop); /* For now, allow this for non-export FHs */ if (!nd->nd_repstat) { if (vp) @@ -1017,7 +1017,7 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag, i < numops - 1); } nfsd_fhtovp(nd, &nfs_pubfh, LK_SHARED, &nvp, - &nes, NULL, 0); + &nes, NULL, 0, nextop); } else nd->nd_repstat = NFSERR_NOFILEHANDLE; if (!nd->nd_repstat) { @@ -1052,7 +1052,7 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag, i < numops - 1); } nfsd_fhtovp(nd, &nfs_rootfh, LK_SHARED, &nvp, - &nes, NULL, 0); + &nes, NULL, 0, nextop); if (!nd->nd_repstat) { if (vp) vrele(vp); @@ -1110,13 +1110,21 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag, nd->nd_repstat = 0; /* If vp == savevp, a no-op */ if (vp != savevp) { - VREF(savevp); - vrele(vp); - vp = savevp; - vpnes = savevpnes; - cur_fsid = save_fsid; + if (nfsrv_checkwrongsec(nd, nextop, + savevp->v_type)) + nd->nd_repstat = + nfsvno_testexp(nd, + &savevpnes); + if (nd->nd_repstat == 0) { + VREF(savevp); + vrele(vp); + vp = savevp; + vpnes = savevpnes; + cur_fsid = save_fsid; + } } - if ((nd->nd_flag & ND_SAVEDCURSTATEID) != 0) { + if (nd->nd_repstat == 0 && + (nd->nd_flag & ND_SAVEDCURSTATEID) != 0) { nd->nd_curstateid = nd->nd_savedcurstateid; nd->nd_flag |= ND_CURSTATEID; @@ -1143,14 +1151,9 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag, op != NFSV4OP_GETFH && op != NFSV4OP_ACCESS && op != NFSV4OP_READLINK && - op != NFSV4OP_SECINFO) + op != NFSV4OP_SECINFO && + op != NFSV4OP_SECINFONONAME) nd->nd_repstat = NFSERR_NOFILEHANDLE; - else if (nfsvno_testexp(nd, &vpnes) && - op != NFSV4OP_LOOKUP && - op != NFSV4OP_GETFH && - op != NFSV4OP_GETATTR && - op != NFSV4OP_SECINFO) - nd->nd_repstat = NFSERR_WRONGSEC; if (nd->nd_repstat) { if (op == NFSV4OP_SETATTR) { /* @@ -1183,6 +1186,16 @@ tryagain: nd->nd_repstat = NFSERR_NOFILEHANDLE; break; } + if (NFSVNO_EXPORTED(&vpnes) && (op == NFSV4OP_LOOKUP || + op == NFSV4OP_LOOKUPP || (op == NFSV4OP_OPEN && + vp->v_type == VDIR))) { + /* Check for wrong security. */ + rstat = nfsvno_testexp(nd, &vpnes); + if (rstat != 0) { + nd->nd_repstat = rstat; + break; + } + } VREF(vp); if (nfsv4_opflag[op].modifyfs) vn_start_write(vp, &temp_mp, V_WAIT); @@ -1197,7 +1210,7 @@ tryagain: nd->nd_nam, &nes, &credanon); if (!nd->nd_repstat) nd->nd_repstat = nfsd_excred(nd, - &nes, credanon); + &nes, credanon, true); if (credanon != NULL) crfree(credanon); if (!nd->nd_repstat) { From owner-dev-commits-src-main@freebsd.org Sun Jun 6 01:18:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B6C264DEF8; Sun, 6 Jun 2021 01:18:22 +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 4FyJXt3JsVz4svv; Sun, 6 Jun 2021 01:18:22 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 57F1D1AE83; Sun, 6 Jun 2021 01:18:22 +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 1561IMIX098548; Sun, 6 Jun 2021 01:18:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1561IMDK098547; Sun, 6 Jun 2021 01:18:22 GMT (envelope-from git) Date: Sun, 6 Jun 2021 01:18:22 GMT Message-Id: <202106060118.1561IMDK098547@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: 59409cb90fc0 - main - Add a generic mechanism for preventing forced unmount MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 59409cb90fc079bd388d8f7404679193e4d34889 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 01:18:22 -0000 The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=59409cb90fc079bd388d8f7404679193e4d34889 commit 59409cb90fc079bd388d8f7404679193e4d34889 Author: Jason A. Harmening AuthorDate: 2021-05-17 22:47:27 +0000 Commit: Jason A. Harmening CommitDate: 2021-06-06 01:20:36 +0000 Add a generic mechanism for preventing forced unmount This is aimed at preventing stacked filesystems like nullfs and unionfs from "losing" their lower mounts due to forced unmount. Otherwise, VFS operations that are passed through to the lower filesystem(s) may crash or otherwise cause unpredictable behavior. Introduce two new functions: vfs_pin_from_vp() and vfs_unpin(). which are intended to be called on the lower mount(s) when the stacked filesystem is mounted and unmounted, respectively. Much as registration in the mnt_uppers list previously did, pinning will prevent even forced unmount of the lower FS and will allow the stacked FS to freely operate on the lower mount either by direct use of the struct mount* or indirect use through a properly-referenced vnode's v_mount field. vfs_pin_from_vp() is modeled after vfs_ref_from_vp() in that it uses the mount interlock coupled with re-checking vp->v_mount to ensure that it will fail in the face of a pending unmount request, even if the concurrent unmount fully completes. Adopt these new functions in both nullfs and unionfs. Reviewed By: kib, markj Differential Revision: https://reviews.freebsd.org/D30401 --- sys/fs/nullfs/null_vfsops.c | 9 ++++++++- sys/fs/unionfs/union_vfsops.c | 22 +++++++++++++++++++--- sys/kern/vfs_mount.c | 39 ++++++++++++++++++++++++++++++++++++++- sys/kern/vfs_subr.c | 3 +++ sys/sys/mount.h | 3 +++ 5 files changed, 71 insertions(+), 5 deletions(-) diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index 0ad2385116a9..4914e5fc2dbf 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -163,7 +163,12 @@ nullfs_mount(struct mount *mp) * Save pointer to underlying FS and the reference to the * lower root vnode. */ - xmp->nullm_vfs = lowerrootvp->v_mount; + xmp->nullm_vfs = vfs_pin_from_vp(lowerrootvp); + if (xmp->nullm_vfs == NULL) { + vput(lowerrootvp); + free(xmp, M_NULLFSMNT); + return (ENOENT); + } vref(lowerrootvp); xmp->nullm_lowerrootvp = lowerrootvp; mp->mnt_data = xmp; @@ -173,6 +178,7 @@ nullfs_mount(struct mount *mp) */ error = null_nodeget(mp, lowerrootvp, &nullm_rootvp); if (error != 0) { + vfs_unpin(xmp->nullm_vfs); vrele(lowerrootvp); free(xmp, M_NULLFSMNT); return (error); @@ -263,6 +269,7 @@ nullfs_unmount(mp, mntflags) TAILQ_REMOVE(&ump->mnt_uppers, mp, mnt_upper_link); MNT_IUNLOCK(ump); } + vfs_unpin(ump); vrele(mntdata->nullm_lowerrootvp); mp->mnt_data = NULL; free(mntdata, M_NULLFSMNT); diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index bd264c7bcdb5..96a30f0ae8b5 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -75,6 +75,7 @@ static int unionfs_domount(struct mount *mp) { int error; + struct mount *lowermp, *uppermp; struct vnode *lowerrootvp; struct vnode *upperrootvp; struct unionfs_mount *ump; @@ -285,15 +286,28 @@ unionfs_domount(struct mount *mp) error = unionfs_nodeget(mp, ump->um_uppervp, ump->um_lowervp, NULLVP, &(ump->um_rootvp), NULL, td); vrele(upperrootvp); - if (error) { + if (error != 0) { free(ump, M_UNIONFSMNT); mp->mnt_data = NULL; return (error); } + lowermp = vfs_pin_from_vp(ump->um_lowervp); + uppermp = vfs_pin_from_vp(ump->um_uppervp); + + if (lowermp == NULL || uppermp == NULL) { + if (lowermp != NULL) + vfs_unpin(lowermp); + if (uppermp != NULL) + vfs_unpin(uppermp); + free(ump, M_UNIONFSMNT); + mp->mnt_data = NULL; + return (ENOENT); + } + MNT_ILOCK(mp); - if ((ump->um_lowervp->v_mount->mnt_flag & MNT_LOCAL) && - (ump->um_uppervp->v_mount->mnt_flag & MNT_LOCAL)) + if ((lowermp->mnt_flag & MNT_LOCAL) != 0 && + (uppermp->mnt_flag & MNT_LOCAL) != 0) mp->mnt_flag |= MNT_LOCAL; mp->mnt_kern_flag |= MNTK_NOMSYNC | MNTK_UNIONFS; MNT_IUNLOCK(mp); @@ -343,6 +357,8 @@ unionfs_unmount(struct mount *mp, int mntflags) if (error) return (error); + vfs_unpin(ump->um_lowervp->v_mount); + vfs_unpin(ump->um_uppervp->v_mount); free(ump, M_UNIONFSMNT); mp->mnt_data = NULL; diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 7dc6b795eefd..8b4426209818 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -504,6 +505,39 @@ vfs_ref(struct mount *mp) MNT_IUNLOCK(mp); } +struct mount * +vfs_pin_from_vp(struct vnode *vp) +{ + struct mount *mp; + + mp = atomic_load_ptr(&vp->v_mount); + if (mp == NULL) + return (NULL); + MNT_ILOCK(mp); + if (mp != vp->v_mount || (mp->mnt_kern_flag & MNTK_UNMOUNT) != 0) { + MNT_IUNLOCK(mp); + return (NULL); + } + MNT_REF(mp); + KASSERT(mp->mnt_pinned_count < INT_MAX, + ("mount pinned count overflow")); + ++mp->mnt_pinned_count; + MNT_IUNLOCK(mp); + return (mp); +} + +void +vfs_unpin(struct mount *mp) +{ + MNT_ILOCK(mp); + KASSERT(mp->mnt_pinned_count > 0, ("mount pinned count underflow")); + KASSERT((mp->mnt_kern_flag & MNTK_UNMOUNT) == 0, + ("mount pinned with pending unmount")); + --mp->mnt_pinned_count; + MNT_REL(mp); + MNT_IUNLOCK(mp); +} + void vfs_rel(struct mount *mp) { @@ -567,6 +601,7 @@ vfs_mount_alloc(struct vnode *vp, struct vfsconf *vfsp, const char *fspath, #endif arc4rand(&mp->mnt_hashseed, sizeof mp->mnt_hashseed, 0); TAILQ_INIT(&mp->mnt_uppers); + mp->mnt_pinned_count = 0; return (mp); } @@ -605,6 +640,8 @@ vfs_mount_destroy(struct mount *mp) vn_printf(vp, "dangling vnode "); panic("unmount: dangling vnode"); } + KASSERT(mp->mnt_pinned_count == 0, + ("mnt_pinned_count = %d", mp->mnt_pinned_count)); KASSERT(TAILQ_EMPTY(&mp->mnt_uppers), ("mnt_uppers")); if (mp->mnt_nvnodelistsize != 0) panic("vfs_mount_destroy: nonzero nvnodelistsize"); @@ -1811,7 +1848,7 @@ dounmount(struct mount *mp, int flags, struct thread *td) MNT_ILOCK(mp); if ((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0 || (mp->mnt_flag & MNT_UPDATE) != 0 || - !TAILQ_EMPTY(&mp->mnt_uppers)) { + mp->mnt_pinned_count != 0) { dounmount_cleanup(mp, coveredvp, 0); return (EBUSY); } diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index ad0f1c2a0c7c..a2f25bf78495 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -831,6 +831,9 @@ vfs_busy(struct mount *mp, int flags) * valid. */ while (mp->mnt_kern_flag & MNTK_UNMOUNT) { + KASSERT(mp->mnt_pinned_count == 0, + ("%s: non-zero pinned count %d with pending unmount", + __func__, mp->mnt_pinned_count)); if (flags & MBF_NOWAIT || mp->mnt_kern_flag & MNTK_REFEXPIRE) { MNT_REL(mp); MNT_IUNLOCK(mp); diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 6b2e6e7f7f13..693293b12370 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -242,6 +242,7 @@ struct mount { struct mtx mnt_listmtx; struct vnodelst mnt_lazyvnodelist; /* (l) list of lazy vnodes */ int mnt_lazyvnodelistsize; /* (l) # of lazy vnodes */ + int mnt_pinned_count; /* (i) unmount prevented */ struct lock mnt_explock; /* vfs_export walkers lock */ TAILQ_ENTRY(mount) mnt_upper_link; /* (i*) we in the all uppers */ TAILQ_HEAD(, mount) mnt_uppers; /* (i) upper mounts over us */ @@ -1011,6 +1012,8 @@ struct mount *vfs_mount_alloc(struct vnode *, struct vfsconf *, const char *, int vfs_suser(struct mount *, struct thread *); void vfs_unbusy(struct mount *); void vfs_unmountall(void); +struct mount *vfs_pin_from_vp(struct vnode *); +void vfs_unpin(struct mount *); extern TAILQ_HEAD(mntlist, mount) mountlist; /* mounted filesystem list */ extern struct mtx_padalign mountlist_mtx; extern struct nfs_public nfs_pub; From owner-dev-commits-src-main@freebsd.org Sun Jun 6 02:50:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DCF3764EDD3; Sun, 6 Jun 2021 02:50:12 +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 4FyLZr5CBjz3DfS; Sun, 6 Jun 2021 02:50:12 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 972B11BF75; Sun, 6 Jun 2021 02:50:12 +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 1562oC1e021536; Sun, 6 Jun 2021 02:50:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1562oCkK021530; Sun, 6 Jun 2021 02:50:12 GMT (envelope-from git) Date: Sun, 6 Jun 2021 02:50:12 GMT Message-Id: <202106060250.1562oCkK021530@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Justin Hibbits Subject: git: d7bfb412a7c3 - main - powerpc64le/pmap: Fix superpage promotions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhibbits X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d7bfb412a7c3bd53ef1b664a46726e88ec9e02d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 02:50:12 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=d7bfb412a7c3bd53ef1b664a46726e88ec9e02d1 commit d7bfb412a7c3bd53ef1b664a46726e88ec9e02d1 Author: Justin Hibbits AuthorDate: 2021-06-06 02:45:15 +0000 Commit: Justin Hibbits CommitDate: 2021-06-06 02:49:42 +0000 powerpc64le/pmap: Fix superpage promotions The page table is always big endian. Without byte swapping on LE, the promotion ability checks were invalid, and superpage promotions always failed. --- sys/powerpc/aim/mmu_radix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index 83eda03f9556..c1f587a09e86 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -2712,7 +2712,7 @@ pmap_promote_l3e(pmap_t pmap, pml3_entry_t *pde, vm_offset_t va, */ firstpte = (pt_entry_t *)PHYS_TO_DMAP(be64toh(*pde) & PG_FRAME); setpde: - newpde = *firstpte; + newpde = be64toh(*firstpte); if ((newpde & ((PG_FRAME & L3_PAGE_MASK) | PG_A | PG_V)) != (PG_A | PG_V)) { CTR2(KTR_PMAP, "pmap_promote_l3e: failure for va %#lx" " in pmap %p", va, pmap); From owner-dev-commits-src-main@freebsd.org Sun Jun 6 13:46:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E824465EE14; Sun, 6 Jun 2021 13:46:28 +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 4Fyd845xK7z4pgY; Sun, 6 Jun 2021 13:46:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B3E9824661; Sun, 6 Jun 2021 13:46:28 +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 156DkS1f092674; Sun, 6 Jun 2021 13:46:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156DkSKa092673; Sun, 6 Jun 2021 13:46:28 GMT (envelope-from git) Date: Sun, 6 Jun 2021 13:46:28 GMT Message-Id: <202106061346.156DkSKa092673@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: bfcce1a9f6e3 - main - linux(4): add struct timespec64 definition and conversion routine for future use. 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: bfcce1a9f6e3c9defde10bb1f83d4ba9752c23f6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 13:46:29 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=bfcce1a9f6e3c9defde10bb1f83d4ba9752c23f6 commit bfcce1a9f6e3c9defde10bb1f83d4ba9752c23f6 Author: Dmitry Chagin AuthorDate: 2021-06-07 01:47:12 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-07 01:47:12 +0000 linux(4): add struct timespec64 definition and conversion routine for future use. MFC after: 2 weeks --- sys/amd64/linux32/linux.h | 7 +++++++ sys/compat/linux/linux_time.c | 24 ++++++++++++++++++++++++ sys/compat/linux/linux_timer.h | 6 ++++++ sys/i386/linux/linux.h | 7 +++++++ 4 files changed, 44 insertions(+) diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h index 6f26974a75a1..50a4efed1709 100644 --- a/sys/amd64/linux32/linux.h +++ b/sys/amd64/linux32/linux.h @@ -81,6 +81,7 @@ typedef l_int l_pid_t; typedef l_uint l_size_t; typedef l_long l_suseconds_t; typedef l_long l_time_t; +typedef l_longlong l_time64_t; typedef l_uint l_uid_t; typedef l_ushort l_uid16_t; typedef l_int l_timer_t; @@ -171,6 +172,12 @@ struct l_timespec { l_long tv_nsec; }; +/* __kernel_timespec */ +struct l_timespec64 { + l_time64_t tv_sec; + l_longlong tv_nsec; +}; + struct l_newstat { l_ushort st_dev; l_ushort __pad1; diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c index 1d7dcc869159..2f1430faf702 100644 --- a/sys/compat/linux/linux_time.c +++ b/sys/compat/linux/linux_time.c @@ -124,6 +124,30 @@ linux_to_native_timespec(struct timespec *ntp, struct l_timespec *ltp) return (0); } +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +int +native_to_linux_timespec64(struct l_timespec64 *ltp64, struct timespec *ntp) +{ + + ltp64->tv_sec = ntp->tv_sec; + ltp64->tv_nsec = ntp->tv_nsec; + + return (0); +} + +int +linux_to_native_timespec64(struct timespec *ntp, struct l_timespec64 *ltp64) +{ + + if (ltp64->tv_sec < 0 || ltp64->tv_nsec < 0 || ltp64->tv_nsec > 999999999) + return (EINVAL); + ntp->tv_sec = ltp64->tv_sec; + ntp->tv_nsec = ltp64->tv_nsec; + + return (0); +} +#endif + int native_to_linux_itimerspec(struct l_itimerspec *ltp, struct itimerspec *ntp) { diff --git a/sys/compat/linux/linux_timer.h b/sys/compat/linux/linux_timer.h index 5344191742bb..6b5cf346049e 100644 --- a/sys/compat/linux/linux_timer.h +++ b/sys/compat/linux/linux_timer.h @@ -108,6 +108,12 @@ int native_to_linux_timespec(struct l_timespec *, struct timespec *); int linux_to_native_timespec(struct timespec *, struct l_timespec *); +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +int native_to_linux_timespec64(struct l_timespec64 *, + struct timespec *); +int linux_to_native_timespec64(struct timespec *, + struct l_timespec64 *); +#endif int linux_to_native_clockid(clockid_t *, clockid_t); int native_to_linux_itimerspec(struct l_itimerspec *, struct itimerspec *); diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h index 7a8de667e176..1bb76d8e41d0 100644 --- a/sys/i386/linux/linux.h +++ b/sys/i386/linux/linux.h @@ -71,6 +71,7 @@ typedef l_int l_pid_t; typedef l_uint l_size_t; typedef l_long l_suseconds_t; typedef l_long l_time_t; +typedef l_longlong l_time64_t; typedef l_uint l_uid_t; typedef l_ushort l_uid16_t; typedef l_int l_timer_t; @@ -142,6 +143,12 @@ struct l_timespec { l_long tv_nsec; }; +/* __kernel_timespec */ +struct l_timespec64 { + l_time64_t tv_sec; + l_longlong tv_nsec; +}; + struct l_newstat { l_ushort st_dev; l_ushort __pad1; From owner-dev-commits-src-main@freebsd.org Sun Jun 6 13:59:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C9B465EFA2; Sun, 6 Jun 2021 13:59:24 +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 4FydR03KXqz4qBH; Sun, 6 Jun 2021 13:59:24 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 5A8A324B98; Sun, 6 Jun 2021 13:59: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 156DxOUH005876; Sun, 6 Jun 2021 13:59:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156DxOX8005875; Sun, 6 Jun 2021 13:59:24 GMT (envelope-from git) Date: Sun, 6 Jun 2021 13:59:24 GMT Message-Id: <202106061359.156DxOX8005875@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: e4bffb80bbc6 - main - linux(4): Implement utimensat_time64 system call. 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: e4bffb80bbc6a2e4b3be89aefcbd5bb2c2fc0ba0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 13:59:24 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=e4bffb80bbc6a2e4b3be89aefcbd5bb2c2fc0ba0 commit e4bffb80bbc6a2e4b3be89aefcbd5bb2c2fc0ba0 Author: Dmitry Chagin AuthorDate: 2021-06-07 01:54:30 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-07 01:54:30 +0000 linux(4): Implement utimensat_time64 system call. MFC after: 2 weeks --- sys/amd64/linux32/linux32_dummy_machdep.c | 1 - sys/amd64/linux32/syscalls.master | 7 +- sys/compat/linux/linux_misc.c | 181 ++++++++++++++++++++---------- sys/i386/linux/linux_dummy_machdep.c | 1 - sys/i386/linux/syscalls.master | 7 +- 5 files changed, 134 insertions(+), 63 deletions(-) diff --git a/sys/amd64/linux32/linux32_dummy_machdep.c b/sys/amd64/linux32/linux32_dummy_machdep.c index 5eb54fefd276..be07eb033e77 100644 --- a/sys/amd64/linux32/linux32_dummy_machdep.c +++ b/sys/amd64/linux32/linux32_dummy_machdep.c @@ -76,7 +76,6 @@ DUMMY(timer_gettime64); DUMMY(timer_settime64); DUMMY(timerfd_gettime64); DUMMY(timerfd_settime64); -DUMMY(utimensat_time64); DUMMY(pselect6_time64); DUMMY(ppoll_time64); DUMMY(io_pgetevents_time64); diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master index d7002ed5ac72..67591b487652 100644 --- a/sys/amd64/linux32/syscalls.master +++ b/sys/amd64/linux32/syscalls.master @@ -2368,7 +2368,12 @@ int linux_timerfd_settime64(void); } 412 AUE_NULL STD { - int linux_utimensat_time64(void); + int linux_utimensat_time64( + l_int dfd, + const char *pathname, + const struct l_timespec64 *times64, + l_int flags + ); } 413 AUE_NULL STD { int linux_pselect6_time64(void); diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index c3f783694d84..bfa7bb659d5f 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -130,7 +130,14 @@ struct l_pselect6arg { l_size_t ss_len; }; -static int linux_utimensat_nsec_valid(l_long); +static int linux_utimensat_lts_to_ts(struct l_timespec *, + struct timespec *); +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +static int linux_utimensat_lts64_to_ts(struct l_timespec64 *, + struct timespec *); +#endif +static int linux_common_utimensat(struct thread *, int, + const char *, struct timespec *, int); int linux_sysinfo(struct thread *td, struct linux_sysinfo_args *args) @@ -780,89 +787,66 @@ linux_utimes(struct thread *td, struct linux_utimes_args *args) #endif static int -linux_utimensat_nsec_valid(l_long nsec) +linux_utimensat_lts_to_ts(struct l_timespec *l_times, struct timespec *times) { - if (nsec == LINUX_UTIME_OMIT || nsec == LINUX_UTIME_NOW) - return (0); - if (nsec >= 0 && nsec <= 999999999) - return (0); - return (1); + if (l_times->tv_nsec != LINUX_UTIME_OMIT && + l_times->tv_nsec != LINUX_UTIME_NOW && + (l_times->tv_nsec < 0 || l_times->tv_nsec > 999999999)) + return (EINVAL); + + times->tv_sec = l_times->tv_sec; + switch (l_times->tv_nsec) + { + case LINUX_UTIME_OMIT: + times->tv_nsec = UTIME_OMIT; + break; + case LINUX_UTIME_NOW: + times->tv_nsec = UTIME_NOW; + break; + default: + times->tv_nsec = l_times->tv_nsec; + } + + return (0); } -int -linux_utimensat(struct thread *td, struct linux_utimensat_args *args) +static int +linux_common_utimensat(struct thread *td, int ldfd, const char *pathname, + struct timespec *timesp, int lflags) { - struct l_timespec l_times[2]; - struct timespec times[2], *timesp = NULL; char *path = NULL; int error, dfd, flags = 0; - dfd = (args->dfd == LINUX_AT_FDCWD) ? AT_FDCWD : args->dfd; + dfd = (ldfd == LINUX_AT_FDCWD) ? AT_FDCWD : ldfd; - if (args->flags & ~(LINUX_AT_SYMLINK_NOFOLLOW | LINUX_AT_EMPTY_PATH)) + if (lflags & ~(LINUX_AT_SYMLINK_NOFOLLOW | LINUX_AT_EMPTY_PATH)) return (EINVAL); - if (args->times != NULL) { - error = copyin(args->times, l_times, sizeof(l_times)); - if (error != 0) - return (error); - - if (linux_utimensat_nsec_valid(l_times[0].tv_nsec) != 0 || - linux_utimensat_nsec_valid(l_times[1].tv_nsec) != 0) - return (EINVAL); - - times[0].tv_sec = l_times[0].tv_sec; - switch (l_times[0].tv_nsec) - { - case LINUX_UTIME_OMIT: - times[0].tv_nsec = UTIME_OMIT; - break; - case LINUX_UTIME_NOW: - times[0].tv_nsec = UTIME_NOW; - break; - default: - times[0].tv_nsec = l_times[0].tv_nsec; - } - - times[1].tv_sec = l_times[1].tv_sec; - switch (l_times[1].tv_nsec) - { - case LINUX_UTIME_OMIT: - times[1].tv_nsec = UTIME_OMIT; - break; - case LINUX_UTIME_NOW: - times[1].tv_nsec = UTIME_NOW; - break; - default: - times[1].tv_nsec = l_times[1].tv_nsec; - break; - } - timesp = times; - + if (timesp != NULL) { /* This breaks POSIX, but is what the Linux kernel does * _on purpose_ (documented in the man page for utimensat(2)), * so we must follow that behaviour. */ - if (times[0].tv_nsec == UTIME_OMIT && - times[1].tv_nsec == UTIME_OMIT) + if (timesp[0].tv_nsec == UTIME_OMIT && + timesp[1].tv_nsec == UTIME_OMIT) return (0); } - if (args->flags & LINUX_AT_SYMLINK_NOFOLLOW) + if (lflags & LINUX_AT_SYMLINK_NOFOLLOW) flags |= AT_SYMLINK_NOFOLLOW; - if (args->flags & LINUX_AT_EMPTY_PATH) + if (lflags & LINUX_AT_EMPTY_PATH) flags |= AT_EMPTY_PATH; if (!LUSECONVPATH(td)) { - if (args->pathname != NULL) { - return (kern_utimensat(td, dfd, args->pathname, + if (pathname != NULL) { + return (kern_utimensat(td, dfd, pathname, UIO_USERSPACE, timesp, UIO_SYSSPACE, flags)); } } - if (args->pathname != NULL) - LCONVPATHEXIST_AT(td, args->pathname, &path, dfd); - else if (args->flags != 0) + if (pathname != NULL) + LCONVPATHEXIST_AT(td, pathname, &path, dfd); + else if (lflags != 0) return (EINVAL); if (path == NULL) @@ -876,6 +860,85 @@ linux_utimensat(struct thread *td, struct linux_utimensat_args *args) return (error); } +int +linux_utimensat(struct thread *td, struct linux_utimensat_args *args) +{ + struct l_timespec l_times[2]; + struct timespec times[2], *timesp; + int error; + + if (args->times != NULL) { + error = copyin(args->times, l_times, sizeof(l_times)); + if (error != 0) + return (error); + + error = linux_utimensat_lts_to_ts(&l_times[0], ×[0]); + if (error != 0) + return (error); + error = linux_utimensat_lts_to_ts(&l_times[1], ×[1]); + if (error != 0) + return (error); + timesp = times; + } else + timesp = NULL; + + return (linux_common_utimensat(td, args->dfd, args->pathname, + timesp, args->flags)); +} + +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +static int +linux_utimensat_lts64_to_ts(struct l_timespec64 *l_times, struct timespec *times) +{ + + if (l_times->tv_nsec != LINUX_UTIME_OMIT && + l_times->tv_nsec != LINUX_UTIME_NOW && + (l_times->tv_nsec < 0 || l_times->tv_nsec > 999999999)) + return (EINVAL); + + times->tv_sec = l_times->tv_sec; + switch (l_times->tv_nsec) + { + case LINUX_UTIME_OMIT: + times->tv_nsec = UTIME_OMIT; + break; + case LINUX_UTIME_NOW: + times->tv_nsec = UTIME_NOW; + break; + default: + times->tv_nsec = l_times->tv_nsec; + } + + return (0); +} + +int +linux_utimensat_time64(struct thread *td, struct linux_utimensat_time64_args *args) +{ + struct l_timespec64 l_times[2]; + struct timespec times[2], *timesp; + int error; + + if (args->times64 != NULL) { + error = copyin(args->times64, l_times, sizeof(l_times)); + if (error != 0) + return (error); + + error = linux_utimensat_lts64_to_ts(&l_times[0], ×[0]); + if (error != 0) + return (error); + error = linux_utimensat_lts64_to_ts(&l_times[1], ×[1]); + if (error != 0) + return (error); + timesp = times; + } else + timesp = NULL; + + return (linux_common_utimensat(td, args->dfd, args->pathname, + timesp, args->flags)); +} +#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ + #ifdef LINUX_LEGACY_SYSCALLS int linux_futimesat(struct thread *td, struct linux_futimesat_args *args) diff --git a/sys/i386/linux/linux_dummy_machdep.c b/sys/i386/linux/linux_dummy_machdep.c index dfcc691a3582..d479ecde7a01 100644 --- a/sys/i386/linux/linux_dummy_machdep.c +++ b/sys/i386/linux/linux_dummy_machdep.c @@ -78,7 +78,6 @@ DUMMY(timer_gettime64); DUMMY(timer_settime64); DUMMY(timerfd_gettime64); DUMMY(timerfd_settime64); -DUMMY(utimensat_time64); DUMMY(pselect6_time64); DUMMY(ppoll_time64); DUMMY(io_pgetevents_time64); diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index e2732d211235..5ba21877f42c 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -2386,7 +2386,12 @@ int linux_timerfd_settime64(void); } 412 AUE_NULL STD { - int linux_utimensat_time64(void); + int linux_utimensat_time64( + l_int dfd, + const char *pathname, + const struct l_timespec64 *times64, + l_int flags + ); } 413 AUE_NULL STD { int linux_pselect6_time64(void); From owner-dev-commits-src-main@freebsd.org Sun Jun 6 13:59:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2B8965EF2C; Sun, 6 Jun 2021 13:59:25 +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 4FydR14PXHz4pv1; Sun, 6 Jun 2021 13:59:25 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7B1D924C87; Sun, 6 Jun 2021 13:59:25 +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 156DxPMJ005897; Sun, 6 Jun 2021 13:59:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156DxPJr005896; Sun, 6 Jun 2021 13:59:25 GMT (envelope-from git) Date: Sun, 6 Jun 2021 13:59:25 GMT Message-Id: <202106061359.156DxPJr005896@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: ea7fa5583c40 - main - Regen for ('e4bffb80bbc6a2e4b3be89aefcbd5bb2c2fc0ba0') Linux utimensat_time64 syscall. 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: ea7fa5583c407664b278a5f50cb16c7a7c6bcbc0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 13:59:25 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=ea7fa5583c407664b278a5f50cb16c7a7c6bcbc0 commit ea7fa5583c407664b278a5f50cb16c7a7c6bcbc0 Author: Dmitry Chagin AuthorDate: 2021-06-07 01:56:58 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-07 01:56:58 +0000 Regen for ('e4bffb80bbc6a2e4b3be89aefcbd5bb2c2fc0ba0') Linux utimensat_time64 syscall. MFC after: 2 weeks --- sys/amd64/linux32/linux32_proto.h | 5 ++++- sys/amd64/linux32/linux32_sysent.c | 2 +- sys/amd64/linux32/linux32_systrace_args.c | 26 +++++++++++++++++++++++++- sys/i386/linux/linux_proto.h | 5 ++++- sys/i386/linux/linux_sysent.c | 2 +- sys/i386/linux/linux_systrace_args.c | 26 +++++++++++++++++++++++++- 6 files changed, 60 insertions(+), 6 deletions(-) diff --git a/sys/amd64/linux32/linux32_proto.h b/sys/amd64/linux32/linux32_proto.h index 3055651ac382..8d2f74d3f04c 100644 --- a/sys/amd64/linux32/linux32_proto.h +++ b/sys/amd64/linux32/linux32_proto.h @@ -1546,7 +1546,10 @@ struct linux_timerfd_settime64_args { register_t dummy; }; struct linux_utimensat_time64_args { - register_t dummy; + char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)]; + char pathname_l_[PADL_(const char *)]; const char * pathname; char pathname_r_[PADR_(const char *)]; + char times64_l_[PADL_(const struct l_timespec64 *)]; const struct l_timespec64 * times64; char times64_r_[PADR_(const struct l_timespec64 *)]; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_pselect6_time64_args { register_t dummy; diff --git a/sys/amd64/linux32/linux32_sysent.c b/sys/amd64/linux32/linux32_sysent.c index 4c0c0e991244..da751f94b5e6 100644 --- a/sys/amd64/linux32/linux32_sysent.c +++ b/sys/amd64/linux32/linux32_sysent.c @@ -429,7 +429,7 @@ struct sysent linux32_sysent[] = { { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timer_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 409 = linux_timer_settime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timerfd_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 410 = linux_timerfd_gettime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timerfd_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 411 = linux_timerfd_settime64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_utimensat_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 412 = linux_utimensat_time64 */ + { .sy_narg = AS(linux_utimensat_time64_args), .sy_call = (sy_call_t *)linux_utimensat_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 412 = linux_utimensat_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_pselect6_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 413 = linux_pselect6_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_ppoll_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 414 = linux_ppoll_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 415 = nosys */ diff --git a/sys/amd64/linux32/linux32_systrace_args.c b/sys/amd64/linux32/linux32_systrace_args.c index 1a1f46412f33..4d6a54e37e11 100644 --- a/sys/amd64/linux32/linux32_systrace_args.c +++ b/sys/amd64/linux32/linux32_systrace_args.c @@ -3007,7 +3007,12 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_utimensat_time64 */ case 412: { - *n_args = 0; + struct linux_utimensat_time64_args *p = params; + iarg[0] = p->dfd; /* l_int */ + uarg[1] = (intptr_t)p->pathname; /* const char * */ + uarg[2] = (intptr_t)p->times64; /* const struct l_timespec64 * */ + iarg[3] = p->flags; /* l_int */ + *n_args = 4; break; } /* linux_pselect6_time64 */ @@ -8013,6 +8018,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_utimensat_time64 */ case 412: + switch (ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "userland const char *"; + break; + case 2: + p = "userland const struct l_timespec64 *"; + break; + case 3: + p = "l_int"; + break; + default: + break; + }; break; /* linux_pselect6_time64 */ case 413: @@ -9774,6 +9795,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 411: /* linux_utimensat_time64 */ case 412: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_pselect6_time64 */ case 413: /* linux_ppoll_time64 */ diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h index d306e345224a..1a963a49aecd 100644 --- a/sys/i386/linux/linux_proto.h +++ b/sys/i386/linux/linux_proto.h @@ -1539,7 +1539,10 @@ struct linux_timerfd_settime64_args { register_t dummy; }; struct linux_utimensat_time64_args { - register_t dummy; + char dfd_l_[PADL_(l_int)]; l_int dfd; char dfd_r_[PADR_(l_int)]; + char pathname_l_[PADL_(const char *)]; const char * pathname; char pathname_r_[PADR_(const char *)]; + char times64_l_[PADL_(const struct l_timespec64 *)]; const struct l_timespec64 * times64; char times64_r_[PADR_(const struct l_timespec64 *)]; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; }; struct linux_pselect6_time64_args { register_t dummy; diff --git a/sys/i386/linux/linux_sysent.c b/sys/i386/linux/linux_sysent.c index 83e8550b15f6..bb9280580dde 100644 --- a/sys/i386/linux/linux_sysent.c +++ b/sys/i386/linux/linux_sysent.c @@ -429,7 +429,7 @@ struct sysent linux_sysent[] = { { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timer_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 409 = linux_timer_settime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timerfd_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 410 = linux_timerfd_gettime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timerfd_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 411 = linux_timerfd_settime64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_utimensat_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 412 = linux_utimensat_time64 */ + { .sy_narg = AS(linux_utimensat_time64_args), .sy_call = (sy_call_t *)linux_utimensat_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 412 = linux_utimensat_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_pselect6_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 413 = linux_pselect6_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_ppoll_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 414 = linux_ppoll_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 415 = nosys */ diff --git a/sys/i386/linux/linux_systrace_args.c b/sys/i386/linux/linux_systrace_args.c index f2c36cd2dd65..91aa3a9a13eb 100644 --- a/sys/i386/linux/linux_systrace_args.c +++ b/sys/i386/linux/linux_systrace_args.c @@ -3046,7 +3046,12 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_utimensat_time64 */ case 412: { - *n_args = 0; + struct linux_utimensat_time64_args *p = params; + iarg[0] = p->dfd; /* l_int */ + uarg[1] = (intptr_t)p->pathname; /* const char * */ + uarg[2] = (intptr_t)p->times64; /* const struct l_timespec64 * */ + iarg[3] = p->flags; /* l_int */ + *n_args = 4; break; } /* linux_pselect6_time64 */ @@ -8090,6 +8095,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_utimensat_time64 */ case 412: + switch (ndx) { + case 0: + p = "l_int"; + break; + case 1: + p = "userland const char *"; + break; + case 2: + p = "userland const struct l_timespec64 *"; + break; + case 3: + p = "l_int"; + break; + default: + break; + }; break; /* linux_pselect6_time64 */ case 413: @@ -9880,6 +9901,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 411: /* linux_utimensat_time64 */ case 412: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_pselect6_time64 */ case 413: /* linux_ppoll_time64 */ From owner-dev-commits-src-main@freebsd.org Sun Jun 6 14:07:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49AF565F406; Sun, 6 Jun 2021 14:07: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 4Fydcn1PV8z4qgP; Sun, 6 Jun 2021 14:07:53 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1822A24B6A; Sun, 6 Jun 2021 14:07:53 +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 156E7qgQ020231; Sun, 6 Jun 2021 14:07:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156E7q6T020230; Sun, 6 Jun 2021 14:07:52 GMT (envelope-from git) Date: Sun, 6 Jun 2021 14:07:52 GMT Message-Id: <202106061407.156E7q6T020230@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: 99b6f430698f - main - linux(4): Implement clock_gettime64 system call. 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: 99b6f430698fa00a33184dd61591d8b6518ed9d3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 14:07:53 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=99b6f430698fa00a33184dd61591d8b6518ed9d3 commit 99b6f430698fa00a33184dd61591d8b6518ed9d3 Author: Dmitry Chagin AuthorDate: 2021-06-07 02:04:42 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-07 02:04:42 +0000 linux(4): Implement clock_gettime64 system call. MFC after: 2 weeks --- sys/amd64/linux32/linux32_dummy_machdep.c | 1 - sys/amd64/linux32/syscalls.master | 5 +- sys/compat/linux/linux_time.c | 88 +++++++++++++++++++++++-------- sys/i386/linux/linux_dummy_machdep.c | 1 - sys/i386/linux/syscalls.master | 5 +- 5 files changed, 73 insertions(+), 27 deletions(-) diff --git a/sys/amd64/linux32/linux32_dummy_machdep.c b/sys/amd64/linux32/linux32_dummy_machdep.c index be07eb033e77..3ff38c7a8584 100644 --- a/sys/amd64/linux32/linux32_dummy_machdep.c +++ b/sys/amd64/linux32/linux32_dummy_machdep.c @@ -67,7 +67,6 @@ DUMMY(mq_getsetattr); /* Linux 4.11: */ DUMMY(arch_prctl); /* Linux 5.0: */ -DUMMY(clock_gettime64); DUMMY(clock_settime64); DUMMY(clock_adjtime64); DUMMY(clock_getres_time64); diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master index 67591b487652..dbba97da68f8 100644 --- a/sys/amd64/linux32/syscalls.master +++ b/sys/amd64/linux32/syscalls.master @@ -2341,7 +2341,10 @@ } ; Linux 5.0: 403 AUE_NULL STD { - int linux_clock_gettime64(void); + int linux_clock_gettime64( + clockid_t which, + struct l_timespec64 *tp + ); } 404 AUE_NULL STD { int linux_clock_settime64(void); diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c index 2f1430faf702..10df72ad29f8 100644 --- a/sys/compat/linux/linux_time.c +++ b/sys/compat/linux/linux_time.c @@ -79,9 +79,13 @@ LIN_SDT_PROBE_DEFINE1(time, linux_to_native_clockid, unsupported_clockid, "clockid_t"); LIN_SDT_PROBE_DEFINE1(time, linux_to_native_clockid, unknown_clockid, "clockid_t"); -LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, conversion_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_common_clock_gettime, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, gettime_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime, copyout_error, "int"); +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime64, gettime_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime64, copyout_error, "int"); +#endif LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, settime_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, copyin_error, "int"); @@ -98,6 +102,9 @@ LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyin_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_flags, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_clockid, "int"); +static int linux_common_clock_gettime(struct thread *, clockid_t, + struct timespec *); + int native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp) { @@ -239,11 +246,10 @@ linux_to_native_timerflags(int *nflags, int flags) return (0); } -int -linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args) +static int +linux_common_clock_gettime(struct thread *td, clockid_t which, + struct timespec *tp) { - struct l_timespec lts; - struct timespec tp; struct rusage ru; struct thread *targettd; struct proc *p; @@ -252,20 +258,20 @@ linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args) pid_t pid; lwpid_t tid; - error = linux_to_native_clockid(&nwhich, args->which); + error = linux_to_native_clockid(&nwhich, which); if (error != 0) { linux_msg(curthread, - "unsupported clock_gettime clockid %d", args->which); - LIN_SDT_PROBE1(time, linux_clock_gettime, conversion_error, - error); + "unsupported clock_gettime clockid %d", which); + LIN_SDT_PROBE1(time, linux_common_clock_gettime, + conversion_error, error); return (error); } switch (nwhich) { case CLOCK_PROCESS_CPUTIME_ID: - if (args->which < 0) { - clockwhich = LINUX_CPUCLOCK_WHICH(args->which); - pid = LINUX_CPUCLOCK_ID(args->which); + if (which < 0) { + clockwhich = LINUX_CPUCLOCK_WHICH(which); + pid = LINUX_CPUCLOCK_ID(which); } else { clockwhich = LINUX_CPUCLOCK_SCHED; pid = 0; @@ -285,17 +291,17 @@ linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args) PROC_STATUNLOCK(p); PROC_UNLOCK(p); timevaladd(&ru.ru_utime, &ru.ru_stime); - TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp); + TIMEVAL_TO_TIMESPEC(&ru.ru_utime, tp); break; case LINUX_CPUCLOCK_VIRT: PROC_STATLOCK(p); calcru(p, &ru.ru_utime, &ru.ru_stime); PROC_STATUNLOCK(p); PROC_UNLOCK(p); - TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp); + TIMEVAL_TO_TIMESPEC(&ru.ru_utime, tp); break; case LINUX_CPUCLOCK_SCHED: - kern_process_cputime(p, &tp); + kern_process_cputime(p, tp); PROC_UNLOCK(p); break; default: @@ -306,9 +312,9 @@ linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args) break; case CLOCK_THREAD_CPUTIME_ID: - if (args->which < 0) { - clockwhich = LINUX_CPUCLOCK_WHICH(args->which); - tid = LINUX_CPUCLOCK_ID(args->which); + if (which < 0) { + clockwhich = LINUX_CPUCLOCK_WHICH(which); + tid = LINUX_CPUCLOCK_ID(which); } else { clockwhich = LINUX_CPUCLOCK_SCHED; tid = 0; @@ -331,7 +337,7 @@ linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args) PROC_STATUNLOCK(p); PROC_UNLOCK(p); timevaladd(&ru.ru_utime, &ru.ru_stime); - TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp); + TIMEVAL_TO_TIMESPEC(&ru.ru_utime, tp); break; case LINUX_CPUCLOCK_VIRT: PROC_STATLOCK(p); @@ -340,12 +346,12 @@ linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args) thread_unlock(targettd); PROC_STATUNLOCK(p); PROC_UNLOCK(p); - TIMEVAL_TO_TIMESPEC(&ru.ru_utime, &tp); + TIMEVAL_TO_TIMESPEC(&ru.ru_utime, tp); break; case LINUX_CPUCLOCK_SCHED: if (td == targettd) targettd = NULL; - kern_thread_cputime(targettd, &tp); + kern_thread_cputime(targettd, tp); PROC_UNLOCK(p); break; default: @@ -355,9 +361,21 @@ linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args) break; default: - error = kern_clock_gettime(td, nwhich, &tp); + error = kern_clock_gettime(td, nwhich, tp); break; } + + return (error); +} + +int +linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args) +{ + struct l_timespec lts; + struct timespec tp; + int error; + + error = linux_common_clock_gettime(td, args->which, &tp); if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_gettime, gettime_error, error); return (error); @@ -365,13 +383,37 @@ linux_clock_gettime(struct thread *td, struct linux_clock_gettime_args *args) error = native_to_linux_timespec(<s, &tp); if (error != 0) return (error); - error = copyout(<s, args->tp, sizeof lts); + error = copyout(<s, args->tp, sizeof(lts)); if (error != 0) LIN_SDT_PROBE1(time, linux_clock_gettime, copyout_error, error); return (error); } +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +int +linux_clock_gettime64(struct thread *td, struct linux_clock_gettime64_args *args) +{ + struct l_timespec64 lts; + struct timespec tp; + int error; + + error = linux_common_clock_gettime(td, args->which, &tp); + if (error != 0) { + LIN_SDT_PROBE1(time, linux_clock_gettime64, gettime_error, error); + return (error); + } + error = native_to_linux_timespec64(<s, &tp); + if (error != 0) + return (error); + error = copyout(<s, args->tp, sizeof(lts)); + if (error != 0) + LIN_SDT_PROBE1(time, linux_clock_gettime64, copyout_error, error); + + return (error); +} +#endif + int linux_clock_settime(struct thread *td, struct linux_clock_settime_args *args) { diff --git a/sys/i386/linux/linux_dummy_machdep.c b/sys/i386/linux/linux_dummy_machdep.c index d479ecde7a01..6855573c9358 100644 --- a/sys/i386/linux/linux_dummy_machdep.c +++ b/sys/i386/linux/linux_dummy_machdep.c @@ -69,7 +69,6 @@ DUMMY(vm86old); /* Linux 4.11: */ DUMMY(arch_prctl); /* Linux 5.0: */ -DUMMY(clock_gettime64); DUMMY(clock_settime64); DUMMY(clock_adjtime64); DUMMY(clock_getres_time64); diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index 5ba21877f42c..b0e305a45332 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -2359,7 +2359,10 @@ } ; Linux 5.0: 403 AUE_NULL STD { - int linux_clock_gettime64(void); + int linux_clock_gettime64( + clockid_t which, + struct l_timespec64 *tp + ); } 404 AUE_NULL STD { int linux_clock_settime64(void); From owner-dev-commits-src-main@freebsd.org Sun Jun 6 14:07:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69BCC65EE5A; Sun, 6 Jun 2021 14:07:54 +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 4Fydcp2Rwfz4qRq; Sun, 6 Jun 2021 14:07:54 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 3C39E24E10; Sun, 6 Jun 2021 14:07:54 +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 156E7sbQ020252; Sun, 6 Jun 2021 14:07:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156E7sAp020251; Sun, 6 Jun 2021 14:07:54 GMT (envelope-from git) Date: Sun, 6 Jun 2021 14:07:54 GMT Message-Id: <202106061407.156E7sAp020251@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: 9e07ae7a0967 - main - Regen for ('99b6f430698fa00a33184dd61591d8b6518ed9d3') Linux clock_gettime64 system call. 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: 9e07ae7a096742018aafb7e29ddf5c4cac8c1e7e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 14:07:54 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=9e07ae7a096742018aafb7e29ddf5c4cac8c1e7e commit 9e07ae7a096742018aafb7e29ddf5c4cac8c1e7e Author: Dmitry Chagin AuthorDate: 2021-06-07 02:08:11 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-07 02:08:11 +0000 Regen for ('99b6f430698fa00a33184dd61591d8b6518ed9d3') Linux clock_gettime64 system call. MFC after: 2 weeks --- sys/amd64/linux32/linux32_proto.h | 3 ++- sys/amd64/linux32/linux32_sysent.c | 2 +- sys/amd64/linux32/linux32_systrace_args.c | 18 +++++++++++++++++- sys/i386/linux/linux_proto.h | 3 ++- sys/i386/linux/linux_sysent.c | 2 +- sys/i386/linux/linux_systrace_args.c | 18 +++++++++++++++++- 6 files changed, 40 insertions(+), 6 deletions(-) diff --git a/sys/amd64/linux32/linux32_proto.h b/sys/amd64/linux32/linux32_proto.h index 8d2f74d3f04c..b1cd97ee6e74 100644 --- a/sys/amd64/linux32/linux32_proto.h +++ b/sys/amd64/linux32/linux32_proto.h @@ -1519,7 +1519,8 @@ struct linux_msgctl_args { char buf_l_[PADL_(struct l_msqid_ds *)]; struct l_msqid_ds * buf; char buf_r_[PADR_(struct l_msqid_ds *)]; }; struct linux_clock_gettime64_args { - register_t dummy; + char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)]; + char tp_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * tp; char tp_r_[PADR_(struct l_timespec64 *)]; }; struct linux_clock_settime64_args { register_t dummy; diff --git a/sys/amd64/linux32/linux32_sysent.c b/sys/amd64/linux32/linux32_sysent.c index da751f94b5e6..c1d92dc14299 100644 --- a/sys/amd64/linux32/linux32_sysent.c +++ b/sys/amd64/linux32/linux32_sysent.c @@ -420,7 +420,7 @@ struct sysent linux32_sysent[] = { { .sy_narg = AS(linux_msgsnd_args), .sy_call = (sy_call_t *)linux_msgsnd, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 400 = linux_msgsnd */ { .sy_narg = AS(linux_msgrcv_args), .sy_call = (sy_call_t *)linux_msgrcv, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 401 = linux_msgrcv */ { .sy_narg = AS(linux_msgctl_args), .sy_call = (sy_call_t *)linux_msgctl, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 402 = linux_msgctl */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 403 = linux_clock_gettime64 */ + { .sy_narg = AS(linux_clock_gettime64_args), .sy_call = (sy_call_t *)linux_clock_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 403 = linux_clock_gettime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 404 = linux_clock_settime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_adjtime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 405 = linux_clock_adjtime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_getres_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 406 = linux_clock_getres_time64 */ diff --git a/sys/amd64/linux32/linux32_systrace_args.c b/sys/amd64/linux32/linux32_systrace_args.c index 4d6a54e37e11..4c5c8a65c2b3 100644 --- a/sys/amd64/linux32/linux32_systrace_args.c +++ b/sys/amd64/linux32/linux32_systrace_args.c @@ -2962,7 +2962,10 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_clock_gettime64 */ case 403: { - *n_args = 0; + struct linux_clock_gettime64_args *p = params; + iarg[0] = p->which; /* clockid_t */ + uarg[1] = (intptr_t)p->tp; /* struct l_timespec64 * */ + *n_args = 2; break; } /* linux_clock_settime64 */ @@ -7991,6 +7994,16 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_gettime64 */ case 403: + switch (ndx) { + case 0: + p = "clockid_t"; + break; + case 1: + p = "userland struct l_timespec64 *"; + break; + default: + break; + }; break; /* linux_clock_settime64 */ case 404: @@ -9777,6 +9790,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_gettime64 */ case 403: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_clock_settime64 */ case 404: /* linux_clock_adjtime64 */ diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h index 1a963a49aecd..6adcdcc08f14 100644 --- a/sys/i386/linux/linux_proto.h +++ b/sys/i386/linux/linux_proto.h @@ -1512,7 +1512,8 @@ struct linux_msgctl_args { char buf_l_[PADL_(struct l_msqid_ds *)]; struct l_msqid_ds * buf; char buf_r_[PADR_(struct l_msqid_ds *)]; }; struct linux_clock_gettime64_args { - register_t dummy; + char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)]; + char tp_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * tp; char tp_r_[PADR_(struct l_timespec64 *)]; }; struct linux_clock_settime64_args { register_t dummy; diff --git a/sys/i386/linux/linux_sysent.c b/sys/i386/linux/linux_sysent.c index bb9280580dde..c62a5921100d 100644 --- a/sys/i386/linux/linux_sysent.c +++ b/sys/i386/linux/linux_sysent.c @@ -420,7 +420,7 @@ struct sysent linux_sysent[] = { { .sy_narg = AS(linux_msgsnd_args), .sy_call = (sy_call_t *)linux_msgsnd, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 400 = linux_msgsnd */ { .sy_narg = AS(linux_msgrcv_args), .sy_call = (sy_call_t *)linux_msgrcv, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 401 = linux_msgrcv */ { .sy_narg = AS(linux_msgctl_args), .sy_call = (sy_call_t *)linux_msgctl, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 402 = linux_msgctl */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 403 = linux_clock_gettime64 */ + { .sy_narg = AS(linux_clock_gettime64_args), .sy_call = (sy_call_t *)linux_clock_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 403 = linux_clock_gettime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 404 = linux_clock_settime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_adjtime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 405 = linux_clock_adjtime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_getres_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 406 = linux_clock_getres_time64 */ diff --git a/sys/i386/linux/linux_systrace_args.c b/sys/i386/linux/linux_systrace_args.c index 91aa3a9a13eb..dc07c0d135b2 100644 --- a/sys/i386/linux/linux_systrace_args.c +++ b/sys/i386/linux/linux_systrace_args.c @@ -3001,7 +3001,10 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_clock_gettime64 */ case 403: { - *n_args = 0; + struct linux_clock_gettime64_args *p = params; + iarg[0] = p->which; /* clockid_t */ + uarg[1] = (intptr_t)p->tp; /* struct l_timespec64 * */ + *n_args = 2; break; } /* linux_clock_settime64 */ @@ -8068,6 +8071,16 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_gettime64 */ case 403: + switch (ndx) { + case 0: + p = "clockid_t"; + break; + case 1: + p = "userland struct l_timespec64 *"; + break; + default: + break; + }; break; /* linux_clock_settime64 */ case 404: @@ -9883,6 +9896,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_gettime64 */ case 403: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_clock_settime64 */ case 404: /* linux_clock_adjtime64 */ From owner-dev-commits-src-main@freebsd.org Sun Jun 6 14:13:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2557465F1EE; Sun, 6 Jun 2021 14:13:50 +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 4Fydlf0YNjz4qrN; Sun, 6 Jun 2021 14:13:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 EF39425080; Sun, 6 Jun 2021 14:13:49 +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 156EDnpX033195; Sun, 6 Jun 2021 14:13:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156EDn5D033194; Sun, 6 Jun 2021 14:13:49 GMT (envelope-from git) Date: Sun, 6 Jun 2021 14:13:49 GMT Message-Id: <202106061413.156EDn5D033194@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: 19f9a0e4df54 - main - linux(4): Implement clock_settime64 system call. 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: 19f9a0e4df54f8d1e99234146024422bdcfa09ce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 14:13:50 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=19f9a0e4df54f8d1e99234146024422bdcfa09ce commit 19f9a0e4df54f8d1e99234146024422bdcfa09ce Author: Dmitry Chagin AuthorDate: 2021-06-07 02:11:25 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-07 02:11:25 +0000 linux(4): Implement clock_settime64 system call. MFC after: 2 weeks --- sys/amd64/linux32/linux32_dummy_machdep.c | 1 - sys/amd64/linux32/syscalls.master | 5 ++- sys/compat/linux/linux_time.c | 67 ++++++++++++++++++++++++------- sys/i386/linux/linux_dummy_machdep.c | 1 - sys/i386/linux/syscalls.master | 5 ++- 5 files changed, 60 insertions(+), 19 deletions(-) diff --git a/sys/amd64/linux32/linux32_dummy_machdep.c b/sys/amd64/linux32/linux32_dummy_machdep.c index 3ff38c7a8584..022fbcbdd0c6 100644 --- a/sys/amd64/linux32/linux32_dummy_machdep.c +++ b/sys/amd64/linux32/linux32_dummy_machdep.c @@ -67,7 +67,6 @@ DUMMY(mq_getsetattr); /* Linux 4.11: */ DUMMY(arch_prctl); /* Linux 5.0: */ -DUMMY(clock_settime64); DUMMY(clock_adjtime64); DUMMY(clock_getres_time64); DUMMY(clock_nanosleep_time64); diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master index dbba97da68f8..924fbce9eac7 100644 --- a/sys/amd64/linux32/syscalls.master +++ b/sys/amd64/linux32/syscalls.master @@ -2347,7 +2347,10 @@ ); } 404 AUE_NULL STD { - int linux_clock_settime64(void); + int linux_clock_settime64( + clockid_t which, + struct l_timespec64 *tp + ); } 405 AUE_NULL STD { int linux_clock_adjtime64(void); diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c index 10df72ad29f8..65bb4e9b754f 100644 --- a/sys/compat/linux/linux_time.c +++ b/sys/compat/linux/linux_time.c @@ -87,8 +87,13 @@ LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime64, gettime_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_gettime64, copyout_error, "int"); #endif LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, conversion_error, "int"); -LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, settime_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_common_clock_settime, settime_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_common_clock_settime, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, copyin_error, "int"); +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime64, conversion_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime64, copyin_error, "int"); +#endif LIN_SDT_PROBE_DEFINE0(time, linux_clock_getres, nullcall); LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, getres_error, "int"); @@ -104,6 +109,8 @@ LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_clockid, "int"); static int linux_common_clock_gettime(struct thread *, clockid_t, struct timespec *); +static int linux_common_clock_settime(struct thread *, clockid_t, + struct timespec *); int native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp) @@ -414,40 +421,70 @@ linux_clock_gettime64(struct thread *td, struct linux_clock_gettime64_args *args } #endif -int -linux_clock_settime(struct thread *td, struct linux_clock_settime_args *args) +static int +linux_common_clock_settime(struct thread *td, clockid_t which, + struct timespec *ts) { - struct timespec ts; - struct l_timespec lts; int error; clockid_t nwhich; - error = linux_to_native_clockid(&nwhich, args->which); + error = linux_to_native_clockid(&nwhich, which); if (error != 0) { linux_msg(curthread, - "unsupported clock_settime clockid %d", args->which); - LIN_SDT_PROBE1(time, linux_clock_settime, conversion_error, + "unsupported clock_settime clockid %d", which); + LIN_SDT_PROBE1(time, linux_common_clock_settime, conversion_error, error); return (error); } - error = copyin(args->tp, <s, sizeof lts); + + error = kern_clock_settime(td, nwhich, ts); + if (error != 0) + LIN_SDT_PROBE1(time, linux_common_clock_settime, + settime_error, error); + + return (error); +} + +int +linux_clock_settime(struct thread *td, struct linux_clock_settime_args *args) +{ + struct timespec ts; + struct l_timespec lts; + int error; + + error = copyin(args->tp, <s, sizeof(lts)); if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_settime, copyin_error, error); return (error); } error = linux_to_native_timespec(&ts, <s); - if (error != 0) { + if (error != 0) LIN_SDT_PROBE1(time, linux_clock_settime, conversion_error, error); + + return (linux_common_clock_settime(td, args->which, &ts)); +} + +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +int +linux_clock_settime64(struct thread *td, struct linux_clock_settime64_args *args) +{ + struct timespec ts; + struct l_timespec64 lts; + int error; + + error = copyin(args->tp, <s, sizeof(lts)); + if (error != 0) { + LIN_SDT_PROBE1(time, linux_clock_settime64, copyin_error, error); return (error); } - - error = kern_clock_settime(td, nwhich, &ts); + error = linux_to_native_timespec64(&ts, <s); if (error != 0) - LIN_SDT_PROBE1(time, linux_clock_settime, settime_error, error); - - return (error); + LIN_SDT_PROBE1(time, linux_clock_settime64, conversion_error, + error); + return (linux_common_clock_settime(td, args->which, &ts)); } +#endif int linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args) diff --git a/sys/i386/linux/linux_dummy_machdep.c b/sys/i386/linux/linux_dummy_machdep.c index 6855573c9358..762dc177b1b0 100644 --- a/sys/i386/linux/linux_dummy_machdep.c +++ b/sys/i386/linux/linux_dummy_machdep.c @@ -69,7 +69,6 @@ DUMMY(vm86old); /* Linux 4.11: */ DUMMY(arch_prctl); /* Linux 5.0: */ -DUMMY(clock_settime64); DUMMY(clock_adjtime64); DUMMY(clock_getres_time64); DUMMY(clock_nanosleep_time64); diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index b0e305a45332..a8b41605b743 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -2365,7 +2365,10 @@ ); } 404 AUE_NULL STD { - int linux_clock_settime64(void); + int linux_clock_settime64( + clockid_t which, + struct l_timespec64 *tp + ); } 405 AUE_NULL STD { int linux_clock_adjtime64(void); From owner-dev-commits-src-main@freebsd.org Sun Jun 6 14:13:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4AD2565F705; Sun, 6 Jun 2021 14:13:51 +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 4Fydlg1ZCqz4qjB; Sun, 6 Jun 2021 14:13:51 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1A5332501B; Sun, 6 Jun 2021 14:13:51 +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 156EDpSm033223; Sun, 6 Jun 2021 14:13:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156EDok0033222; Sun, 6 Jun 2021 14:13:50 GMT (envelope-from git) Date: Sun, 6 Jun 2021 14:13:50 GMT Message-Id: <202106061413.156EDok0033222@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: 82e38486548c - main - Regen for ('19f9a0e4df54f8d1e99234146024422bdcfa09ce') Linux clock_settime64 system call. 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: 82e38486548c70b9e7fc4323376aab85f5cc026c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 14:13:51 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=82e38486548c70b9e7fc4323376aab85f5cc026c commit 82e38486548c70b9e7fc4323376aab85f5cc026c Author: Dmitry Chagin AuthorDate: 2021-06-07 02:14:04 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-07 02:14:04 +0000 Regen for ('19f9a0e4df54f8d1e99234146024422bdcfa09ce') Linux clock_settime64 system call. MFC after: 2 weeks --- sys/amd64/linux32/linux32_proto.h | 3 ++- sys/amd64/linux32/linux32_sysent.c | 2 +- sys/amd64/linux32/linux32_systrace_args.c | 18 +++++++++++++++++- sys/i386/linux/linux_proto.h | 3 ++- sys/i386/linux/linux_sysent.c | 2 +- sys/i386/linux/linux_systrace_args.c | 18 +++++++++++++++++- 6 files changed, 40 insertions(+), 6 deletions(-) diff --git a/sys/amd64/linux32/linux32_proto.h b/sys/amd64/linux32/linux32_proto.h index b1cd97ee6e74..18b448d57a8d 100644 --- a/sys/amd64/linux32/linux32_proto.h +++ b/sys/amd64/linux32/linux32_proto.h @@ -1523,7 +1523,8 @@ struct linux_clock_gettime64_args { char tp_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * tp; char tp_r_[PADR_(struct l_timespec64 *)]; }; struct linux_clock_settime64_args { - register_t dummy; + char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)]; + char tp_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * tp; char tp_r_[PADR_(struct l_timespec64 *)]; }; struct linux_clock_adjtime64_args { register_t dummy; diff --git a/sys/amd64/linux32/linux32_sysent.c b/sys/amd64/linux32/linux32_sysent.c index c1d92dc14299..d33fa28f7a32 100644 --- a/sys/amd64/linux32/linux32_sysent.c +++ b/sys/amd64/linux32/linux32_sysent.c @@ -421,7 +421,7 @@ struct sysent linux32_sysent[] = { { .sy_narg = AS(linux_msgrcv_args), .sy_call = (sy_call_t *)linux_msgrcv, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 401 = linux_msgrcv */ { .sy_narg = AS(linux_msgctl_args), .sy_call = (sy_call_t *)linux_msgctl, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 402 = linux_msgctl */ { .sy_narg = AS(linux_clock_gettime64_args), .sy_call = (sy_call_t *)linux_clock_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 403 = linux_clock_gettime64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 404 = linux_clock_settime64 */ + { .sy_narg = AS(linux_clock_settime64_args), .sy_call = (sy_call_t *)linux_clock_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 404 = linux_clock_settime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_adjtime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 405 = linux_clock_adjtime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_getres_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 406 = linux_clock_getres_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_nanosleep_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 407 = linux_clock_nanosleep_time64 */ diff --git a/sys/amd64/linux32/linux32_systrace_args.c b/sys/amd64/linux32/linux32_systrace_args.c index 4c5c8a65c2b3..6999999399eb 100644 --- a/sys/amd64/linux32/linux32_systrace_args.c +++ b/sys/amd64/linux32/linux32_systrace_args.c @@ -2970,7 +2970,10 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_clock_settime64 */ case 404: { - *n_args = 0; + struct linux_clock_settime64_args *p = params; + iarg[0] = p->which; /* clockid_t */ + uarg[1] = (intptr_t)p->tp; /* struct l_timespec64 * */ + *n_args = 2; break; } /* linux_clock_adjtime64 */ @@ -8007,6 +8010,16 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_settime64 */ case 404: + switch (ndx) { + case 0: + p = "clockid_t"; + break; + case 1: + p = "userland struct l_timespec64 *"; + break; + default: + break; + }; break; /* linux_clock_adjtime64 */ case 405: @@ -9795,6 +9808,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_settime64 */ case 404: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_clock_adjtime64 */ case 405: /* linux_clock_getres_time64 */ diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h index 6adcdcc08f14..6fc65571cade 100644 --- a/sys/i386/linux/linux_proto.h +++ b/sys/i386/linux/linux_proto.h @@ -1516,7 +1516,8 @@ struct linux_clock_gettime64_args { char tp_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * tp; char tp_r_[PADR_(struct l_timespec64 *)]; }; struct linux_clock_settime64_args { - register_t dummy; + char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)]; + char tp_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * tp; char tp_r_[PADR_(struct l_timespec64 *)]; }; struct linux_clock_adjtime64_args { register_t dummy; diff --git a/sys/i386/linux/linux_sysent.c b/sys/i386/linux/linux_sysent.c index c62a5921100d..743c541f9277 100644 --- a/sys/i386/linux/linux_sysent.c +++ b/sys/i386/linux/linux_sysent.c @@ -421,7 +421,7 @@ struct sysent linux_sysent[] = { { .sy_narg = AS(linux_msgrcv_args), .sy_call = (sy_call_t *)linux_msgrcv, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 401 = linux_msgrcv */ { .sy_narg = AS(linux_msgctl_args), .sy_call = (sy_call_t *)linux_msgctl, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 402 = linux_msgctl */ { .sy_narg = AS(linux_clock_gettime64_args), .sy_call = (sy_call_t *)linux_clock_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 403 = linux_clock_gettime64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 404 = linux_clock_settime64 */ + { .sy_narg = AS(linux_clock_settime64_args), .sy_call = (sy_call_t *)linux_clock_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 404 = linux_clock_settime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_adjtime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 405 = linux_clock_adjtime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_getres_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 406 = linux_clock_getres_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_nanosleep_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 407 = linux_clock_nanosleep_time64 */ diff --git a/sys/i386/linux/linux_systrace_args.c b/sys/i386/linux/linux_systrace_args.c index dc07c0d135b2..fde853acdeec 100644 --- a/sys/i386/linux/linux_systrace_args.c +++ b/sys/i386/linux/linux_systrace_args.c @@ -3009,7 +3009,10 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_clock_settime64 */ case 404: { - *n_args = 0; + struct linux_clock_settime64_args *p = params; + iarg[0] = p->which; /* clockid_t */ + uarg[1] = (intptr_t)p->tp; /* struct l_timespec64 * */ + *n_args = 2; break; } /* linux_clock_adjtime64 */ @@ -8084,6 +8087,16 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_settime64 */ case 404: + switch (ndx) { + case 0: + p = "clockid_t"; + break; + case 1: + p = "userland struct l_timespec64 *"; + break; + default: + break; + }; break; /* linux_clock_adjtime64 */ case 405: @@ -9901,6 +9914,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_settime64 */ case 404: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_clock_adjtime64 */ case 405: /* linux_clock_getres_time64 */ From owner-dev-commits-src-main@freebsd.org Sun Jun 6 14:18:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 915CF65F552; Sun, 6 Jun 2021 14:18:50 +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 4FydsQ3jx2z4rBM; Sun, 6 Jun 2021 14:18:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 67E8224C4C; Sun, 6 Jun 2021 14:18:50 +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 156EIoUu033651; Sun, 6 Jun 2021 14:18:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156EIo3u033650; Sun, 6 Jun 2021 14:18:50 GMT (envelope-from git) Date: Sun, 6 Jun 2021 14:18:50 GMT Message-Id: <202106061418.156EIo3u033650@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: a3c2c06bc938 - main - Make LINT NOINET and NOIP kernel builds warning free. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a3c2c06bc938dbb9ad2ec4a352194159e29b9146 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 14:18:50 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=a3c2c06bc938dbb9ad2ec4a352194159e29b9146 commit a3c2c06bc938dbb9ad2ec4a352194159e29b9146 Author: Bjoern A. Zeeb AuthorDate: 2021-06-06 14:03:06 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-06-06 14:03:06 +0000 Make LINT NOINET and NOIP kernel builds warning free. Apply #ifdef INET or #if defined(INET6) || defined(INET) to make universe NOINET and NOIP LINT kernels warning free as well again. --- sys/net/if_vxlan.c | 2 ++ sys/net/rtsock.c | 4 ++++ sys/netgraph/netflow/netflow.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c index f56ec23540a7..b03357c30c08 100644 --- a/sys/net/if_vxlan.c +++ b/sys/net/if_vxlan.c @@ -2429,6 +2429,7 @@ vxlan_encap_header(struct vxlan_softc *sc, struct mbuf *m, int ipoff, } #endif +#if defined(INET6) || defined(INET) /* * Return the CSUM_INNER_* equivalent of CSUM_* caps. */ @@ -2470,6 +2471,7 @@ csum_flags_to_inner_flags(uint32_t csum_flags_in, const uint32_t encap) return (csum_flags); } +#endif static int vxlan_encap4(struct vxlan_softc *sc, const union vxlan_sockaddr *fvxlsa, diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 3cb645f42e4c..07a2deaa5518 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1007,6 +1007,7 @@ save_add_notification(struct rib_cmd_info *rc, void *_cbdata) } #endif +#if defined(INET6) || defined(INET) static struct sockaddr * alloc_sockaddr_aligned(struct linear_buffer *lb, int len) { @@ -1017,6 +1018,7 @@ alloc_sockaddr_aligned(struct linear_buffer *lb, int len) lb->offset += len; return (sa); } +#endif /*ARGSUSED*/ static int @@ -1358,6 +1360,7 @@ fill_sockaddr_inet6(struct sockaddr_in6 *sin6, const struct in6_addr *addr6, } #endif +#if defined(INET6) || defined(INET) /* * Checks if gateway is suitable for lltable operations. * Lltable code requires AF_LINK gateway with ifindex @@ -1448,6 +1451,7 @@ cleanup_xaddrs_gateway(struct rt_addrinfo *info, struct linear_buffer *lb) return (0); } +#endif static void remove_netmask(struct rt_addrinfo *info) diff --git a/sys/netgraph/netflow/netflow.c b/sys/netgraph/netflow/netflow.c index f7f0648b296f..7d4108ee59a7 100644 --- a/sys/netgraph/netflow/netflow.c +++ b/sys/netgraph/netflow/netflow.c @@ -117,6 +117,7 @@ static int hash6_insert(priv_p, struct flow_hash_entry *, struct flow6_rec *, static void expire_flow(priv_p, fib_export_p, struct flow_entry *, int); +#ifdef INET /* * Generate hash for a given flow record. * @@ -140,6 +141,7 @@ ip_hash(struct flow_rec *r) return ADDR_HASH(r->r_src.s_addr, r->r_dst.s_addr); } } +#endif #ifdef INET6 /* Generate hash for a given flow6 record. Use lower 4 octets from v6 addresses */ From owner-dev-commits-src-main@freebsd.org Sun Jun 6 14:21:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B54265F4C2; Sun, 6 Jun 2021 14:21:30 +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 4FydwV0FyGz4rJ4; Sun, 6 Jun 2021 14:21:30 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E5CA62502F; Sun, 6 Jun 2021 14:21:29 +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 156ELTs7045193; Sun, 6 Jun 2021 14:21:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156ELTuv045192; Sun, 6 Jun 2021 14:21:29 GMT (envelope-from git) Date: Sun, 6 Jun 2021 14:21:29 GMT Message-Id: <202106061421.156ELTuv045192@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: 187715a42023 - main - linux(4): Implement clock_getres_time64 system call. 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: 187715a420237e1ed94dd5aef158eada7dcdc559 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 14:21:30 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=187715a420237e1ed94dd5aef158eada7dcdc559 commit 187715a420237e1ed94dd5aef158eada7dcdc559 Author: Dmitry Chagin AuthorDate: 2021-06-07 02:21:32 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-07 02:21:32 +0000 linux(4): Implement clock_getres_time64 system call. MFC after: 2 weeks --- sys/amd64/linux32/linux32_dummy_machdep.c | 1 - sys/amd64/linux32/syscalls.master | 5 +- sys/compat/linux/linux_time.c | 92 +++++++++++++++++++++++-------- sys/i386/linux/linux_dummy_machdep.c | 1 - sys/i386/linux/syscalls.master | 5 +- 5 files changed, 76 insertions(+), 28 deletions(-) diff --git a/sys/amd64/linux32/linux32_dummy_machdep.c b/sys/amd64/linux32/linux32_dummy_machdep.c index 022fbcbdd0c6..3f8dfe711dba 100644 --- a/sys/amd64/linux32/linux32_dummy_machdep.c +++ b/sys/amd64/linux32/linux32_dummy_machdep.c @@ -68,7 +68,6 @@ DUMMY(mq_getsetattr); DUMMY(arch_prctl); /* Linux 5.0: */ DUMMY(clock_adjtime64); -DUMMY(clock_getres_time64); DUMMY(clock_nanosleep_time64); DUMMY(timer_gettime64); DUMMY(timer_settime64); diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master index 924fbce9eac7..27034c0216ff 100644 --- a/sys/amd64/linux32/syscalls.master +++ b/sys/amd64/linux32/syscalls.master @@ -2356,7 +2356,10 @@ int linux_clock_adjtime64(void); } 406 AUE_NULL STD { - int linux_clock_getres_time64(void); + int linux_clock_getres_time64( + clockid_t which, + struct l_timespec64 *tp + ); } 407 AUE_NULL STD { int linux_clock_nanosleep_time64(void); diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c index 65bb4e9b754f..43db8871a0d8 100644 --- a/sys/compat/linux/linux_time.c +++ b/sys/compat/linux/linux_time.c @@ -94,10 +94,13 @@ LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime, copyin_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime64, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_settime64, copyin_error, "int"); #endif -LIN_SDT_PROBE_DEFINE0(time, linux_clock_getres, nullcall); -LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, conversion_error, "int"); -LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, getres_error, "int"); +LIN_SDT_PROBE_DEFINE0(time, linux_common_clock_getres, nullcall); +LIN_SDT_PROBE_DEFINE1(time, linux_common_clock_getres, conversion_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_common_clock_getres, getres_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres, copyout_error, "int"); +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +LIN_SDT_PROBE_DEFINE1(time, linux_clock_getres_time64, copyout_error, "int"); +#endif LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyout_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyin_error, "int"); @@ -111,6 +114,8 @@ static int linux_common_clock_gettime(struct thread *, clockid_t, struct timespec *); static int linux_common_clock_settime(struct thread *, clockid_t, struct timespec *); +static int linux_common_clock_getres(struct thread *, clockid_t, + struct timespec *); int native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp) @@ -486,23 +491,22 @@ linux_clock_settime64(struct thread *td, struct linux_clock_settime64_args *args } #endif -int -linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args) +static int +linux_common_clock_getres(struct thread *td, clockid_t which, + struct timespec *ts) { struct proc *p; - struct timespec ts; - struct l_timespec lts; int error, clockwhich; clockid_t nwhich; pid_t pid; lwpid_t tid; - error = linux_to_native_clockid(&nwhich, args->which); + error = linux_to_native_clockid(&nwhich, which); if (error != 0) { linux_msg(curthread, - "unsupported clock_getres clockid %d", args->which); - LIN_SDT_PROBE1(time, linux_clock_getres, conversion_error, - error); + "unsupported clock_getres clockid %d", which); + LIN_SDT_PROBE1(time, linux_common_clock_getres, + conversion_error, error); return (error); } @@ -510,10 +514,10 @@ linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args) * Check user supplied clock id in case of per-process * or thread-specific cpu-time clock. */ - if (args->which < 0) { + if (which < 0) { switch (nwhich) { case CLOCK_THREAD_CPUTIME_ID: - tid = LINUX_CPUCLOCK_ID(args->which); + tid = LINUX_CPUCLOCK_ID(which); if (tid != 0) { p = td->td_proc; if (linux_tdfind(td, tid, p->p_pid) == NULL) @@ -522,7 +526,7 @@ linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args) } break; case CLOCK_PROCESS_CPUTIME_ID: - pid = LINUX_CPUCLOCK_ID(args->which); + pid = LINUX_CPUCLOCK_ID(which); if (pid != 0) { error = pget(pid, PGET_CANSEE, &p); if (error != 0) @@ -533,15 +537,15 @@ linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args) } } - if (args->tp == NULL) { - LIN_SDT_PROBE0(time, linux_clock_getres, nullcall); + if (ts == NULL) { + LIN_SDT_PROBE0(time, linux_common_clock_getres, nullcall); return (0); } switch (nwhich) { case CLOCK_THREAD_CPUTIME_ID: case CLOCK_PROCESS_CPUTIME_ID: - clockwhich = LINUX_CPUCLOCK_WHICH(args->which); + clockwhich = LINUX_CPUCLOCK_WHICH(which); /* * In both cases (when the clock id obtained by a call to * clock_getcpuclockid() or using the clock @@ -550,9 +554,9 @@ linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args) * * See Linux posix_cpu_clock_getres() implementation. */ - if (args->which > 0 || clockwhich == LINUX_CPUCLOCK_SCHED) { - ts.tv_sec = 0; - ts.tv_nsec = 1; + if (which > 0 || clockwhich == LINUX_CPUCLOCK_SCHED) { + ts->tv_sec = 0; + ts->tv_nsec = 1; goto out; } @@ -571,22 +575,62 @@ linux_clock_getres(struct thread *td, struct linux_clock_getres_args *args) default: break; } - error = kern_clock_getres(td, nwhich, &ts); + error = kern_clock_getres(td, nwhich, ts); if (error != 0) { - LIN_SDT_PROBE1(time, linux_clock_getres, getres_error, error); + LIN_SDT_PROBE1(time, linux_common_clock_getres, + getres_error, error); return (error); } out: + return (error); +} + +int +linux_clock_getres(struct thread *td, + struct linux_clock_getres_args *args) +{ + struct timespec ts; + struct l_timespec lts; + int error; + + error = linux_common_clock_getres(td, args->which, &ts); + if (error != 0 || args->tp == NULL) + return (error); + error = native_to_linux_timespec(<s, &ts); if (error != 0) return (error); - error = copyout(<s, args->tp, sizeof lts); + error = copyout(<s, args->tp, sizeof(lts)); if (error != 0) - LIN_SDT_PROBE1(time, linux_clock_getres, copyout_error, error); + LIN_SDT_PROBE1(time, linux_clock_getres, + copyout_error, error); + return (error); +} + +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +int +linux_clock_getres_time64(struct thread *td, + struct linux_clock_getres_time64_args *args) +{ + struct timespec ts; + struct l_timespec64 lts; + int error; + + error = linux_common_clock_getres(td, args->which, &ts); + if (error != 0 || args->tp == NULL) + return (error); + error = native_to_linux_timespec64(<s, &ts); + if (error != 0) + return (error); + error = copyout(<s, args->tp, sizeof(lts)); + if (error != 0) + LIN_SDT_PROBE1(time, linux_clock_getres_time64, + copyout_error, error); return (error); } +#endif int linux_nanosleep(struct thread *td, struct linux_nanosleep_args *args) diff --git a/sys/i386/linux/linux_dummy_machdep.c b/sys/i386/linux/linux_dummy_machdep.c index 762dc177b1b0..6e4c9c66edcb 100644 --- a/sys/i386/linux/linux_dummy_machdep.c +++ b/sys/i386/linux/linux_dummy_machdep.c @@ -70,7 +70,6 @@ DUMMY(vm86old); DUMMY(arch_prctl); /* Linux 5.0: */ DUMMY(clock_adjtime64); -DUMMY(clock_getres_time64); DUMMY(clock_nanosleep_time64); DUMMY(timer_gettime64); DUMMY(timer_settime64); diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index a8b41605b743..0876a039ea05 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -2374,7 +2374,10 @@ int linux_clock_adjtime64(void); } 406 AUE_NULL STD { - int linux_clock_getres_time64(void); + int linux_clock_getres_time64( + clockid_t which, + struct l_timespec64 *tp + ); } 407 AUE_NULL STD { int linux_clock_nanosleep_time64(void); From owner-dev-commits-src-main@freebsd.org Sun Jun 6 14:21:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5677865F6A8; Sun, 6 Jun 2021 14:21: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 4FydwW1ZLDz4rVV; Sun, 6 Jun 2021 14:21:31 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 1BE8B25030; Sun, 6 Jun 2021 14:21:31 +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 156ELUUf045217; Sun, 6 Jun 2021 14:21:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156ELUA5045216; Sun, 6 Jun 2021 14:21:30 GMT (envelope-from git) Date: Sun, 6 Jun 2021 14:21:30 GMT Message-Id: <202106061421.156ELUA5045216@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: 773d9153c37a - main - Regen for ('187715a420237e1ed94dd5aef158eada7dcdc559') Linux clock_getres_time64 system call. 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: 773d9153c37a709d5c12bc8abe9166e1d044c01b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 14:21:31 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=773d9153c37a709d5c12bc8abe9166e1d044c01b commit 773d9153c37a709d5c12bc8abe9166e1d044c01b Author: Dmitry Chagin AuthorDate: 2021-06-07 02:21:48 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-07 02:21:48 +0000 Regen for ('187715a420237e1ed94dd5aef158eada7dcdc559') Linux clock_getres_time64 system call. MFC after: 2 weeks --- sys/amd64/linux32/linux32_proto.h | 3 ++- sys/amd64/linux32/linux32_sysent.c | 2 +- sys/amd64/linux32/linux32_systrace_args.c | 18 +++++++++++++++++- sys/i386/linux/linux_proto.h | 3 ++- sys/i386/linux/linux_sysent.c | 2 +- sys/i386/linux/linux_systrace_args.c | 18 +++++++++++++++++- 6 files changed, 40 insertions(+), 6 deletions(-) diff --git a/sys/amd64/linux32/linux32_proto.h b/sys/amd64/linux32/linux32_proto.h index 18b448d57a8d..7c21877c6214 100644 --- a/sys/amd64/linux32/linux32_proto.h +++ b/sys/amd64/linux32/linux32_proto.h @@ -1530,7 +1530,8 @@ struct linux_clock_adjtime64_args { register_t dummy; }; struct linux_clock_getres_time64_args { - register_t dummy; + char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)]; + char tp_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * tp; char tp_r_[PADR_(struct l_timespec64 *)]; }; struct linux_clock_nanosleep_time64_args { register_t dummy; diff --git a/sys/amd64/linux32/linux32_sysent.c b/sys/amd64/linux32/linux32_sysent.c index d33fa28f7a32..7f2a3dfec397 100644 --- a/sys/amd64/linux32/linux32_sysent.c +++ b/sys/amd64/linux32/linux32_sysent.c @@ -423,7 +423,7 @@ struct sysent linux32_sysent[] = { { .sy_narg = AS(linux_clock_gettime64_args), .sy_call = (sy_call_t *)linux_clock_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 403 = linux_clock_gettime64 */ { .sy_narg = AS(linux_clock_settime64_args), .sy_call = (sy_call_t *)linux_clock_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 404 = linux_clock_settime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_adjtime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 405 = linux_clock_adjtime64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_getres_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 406 = linux_clock_getres_time64 */ + { .sy_narg = AS(linux_clock_getres_time64_args), .sy_call = (sy_call_t *)linux_clock_getres_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 406 = linux_clock_getres_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_nanosleep_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 407 = linux_clock_nanosleep_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timer_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 408 = linux_timer_gettime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timer_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 409 = linux_timer_settime64 */ diff --git a/sys/amd64/linux32/linux32_systrace_args.c b/sys/amd64/linux32/linux32_systrace_args.c index 6999999399eb..42b963379259 100644 --- a/sys/amd64/linux32/linux32_systrace_args.c +++ b/sys/amd64/linux32/linux32_systrace_args.c @@ -2983,7 +2983,10 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_clock_getres_time64 */ case 406: { - *n_args = 0; + struct linux_clock_getres_time64_args *p = params; + iarg[0] = p->which; /* clockid_t */ + uarg[1] = (intptr_t)p->tp; /* struct l_timespec64 * */ + *n_args = 2; break; } /* linux_clock_nanosleep_time64 */ @@ -8026,6 +8029,16 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_getres_time64 */ case 406: + switch (ndx) { + case 0: + p = "clockid_t"; + break; + case 1: + p = "userland struct l_timespec64 *"; + break; + default: + break; + }; break; /* linux_clock_nanosleep_time64 */ case 407: @@ -9815,6 +9828,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 405: /* linux_clock_getres_time64 */ case 406: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_clock_nanosleep_time64 */ case 407: /* linux_timer_gettime64 */ diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h index 6fc65571cade..b62d91585495 100644 --- a/sys/i386/linux/linux_proto.h +++ b/sys/i386/linux/linux_proto.h @@ -1523,7 +1523,8 @@ struct linux_clock_adjtime64_args { register_t dummy; }; struct linux_clock_getres_time64_args { - register_t dummy; + char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)]; + char tp_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * tp; char tp_r_[PADR_(struct l_timespec64 *)]; }; struct linux_clock_nanosleep_time64_args { register_t dummy; diff --git a/sys/i386/linux/linux_sysent.c b/sys/i386/linux/linux_sysent.c index 743c541f9277..de0622c464c5 100644 --- a/sys/i386/linux/linux_sysent.c +++ b/sys/i386/linux/linux_sysent.c @@ -423,7 +423,7 @@ struct sysent linux_sysent[] = { { .sy_narg = AS(linux_clock_gettime64_args), .sy_call = (sy_call_t *)linux_clock_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 403 = linux_clock_gettime64 */ { .sy_narg = AS(linux_clock_settime64_args), .sy_call = (sy_call_t *)linux_clock_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 404 = linux_clock_settime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_adjtime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 405 = linux_clock_adjtime64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_getres_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 406 = linux_clock_getres_time64 */ + { .sy_narg = AS(linux_clock_getres_time64_args), .sy_call = (sy_call_t *)linux_clock_getres_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 406 = linux_clock_getres_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_nanosleep_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 407 = linux_clock_nanosleep_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timer_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 408 = linux_timer_gettime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timer_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 409 = linux_timer_settime64 */ diff --git a/sys/i386/linux/linux_systrace_args.c b/sys/i386/linux/linux_systrace_args.c index fde853acdeec..304ef643826e 100644 --- a/sys/i386/linux/linux_systrace_args.c +++ b/sys/i386/linux/linux_systrace_args.c @@ -3022,7 +3022,10 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_clock_getres_time64 */ case 406: { - *n_args = 0; + struct linux_clock_getres_time64_args *p = params; + iarg[0] = p->which; /* clockid_t */ + uarg[1] = (intptr_t)p->tp; /* struct l_timespec64 * */ + *n_args = 2; break; } /* linux_clock_nanosleep_time64 */ @@ -8103,6 +8106,16 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_getres_time64 */ case 406: + switch (ndx) { + case 0: + p = "clockid_t"; + break; + case 1: + p = "userland struct l_timespec64 *"; + break; + default: + break; + }; break; /* linux_clock_nanosleep_time64 */ case 407: @@ -9921,6 +9934,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) case 405: /* linux_clock_getres_time64 */ case 406: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_clock_nanosleep_time64 */ case 407: /* linux_timer_gettime64 */ From owner-dev-commits-src-main@freebsd.org Sun Jun 6 14:29:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33DFB65F6C9; Sun, 6 Jun 2021 14:29:11 +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 4Fyf5M11Prz4rRY; Sun, 6 Jun 2021 14:29:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0B14F251F1; Sun, 6 Jun 2021 14:29:11 +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 156ETAQI046709; Sun, 6 Jun 2021 14:29:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156ETAFs046708; Sun, 6 Jun 2021 14:29:10 GMT (envelope-from git) Date: Sun, 6 Jun 2021 14:29:10 GMT Message-Id: <202106061429.156ETAFs046708@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: 6501370a7dfb - main - linux(4): Implement clock_nanosleep_time64 system call. 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: 6501370a7dfb358daf07555136742bc064e68cb7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 14:29:11 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=6501370a7dfb358daf07555136742bc064e68cb7 commit 6501370a7dfb358daf07555136742bc064e68cb7 Author: Dmitry Chagin AuthorDate: 2021-06-07 02:26:48 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-07 02:26:48 +0000 linux(4): Implement clock_nanosleep_time64 system call. MFC after: 2 weeks --- sys/amd64/linux32/linux32_dummy_machdep.c | 1 - sys/amd64/linux32/syscalls.master | 7 +- sys/compat/linux/linux_time.c | 109 ++++++++++++++++++++++++------ sys/i386/linux/linux_dummy_machdep.c | 1 - sys/i386/linux/syscalls.master | 7 +- 5 files changed, 99 insertions(+), 26 deletions(-) diff --git a/sys/amd64/linux32/linux32_dummy_machdep.c b/sys/amd64/linux32/linux32_dummy_machdep.c index 3f8dfe711dba..041156bd514b 100644 --- a/sys/amd64/linux32/linux32_dummy_machdep.c +++ b/sys/amd64/linux32/linux32_dummy_machdep.c @@ -68,7 +68,6 @@ DUMMY(mq_getsetattr); DUMMY(arch_prctl); /* Linux 5.0: */ DUMMY(clock_adjtime64); -DUMMY(clock_nanosleep_time64); DUMMY(timer_gettime64); DUMMY(timer_settime64); DUMMY(timerfd_gettime64); diff --git a/sys/amd64/linux32/syscalls.master b/sys/amd64/linux32/syscalls.master index 27034c0216ff..d3a124c6e8c2 100644 --- a/sys/amd64/linux32/syscalls.master +++ b/sys/amd64/linux32/syscalls.master @@ -2362,7 +2362,12 @@ ); } 407 AUE_NULL STD { - int linux_clock_nanosleep_time64(void); + int linux_clock_nanosleep_time64( + clockid_t which, + l_int flags, + struct l_timespec64 *rqtp, + struct l_timespec64 *rmtp + ); } 408 AUE_NULL STD { int linux_timer_gettime64(void); diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c index 43db8871a0d8..184de336fd99 100644 --- a/sys/compat/linux/linux_time.c +++ b/sys/compat/linux/linux_time.c @@ -107,8 +107,13 @@ LIN_SDT_PROBE_DEFINE1(time, linux_nanosleep, copyin_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, conversion_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyout_error, "int"); LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, copyin_error, "int"); -LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_flags, "int"); -LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep, unsupported_clockid, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_common_clock_nanosleep, unsupported_flags, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_common_clock_nanosleep, unsupported_clockid, "int"); +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep_time64, conversion_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep_time64, copyout_error, "int"); +LIN_SDT_PROBE_DEFINE1(time, linux_clock_nanosleep_time64, copyin_error, "int"); +#endif static int linux_common_clock_gettime(struct thread *, clockid_t, struct timespec *); @@ -116,6 +121,8 @@ static int linux_common_clock_settime(struct thread *, clockid_t, struct timespec *); static int linux_common_clock_getres(struct thread *, clockid_t, struct timespec *); +static int linux_common_clock_nanosleep(struct thread *, clockid_t, + l_int, struct timespec *, struct timespec *); int native_to_linux_timespec(struct l_timespec *ltp, struct timespec *ntp) @@ -672,31 +679,41 @@ linux_nanosleep(struct thread *td, struct linux_nanosleep_args *args) return (error); } -int -linux_clock_nanosleep(struct thread *td, struct linux_clock_nanosleep_args *args) +static int +linux_common_clock_nanosleep(struct thread *td, clockid_t which, + l_int lflags, struct timespec *rqtp, struct timespec *rmtp) { - struct timespec *rmtp; - struct l_timespec lrqts, lrmts; - struct timespec rqts, rmts; - int error, error2, flags; + int error, flags; clockid_t clockid; - error = linux_to_native_timerflags(&flags, args->flags); + error = linux_to_native_timerflags(&flags, lflags); if (error != 0) { - LIN_SDT_PROBE1(time, linux_clock_nanosleep, unsupported_flags, - args->flags); + LIN_SDT_PROBE1(time, linux_common_clock_nanosleep, + unsupported_flags, lflags); return (error); } - error = linux_to_native_clockid(&clockid, args->which); + error = linux_to_native_clockid(&clockid, which); if (error != 0) { linux_msg(curthread, - "unsupported clock_nanosleep clockid %d", args->which); - LIN_SDT_PROBE1(time, linux_clock_nanosleep, unsupported_clockid, - args->which); + "unsupported clock_nanosleep clockid %d", which); + LIN_SDT_PROBE1(time, linux_common_clock_nanosleep, + unsupported_clockid, which); return (error); } + return (kern_clock_nanosleep(td, clockid, flags, rqtp, rmtp)); +} + +int +linux_clock_nanosleep(struct thread *td, + struct linux_clock_nanosleep_args *args) +{ + struct timespec *rmtp; + struct l_timespec lrqts, lrmts; + struct timespec rqts, rmts; + int error, error2; + error = copyin(args->rqtp, &lrqts, sizeof(lrqts)); if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_nanosleep, copyin_error, @@ -704,19 +721,21 @@ linux_clock_nanosleep(struct thread *td, struct linux_clock_nanosleep_args *args return (error); } - if (args->rmtp != NULL) - rmtp = &rmts; - else - rmtp = NULL; - error = linux_to_native_timespec(&rqts, &lrqts); if (error != 0) { LIN_SDT_PROBE1(time, linux_clock_nanosleep, conversion_error, error); return (error); } - error = kern_clock_nanosleep(td, clockid, flags, &rqts, rmtp); - if (error == EINTR && (flags & TIMER_ABSTIME) == 0 && + + if (args->rmtp != NULL) + rmtp = &rmts; + else + rmtp = NULL; + + error = linux_common_clock_nanosleep(td, args->which, args->flags, + &rqts, rmtp); + if (error == EINTR && (args->flags & LINUX_TIMER_ABSTIME) == 0 && args->rmtp != NULL) { error2 = native_to_linux_timespec(&lrmts, rmtp); if (error2 != 0) @@ -728,6 +747,52 @@ linux_clock_nanosleep(struct thread *td, struct linux_clock_nanosleep_args *args return (error2); } } + return (error); +} +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) +int +linux_clock_nanosleep_time64(struct thread *td, + struct linux_clock_nanosleep_time64_args *args) +{ + struct timespec *rmtp; + struct l_timespec64 lrqts, lrmts; + struct timespec rqts, rmts; + int error, error2; + + error = copyin(args->rqtp, &lrqts, sizeof(lrqts)); + if (error != 0) { + LIN_SDT_PROBE1(time, linux_clock_nanosleep_time64, + copyin_error, error); + return (error); + } + + error = linux_to_native_timespec64(&rqts, &lrqts); + if (error != 0) { + LIN_SDT_PROBE1(time, linux_clock_nanosleep_time64, + conversion_error, error); + return (error); + } + + if (args->rmtp != NULL) + rmtp = &rmts; + else + rmtp = NULL; + + error = linux_common_clock_nanosleep(td, args->which, args->flags, + &rqts, rmtp); + if (error == EINTR && (args->flags & LINUX_TIMER_ABSTIME) == 0 && + args->rmtp != NULL) { + error2 = native_to_linux_timespec64(&lrmts, rmtp); + if (error2 != 0) + return (error2); + error2 = copyout(&lrmts, args->rmtp, sizeof(lrmts)); + if (error2 != 0) { + LIN_SDT_PROBE1(time, linux_clock_nanosleep_time64, + copyout_error, error2); + return (error2); + } + } return (error); } +#endif diff --git a/sys/i386/linux/linux_dummy_machdep.c b/sys/i386/linux/linux_dummy_machdep.c index 6e4c9c66edcb..f679e090c7c1 100644 --- a/sys/i386/linux/linux_dummy_machdep.c +++ b/sys/i386/linux/linux_dummy_machdep.c @@ -70,7 +70,6 @@ DUMMY(vm86old); DUMMY(arch_prctl); /* Linux 5.0: */ DUMMY(clock_adjtime64); -DUMMY(clock_nanosleep_time64); DUMMY(timer_gettime64); DUMMY(timer_settime64); DUMMY(timerfd_gettime64); diff --git a/sys/i386/linux/syscalls.master b/sys/i386/linux/syscalls.master index 0876a039ea05..7e1ab24e9f75 100644 --- a/sys/i386/linux/syscalls.master +++ b/sys/i386/linux/syscalls.master @@ -2380,7 +2380,12 @@ ); } 407 AUE_NULL STD { - int linux_clock_nanosleep_time64(void); + int linux_clock_nanosleep_time64( + clockid_t which, + l_int flags, + struct l_timespec64 *rqtp, + struct l_timespec64 *rmtp + ); } 408 AUE_NULL STD { int linux_timer_gettime64(void); From owner-dev-commits-src-main@freebsd.org Sun Jun 6 14:29:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5DA1E65F4E7; Sun, 6 Jun 2021 14:29:12 +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 4Fyf5N21t3z4rcv; Sun, 6 Jun 2021 14:29:12 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2D94F250EB; Sun, 6 Jun 2021 14:29:12 +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 156ETCVZ046730; Sun, 6 Jun 2021 14:29:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156ETC9O046729; Sun, 6 Jun 2021 14:29:12 GMT (envelope-from git) Date: Sun, 6 Jun 2021 14:29:12 GMT Message-Id: <202106061429.156ETC9O046729@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: 56b187005c07 - main - Regen for ('6501370a7dfb358daf07555136742bc064e68cb7') Linux clock_nanosleep_time64 system call. 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: 56b187005c07562dd85f126ee6d2986df1881cec Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 14:29:12 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=56b187005c07562dd85f126ee6d2986df1881cec commit 56b187005c07562dd85f126ee6d2986df1881cec Author: Dmitry Chagin AuthorDate: 2021-06-07 02:29:27 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-07 02:29:27 +0000 Regen for ('6501370a7dfb358daf07555136742bc064e68cb7') Linux clock_nanosleep_time64 system call. MFC after: 2 weeks --- sys/amd64/linux32/linux32_proto.h | 5 ++++- sys/amd64/linux32/linux32_sysent.c | 2 +- sys/amd64/linux32/linux32_systrace_args.c | 26 +++++++++++++++++++++++++- sys/i386/linux/linux_proto.h | 5 ++++- sys/i386/linux/linux_sysent.c | 2 +- sys/i386/linux/linux_systrace_args.c | 26 +++++++++++++++++++++++++- 6 files changed, 60 insertions(+), 6 deletions(-) diff --git a/sys/amd64/linux32/linux32_proto.h b/sys/amd64/linux32/linux32_proto.h index 7c21877c6214..53218980b3f4 100644 --- a/sys/amd64/linux32/linux32_proto.h +++ b/sys/amd64/linux32/linux32_proto.h @@ -1534,7 +1534,10 @@ struct linux_clock_getres_time64_args { char tp_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * tp; char tp_r_[PADR_(struct l_timespec64 *)]; }; struct linux_clock_nanosleep_time64_args { - register_t dummy; + char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)]; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; + char rqtp_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * rqtp; char rqtp_r_[PADR_(struct l_timespec64 *)]; + char rmtp_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * rmtp; char rmtp_r_[PADR_(struct l_timespec64 *)]; }; struct linux_timer_gettime64_args { register_t dummy; diff --git a/sys/amd64/linux32/linux32_sysent.c b/sys/amd64/linux32/linux32_sysent.c index 7f2a3dfec397..dd59369c7fe4 100644 --- a/sys/amd64/linux32/linux32_sysent.c +++ b/sys/amd64/linux32/linux32_sysent.c @@ -424,7 +424,7 @@ struct sysent linux32_sysent[] = { { .sy_narg = AS(linux_clock_settime64_args), .sy_call = (sy_call_t *)linux_clock_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 404 = linux_clock_settime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_adjtime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 405 = linux_clock_adjtime64 */ { .sy_narg = AS(linux_clock_getres_time64_args), .sy_call = (sy_call_t *)linux_clock_getres_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 406 = linux_clock_getres_time64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_nanosleep_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 407 = linux_clock_nanosleep_time64 */ + { .sy_narg = AS(linux_clock_nanosleep_time64_args), .sy_call = (sy_call_t *)linux_clock_nanosleep_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 407 = linux_clock_nanosleep_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timer_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 408 = linux_timer_gettime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timer_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 409 = linux_timer_settime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timerfd_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 410 = linux_timerfd_gettime64 */ diff --git a/sys/amd64/linux32/linux32_systrace_args.c b/sys/amd64/linux32/linux32_systrace_args.c index 42b963379259..bb29f8d0d3a5 100644 --- a/sys/amd64/linux32/linux32_systrace_args.c +++ b/sys/amd64/linux32/linux32_systrace_args.c @@ -2991,7 +2991,12 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_clock_nanosleep_time64 */ case 407: { - *n_args = 0; + struct linux_clock_nanosleep_time64_args *p = params; + iarg[0] = p->which; /* clockid_t */ + iarg[1] = p->flags; /* l_int */ + uarg[2] = (intptr_t)p->rqtp; /* struct l_timespec64 * */ + uarg[3] = (intptr_t)p->rmtp; /* struct l_timespec64 * */ + *n_args = 4; break; } /* linux_timer_gettime64 */ @@ -8042,6 +8047,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_nanosleep_time64 */ case 407: + switch (ndx) { + case 0: + p = "clockid_t"; + break; + case 1: + p = "l_int"; + break; + case 2: + p = "userland struct l_timespec64 *"; + break; + case 3: + p = "userland struct l_timespec64 *"; + break; + default: + break; + }; break; /* linux_timer_gettime64 */ case 408: @@ -9833,6 +9854,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_nanosleep_time64 */ case 407: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_timer_gettime64 */ case 408: /* linux_timer_settime64 */ diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h index b62d91585495..e6f992539dc3 100644 --- a/sys/i386/linux/linux_proto.h +++ b/sys/i386/linux/linux_proto.h @@ -1527,7 +1527,10 @@ struct linux_clock_getres_time64_args { char tp_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * tp; char tp_r_[PADR_(struct l_timespec64 *)]; }; struct linux_clock_nanosleep_time64_args { - register_t dummy; + char which_l_[PADL_(clockid_t)]; clockid_t which; char which_r_[PADR_(clockid_t)]; + char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)]; + char rqtp_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * rqtp; char rqtp_r_[PADR_(struct l_timespec64 *)]; + char rmtp_l_[PADL_(struct l_timespec64 *)]; struct l_timespec64 * rmtp; char rmtp_r_[PADR_(struct l_timespec64 *)]; }; struct linux_timer_gettime64_args { register_t dummy; diff --git a/sys/i386/linux/linux_sysent.c b/sys/i386/linux/linux_sysent.c index de0622c464c5..c905daebd9d6 100644 --- a/sys/i386/linux/linux_sysent.c +++ b/sys/i386/linux/linux_sysent.c @@ -424,7 +424,7 @@ struct sysent linux_sysent[] = { { .sy_narg = AS(linux_clock_settime64_args), .sy_call = (sy_call_t *)linux_clock_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 404 = linux_clock_settime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_adjtime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 405 = linux_clock_adjtime64 */ { .sy_narg = AS(linux_clock_getres_time64_args), .sy_call = (sy_call_t *)linux_clock_getres_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 406 = linux_clock_getres_time64 */ - { .sy_narg = 0, .sy_call = (sy_call_t *)linux_clock_nanosleep_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 407 = linux_clock_nanosleep_time64 */ + { .sy_narg = AS(linux_clock_nanosleep_time64_args), .sy_call = (sy_call_t *)linux_clock_nanosleep_time64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 407 = linux_clock_nanosleep_time64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timer_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 408 = linux_timer_gettime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timer_settime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 409 = linux_timer_settime64 */ { .sy_narg = 0, .sy_call = (sy_call_t *)linux_timerfd_gettime64, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 410 = linux_timerfd_gettime64 */ diff --git a/sys/i386/linux/linux_systrace_args.c b/sys/i386/linux/linux_systrace_args.c index 304ef643826e..390b99e94052 100644 --- a/sys/i386/linux/linux_systrace_args.c +++ b/sys/i386/linux/linux_systrace_args.c @@ -3030,7 +3030,12 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) } /* linux_clock_nanosleep_time64 */ case 407: { - *n_args = 0; + struct linux_clock_nanosleep_time64_args *p = params; + iarg[0] = p->which; /* clockid_t */ + iarg[1] = p->flags; /* l_int */ + uarg[2] = (intptr_t)p->rqtp; /* struct l_timespec64 * */ + uarg[3] = (intptr_t)p->rmtp; /* struct l_timespec64 * */ + *n_args = 4; break; } /* linux_timer_gettime64 */ @@ -8119,6 +8124,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_nanosleep_time64 */ case 407: + switch (ndx) { + case 0: + p = "clockid_t"; + break; + case 1: + p = "l_int"; + break; + case 2: + p = "userland struct l_timespec64 *"; + break; + case 3: + p = "userland struct l_timespec64 *"; + break; + default: + break; + }; break; /* linux_timer_gettime64 */ case 408: @@ -9939,6 +9960,9 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) break; /* linux_clock_nanosleep_time64 */ case 407: + if (ndx == 0 || ndx == 1) + p = "int"; + break; /* linux_timer_gettime64 */ case 408: /* linux_timer_settime64 */ From owner-dev-commits-src-main@freebsd.org Sun Jun 6 14:40:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E1DFD65FB3F; Sun, 6 Jun 2021 14:40:21 +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 4FyfLF64Xgz4t5R; Sun, 6 Jun 2021 14:40:21 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 B91A425221; Sun, 6 Jun 2021 14:40:21 +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 156EeLf4068543; Sun, 6 Jun 2021 14:40:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156EeLEK068536; Sun, 6 Jun 2021 14:40:21 GMT (envelope-from git) Date: Sun, 6 Jun 2021 14:40:21 GMT Message-Id: <202106061440.156EeLEK068536@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: 0f8dab45404f - main - linux(4): Fix timeout parameter of rt_sigtimedwait syscall, which is timespec not a timeval. 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: 0f8dab45404f347752470579feccc6d2739b9570 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 14:40:21 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=0f8dab45404f347752470579feccc6d2739b9570 commit 0f8dab45404f347752470579feccc6d2739b9570 Author: Dmitry Chagin AuthorDate: 2021-06-07 02:35:35 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-07 02:35:35 +0000 linux(4): Fix timeout parameter of rt_sigtimedwait syscall, which is timespec not a timeval. MFC after: 2 weeks --- 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 c8e7a2da812a..202425581e8e 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 51f08d61bef1..a479c9cc769c 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 @@ -392,9 +393,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; @@ -409,27 +409,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 ); } From owner-dev-commits-src-main@freebsd.org Sun Jun 6 14:40:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B7E765FF05; Sun, 6 Jun 2021 14:40:23 +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 4FyfLH04X7z4tBr; Sun, 6 Jun 2021 14:40:23 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 DEB3424FED; Sun, 6 Jun 2021 14:40:22 +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 156EeM3M068651; Sun, 6 Jun 2021 14:40:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156EeMpS068650; Sun, 6 Jun 2021 14:40:22 GMT (envelope-from git) Date: Sun, 6 Jun 2021 14:40:22 GMT Message-Id: <202106061440.156EeMpS068650@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: e29ea22f7012 - main - Regen for ('0f8dab45404f347752470579feccc6d2739b9570') Linux rt_sigtimedwait system call. 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: e29ea22f7012bb94f5f427349aa4580539cf2b7c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 14:40:23 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=e29ea22f7012bb94f5f427349aa4580539cf2b7c commit e29ea22f7012bb94f5f427349aa4580539cf2b7c Author: Dmitry Chagin AuthorDate: 2021-06-07 02:39:29 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-07 02:39:29 +0000 Regen for ('0f8dab45404f347752470579feccc6d2739b9570') Linux rt_sigtimedwait system call. MFC after: 2 weeks --- sys/amd64/linux/linux_proto.h | 2 +- sys/amd64/linux/linux_systrace_args.c | 4 ++-- sys/amd64/linux32/linux32_proto.h | 2 +- sys/amd64/linux32/linux32_systrace_args.c | 4 ++-- sys/arm/linux/linux_proto.h | 2 +- sys/arm/linux/linux_systrace_args.c | 4 ++-- sys/arm64/linux/linux_proto.h | 2 +- sys/arm64/linux/linux_systrace_args.c | 4 ++-- sys/i386/linux/linux_proto.h | 2 +- sys/i386/linux/linux_systrace_args.c | 4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sys/amd64/linux/linux_proto.h b/sys/amd64/linux/linux_proto.h index 5bd92a9ebf43..60e880d891e8 100644 --- a/sys/amd64/linux/linux_proto.h +++ b/sys/amd64/linux/linux_proto.h @@ -478,7 +478,7 @@ struct linux_rt_sigpending_args { struct linux_rt_sigtimedwait_args { char mask_l_[PADL_(l_sigset_t *)]; l_sigset_t * mask; char mask_r_[PADR_(l_sigset_t *)]; char ptr_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * ptr; char ptr_r_[PADR_(l_siginfo_t *)]; - char timeout_l_[PADL_(struct l_timeval *)]; struct l_timeval * timeout; char timeout_r_[PADR_(struct l_timeval *)]; + char timeout_l_[PADL_(struct l_timespec *)]; struct l_timespec * timeout; char timeout_r_[PADR_(struct l_timespec *)]; char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)]; }; struct linux_rt_sigqueueinfo_args { diff --git a/sys/amd64/linux/linux_systrace_args.c b/sys/amd64/linux/linux_systrace_args.c index da43328aad5a..d1f2f30f60e0 100644 --- a/sys/amd64/linux/linux_systrace_args.c +++ b/sys/amd64/linux/linux_systrace_args.c @@ -1070,7 +1070,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_rt_sigtimedwait_args *p = params; uarg[0] = (intptr_t)p->mask; /* l_sigset_t * */ uarg[1] = (intptr_t)p->ptr; /* l_siginfo_t * */ - uarg[2] = (intptr_t)p->timeout; /* struct l_timeval * */ + uarg[2] = (intptr_t)p->timeout; /* struct l_timespec * */ iarg[3] = p->sigsetsize; /* l_size_t */ *n_args = 4; break; @@ -4475,7 +4475,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "userland l_siginfo_t *"; break; case 2: - p = "userland struct l_timeval *"; + p = "userland struct l_timespec *"; break; case 3: p = "l_size_t"; diff --git a/sys/amd64/linux32/linux32_proto.h b/sys/amd64/linux32/linux32_proto.h index 53218980b3f4..d8ac24f8492b 100644 --- a/sys/amd64/linux32/linux32_proto.h +++ b/sys/amd64/linux32/linux32_proto.h @@ -558,7 +558,7 @@ struct linux_rt_sigpending_args { struct linux_rt_sigtimedwait_args { char mask_l_[PADL_(l_sigset_t *)]; l_sigset_t * mask; char mask_r_[PADR_(l_sigset_t *)]; char ptr_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * ptr; char ptr_r_[PADR_(l_siginfo_t *)]; - char timeout_l_[PADL_(struct l_timeval *)]; struct l_timeval * timeout; char timeout_r_[PADR_(struct l_timeval *)]; + char timeout_l_[PADL_(struct l_timespec *)]; struct l_timespec * timeout; char timeout_r_[PADR_(struct l_timespec *)]; char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)]; }; struct linux_rt_sigqueueinfo_args { diff --git a/sys/amd64/linux32/linux32_systrace_args.c b/sys/amd64/linux32/linux32_systrace_args.c index bb29f8d0d3a5..9eb9bfc15390 100644 --- a/sys/amd64/linux32/linux32_systrace_args.c +++ b/sys/amd64/linux32/linux32_systrace_args.c @@ -1207,7 +1207,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_rt_sigtimedwait_args *p = params; uarg[0] = (intptr_t)p->mask; /* l_sigset_t * */ uarg[1] = (intptr_t)p->ptr; /* l_siginfo_t * */ - uarg[2] = (intptr_t)p->timeout; /* struct l_timeval * */ + uarg[2] = (intptr_t)p->timeout; /* struct l_timespec * */ iarg[3] = p->sigsetsize; /* l_size_t */ *n_args = 4; break; @@ -5041,7 +5041,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "userland l_siginfo_t *"; break; case 2: - p = "userland struct l_timeval *"; + p = "userland struct l_timespec *"; break; case 3: p = "l_size_t"; diff --git a/sys/arm/linux/linux_proto.h b/sys/arm/linux/linux_proto.h index 71225320bea1..e458adb30a10 100644 --- a/sys/arm/linux/linux_proto.h +++ b/sys/arm/linux/linux_proto.h @@ -463,7 +463,7 @@ struct linux_rt_sigpending_args { struct linux_rt_sigtimedwait_args { char mask_l_[PADL_(l_sigset_t *)]; l_sigset_t * mask; char mask_r_[PADR_(l_sigset_t *)]; char ptr_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * ptr; char ptr_r_[PADR_(l_siginfo_t *)]; - char timeout_l_[PADL_(struct l_timeval *)]; struct l_timeval * timeout; char timeout_r_[PADR_(struct l_timeval *)]; + char timeout_l_[PADL_(struct l_timespec *)]; struct l_timespec * timeout; char timeout_r_[PADR_(struct l_timespec *)]; char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)]; }; struct linux_rt_sigqueueinfo_args { diff --git a/sys/arm/linux/linux_systrace_args.c b/sys/arm/linux/linux_systrace_args.c index 2d5a8d2a9a74..608d8c1ed238 100644 --- a/sys/arm/linux/linux_systrace_args.c +++ b/sys/arm/linux/linux_systrace_args.c @@ -1050,7 +1050,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_rt_sigtimedwait_args *p = params; uarg[0] = (intptr_t)p->mask; /* l_sigset_t * */ uarg[1] = (intptr_t)p->ptr; /* l_siginfo_t * */ - uarg[2] = (intptr_t)p->timeout; /* struct l_timeval * */ + uarg[2] = (intptr_t)p->timeout; /* struct l_timespec * */ iarg[3] = p->sigsetsize; /* l_size_t */ *n_args = 4; break; @@ -4117,7 +4117,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "userland l_siginfo_t *"; break; case 2: - p = "userland struct l_timeval *"; + p = "userland struct l_timespec *"; break; case 3: p = "l_size_t"; diff --git a/sys/arm64/linux/linux_proto.h b/sys/arm64/linux/linux_proto.h index 8953a9d71401..66d9cad8b442 100644 --- a/sys/arm64/linux/linux_proto.h +++ b/sys/arm64/linux/linux_proto.h @@ -572,7 +572,7 @@ struct linux_rt_sigpending_args { struct linux_rt_sigtimedwait_args { char mask_l_[PADL_(l_sigset_t *)]; l_sigset_t * mask; char mask_r_[PADR_(l_sigset_t *)]; char ptr_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * ptr; char ptr_r_[PADR_(l_siginfo_t *)]; - char timeout_l_[PADL_(struct l_timeval *)]; struct l_timeval * timeout; char timeout_r_[PADR_(struct l_timeval *)]; + char timeout_l_[PADL_(struct l_timespec *)]; struct l_timespec * timeout; char timeout_r_[PADR_(struct l_timespec *)]; char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)]; }; struct linux_rt_sigqueueinfo_args { diff --git a/sys/arm64/linux/linux_systrace_args.c b/sys/arm64/linux/linux_systrace_args.c index 7edf41dbcdc4..18b6201516e7 100644 --- a/sys/arm64/linux/linux_systrace_args.c +++ b/sys/arm64/linux/linux_systrace_args.c @@ -1083,7 +1083,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_rt_sigtimedwait_args *p = params; uarg[0] = (intptr_t)p->mask; /* l_sigset_t * */ uarg[1] = (intptr_t)p->ptr; /* l_siginfo_t * */ - uarg[2] = (intptr_t)p->timeout; /* struct l_timeval * */ + uarg[2] = (intptr_t)p->timeout; /* struct l_timespec * */ iarg[3] = p->sigsetsize; /* l_size_t */ *n_args = 4; break; @@ -4146,7 +4146,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "userland l_siginfo_t *"; break; case 2: - p = "userland struct l_timeval *"; + p = "userland struct l_timespec *"; break; case 3: p = "l_size_t"; diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h index e6f992539dc3..1b3512c5b890 100644 --- a/sys/i386/linux/linux_proto.h +++ b/sys/i386/linux/linux_proto.h @@ -559,7 +559,7 @@ struct linux_rt_sigpending_args { struct linux_rt_sigtimedwait_args { char mask_l_[PADL_(l_sigset_t *)]; l_sigset_t * mask; char mask_r_[PADR_(l_sigset_t *)]; char ptr_l_[PADL_(l_siginfo_t *)]; l_siginfo_t * ptr; char ptr_r_[PADR_(l_siginfo_t *)]; - char timeout_l_[PADL_(struct l_timeval *)]; struct l_timeval * timeout; char timeout_r_[PADR_(struct l_timeval *)]; + char timeout_l_[PADL_(struct l_timespec *)]; struct l_timespec * timeout; char timeout_r_[PADR_(struct l_timespec *)]; char sigsetsize_l_[PADL_(l_size_t)]; l_size_t sigsetsize; char sigsetsize_r_[PADR_(l_size_t)]; }; struct linux_rt_sigqueueinfo_args { diff --git a/sys/i386/linux/linux_systrace_args.c b/sys/i386/linux/linux_systrace_args.c index 390b99e94052..b8e07e3cc985 100644 --- a/sys/i386/linux/linux_systrace_args.c +++ b/sys/i386/linux/linux_systrace_args.c @@ -1250,7 +1250,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) struct linux_rt_sigtimedwait_args *p = params; uarg[0] = (intptr_t)p->mask; /* l_sigset_t * */ uarg[1] = (intptr_t)p->ptr; /* l_siginfo_t * */ - uarg[2] = (intptr_t)p->timeout; /* struct l_timeval * */ + uarg[2] = (intptr_t)p->timeout; /* struct l_timespec * */ iarg[3] = p->sigsetsize; /* l_size_t */ *n_args = 4; break; @@ -5141,7 +5141,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) p = "userland l_siginfo_t *"; break; case 2: - p = "userland struct l_timeval *"; + p = "userland struct l_timespec *"; break; case 3: p = "l_size_t"; From owner-dev-commits-src-main@freebsd.org Sun Jun 6 14:54:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 447BC638304; Sun, 6 Jun 2021 14:54:41 +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 4Fyffn1NDyz4vRp; Sun, 6 Jun 2021 14:54:41 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 17962253F0; Sun, 6 Jun 2021 14:54:41 +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 156EsfvP085974; Sun, 6 Jun 2021 14:54:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156Eseqd085973; Sun, 6 Jun 2021 14:54:40 GMT (envelope-from git) Date: Sun, 6 Jun 2021 14:54:40 GMT Message-Id: <202106061454.156Eseqd085973@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: 9c1045ff0093 - main - linux(4): Properly convert linux siginfo to native siginfo add input validation. 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: 9c1045ff00935a4bb0592d8c00ca1981d3e6eb8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 14:54:41 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=9c1045ff00935a4bb0592d8c00ca1981d3e6eb8b commit 9c1045ff00935a4bb0592d8c00ca1981d3e6eb8b Author: Dmitry Chagin AuthorDate: 2021-06-07 02:55:34 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-07 02:55:34 +0000 linux(4): Properly convert linux siginfo to native siginfo add input validation. MFC after: 2 weeks --- sys/compat/linux/linux_mib.h | 1 + sys/compat/linux/linux_signal.c | 59 ++++++++++++++++++++++++++++++----------- sys/compat/linux/linux_signal.h | 3 ++- 3 files changed, 47 insertions(+), 16 deletions(-) diff --git a/sys/compat/linux/linux_mib.h b/sys/compat/linux/linux_mib.h index b3d5949c9630..c4d3d1e83f7e 100644 --- a/sys/compat/linux/linux_mib.h +++ b/sys/compat/linux/linux_mib.h @@ -59,6 +59,7 @@ int linux_kernver(struct thread *td); #define LINUX_KERNVER_2004000 LINUX_KERNVER(2,4,0) #define LINUX_KERNVER_2006000 LINUX_KERNVER(2,6,0) +#define LINUX_KERNVER_2006039 LINUX_KERNVER(2,6,39) #define linux_use26(t) (linux_kernver(t) >= LINUX_KERNVER_2006000) diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c index a479c9cc769c..02abfe961e6b 100644 --- a/sys/compat/linux/linux_signal.c +++ b/sys/compat/linux/linux_signal.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #endif +#include #include #include #include @@ -651,17 +652,40 @@ siginfo_to_lsiginfo(const siginfo_t *si, l_siginfo_t *lsi, l_int sig) } } -void -lsiginfo_to_ksiginfo(const l_siginfo_t *lsi, ksiginfo_t *ksi, int sig) +int +lsiginfo_to_siginfo(struct thread *td, const l_siginfo_t *lsi, + siginfo_t *si, int sig) { - ksi->ksi_signo = sig; - ksi->ksi_code = lsi->lsi_code; /* XXX. Convert. */ - ksi->ksi_pid = lsi->lsi_pid; - ksi->ksi_uid = lsi->lsi_uid; - ksi->ksi_status = lsi->lsi_status; - ksi->ksi_addr = PTRIN(lsi->lsi_addr); - ksi->ksi_info.si_value.sival_int = lsi->lsi_int; + switch (lsi->lsi_code) { + case LINUX_SI_TKILL: + if (linux_kernver(td) >= LINUX_KERNVER_2006039) { + linux_msg(td, "SI_TKILL forbidden since 2.6.39"); + return (EPERM); + } + si->si_code = SI_LWP; + case LINUX_SI_QUEUE: + si->si_code = SI_QUEUE; + break; + case LINUX_SI_TIMER: + si->si_code = SI_TIMER; + break; + case LINUX_SI_MESGQ: + si->si_code = SI_MESGQ; + break; + case LINUX_SI_ASYNCIO: + si->si_code = SI_ASYNCIO; + break; + default: + si->si_code = lsi->lsi_code; + break; + } + + si->si_signo = sig; + si->si_pid = td->td_proc->p_pid; + si->si_uid = td->td_ucred->cr_ruid; + si->si_value.sival_ptr = PTRIN(lsi->lsi_value.sival_ptr); + return (0); } int @@ -681,9 +705,14 @@ linux_rt_sigqueueinfo(struct thread *td, struct linux_rt_sigqueueinfo_args *args return (error); if (linfo.lsi_code >= 0) + /* SI_USER, SI_KERNEL */ return (EPERM); sig = linux_to_bsd_signal(args->sig); + ksiginfo_init(&ksi); + error = lsiginfo_to_siginfo(td, &linfo, &ksi.ksi_info, sig); + if (error != 0) + return (error); error = ESRCH; if ((p = pfind_any(args->pid)) != NULL) { @@ -692,9 +721,6 @@ linux_rt_sigqueueinfo(struct thread *td, struct linux_rt_sigqueueinfo_args *args PROC_UNLOCK(p); return (error); } - - ksiginfo_init(&ksi); - lsiginfo_to_ksiginfo(&linfo, &ksi, sig); error = tdsendsignal(p, NULL, sig, &ksi); PROC_UNLOCK(p); } @@ -721,12 +747,15 @@ linux_rt_tgsigqueueinfo(struct thread *td, struct linux_rt_tgsigqueueinfo_args * if (linfo.lsi_code >= 0) return (EPERM); + sig = linux_to_bsd_signal(args->sig); + ksiginfo_init(&ksi); + error = lsiginfo_to_siginfo(td, &linfo, &ksi.ksi_info, sig); + if (error != 0) + return (error); + tds = linux_tdfind(td, args->tid, args->tgid); if (tds == NULL) return (ESRCH); - sig = linux_to_bsd_signal(args->sig); - ksiginfo_init(&ksi); - lsiginfo_to_ksiginfo(&linfo, &ksi, sig); return (linux_do_tkill(td, tds, &ksi)); } diff --git a/sys/compat/linux/linux_signal.h b/sys/compat/linux/linux_signal.h index 5df74fb71029..bb34613fa2be 100644 --- a/sys/compat/linux/linux_signal.h +++ b/sys/compat/linux/linux_signal.h @@ -46,6 +46,7 @@ int linux_do_sigaction(struct thread *, int, l_sigaction_t *, l_sigaction_t *); void ksiginfo_to_lsiginfo(const ksiginfo_t *ksi, l_siginfo_t *lsi, l_int sig); void siginfo_to_lsiginfo(const siginfo_t *si, l_siginfo_t *lsi, l_int sig); -void lsiginfo_to_ksiginfo(const l_siginfo_t *lsi, ksiginfo_t *ksi, int sig); +int lsiginfo_to_siginfo(struct thread *td, const l_siginfo_t *lsi, + siginfo_t *si, int sig); #endif /* _LINUX_SIGNAL_H_ */ From owner-dev-commits-src-main@freebsd.org Sun Jun 6 15:06:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62B31638589; Sun, 6 Jun 2021 15:06:17 +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 4Fyfw92HFbz3DHv; Sun, 6 Jun 2021 15:06:17 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 321192555C; Sun, 6 Jun 2021 15:06:17 +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 156F6HtB000529; Sun, 6 Jun 2021 15:06:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156F6H0D000528; Sun, 6 Jun 2021 15:06:17 GMT (envelope-from git) Date: Sun, 6 Jun 2021 15:06:17 GMT Message-Id: <202106061506.156F6H0D000528@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: f4e801085b05 - main - linux(4): optimize ksiginfo to siginfo conversion. 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: f4e801085b055fd33f680dd7cb9f8562d236f39a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 15:06:17 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=f4e801085b055fd33f680dd7cb9f8562d236f39a commit f4e801085b055fd33f680dd7cb9f8562d236f39a Author: Dmitry Chagin AuthorDate: 2021-06-07 03:06:17 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-07 03:06:17 +0000 linux(4): optimize ksiginfo to siginfo conversion. Retire ksiginfo_to_lsiginfo function, use siginfo_to_lsiginfo instead. Convert rt_sigtimedwait siginfo variables to well known names. MFC after: 2 weeks --- sys/amd64/linux/linux_sysvec.c | 2 +- sys/amd64/linux32/linux32_sysvec.c | 2 +- sys/compat/linux/linux_signal.c | 21 +++++++-------------- sys/compat/linux/linux_signal.h | 1 - sys/i386/linux/linux_sysvec.c | 2 +- 5 files changed, 10 insertions(+), 18 deletions(-) diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index a04cddeb3c71..02225e63072d 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -666,7 +666,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) sf.sf_handler = catcher; /* Fill in POSIX parts. */ - ksiginfo_to_lsiginfo(ksi, &sf.sf_si, sig); + siginfo_to_lsiginfo(&ksi->ksi_info, &sf.sf_si, sig); /* Copy the sigframe out to the user's stack. */ if (copyout(&sf, sfp, sizeof(*sfp)) != 0) { diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index 86402035ff5a..05354803cf03 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -298,7 +298,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) frame.sf_ucontext = PTROUT(&fp->sf_sc); /* Fill in POSIX parts. */ - ksiginfo_to_lsiginfo(ksi, &frame.sf_si, sig); + siginfo_to_lsiginfo(&ksi->ksi_info, &frame.sf_si, sig); /* * Build the signal context to be used by sigreturn and libgcc unwind. diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c index 02abfe961e6b..5310895cb92c 100644 --- a/sys/compat/linux/linux_signal.c +++ b/sys/compat/linux/linux_signal.c @@ -398,8 +398,8 @@ linux_rt_sigtimedwait(struct thread *td, struct l_timespec lts; l_sigset_t lset; sigset_t bset; - l_siginfo_t linfo; - ksiginfo_t info; + l_siginfo_t lsi; + ksiginfo_t ksi; if (args->sigsetsize != sizeof(l_sigset_t)) return (EINVAL); @@ -419,16 +419,16 @@ linux_rt_sigtimedwait(struct thread *td, } else tsa = NULL; - error = kern_sigtimedwait(td, bset, &info, tsa); + error = kern_sigtimedwait(td, bset, &ksi, tsa); if (error) return (error); - sig = bsd_to_linux_signal(info.ksi_signo); + sig = bsd_to_linux_signal(ksi.ksi_signo); if (args->ptr) { - memset(&linfo, 0, sizeof(linfo)); - ksiginfo_to_lsiginfo(&info, &linfo, sig); - error = copyout(&linfo, args->ptr, sizeof(linfo)); + memset(&lsi, 0, sizeof(lsi)); + siginfo_to_lsiginfo(&ksi.ksi_info, &lsi, sig); + error = copyout(&lsi, args->ptr, sizeof(lsi)); } if (error == 0) td->td_retval[0] = sig; @@ -542,13 +542,6 @@ linux_tkill(struct thread *td, struct linux_tkill_args *args) return (linux_do_tkill(td, tdt, &ksi)); } -void -ksiginfo_to_lsiginfo(const ksiginfo_t *ksi, l_siginfo_t *lsi, l_int sig) -{ - - siginfo_to_lsiginfo(&ksi->ksi_info, lsi, sig); -} - static void sicode_to_lsicode(int si_code, int *lsi_code) { diff --git a/sys/compat/linux/linux_signal.h b/sys/compat/linux/linux_signal.h index bb34613fa2be..f434ab1b1b35 100644 --- a/sys/compat/linux/linux_signal.h +++ b/sys/compat/linux/linux_signal.h @@ -44,7 +44,6 @@ #define LINUX_SI_TKILL -6 /* sent by tkill system call */ int linux_do_sigaction(struct thread *, int, l_sigaction_t *, l_sigaction_t *); -void ksiginfo_to_lsiginfo(const ksiginfo_t *ksi, l_siginfo_t *lsi, l_int sig); 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); diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index ef845675aaa4..0e6ad4b5c137 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -430,7 +430,7 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask) frame.sf_ucontext = &fp->sf_sc; /* Fill in POSIX parts. */ - ksiginfo_to_lsiginfo(ksi, &frame.sf_si, sig); + siginfo_to_lsiginfo(&ksi->ksi_info, &frame.sf_si, sig); /* Build the signal context to be used by sigreturn. */ frame.sf_sc.uc_flags = 0; /* XXX ??? */ From owner-dev-commits-src-main@freebsd.org Sun Jun 6 15:23:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CC7463879F; Sun, 6 Jun 2021 15:23:13 +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 4FygHj1kJBz3Dvg; Sun, 6 Jun 2021 15:23:13 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2374025B48; Sun, 6 Jun 2021 15:23:13 +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 156FNDpi026191; Sun, 6 Jun 2021 15:23:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156FNDpW026190; Sun, 6 Jun 2021 15:23:13 GMT (envelope-from git) Date: Sun, 6 Jun 2021 15:23:13 GMT Message-Id: <202106061523.156FNDpW026190@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: 66e73ce7371b - main - linux(4): Fix clock_nanosleep return value for unsupported clockid. 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: 66e73ce7371b717b8dd0dfd6e3deeacfa95e6f8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 15:23:13 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=66e73ce7371b717b8dd0dfd6e3deeacfa95e6f8b commit 66e73ce7371b717b8dd0dfd6e3deeacfa95e6f8b Author: Dmitry Chagin AuthorDate: 2021-06-07 03:22:25 +0000 Commit: Dmitry Chagin CommitDate: 2021-06-07 03:22:25 +0000 linux(4): Fix clock_nanosleep return value for unsupported clockid. The Linux clock_nanosleep() returns ENOTSUP for CLOCK_THREAD_CPUTIME_ID. This silence one of the LTP clock_nanosleep tests. MFC after: 2 weeks --- sys/compat/linux/linux_time.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linux/linux_time.c b/sys/compat/linux/linux_time.c index 184de336fd99..c1644b5de939 100644 --- a/sys/compat/linux/linux_time.c +++ b/sys/compat/linux/linux_time.c @@ -701,6 +701,8 @@ linux_common_clock_nanosleep(struct thread *td, clockid_t which, unsupported_clockid, which); return (error); } + if (clockid == CLOCK_THREAD_CPUTIME_ID) + return (ENOTSUP); return (kern_clock_nanosleep(td, clockid, flags, rqtp, rmtp)); } From owner-dev-commits-src-main@freebsd.org Sun Jun 6 16:38:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CCBC639203; Sun, 6 Jun 2021 16:38:11 +0000 (UTC) (envelope-from lutz@iks-jena.de) Received: from annwfn.iks-jena.de (annwfn.iks-jena.de [IPv6:2001:4bd8::19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FyhyC1fTjz3LbD; Sun, 6 Jun 2021 16:38:10 +0000 (UTC) (envelope-from lutz@iks-jena.de) X-SMTP-Sender: IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f Received: from belenus.iks-jena.de (belenus.iks-jena.de [IPv6:2001:4bd8:0:666:248:54ff:fe12:ee3f]) by annwfn.iks-jena.de (8.15.2/8.15.2) with ESMTPS id 156Gb8vg005851 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 6 Jun 2021 18:37:08 +0200 X-MSA-Host: belenus.iks-jena.de Received: (from lutz@localhost) by belenus.iks-jena.de (8.14.3/8.14.1/Submit) id 156Gb8mu010740; Sun, 6 Jun 2021 18:37:08 +0200 Date: Sun, 6 Jun 2021 18:37:08 +0200 From: Lutz Donnerhacke To: Dmitry Chagin Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 0f8dab45404f - main - linux(4): Fix timeout parameter of rt_sigtimedwait syscall, which is timespec not a timeval. Message-ID: <20210606163708.GA10633@belenus.iks-jena.de> References: <202106061440.156EeLEK068536@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202106061440.156EeLEK068536@gitrepo.freebsd.org> X-message-flag: Please send plain text messages only. Thank you. User-Agent: Mutt/1.5.17 (2007-11-01) X-Rspamd-Queue-Id: 4FyhyC1fTjz3LbD X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 16:38:11 -0000 On Sun, Jun 06, 2021 at 02:40:21PM +0000, Dmitry Chagin wrote: > The branch main has been updated by dchagin: > > URL: https://cgit.FreeBSD.org/src/commit/?id=0f8dab45404f347752470579feccc6d2739b9570 > > commit 0f8dab45404f347752470579feccc6d2739b9570 > Author: Dmitry Chagin > AuthorDate: 2021-06-07 02:35:35 +0000 > Commit: Dmitry Chagin > CommitDate: 2021-06-07 02:35:35 +0000 > > linux(4): Fix timeout parameter of rt_sigtimedwait syscall, which is > timespec not a timeval. > > MFC after: 2 weeks May I ask, why NONE of those commits are discussed beforehand in Phabricator? freebsd/main is not intended to be used as a local development train by anybody who wants to play with a specific submodule. I don't want to see any of those "try and fix" commits to be MFCed into any stable without serious squashing and fixup runs, in order to minimize the impact on the stable trains. If there is a known bug in the commit, the MFCed commit must contain all the known necessary fixes to avoid any breakage of the stable train. So please do not mess up the freebsd/main any further. Thank you. From owner-dev-commits-src-main@freebsd.org Sun Jun 6 17:34:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1208163A4B8 for ; Sun, 6 Jun 2021 17:34:26 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FykC56XWGz3PCJ for ; Sun, 6 Jun 2021 17:34:25 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f43.google.com with SMTP id l7-20020a05600c1d07b02901b0e2ebd6deso360086wms.1 for ; Sun, 06 Jun 2021 10:34:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=4T7weV/v6EhNXU6FYn+fR8D0QBQIwBH656HILFyTB70=; b=FOglQVBM8d2QrKMUbwOYMXq25aArsfX4ExrWHyPRIQQkRb1EZOzQOAh8e0WY6JSm8t cEURH6kmM4iNc55j/1KLvjzJGqpSBSF1ySgoeGijR2r5vG/AKkZ+vi15Xj9xoo+FCuQi NfMM3Y0DEHXElhFfILExXphvaeLsUQq+BRS5TjpjbZaG6gCGepiXU59VgowX6AKyO+uD w/DTwkzTYqa+7T+ouIau378/4Ren+6LXY2ukxM0f5Ca1X3MSrwNZF7GgIarrqMsc81Li UfI++ePbUx4r+fQeqw8adMLOdY2BnzN9QXpZqR6H7XMybgQ7e61i1F14mkHeWyioZDHj NwXg== X-Gm-Message-State: AOAM533/3bvOYDKeaJBKJ8ywtqdSuI5jtp3rk0faIrzJqeVg4aq5JSWT lIHwjp5E46DcA1EWTL+N2vYqryNL7X4pW+Ft X-Google-Smtp-Source: ABdhPJzA1YMIwPhXKZW56Spd9enG8YIZ3a3NbEW2nVpvpneT2CGQn2tZRXegqXP9pQIeGJo7bPnGpA== X-Received: by 2002:a1c:9804:: with SMTP id a4mr13482073wme.34.1623000864431; Sun, 06 Jun 2021 10:34:24 -0700 (PDT) Received: from smtpclient.apple (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id p1sm11662995wmc.11.2021.06.06.10.34.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Jun 2021 10:34:23 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: git: 0f8dab45404f - main - linux(4): Fix timeout parameter of rt_sigtimedwait syscall, which is timespec not a timeval. From: Jessica Clarke In-Reply-To: <202106061440.156EeLEK068536@gitrepo.freebsd.org> Date: Sun, 6 Jun 2021 18:34:23 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <10F3D299-5675-41EB-A45C-81A0050B2E87@freebsd.org> References: <202106061440.156EeLEK068536@gitrepo.freebsd.org> To: Dmitry Chagin X-Mailer: Apple Mail (2.3654.100.0.2.22) X-Rspamd-Queue-Id: 4FykC56XWGz3PCJ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 17:34:26 -0000 On 6 Jun 2021, at 15:40, Dmitry Chagin wrote: >=20 > The branch main has been updated by dchagin: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D0f8dab45404f347752470579feccc6d2= 739b9570 >=20 > commit 0f8dab45404f347752470579feccc6d2739b9570 > Author: Dmitry Chagin > AuthorDate: 2021-06-07 02:35:35 +0000 > Commit: Dmitry Chagin > CommitDate: 2021-06-07 02:35:35 +0000 Please fix your system clock. Jess From owner-dev-commits-src-main@freebsd.org Sun Jun 6 17:37:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5460863A3E6; Sun, 6 Jun 2021 17:37:32 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (heemeyer.club [IPv6:2001:19f0:6400:80a1:5054:ff:fe7a:a27d]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4FykGh1YDkz3PKp; Sun, 6 Jun 2021 17:37:32 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (localhost [127.0.0.1]) by heemeyer.club (8.16.1/8.16.1) with ESMTP id 156HbKAq050466; Sun, 6 Jun 2021 17:37:20 GMT (envelope-from dchagin@heemeyer.club) Received: (from dchagin@localhost) by heemeyer.club (8.16.1/8.16.1/Submit) id 156HbKCO050465; Sun, 6 Jun 2021 17:37:20 GMT (envelope-from dchagin) Date: Sun, 6 Jun 2021 17:37:20 +0000 From: Dmitry Chagin To: Lutz Donnerhacke Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0f8dab45404f - main - linux(4): Fix timeout parameter of rt_sigtimedwait syscall, which is timespec not a timeval. Message-ID: References: <202106061440.156EeLEK068536@gitrepo.freebsd.org> <20210606163708.GA10633@belenus.iks-jena.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210606163708.GA10633@belenus.iks-jena.de> X-Rspamd-Queue-Id: 4FykGh1YDkz3PKp X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 17:37:32 -0000 On Sun, Jun 06, 2021 at 06:37:08PM +0200, Lutz Donnerhacke wrote: > On Sun, Jun 06, 2021 at 02:40:21PM +0000, Dmitry Chagin wrote: > > The branch main has been updated by dchagin: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=0f8dab45404f347752470579feccc6d2739b9570 > > > > commit 0f8dab45404f347752470579feccc6d2739b9570 > > Author: Dmitry Chagin > > AuthorDate: 2021-06-07 02:35:35 +0000 > > Commit: Dmitry Chagin > > CommitDate: 2021-06-07 02:35:35 +0000 > > > > linux(4): Fix timeout parameter of rt_sigtimedwait syscall, which is > > timespec not a timeval. > > > > MFC after: 2 weeks > > May I ask, why NONE of those commits are discussed beforehand in Phabricator? > freebsd/main is not intended to be used as a local development train by > anybody who wants to play with a specific submodule. > in the main, these are trivial changes, there too few reviewrs in the Linuxulator area to spend their time. feel free to review, there are many requests. > I don't want to see any of those "try and fix" commits to be MFCed into any > stable without serious squashing and fixup runs, in order to minimize the > impact on the stable trains. If there is a known bug in the commit, the > MFCed commit must contain all the known necessary fixes to avoid any > breakage of the stable train. > > So please do not mess up the freebsd/main any further. Thank you. please, re-read the committer's guide carefully, especially about committers relations and pre-commit review. From owner-dev-commits-src-main@freebsd.org Sun Jun 6 17:41:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11EED63A992; Sun, 6 Jun 2021 17:41:31 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (heemeyer.club [IPv6:2001:19f0:6400:80a1:5054:ff:fe7a:a27d]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4FykMG6jkrz3PfT; Sun, 6 Jun 2021 17:41:30 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (localhost [127.0.0.1]) by heemeyer.club (8.16.1/8.16.1) with ESMTP id 156HfUkm050657; Sun, 6 Jun 2021 17:41:30 GMT (envelope-from dchagin@heemeyer.club) Received: (from dchagin@localhost) by heemeyer.club (8.16.1/8.16.1/Submit) id 156HfUQO050656; Sun, 6 Jun 2021 17:41:30 GMT (envelope-from dchagin) Date: Sun, 6 Jun 2021 17:41:30 +0000 From: Dmitry Chagin To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 0f8dab45404f - main - linux(4): Fix timeout parameter of rt_sigtimedwait syscall, which is timespec not a timeval. Message-ID: References: <202106061440.156EeLEK068536@gitrepo.freebsd.org> <10F3D299-5675-41EB-A45C-81A0050B2E87@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <10F3D299-5675-41EB-A45C-81A0050B2E87@freebsd.org> X-Rspamd-Queue-Id: 4FykMG6jkrz3PfT X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 17:41:31 -0000 On Sun, Jun 06, 2021 at 06:34:23PM +0100, Jessica Clarke wrote: > On 6 Jun 2021, at 15:40, Dmitry Chagin wrote: > > > > The branch main has been updated by dchagin: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=0f8dab45404f347752470579feccc6d2739b9570 > > > > commit 0f8dab45404f347752470579feccc6d2739b9570 > > Author: Dmitry Chagin > > AuthorDate: 2021-06-07 02:35:35 +0000 > > Commit: Dmitry Chagin > > CommitDate: 2021-06-07 02:35:35 +0000 > > Please fix your system clock. > > Jess > whoops, thank you, Jess. I run glibc nptl test suite which playing with many syscalls, seems that clock_settime does not restore system time. From owner-dev-commits-src-main@freebsd.org Sun Jun 6 19:25:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4803463BEB6; Sun, 6 Jun 2021 19:25:50 +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 4Fymgf1LMYz3mJZ; Sun, 6 Jun 2021 19:25:50 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 164581109; Sun, 6 Jun 2021 19:25:50 +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 156JPoJ8045012; Sun, 6 Jun 2021 19:25:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156JPole045011; Sun, 6 Jun 2021 19:25:50 GMT (envelope-from git) Date: Sun, 6 Jun 2021 19:25:50 GMT Message-Id: <202106061925.156JPole045011@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 19e6043a443e - main - kern_exec.c: Add execve_nosetid() helper MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 19e6043a443ea51207786b85c8d62d070ec36005 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 19:25:50 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=19e6043a443ea51207786b85c8d62d070ec36005 commit 19e6043a443ea51207786b85c8d62d070ec36005 Author: Konstantin Belousov AuthorDate: 2021-01-14 13:36:15 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-06 18:42:41 +0000 kern_exec.c: Add execve_nosetid() helper Reviewed by: dchagin Tested by: trasz MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28154 --- sys/kern/kern_exec.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 50451c1242eb..356c30ee030c 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -355,6 +355,16 @@ kern_execve(struct thread *td, struct image_args *args, struct mac *mac_p, return (do_execve(td, args, mac_p, oldvmspace)); } +static void +execve_nosetid(struct image_params *imgp) +{ + imgp->credential_setid = false; + if (imgp->newcred != NULL) { + crfree(imgp->newcred); + imgp->newcred = NULL; + } +} + /* * In-kernel implementation of execve(). All arguments are assumed to be * userspace pointers from the passed thread. @@ -643,11 +653,7 @@ interpret: vput(newtextvp); vm_object_deallocate(imgp->object); imgp->object = NULL; - imgp->credential_setid = false; - if (imgp->newcred != NULL) { - crfree(imgp->newcred); - imgp->newcred = NULL; - } + execve_nosetid(imgp); imgp->execpath = NULL; free(imgp->freepath, M_TEMP); imgp->freepath = NULL; From owner-dev-commits-src-main@freebsd.org Sun Jun 6 19:25:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A4D863BE41; Sun, 6 Jun 2021 19:25:51 +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 4Fymgg2Lp9z3mGq; Sun, 6 Jun 2021 19:25:51 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 386C01180; Sun, 6 Jun 2021 19:25:51 +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 156JPp66045033; Sun, 6 Jun 2021 19:25:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156JPpAX045032; Sun, 6 Jun 2021 19:25:51 GMT (envelope-from git) Date: Sun, 6 Jun 2021 19:25:51 GMT Message-Id: <202106061925.156JPpAX045032@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 2d423f7671fe - main - sysent: allow ABI to disable setid on exec. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2d423f7671fe452486932c8e41e7d3547afe82aa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 19:25:51 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2d423f7671fe452486932c8e41e7d3547afe82aa commit 2d423f7671fe452486932c8e41e7d3547afe82aa Author: Konstantin Belousov AuthorDate: 2021-01-14 13:38:29 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-06 18:42:52 +0000 sysent: allow ABI to disable setid on exec. Reviewed by: dchagin Tested by: trasz MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28154 --- sys/kern/kern_exec.c | 4 ++++ sys/sys/sysent.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 356c30ee030c..b091d6061616 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -778,6 +778,10 @@ interpret: signotify(td); } + if (imgp->sysent->sv_setid_allowed != NULL && + !(*imgp->sysent->sv_setid_allowed)(td, imgp)) + execve_nosetid(imgp); + /* * Implement image setuid/setgid installation. */ diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index e6db2ec3dfb1..4a707b41e020 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -148,6 +148,8 @@ struct sysentvec { void (*sv_onexec)(struct proc *, struct image_params *); void (*sv_onexit)(struct proc *); void (*sv_ontdexit)(struct thread *td); + bool (*sv_setid_allowed)(struct thread *td, + struct image_params *imgp); }; #define SV_ILP32 0x000100 /* 32-bit executable. */ From owner-dev-commits-src-main@freebsd.org Sun Jun 6 19:25:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F56063C0B7; Sun, 6 Jun 2021 19:25:52 +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 4Fymgh42q2z3mdM; Sun, 6 Jun 2021 19:25:52 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 63E1D110A; Sun, 6 Jun 2021 19:25: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 156JPqtj045054; Sun, 6 Jun 2021 19:25:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156JPqB7045053; Sun, 6 Jun 2021 19:25:52 GMT (envelope-from git) Date: Sun, 6 Jun 2021 19:25:52 GMT Message-Id: <202106061925.156JPqB7045053@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 598f6fb49c9c - main - linuxolator: Add compat.linux.setid_allowed knob MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 598f6fb49c9ca688029b79de0a44227ab79c608c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 19:25:52 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=598f6fb49c9ca688029b79de0a44227ab79c608c commit 598f6fb49c9ca688029b79de0a44227ab79c608c Author: Konstantin Belousov AuthorDate: 2021-01-14 13:51:52 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-06 18:43:00 +0000 linuxolator: Add compat.linux.setid_allowed knob PR: 21463 Reported by: kris Reviewed by: dchagin Tested by: trasz Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28154 --- share/man/man4/linux.4 | 14 +++++++++++++- sys/amd64/linux/linux_sysvec.c | 1 + sys/amd64/linux32/linux32_sysvec.c | 1 + sys/arm64/linux/linux_sysvec.c | 1 + sys/compat/linux/linux_mib.c | 12 ++++++++++++ sys/compat/linux/linux_mib.h | 3 +++ sys/i386/linux/linux_sysvec.c | 2 ++ 7 files changed, 33 insertions(+), 1 deletion(-) diff --git a/share/man/man4/linux.4 b/share/man/man4/linux.4 index 23bc0c26f7f9..b2d36158c622 100644 --- a/share/man/man4/linux.4 +++ b/share/man/man4/linux.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 5, 2020 +.Dd May 6, 2021 .Dt LINUX 4 .Os .Sh NAME @@ -130,6 +130,18 @@ From a user perspective, this makes .Va SIGINFO work for Linux executables. Defaults to 0. +.It Va compat.linux.setid_allowed +Disable handling of set-user-ID and set-group-ID mode bits for the new +process image file when image is to be executed under Linux ABI. +When set, new Linux images always use credentials of the program +that issued +.Xr execve 2 +call, regardless of the image file mode. +.Pp +This might be reasonable or even required, because +.Fx +does not emulate Linux environment completely, and missed features +could become holes. .El .Sh FILES .Bl -tag -width /compat/linux/dev/shm -compact diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index 02225e63072d..3eab9126f192 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -764,6 +764,7 @@ struct sysentvec elf_linux_sysvec = { .sv_onexec = linux_on_exec, .sv_onexit = linux_on_exit, .sv_ontdexit = linux_thread_dtor, + .sv_setid_allowed = &linux_setid_allowed_query, }; static void diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index 05354803cf03..b950c00eba1d 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -931,6 +931,7 @@ struct sysentvec elf_linux_sysvec = { .sv_onexec = linux_on_exec, .sv_onexit = linux_on_exit, .sv_ontdexit = linux_thread_dtor, + .sv_setid_allowed = &linux_setid_allowed_query, }; static void diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 365cb9fc386a..57abdc6fd691 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -443,6 +443,7 @@ struct sysentvec elf_linux_sysvec = { .sv_onexec = linux_on_exec, .sv_onexit = linux_on_exit, .sv_ontdexit = linux_thread_dtor, + .sv_setid_allowed = &linux_setid_allowed_query, }; static void diff --git a/sys/compat/linux/linux_mib.c b/sys/compat/linux/linux_mib.c index cc4207f74a39..3a6627df9abd 100644 --- a/sys/compat/linux/linux_mib.c +++ b/sys/compat/linux/linux_mib.c @@ -99,6 +99,18 @@ int linux_use_emul_path = 1; SYSCTL_INT(_compat_linux, OID_AUTO, use_emul_path, CTLFLAG_RWTUN, &linux_use_emul_path, 0, "Use linux.compat.emul_path"); +static bool linux_setid_allowed = true; +SYSCTL_BOOL(_compat_linux, OID_AUTO, setid_allowed, CTLFLAG_RWTUN, + &linux_setid_allowed, 0, + "Allow setuid/setgid on execve of Linux binary"); + +bool +linux_setid_allowed_query(struct thread *td __unused, + struct image_params *imgp __unused) +{ + return (linux_setid_allowed); +} + static int linux_set_osname(struct thread *td, char *osname); static int linux_set_osrelease(struct thread *td, char *osrelease); static int linux_set_oss_version(struct thread *td, int oss_version); diff --git a/sys/compat/linux/linux_mib.h b/sys/compat/linux/linux_mib.h index c4d3d1e83f7e..adf71cb65401 100644 --- a/sys/compat/linux/linux_mib.h +++ b/sys/compat/linux/linux_mib.h @@ -71,4 +71,7 @@ extern int linux_ignore_ip_recverr; extern int linux_preserve_vstatus; extern bool linux_map_sched_prio; +struct image_params; +bool linux_setid_allowed_query(struct thread *td, struct image_params *imgp); + #endif /* _LINUX_MIB_H_ */ diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 0e6ad4b5c137..9cc1a723ab55 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -871,6 +871,7 @@ struct sysentvec linux_sysvec = { .sv_onexec = linux_on_exec, .sv_onexit = linux_on_exit, .sv_ontdexit = linux_thread_dtor, + .sv_setid_allowed = &linux_setid_allowed_query, }; INIT_SYSENTVEC(aout_sysvec, &linux_sysvec); @@ -908,6 +909,7 @@ struct sysentvec elf_linux_sysvec = { .sv_onexec = linux_on_exec, .sv_onexit = linux_on_exit, .sv_ontdexit = linux_thread_dtor, + .sv_setid_allowed = &linux_setid_allowed_query, }; static void From owner-dev-commits-src-main@freebsd.org Sun Jun 6 20:41:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E12963DA5A; Sun, 6 Jun 2021 20:41:23 +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 4FypLq474Gz3tpd; Sun, 6 Jun 2021 20:41:23 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 776D11C60; Sun, 6 Jun 2021 20:41:23 +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 156KfNB1049189; Sun, 6 Jun 2021 20:41:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156KfNO3049176; Sun, 6 Jun 2021 20:41:23 GMT (envelope-from git) Date: Sun, 6 Jun 2021 20:41:23 GMT Message-Id: <202106062041.156KfNO3049176@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 62b8258a7e43 - main - Change the return type of sv__setid_allowed from bool to int MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 62b8258a7e43f3c774f13eab758b2cfdf353073e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 20:41:23 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=62b8258a7e43f3c774f13eab758b2cfdf353073e commit 62b8258a7e43f3c774f13eab758b2cfdf353073e Author: Konstantin Belousov AuthorDate: 2021-06-06 20:38:48 +0000 Commit: Konstantin Belousov CommitDate: 2021-06-06 20:38:48 +0000 Change the return type of sv__setid_allowed from bool to int to please some userspace code using sys/sysent.h. Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/compat/linux/linux_mib.c | 2 +- sys/compat/linux/linux_mib.h | 2 +- sys/sys/sysent.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/compat/linux/linux_mib.c b/sys/compat/linux/linux_mib.c index 3a6627df9abd..13beba323787 100644 --- a/sys/compat/linux/linux_mib.c +++ b/sys/compat/linux/linux_mib.c @@ -104,7 +104,7 @@ SYSCTL_BOOL(_compat_linux, OID_AUTO, setid_allowed, CTLFLAG_RWTUN, &linux_setid_allowed, 0, "Allow setuid/setgid on execve of Linux binary"); -bool +int linux_setid_allowed_query(struct thread *td __unused, struct image_params *imgp __unused) { diff --git a/sys/compat/linux/linux_mib.h b/sys/compat/linux/linux_mib.h index adf71cb65401..61a3a38a23ae 100644 --- a/sys/compat/linux/linux_mib.h +++ b/sys/compat/linux/linux_mib.h @@ -72,6 +72,6 @@ extern int linux_preserve_vstatus; extern bool linux_map_sched_prio; struct image_params; -bool linux_setid_allowed_query(struct thread *td, struct image_params *imgp); +int linux_setid_allowed_query(struct thread *td, struct image_params *imgp); #endif /* _LINUX_MIB_H_ */ diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 4a707b41e020..c2cbd77a92b9 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -148,7 +148,7 @@ struct sysentvec { void (*sv_onexec)(struct proc *, struct image_params *); void (*sv_onexit)(struct proc *); void (*sv_ontdexit)(struct thread *td); - bool (*sv_setid_allowed)(struct thread *td, + int (*sv_setid_allowed)(struct thread *td, struct image_params *imgp); }; From owner-dev-commits-src-main@freebsd.org Sun Jun 6 20:45:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A855B63D7D2; Sun, 6 Jun 2021 20:45:08 +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 4FypR84PXlz3vKl; Sun, 6 Jun 2021 20:45:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 7F8751F6A; Sun, 6 Jun 2021 20:45:08 +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 156Kj8A4051916; Sun, 6 Jun 2021 20:45:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156Kj8WS051915; Sun, 6 Jun 2021 20:45:08 GMT (envelope-from git) Date: Sun, 6 Jun 2021 20:45:08 GMT Message-Id: <202106062045.156Kj8WS051915@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: fbeb4ccac990 - main - Suppress D_NEEDGIANT warnings for some drivers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fbeb4ccac990fdb3bc26ab925a3ca8e7d2f89721 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 20:45:08 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fbeb4ccac990fdb3bc26ab925a3ca8e7d2f89721 commit fbeb4ccac990fdb3bc26ab925a3ca8e7d2f89721 Author: Mark Johnston AuthorDate: 2021-06-06 20:40:19 +0000 Commit: Mark Johnston CommitDate: 2021-06-06 20:44:46 +0000 Suppress D_NEEDGIANT warnings for some drivers During boot we warn that the kbd and openfirm drivers are Giant-locked and may be deleted. Generally, the warning helps signal that certain old drivers are not being maintained and are subject to removal, but this doesn't really apply to certain drivers which are harder to detangle from Giant. Add a flag, D_GIANTOK, that devices can specify to suppress the misleading warning. Use it in the kbd and openfirm drivers. Reviewed by: imp, jhb MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30649 --- sys/dev/kbd/kbd.c | 2 +- sys/dev/ofw/openfirmio.c | 2 +- sys/kern/kern_conf.c | 2 +- sys/sys/conf.h | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c index fd996f7a06ad..70c0ef15a56e 100644 --- a/sys/dev/kbd/kbd.c +++ b/sys/dev/kbd/kbd.c @@ -453,7 +453,7 @@ static d_poll_t genkbdpoll; static struct cdevsw kbd_cdevsw = { .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, + .d_flags = D_NEEDGIANT | D_GIANTOK, .d_open = genkbdopen, .d_close = genkbdclose, .d_read = genkbdread, diff --git a/sys/dev/ofw/openfirmio.c b/sys/dev/ofw/openfirmio.c index 2112d45d4dd9..30afb85baf8a 100644 --- a/sys/dev/ofw/openfirmio.c +++ b/sys/dev/ofw/openfirmio.c @@ -66,7 +66,7 @@ static d_ioctl_t openfirm_ioctl; static struct cdevsw openfirm_cdevsw = { .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, + .d_flags = D_NEEDGIANT | D_GIANTOK, .d_ioctl = openfirm_ioctl, .d_name = "openfirm", }; diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 3a07c95e74d0..42435c0b8740 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -665,7 +665,7 @@ prep_cdevsw(struct cdevsw *devsw, int flags) devsw->d_kqfilter = dead_kqfilter; } - if (devsw->d_flags & D_NEEDGIANT) { + if ((devsw->d_flags & (D_NEEDGIANT | D_GIANTOK)) == D_NEEDGIANT) { printf("WARNING: Device \"%s\" is Giant locked and may be " "deleted before FreeBSD 14.0.\n", devsw->d_name == NULL ? "???" : devsw->d_name); diff --git a/sys/sys/conf.h b/sys/sys/conf.h index 2a87e5d3a9ca..123bf91cf952 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -173,6 +173,7 @@ typedef int dumper_hdr_t(struct dumperinfo *di, struct kerneldumpheader *kdh, */ #define D_TRACKCLOSE 0x00080000 /* track all closes */ #define D_MMAP_ANON 0x00100000 /* special treatment in vm_mmap.c */ +#define D_GIANTOK 0x00200000 /* suppress warning about using Giant */ #define D_NEEDGIANT 0x00400000 /* driver want Giant */ #define D_NEEDMINOR 0x00800000 /* driver uses clone_create() */ From owner-dev-commits-src-main@freebsd.org Sun Jun 6 20:45:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EAEB363D670; Sun, 6 Jun 2021 20:45:09 +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 4FypR95dVjz3tvx; Sun, 6 Jun 2021 20:45:09 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 A82C52067; Sun, 6 Jun 2021 20:45:09 +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 156Kj9Gg051937; Sun, 6 Jun 2021 20:45:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156Kj9UP051936; Sun, 6 Jun 2021 20:45:09 GMT (envelope-from git) Date: Sun, 6 Jun 2021 20:45:09 GMT Message-Id: <202106062045.156Kj9UP051936@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 1ea87e2a70c3 - main - stand: Fix __elfN(loadimage) return value MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ea87e2a70c31454a8696ab2979d13d21c5575d2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 20:45:10 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1ea87e2a70c31454a8696ab2979d13d21c5575d2 commit 1ea87e2a70c31454a8696ab2979d13d21c5575d2 Author: Mark Johnston AuthorDate: 2021-06-06 20:40:25 +0000 Commit: Mark Johnston CommitDate: 2021-06-06 20:44:46 +0000 stand: Fix __elfN(loadimage) return value Caller functions expect __elfN(loadimage) to return a value of zero on failure and the file size on success. PR: 256390 Reviewed by: markj MFC after: 2 weeks --- stand/common/load_elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c index 8bb780ef34df..f1a9ff8e0c22 100644 --- a/stand/common/load_elf.c +++ b/stand/common/load_elf.c @@ -893,7 +893,7 @@ nosyms: p_start = sym.st_value + ef->off; if (__elfN(lookup_symbol)(ef, "__stop_set_modmetadata_set", &sym, STT_NOTYPE) != 0) - return ENOENT; + return 0; p_end = sym.st_value + ef->off; if (__elfN(parse_modmetadata)(fp, ef, p_start, p_end) == 0) From owner-dev-commits-src-main@freebsd.org Sun Jun 6 20:45:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 20BD563D679; Sun, 6 Jun 2021 20:45:11 +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 4FypRC0FFWz3v8N; Sun, 6 Jun 2021 20:45:11 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 CA3A52201; Sun, 6 Jun 2021 20:45:10 +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 156KjASb051958; Sun, 6 Jun 2021 20:45:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156KjAb0051957; Sun, 6 Jun 2021 20:45:10 GMT (envelope-from git) Date: Sun, 6 Jun 2021 20:45:10 GMT Message-Id: <202106062045.156KjAb0051957@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a48f51b3d396 - main - arm64: Use the right PTE when downgrading perms in pmap_promote_l2() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a48f51b3d396664f9b0a91f016159f4e4324da85 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 20:45:11 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a48f51b3d396664f9b0a91f016159f4e4324da85 commit a48f51b3d396664f9b0a91f016159f4e4324da85 Author: Mark Johnston AuthorDate: 2021-06-06 20:40:29 +0000 Commit: Mark Johnston CommitDate: 2021-06-06 20:44:46 +0000 arm64: Use the right PTE when downgrading perms in pmap_promote_l2() When promoting a run of small mappings to a superpage, we have to downgrade clean, writable mappings to read-only, to handle the possibility that the MMU will concurrently mark one of the mappings as dirty. The code which performed this operation for the first PTE in the run used the wrong PTE pointer. As a result, the comparison would always fail, aborting the promotion. This only occurs when promoting writable, clean mappings. Fixes: ca2cae0b4dd Reviewed by: alc, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30642 --- sys/arm64/arm64/pmap.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index bc5d228af5ad..c26c3d8fce17 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -3518,7 +3518,11 @@ setl2: if ((newl2 & (ATTR_S1_AP_RW_BIT | ATTR_SW_DBM)) == (ATTR_S1_AP(ATTR_S1_AP_RO) | ATTR_SW_DBM)) { - if (!atomic_fcmpset_64(l2, &newl2, newl2 & ~ATTR_SW_DBM)) + /* + * When the mapping is clean, i.e., ATTR_S1_AP_RO is set, + * ATTR_SW_DBM can be cleared without a TLB invalidation. + */ + if (!atomic_fcmpset_64(firstl3, &newl2, newl2 & ~ATTR_SW_DBM)) goto setl2; newl2 &= ~ATTR_SW_DBM; } @@ -3529,6 +3533,11 @@ setl2: setl3: if ((oldl3 & (ATTR_S1_AP_RW_BIT | ATTR_SW_DBM)) == (ATTR_S1_AP(ATTR_S1_AP_RO) | ATTR_SW_DBM)) { + /* + * When the mapping is clean, i.e., ATTR_S1_AP_RO is + * set, ATTR_SW_DBM can be cleared without a TLB + * invalidation. + */ if (!atomic_fcmpset_64(l3, &oldl3, oldl3 & ~ATTR_SW_DBM)) goto setl3; From owner-dev-commits-src-main@freebsd.org Sun Jun 6 20:45:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3015863D7D3; Sun, 6 Jun 2021 20:45:12 +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 4FypRD0dKjz3tw8; Sun, 6 Jun 2021 20:45:12 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E77AF2202; Sun, 6 Jun 2021 20:45:11 +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 156KjBF5051981; Sun, 6 Jun 2021 20:45:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156KjBuC051980; Sun, 6 Jun 2021 20:45:11 GMT (envelope-from git) Date: Sun, 6 Jun 2021 20:45:11 GMT Message-Id: <202106062045.156KjBuC051980@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 4e4035ef1fb5 - main - arm64: Fix pmap_copy()'s handling of 2MB mappings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4e4035ef1fb5e2f9da6b658ffae8a54862b4d018 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 20:45:12 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4e4035ef1fb5e2f9da6b658ffae8a54862b4d018 commit 4e4035ef1fb5e2f9da6b658ffae8a54862b4d018 Author: Mark Johnston AuthorDate: 2021-06-06 20:40:45 +0000 Commit: Mark Johnston CommitDate: 2021-06-06 20:44:46 +0000 arm64: Fix pmap_copy()'s handling of 2MB mappings When copying mappings from parent to child, we clear the accessed and dirty bits. This is done for both 4KB and 2MB PTEs. However, pmap_demote_l2() asserts that writable superpages must be dirty. This is to avoid races with the MMU setting the dirty bit during promotion and demotion. pmap_copy() can create clean, writable superpage mappings, so it violates this assertion. Modify pmap_copy() to preserve the accessed and dirty bits when copying 2MB mappings, like we do on amd64. Fixes: ca2cae0b4dd Reported by: Jenkins via mhorne Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30643 --- sys/arm64/arm64/pmap.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index c26c3d8fce17..ffc83be852bd 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -4573,11 +4573,8 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, ((srcptepaddr & ATTR_SW_MANAGED) == 0 || pmap_pv_insert_l2(dst_pmap, addr, srcptepaddr, PMAP_ENTER_NORECLAIM, &lock))) { - mask = ATTR_AF | ATTR_SW_WIRED; - nbits = 0; - if ((srcptepaddr & ATTR_SW_DBM) != 0) - nbits |= ATTR_S1_AP_RW_BIT; - pmap_store(l2, (srcptepaddr & ~mask) | nbits); + mask = ATTR_SW_WIRED; + pmap_store(l2, srcptepaddr & ~mask); pmap_resident_count_inc(dst_pmap, L2_SIZE / PAGE_SIZE); atomic_add_long(&pmap_l2_mappings, 1); From owner-dev-commits-src-main@freebsd.org Sun Jun 6 20:45:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE7D263DC15; Sun, 6 Jun 2021 20:45:14 +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 4FypRG35Rgz3vMx; Sun, 6 Jun 2021 20:45:14 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 303BF2068; Sun, 6 Jun 2021 20:45:14 +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 156KjEAF052030; Sun, 6 Jun 2021 20:45:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156KjEhG052029; Sun, 6 Jun 2021 20:45:14 GMT (envelope-from git) Date: Sun, 6 Jun 2021 20:45:14 GMT Message-Id: <202106062045.156KjEhG052029@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 317113bb1251 - main - riscv: Rename pmap_fault_fixup() to pmap_fault() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 317113bb125166f6ba3035a29408339af38cca54 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 20:45:15 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=317113bb125166f6ba3035a29408339af38cca54 commit 317113bb125166f6ba3035a29408339af38cca54 Author: Mark Johnston AuthorDate: 2021-06-06 20:42:00 +0000 Commit: Mark Johnston CommitDate: 2021-06-06 20:44:46 +0000 riscv: Rename pmap_fault_fixup() to pmap_fault() This is consistent with other platforms, specifically arm and arm64. No functional change intended. Reviewed by: jrtc27 MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30645 --- sys/riscv/include/pmap.h | 2 +- sys/riscv/riscv/pmap.c | 2 +- sys/riscv/riscv/trap.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/riscv/include/pmap.h b/sys/riscv/include/pmap.h index 9a1f23b20245..64b529e95887 100644 --- a/sys/riscv/include/pmap.h +++ b/sys/riscv/include/pmap.h @@ -160,7 +160,7 @@ void pmap_unmap_io_transient(vm_page_t *, vm_offset_t *, int, boolean_t); bool pmap_get_tables(pmap_t, vm_offset_t, pd_entry_t **, pd_entry_t **, pt_entry_t **); -int pmap_fault_fixup(pmap_t, vm_offset_t, vm_prot_t); +int pmap_fault(pmap_t, vm_offset_t, vm_prot_t); static inline int pmap_vmspace_copy(pmap_t dst_pmap __unused, pmap_t src_pmap __unused) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 747e75b765b2..50248ac79bf4 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -2382,7 +2382,7 @@ retryl3: } int -pmap_fault_fixup(pmap_t pmap, vm_offset_t va, vm_prot_t ftype) +pmap_fault(pmap_t pmap, vm_offset_t va, vm_prot_t ftype) { pd_entry_t *l2, l2e; pt_entry_t bits, *pte, oldpte; diff --git a/sys/riscv/riscv/trap.c b/sys/riscv/riscv/trap.c index 8297d4072a5c..07d7f84a94e8 100644 --- a/sys/riscv/riscv/trap.c +++ b/sys/riscv/riscv/trap.c @@ -226,7 +226,7 @@ page_fault_handler(struct trapframe *frame, int usermode) ftype = VM_PROT_READ; } - if (pmap_fault_fixup(map->pmap, va, ftype)) + if (pmap_fault(map->pmap, va, ftype)) goto done; error = vm_fault_trap(map, va, ftype, VM_FAULT_NORMAL, &sig, &ucode); From owner-dev-commits-src-main@freebsd.org Sun Jun 6 20:45:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D36163DB9B; Sun, 6 Jun 2021 20:45:13 +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 4FypRF1MbLz3v6C; Sun, 6 Jun 2021 20:45:13 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 118EC209F; Sun, 6 Jun 2021 20:45:13 +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 156KjC8e052006; Sun, 6 Jun 2021 20:45:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156KjC4Z052005; Sun, 6 Jun 2021 20:45:12 GMT (envelope-from git) Date: Sun, 6 Jun 2021 20:45:12 GMT Message-Id: <202106062045.156KjC4Z052005@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: c05748e028b8 - main - riscv: Handle hardware-managed dirty bit updates in pmap_promote_l2() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c05748e028b84c216d0161e70418f8cb09e074e4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 20:45:13 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=c05748e028b84c216d0161e70418f8cb09e074e4 commit c05748e028b84c216d0161e70418f8cb09e074e4 Author: Mark Johnston AuthorDate: 2021-06-06 20:41:35 +0000 Commit: Mark Johnston CommitDate: 2021-06-06 20:44:46 +0000 riscv: Handle hardware-managed dirty bit updates in pmap_promote_l2() pmap_promote_l2() failed to handle implementations which set the accessed and dirty flags. In particular, when comparing the attributes of a run of 512 PTEs, we must handle the possibility that the hardware will set PTE_D on a clean, writable mapping. Following the example of amd64 and arm64, change riscv's pmap_promote_l2() to downgrade clean, writable mappings to read-only, so that updates are synchronized by the pmap lock. Fixes: f6893f09d Reported by: Nathaniel Filardo Tested by: Nathaniel Filardo Reviewed by: jrtc27, alc, Nathaniel Filardo MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30644 --- sys/riscv/riscv/pmap.c | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index d0b51d5199e2..747e75b765b2 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -2540,7 +2540,7 @@ static void pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset_t va, struct rwlock **lockp) { - pt_entry_t *firstl3, *l3; + pt_entry_t *firstl3, firstl3e, *l3, l3e; vm_paddr_t pa; vm_page_t ml3; @@ -2551,7 +2551,8 @@ pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset_t va, ("pmap_promote_l2: invalid l2 entry %p", l2)); firstl3 = (pt_entry_t *)PHYS_TO_DMAP(PTE_TO_PHYS(pmap_load(l2))); - pa = PTE_TO_PHYS(pmap_load(firstl3)); + firstl3e = pmap_load(firstl3); + pa = PTE_TO_PHYS(firstl3e); if ((pa & L2_OFFSET) != 0) { CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx pmap %p", va, pmap); @@ -2559,17 +2560,40 @@ pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset_t va, return; } + /* + * Downgrade a clean, writable mapping to read-only to ensure that the + * hardware does not set PTE_D while we are comparing PTEs. + * + * Upon a write access to a clean mapping, the implementation will + * either atomically check protections and set PTE_D, or raise a page + * fault. In the latter case, the pmap lock provides atomicity. Thus, + * we do not issue an sfence.vma here and instead rely on pmap_fault() + * to do so lazily. + */ + while ((firstl3e & (PTE_W | PTE_D)) == PTE_W) { + if (atomic_fcmpset_64(firstl3, &firstl3e, firstl3e & ~PTE_W)) { + firstl3e &= ~PTE_W; + break; + } + } + pa += PAGE_SIZE; for (l3 = firstl3 + 1; l3 < firstl3 + Ln_ENTRIES; l3++) { - if (PTE_TO_PHYS(pmap_load(l3)) != pa) { + l3e = pmap_load(l3); + if (PTE_TO_PHYS(l3e) != pa) { CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx pmap %p", va, pmap); atomic_add_long(&pmap_l2_p_failures, 1); return; } - if ((pmap_load(l3) & PTE_PROMOTE) != - (pmap_load(firstl3) & PTE_PROMOTE)) { + while ((l3e & (PTE_W | PTE_D)) == PTE_W) { + if (atomic_fcmpset_64(l3, &l3e, l3e & ~PTE_W)) { + l3e &= ~PTE_W; + break; + } + } + if ((l3e & PTE_PROMOTE) != (firstl3e & PTE_PROMOTE)) { CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx pmap %p", va, pmap); @@ -2589,11 +2613,10 @@ pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset_t va, return; } - if ((pmap_load(firstl3) & PTE_SW_MANAGED) != 0) - pmap_pv_promote_l2(pmap, va, PTE_TO_PHYS(pmap_load(firstl3)), - lockp); + if ((firstl3e & PTE_SW_MANAGED) != 0) + pmap_pv_promote_l2(pmap, va, PTE_TO_PHYS(firstl3e), lockp); - pmap_store(l2, pmap_load(firstl3)); + pmap_store(l2, firstl3e); atomic_add_long(&pmap_l2_promotions, 1); CTR2(KTR_PMAP, "pmap_promote_l2: success for va %#lx in pmap %p", va, From owner-dev-commits-src-main@freebsd.org Sun Jun 6 20:45:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 88B1E63DC17; Sun, 6 Jun 2021 20:45:15 +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 4FypRH3Cxrz3v2F; Sun, 6 Jun 2021 20:45:15 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 50F8520A0; Sun, 6 Jun 2021 20:45:15 +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 156KjFoK052051; Sun, 6 Jun 2021 20:45:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156KjF5e052050; Sun, 6 Jun 2021 20:45:15 GMT (envelope-from git) Date: Sun, 6 Jun 2021 20:45:15 GMT Message-Id: <202106062045.156KjF5e052050@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 03d4b58feee3 - main - iwn: adjust EEPROM read timeout for Intel 4965AGN M2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 03d4b58feee396d392668f192ecdde08ecc8036c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 20:45:15 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=03d4b58feee396d392668f192ecdde08ecc8036c commit 03d4b58feee396d392668f192ecdde08ecc8036c Author: RadosÅ‚aw Chmielarz AuthorDate: 2021-06-06 20:42:10 +0000 Commit: Mark Johnston CommitDate: 2021-06-06 20:44:47 +0000 iwn: adjust EEPROM read timeout for Intel 4965AGN M2 Reading EEPROM from Intel 4965AGN M2 takes 60 us which was causing panic on system startup. PR: 255465 Reviewed by: markj MFC after: 1 week --- sys/dev/iwn/if_iwn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c index b07b52cbea7c..4191fb340a03 100644 --- a/sys/dev/iwn/if_iwn.c +++ b/sys/dev/iwn/if_iwn.c @@ -1688,13 +1688,13 @@ iwn_read_prom_data(struct iwn_softc *sc, uint32_t addr, void *data, int count) addr += sc->prom_base; for (; count > 0; count -= 2, addr++) { IWN_WRITE(sc, IWN_EEPROM, addr << 2); - for (ntries = 0; ntries < 10; ntries++) { + for (ntries = 0; ntries < 20; ntries++) { val = IWN_READ(sc, IWN_EEPROM); if (val & IWN_EEPROM_READ_VALID) break; DELAY(5); } - if (ntries == 10) { + if (ntries == 20) { device_printf(sc->sc_dev, "timeout reading ROM at 0x%x\n", addr); return ETIMEDOUT; From owner-dev-commits-src-main@freebsd.org Sun Jun 6 20:45:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3E3363DAE6; Sun, 6 Jun 2021 20:45:17 +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 4FypRK5Vybz3v6d; Sun, 6 Jun 2021 20:45:17 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8D9D91F6B; Sun, 6 Jun 2021 20:45:17 +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 156KjHSb052093; Sun, 6 Jun 2021 20:45:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156KjHU3052092; Sun, 6 Jun 2021 20:45:17 GMT (envelope-from git) Date: Sun, 6 Jun 2021 20:45:17 GMT Message-Id: <202106062045.156KjHU3052092@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: e755e2776ddf - main - ngatm: Handle errors from uni_msg_extend() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e755e2776ddff729ae4102f3273473aa33b00077 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 20:45:18 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e755e2776ddff729ae4102f3273473aa33b00077 commit e755e2776ddff729ae4102f3273473aa33b00077 Author: Mark Johnston AuthorDate: 2021-06-06 20:42:16 +0000 Commit: Mark Johnston CommitDate: 2021-06-06 20:44:47 +0000 ngatm: Handle errors from uni_msg_extend() uni_msg_extend() may fail due to a memory allocation failure. In this case, though, the message is freed, so callers shouldn't touch it. PR: 255861 Reviewed by: harti MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30611 --- sys/contrib/ngatm/netnatm/msg/uni_ie.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/contrib/ngatm/netnatm/msg/uni_ie.c b/sys/contrib/ngatm/netnatm/msg/uni_ie.c index e4b8310d88d9..3842279c63a1 100644 --- a/sys/contrib/ngatm/netnatm/msg/uni_ie.c +++ b/sys/contrib/ngatm/netnatm/msg/uni_ie.c @@ -216,7 +216,8 @@ uni_encode_msg_hdr(struct uni_msg *msg, struct uni_msghdr *h, { u_char byte; - (void)uni_msg_ensure(msg, 9); + if (uni_msg_ensure(msg, 9) != 0) + return -1; APP_BYTE(msg, cx->pnni ? PNNI_PROTO : UNI_PROTO); APP_BYTE(msg, 3); @@ -654,7 +655,8 @@ uni_encode_ie_hdr(struct uni_msg *msg, enum uni_ietype type, { u_char byte; - (void)uni_msg_ensure(msg, 4 + len); + if (uni_msg_ensure(msg, 4 + len) != 0) + return -1; *msg->b_wptr++ = type; byte = 0x80 | (h->coding << 5); From owner-dev-commits-src-main@freebsd.org Sun Jun 6 20:45:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F1BD63DBA6; Sun, 6 Jun 2021 20:45:16 +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 4FypRJ3zl7z3v8h; Sun, 6 Jun 2021 20:45:16 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 711F020A1; Sun, 6 Jun 2021 20:45:16 +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 156KjGIV052072; Sun, 6 Jun 2021 20:45:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 156KjGJC052071; Sun, 6 Jun 2021 20:45:16 GMT (envelope-from git) Date: Sun, 6 Jun 2021 20:45:16 GMT Message-Id: <202106062045.156KjGJC052071@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 62ba0def5584 - main - arm: Remove last_fault_code MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 62ba0def5584bc1fc84fc7df6d7a1256e4a34fb8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 20:45:16 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=62ba0def5584bc1fc84fc7df6d7a1256e4a34fb8 commit 62ba0def5584bc1fc84fc7df6d7a1256e4a34fb8 Author: Mark Johnston AuthorDate: 2021-06-06 20:42:13 +0000 Commit: Mark Johnston CommitDate: 2021-06-06 20:44:47 +0000 arm: Remove last_fault_code It is unused since the removal of pmap-v4.c in commit b88b275145. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/arm/arm/trap-v6.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sys/arm/arm/trap-v6.c b/sys/arm/arm/trap-v6.c index 16f166e83114..cd141376d381 100644 --- a/sys/arm/arm/trap-v6.c +++ b/sys/arm/arm/trap-v6.c @@ -70,10 +70,6 @@ __FBSDID("$FreeBSD$"); extern char cachebailout[]; -#ifdef DEBUG -int last_fault_code; /* For the benefit of pmap_fault_fixup() */ -#endif - struct ksig { int sig; u_long code; @@ -495,10 +491,6 @@ abort_handler(struct trapframe *tf, int prefetch) if (prefetch) ftype |= VM_PROT_EXECUTE; -#ifdef DEBUG - last_fault_code = fsr; -#endif - #ifdef INVARIANTS onfault = pcb->pcb_onfault; pcb->pcb_onfault = NULL; From owner-dev-commits-src-main@freebsd.org Sun Jun 6 21:05:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1B4E63E4EA; Sun, 6 Jun 2021 21:05:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4Fypv40WmYz4Y9Y; Sun, 6 Jun 2021 21:05:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 156L5cFv027643 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 7 Jun 2021 00:05:41 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 156L5cFv027643 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 156L5csv027642; Mon, 7 Jun 2021 00:05:38 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 7 Jun 2021 00:05:38 +0300 From: Konstantin Belousov To: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 62b8258a7e43 - main - Change the return type of sv__setid_allowed from bool to int Message-ID: References: <202106062041.156KfNO3049176@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202106062041.156KfNO3049176@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4Fypv40WmYz4Y9Y X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-0.76 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; NEURAL_HAM_MEDIUM(-0.75)[-0.750]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; TO_DN_NONE(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; NEURAL_SPAM_SHORT(0.99)[0.994]; SPAMHAUS_ZRD(0.00)[2001:470:d5e7:1::1:from:127.0.2.255]; RBL_DBL_DONT_QUERY_IPS(0.00)[2001:470:d5e7:1::1:from]; NEURAL_HAM_LONG(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jun 2021 21:05:54 -0000 On Sun, Jun 06, 2021 at 08:41:23PM +0000, Konstantin Belousov wrote: > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=62b8258a7e43f3c774f13eab758b2cfdf353073e > > commit 62b8258a7e43f3c774f13eab758b2cfdf353073e > Author: Konstantin Belousov > AuthorDate: 2021-06-06 20:38:48 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-06-06 20:38:48 +0000 > > Change the return type of sv__setid_allowed from bool to int > > to please some userspace code using sys/sysent.h. This situation with lack of bool in userspace where some kernel headers are used, is repeating too many times. I believe the right fix is to start ensuring that any code that tries to include (kind of) kernel-only headers also provides the bool type. I will do this some time later.