From owner-svn-src-stable-12@freebsd.org Sun Nov 17 00:52:24 2019 Return-Path: Delivered-To: svn-src-stable-12@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 A19531B1CA5; Sun, 17 Nov 2019 00:52:24 +0000 (UTC) (envelope-from mav@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Ftpc2fZ4z3MRc; Sun, 17 Nov 2019 00:52:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03A1A9E7C; Sun, 17 Nov 2019 00:52:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAH0qNA3070700; Sun, 17 Nov 2019 00:52:23 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAH0qNG8070699; Sun, 17 Nov 2019 00:52:23 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911170052.xAH0qNG8070699@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 17 Nov 2019 00:52:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354781 - stable/12/sys/cam/ctl X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam/ctl X-SVN-Commit-Revision: 354781 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 00:52:24 -0000 Author: mav Date: Sun Nov 17 00:52:23 2019 New Revision: 354781 URL: https://svnweb.freebsd.org/changeset/base/354781 Log: MFC r354268: Remove lock from CTL camsim frontend. CAM does not need a SIM lock for quite a while, and CTL never needed it. Modified: stable/12/sys/cam/ctl/ctl_frontend_cam_sim.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/ctl/ctl_frontend_cam_sim.c ============================================================================== --- stable/12/sys/cam/ctl/ctl_frontend_cam_sim.c Sat Nov 16 20:33:46 2019 (r354780) +++ stable/12/sys/cam/ctl/ctl_frontend_cam_sim.c Sun Nov 17 00:52:23 2019 (r354781) @@ -46,12 +46,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include -#include -#include #include #include +#include #include #include @@ -80,7 +77,6 @@ struct cfcs_softc { struct cam_sim *sim; struct cam_devq *devq; struct cam_path *path; - struct mtx lock; uint64_t wwnn; uint64_t wwpn; uint32_t cur_tag_num; @@ -135,7 +131,6 @@ cfcs_init(void) softc = &cfcs_softc; bzero(softc, sizeof(*softc)); - mtx_init(&softc->lock, "ctl2cam", NULL, MTX_DEF); port = &softc->port; port->frontend = &cfcs_frontend; @@ -155,7 +150,6 @@ cfcs_init(void) if (retval != 0) { printf("%s: ctl_port_register() failed with error %d!\n", __func__, retval); - mtx_destroy(&softc->lock); return (retval); } @@ -177,7 +171,6 @@ cfcs_init(void) softc->wwpn = port->wwpn; } - mtx_lock(&softc->lock); softc->devq = cam_simq_alloc(port->num_requested_ctl_io); if (softc->devq == NULL) { printf("%s: error allocating devq\n", __func__); @@ -186,7 +179,7 @@ cfcs_init(void) } softc->sim = cam_sim_alloc(cfcs_action, cfcs_poll, softc->port_name, - softc, /*unit*/ 0, &softc->lock, 1, + softc, /*unit*/ 0, NULL, 1, port->num_requested_ctl_io, softc->devq); if (softc->sim == NULL) { printf("%s: error allocating SIM\n", __func__); @@ -210,8 +203,6 @@ cfcs_init(void) goto bailout; } - mtx_unlock(&softc->lock); - return (retval); bailout: @@ -219,9 +210,6 @@ bailout: cam_sim_free(softc->sim, /*free_devq*/ TRUE); else if (softc->devq) cam_simq_free(softc->devq); - mtx_unlock(&softc->lock); - mtx_destroy(&softc->lock); - return (retval); } @@ -234,12 +222,9 @@ cfcs_shutdown(void) ctl_port_offline(port); - mtx_lock(&softc->lock); xpt_free_path(softc->path); xpt_bus_deregister(cam_sim_path(softc->sim)); cam_sim_free(softc->sim, /*free_devq*/ TRUE); - mtx_unlock(&softc->lock); - mtx_destroy(&softc->lock); if ((error = ctl_port_deregister(port)) != 0) printf("%s: cam_sim port deregistration failed\n", __func__); @@ -255,18 +240,15 @@ cfcs_poll(struct cam_sim *sim) static void cfcs_onoffline(void *arg, int online) { - struct cfcs_softc *softc; + struct cfcs_softc *softc = (struct cfcs_softc *)arg; union ccb *ccb; - softc = (struct cfcs_softc *)arg; - - mtx_lock(&softc->lock); softc->online = online; ccb = xpt_alloc_ccb_nowait(); if (ccb == NULL) { printf("%s: unable to allocate CCB for rescan\n", __func__); - goto bailout; + return; } if (xpt_create_path(&ccb->ccb_h.path, NULL, @@ -274,12 +256,9 @@ cfcs_onoffline(void *arg, int online) CAM_LUN_WILDCARD) != CAM_REQ_CMP) { printf("%s: can't allocate path for rescan\n", __func__); xpt_free_ccb(ccb); - goto bailout; + return; } xpt_rescan(ccb); - -bailout: - mtx_unlock(&softc->lock); } static void @@ -493,13 +472,13 @@ cfcs_done(union ctl_io *io) ccb->ccb_h.status |= CAM_REQ_CMP_ERR; break; } + ctl_free_io(io); if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP && (ccb->ccb_h.status & CAM_DEV_QFRZN) == 0) { xpt_freeze_devq(ccb->ccb_h.path, 1); ccb->ccb_h.status |= CAM_DEV_QFRZN; } xpt_done(ccb); - ctl_free_io(io); } void @@ -509,7 +488,6 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) int err; softc = (struct cfcs_softc *)cam_sim_softc(sim); - mtx_assert(&softc->lock, MA_OWNED); switch (ccb->ccb_h.func_code) { case XPT_SCSI_IO: { @@ -569,7 +547,7 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) * enough for now. Since we're using unsigned ints, * they'll just wrap around. */ - io->scsiio.tag_num = softc->cur_tag_num++; + io->scsiio.tag_num = atomic_fetchadd_32(&softc->cur_tag_num, 1); csio->tag_id = io->scsiio.tag_num; switch (csio->tag_action) { case CAM_TAG_ACTION_NONE: @@ -775,13 +753,13 @@ cfcs_action(struct cam_sim *sim, union ccb *ccb) cpi->target_sprt = 0; cpi->hba_misc = PIM_EXTLUNS; cpi->hba_eng_cnt = 0; - cpi->max_target = 1; + cpi->max_target = 0; cpi->max_lun = 1024; /* Do we really have a limit? */ cpi->maxio = 1024 * 1024; cpi->async_flags = 0; cpi->hpath_id = 0; - cpi->initiator_id = 0; + cpi->initiator_id = 1; strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN); strlcpy(cpi->hba_vid, "FreeBSD", HBA_IDLEN); From owner-svn-src-stable-12@freebsd.org Sun Nov 17 18:25:43 2019 Return-Path: Delivered-To: svn-src-stable-12@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 943831C66EB; Sun, 17 Nov 2019 18:25:43 +0000 (UTC) (envelope-from lwhsu@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GL9z1x9rz4BjM; Sun, 17 Nov 2019 18:25:43 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A3C01DCBC; Sun, 17 Nov 2019 18:25:43 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAHIPgWP090805; Sun, 17 Nov 2019 18:25:42 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAHIPgUq090804; Sun, 17 Nov 2019 18:25:42 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911171825.xAHIPgUq090804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Sun, 17 Nov 2019 18:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354793 - stable/12/lib/msun/src X-SVN-Group: stable-12 X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: stable/12/lib/msun/src X-SVN-Commit-Revision: 354793 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 18:25:43 -0000 Author: lwhsu Date: Sun Nov 17 18:25:42 2019 New Revision: 354793 URL: https://svnweb.freebsd.org/changeset/base/354793 Log: MFC r354520: Get the fix in back by reverting the part accidentally included in r354491. This brings back r354467. Sponsored by: The FreeBSD Foundation Modified: stable/12/lib/msun/src/k_sincosl.h Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/msun/src/k_sincosl.h ============================================================================== --- stable/12/lib/msun/src/k_sincosl.h Sun Nov 17 17:38:53 2019 (r354792) +++ stable/12/lib/msun/src/k_sincosl.h Sun Nov 17 18:25:42 2019 (r354793) @@ -28,8 +28,8 @@ S1lo = -9.2563760475949941e-18; /* -0x15580000000000. #define C1 ((long double)C1hi + C1lo) #else static const long double -C1 = 0.0416666666666666666136L; /* 0xaaaaaaaaaaaaaa9b.0p-68 */ -S1 = -0.166666666666666666671L, /* -0xaaaaaaaaaaaaaaab.0p-66 */ +C1 = 0.0416666666666666666136L, /* 0xaaaaaaaaaaaaaa9b.0p-68 */ +S1 = -0.166666666666666666671L; /* -0xaaaaaaaaaaaaaaab.0p-66 */ #endif static const double From owner-svn-src-stable-12@freebsd.org Sun Nov 17 22:44:39 2019 Return-Path: Delivered-To: svn-src-stable-12@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 EA53E1AD6DA; Sun, 17 Nov 2019 22:44:39 +0000 (UTC) (envelope-from alc@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GRwl46Dxz4clf; Sun, 17 Nov 2019 22:44:39 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 662EE20C1C; Sun, 17 Nov 2019 22:44:39 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAHMidcY042916; Sun, 17 Nov 2019 22:44:39 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAHMid7U042915; Sun, 17 Nov 2019 22:44:39 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201911172244.xAHMid7U042915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Sun, 17 Nov 2019 22:44:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354799 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: alc X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 354799 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Nov 2019 22:44:40 -0000 Author: alc Date: Sun Nov 17 22:44:38 2019 New Revision: 354799 URL: https://svnweb.freebsd.org/changeset/base/354799 Log: MFC r352847,352930,354585 Eliminate redundant calls to critical_enter() and critical_exit() from pmap_update_entry(). It suffices that interrupts are blocked. In short, pmap_enter_quick_locked("user space", ..., VM_PROT_READ) doesn't work. More precisely, it doesn't set ATTR_AP(ATTR_AP_USER) in the page table entry, so any attempt to read from the mapped page by user space generates a page fault. This problem has gone unnoticed because the page fault handler, vm_fault(), will ultimately call pmap_enter(), which replaces the non-working page table entry with one that has ATTR_AP(ATTR_AP_USER) set. This change reduces the number of page faults during a "buildworld" by about 19.4%. Eliminate a redundant pmap_load() from pmap_remove_pages(). There is no reason why the pmap_invalidate_all() in pmap_remove_pages() must be performed before the final PV list lock release. Move it past the lock release. Eliminate a stale comment from pmap_page_test_mappings(). We implemented a modified bit in r350004. Modified: stable/12/sys/arm64/arm64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Sun Nov 17 20:56:25 2019 (r354798) +++ stable/12/sys/arm64/arm64/pmap.c Sun Nov 17 22:44:38 2019 (r354799) @@ -3019,7 +3019,6 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent * as they may make use of an address we are about to invalidate. */ intr = intr_disable(); - critical_enter(); /* Clear the old mapping */ pmap_clear(pte); @@ -3029,7 +3028,6 @@ pmap_update_entry(pmap_t pmap, pd_entry_t *pte, pd_ent pmap_store(pte, newpte); dsb(ishst); - critical_exit(); intr_restore(intr); } @@ -3763,8 +3761,8 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, v ATTR_AP(ATTR_AP_RO) | L3_PAGE; if ((prot & VM_PROT_EXECUTE) == 0 || m->md.pv_memattr == DEVICE_MEMORY) l3_val |= ATTR_XN; - else if (va < VM_MAXUSER_ADDRESS) - l3_val |= ATTR_PXN; + if (va < VM_MAXUSER_ADDRESS) + l3_val |= ATTR_AP(ATTR_AP_USER) | ATTR_PXN; /* * Now validate mapping with RO protection @@ -4330,7 +4328,6 @@ pmap_remove_pages(pmap_t pmap) L2_BLOCK, ("Attempting to remove an invalid " "block: %lx", tpte)); - tpte = pmap_load(pte); break; case 2: pte = pmap_l2_to_l3(pde, pv->pv_va); @@ -4448,17 +4445,15 @@ pmap_remove_pages(pmap_t pmap) free_pv_chunk(pc); } } - pmap_invalidate_all(pmap); if (lock != NULL) rw_wunlock(lock); + pmap_invalidate_all(pmap); PMAP_UNLOCK(pmap); vm_page_free_pages_toq(&free, true); } /* - * This is used to check if a page has been accessed or modified. As we - * don't have a bit to see if it has been modified we have to assume it - * has been if the page is read/write. + * This is used to check if a page has been accessed or modified. */ static boolean_t pmap_page_test_mappings(vm_page_t m, boolean_t accessed, boolean_t modified) From owner-svn-src-stable-12@freebsd.org Mon Nov 18 07:04:59 2019 Return-Path: Delivered-To: svn-src-stable-12@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 E090F1B6FC1; Mon, 18 Nov 2019 07:04:59 +0000 (UTC) (envelope-from dim@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Gg235jjWz4GVv; Mon, 18 Nov 2019 07:04:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F8B026587; Mon, 18 Nov 2019 07:04:59 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAI74xdK039988; Mon, 18 Nov 2019 07:04:59 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAI74xd5039987; Mon, 18 Nov 2019 07:04:59 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201911180704.xAI74xd5039987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 18 Nov 2019 07:04:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354803 - in stable: 11/contrib/llvm/lib/Transforms/InstCombine 12/contrib/llvm/lib/Transforms/InstCombine X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 11/contrib/llvm/lib/Transforms/InstCombine 12/contrib/llvm/lib/Transforms/InstCombine X-SVN-Commit-Revision: 354803 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 07:05:00 -0000 Author: dim Date: Mon Nov 18 07:04:59 2019 New Revision: 354803 URL: https://svnweb.freebsd.org/changeset/base/354803 Log: MFC r354724: Merge commit 5bbb604bb from llvm git (by Craig Topper): [InstCombine] Disable some portions of foldGEPICmp for GEPs that return a vector of pointers. Fix other portions. llvm-svn: 370114 This should fix instances of 'Assertion failed: (isa(Val) && "cast() argument of incompatible type!"), function cast, file /usr/src/contrib/llvm/include/llvm/Support/Casting.h, line 255', when building openjdk8 for aarch64 and armv7. Reported by: jbeich PR: 236566 Modified: stable/12/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp ============================================================================== --- stable/12/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp Mon Nov 18 04:22:04 2019 (r354802) +++ stable/12/contrib/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp Mon Nov 18 07:04:59 2019 (r354803) @@ -830,6 +830,10 @@ getAsConstantIndexedAddress(Value *V, const DataLayout static Instruction *transformToIndexedCompare(GEPOperator *GEPLHS, Value *RHS, ICmpInst::Predicate Cond, const DataLayout &DL) { + // FIXME: Support vector of pointers. + if (GEPLHS->getType()->isVectorTy()) + return nullptr; + if (!GEPLHS->hasAllConstantIndices()) return nullptr; @@ -880,7 +884,9 @@ Instruction *InstCombiner::foldGEPICmp(GEPOperator *GE RHS = RHS->stripPointerCasts(); Value *PtrBase = GEPLHS->getOperand(0); - if (PtrBase == RHS && GEPLHS->isInBounds()) { + // FIXME: Support vector pointer GEPs. + if (PtrBase == RHS && GEPLHS->isInBounds() && + !GEPLHS->getType()->isVectorTy()) { // ((gep Ptr, OFFSET) cmp Ptr) ---> (OFFSET cmp 0). // This transformation (ignoring the base and scales) is valid because we // know pointers can't overflow since the gep is inbounds. See if we can @@ -914,11 +920,13 @@ Instruction *InstCombiner::foldGEPICmp(GEPOperator *GE // If we're comparing GEPs with two base pointers that only differ in type // and both GEPs have only constant indices or just one use, then fold // the compare with the adjusted indices. + // FIXME: Support vector of pointers. if (GEPLHS->isInBounds() && GEPRHS->isInBounds() && (GEPLHS->hasAllConstantIndices() || GEPLHS->hasOneUse()) && (GEPRHS->hasAllConstantIndices() || GEPRHS->hasOneUse()) && PtrBase->stripPointerCasts() == - GEPRHS->getOperand(0)->stripPointerCasts()) { + GEPRHS->getOperand(0)->stripPointerCasts() && + !GEPLHS->getType()->isVectorTy()) { Value *LOffset = EmitGEPOffset(GEPLHS); Value *ROffset = EmitGEPOffset(GEPRHS); @@ -962,15 +970,20 @@ Instruction *InstCombiner::foldGEPICmp(GEPOperator *GE unsigned DiffOperand = 0; // The operand that differs. for (unsigned i = 1, e = GEPRHS->getNumOperands(); i != e; ++i) if (GEPLHS->getOperand(i) != GEPRHS->getOperand(i)) { - if (GEPLHS->getOperand(i)->getType()->getPrimitiveSizeInBits() != - GEPRHS->getOperand(i)->getType()->getPrimitiveSizeInBits()) { + Type *LHSType = GEPLHS->getOperand(i)->getType(); + Type *RHSType = GEPRHS->getOperand(i)->getType(); + // FIXME: Better support for vector of pointers. + if (LHSType->getPrimitiveSizeInBits() != + RHSType->getPrimitiveSizeInBits() || + (GEPLHS->getType()->isVectorTy() && + (!LHSType->isVectorTy() || !RHSType->isVectorTy()))) { // Irreconcilable differences. NumDifferences = 2; break; - } else { - if (NumDifferences++) break; - DiffOperand = i; } + + if (NumDifferences++) break; + DiffOperand = i; } if (NumDifferences == 0) // SAME GEP? From owner-svn-src-stable-12@freebsd.org Mon Nov 18 13:34:27 2019 Return-Path: Delivered-To: svn-src-stable-12@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 EC8F31C01B2; Mon, 18 Nov 2019 13:34:27 +0000 (UTC) (envelope-from kib@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GqgR62B7z3LG8; Mon, 18 Nov 2019 13:34:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B3C062AAE4; Mon, 18 Nov 2019 13:34:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIDYRsV068544; Mon, 18 Nov 2019 13:34:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIDYRPn068543; Mon, 18 Nov 2019 13:34:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911181334.xAIDYRPn068543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 18 Nov 2019 13:34:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354809 - in stable/12/sys/amd64: amd64 include X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys/amd64: amd64 include X-SVN-Commit-Revision: 354809 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 13:34:28 -0000 Author: kib Date: Mon Nov 18 13:34:27 2019 New Revision: 354809 URL: https://svnweb.freebsd.org/changeset/base/354809 Log: MFC r354592: amd64: change r_gdt to the local variable in hammer_time(). Modified: stable/12/sys/amd64/amd64/machdep.c stable/12/sys/amd64/include/segments.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/machdep.c Mon Nov 18 13:31:16 2019 (r354808) +++ stable/12/sys/amd64/amd64/machdep.c Mon Nov 18 13:34:27 2019 (r354809) @@ -228,7 +228,7 @@ vm_paddr_t dump_avail[PHYSMAP_SIZE + 2]; struct kva_md_info kmi; static struct trapframe proc0_tf; -struct region_descriptor r_gdt, r_idt; +struct region_descriptor r_idt; struct pcpu *__pcpu; struct pcpu temp_bsp_pcpu; @@ -1625,6 +1625,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) struct xstate_hdr *xhdr; u_int64_t rsp0; char *env; + struct region_descriptor r_gdt; size_t kstack0_sz; int late_console; Modified: stable/12/sys/amd64/include/segments.h ============================================================================== --- stable/12/sys/amd64/include/segments.h Mon Nov 18 13:31:16 2019 (r354808) +++ stable/12/sys/amd64/include/segments.h Mon Nov 18 13:34:27 2019 (r354809) @@ -92,7 +92,7 @@ struct region_descriptor { extern struct user_segment_descriptor gdt[]; extern struct soft_segment_descriptor gdt_segs[]; extern struct gate_descriptor *idt; -extern struct region_descriptor r_gdt, r_idt; +extern struct region_descriptor r_idt; void lgdt(struct region_descriptor *rdp); void sdtossd(struct user_segment_descriptor *sdp, From owner-svn-src-stable-12@freebsd.org Mon Nov 18 13:37:14 2019 Return-Path: Delivered-To: svn-src-stable-12@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 33DF21C02FF; Mon, 18 Nov 2019 13:37:14 +0000 (UTC) (envelope-from kib@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Gqkf0gc2z3Nmv; Mon, 18 Nov 2019 13:37:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D352B2AAE5; Mon, 18 Nov 2019 13:37:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIDbDZT068729; Mon, 18 Nov 2019 13:37:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIDbDVn068728; Mon, 18 Nov 2019 13:37:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911181337.xAIDbDVn068728@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 18 Nov 2019 13:37:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354810 - stable/12/sys/amd64/amd64 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/amd64/amd64 X-SVN-Commit-Revision: 354810 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 13:37:14 -0000 Author: kib Date: Mon Nov 18 13:37:13 2019 New Revision: 354810 URL: https://svnweb.freebsd.org/changeset/base/354810 Log: MFC r354591: amd64: Change SFENCE to locked op for synchronizing with CLFLUSHOPT on Intel. Modified: stable/12/sys/amd64/amd64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Mon Nov 18 13:34:27 2019 (r354809) +++ stable/12/sys/amd64/amd64/pmap.c Mon Nov 18 13:37:13 2019 (r354810) @@ -2938,16 +2938,16 @@ pmap_force_invalidate_cache_range(vm_offset_t sva, vm_ if ((cpu_stdext_feature & CPUID_STDEXT_CLFLUSHOPT) != 0) { /* - * Do per-cache line flush. Use the sfence + * Do per-cache line flush. Use a locked * instruction to insure that previous stores are * included in the write-back. The processor * propagates flush to other processors in the cache * coherence domain. */ - sfence(); + atomic_thread_fence_seq_cst(); for (; sva < eva; sva += cpu_clflush_line_size) clflushopt(sva); - sfence(); + atomic_thread_fence_seq_cst(); } else { /* * Writes are ordered by CLFLUSH on Intel CPUs. @@ -2989,7 +2989,7 @@ pmap_invalidate_cache_pages(vm_page_t *pages, int coun pmap_invalidate_cache(); else { if (useclflushopt) - sfence(); + atomic_thread_fence_seq_cst(); else if (cpu_vendor_id != CPU_VENDOR_INTEL) mfence(); for (i = 0; i < count; i++) { @@ -3003,7 +3003,7 @@ pmap_invalidate_cache_pages(vm_page_t *pages, int coun } } if (useclflushopt) - sfence(); + atomic_thread_fence_seq_cst(); else if (cpu_vendor_id != CPU_VENDOR_INTEL) mfence(); } @@ -3024,10 +3024,10 @@ pmap_flush_cache_range(vm_offset_t sva, vm_offset_t ev if (pmap_kextract(sva) == lapic_paddr) return; - sfence(); + atomic_thread_fence_seq_cst(); for (; sva < eva; sva += cpu_clflush_line_size) clwb(sva); - sfence(); + atomic_thread_fence_seq_cst(); } void @@ -3060,7 +3060,7 @@ pmap_flush_cache_phys_range(vm_paddr_t spa, vm_paddr_t sched_pin(); pte_store(pte, spa | pte_bits); invlpg(vaddr); - /* XXXKIB sfences inside flush_cache_range are excessive */ + /* XXXKIB atomic inside flush_cache_range are excessive */ pmap_flush_cache_range(vaddr, vaddr + PAGE_SIZE); sched_unpin(); } @@ -9286,10 +9286,10 @@ pmap_large_map_wb_fence_mfence(void) } static void -pmap_large_map_wb_fence_sfence(void) +pmap_large_map_wb_fence_atomic(void) { - sfence(); + atomic_thread_fence_seq_cst(); } static void @@ -9304,7 +9304,7 @@ DEFINE_IFUNC(static, void, pmap_large_map_wb_fence, (v return (pmap_large_map_wb_fence_mfence); else if ((cpu_stdext_feature & (CPUID_STDEXT_CLWB | CPUID_STDEXT_CLFLUSHOPT)) == 0) - return (pmap_large_map_wb_fence_sfence); + return (pmap_large_map_wb_fence_atomic); else /* clflush is strongly enough ordered */ return (pmap_large_map_wb_fence_nop); From owner-svn-src-stable-12@freebsd.org Mon Nov 18 13:38:36 2019 Return-Path: Delivered-To: svn-src-stable-12@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 DDCEF1C03E5; Mon, 18 Nov 2019 13:38:36 +0000 (UTC) (envelope-from kib@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GqmD28fvz3Q5v; Mon, 18 Nov 2019 13:38:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4D972AAEA; Mon, 18 Nov 2019 13:38:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIDcZLN068842; Mon, 18 Nov 2019 13:38:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIDcZ5M068841; Mon, 18 Nov 2019 13:38:35 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911181338.xAIDcZ5M068841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 18 Nov 2019 13:38:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354811 - stable/12/sys/amd64/amd64 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/amd64/amd64 X-SVN-Commit-Revision: 354811 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 13:38:37 -0000 Author: kib Date: Mon Nov 18 13:38:35 2019 New Revision: 354811 URL: https://svnweb.freebsd.org/changeset/base/354811 Log: MFC r354630: amd64: Issue MFENCE on context switch on AMD CPUs when reusing address space. Modified: stable/12/sys/amd64/amd64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Mon Nov 18 13:37:13 2019 (r354810) +++ stable/12/sys/amd64/amd64/pmap.c Mon Nov 18 13:38:35 2019 (r354811) @@ -8592,8 +8592,11 @@ pmap_activate_sw(struct thread *td) oldpmap = PCPU_GET(curpmap); pmap = vmspace_pmap(td->td_proc->p_vmspace); - if (oldpmap == pmap) + if (oldpmap == pmap) { + if (cpu_vendor_id != CPU_VENDOR_INTEL) + mfence(); return; + } cpuid = PCPU_GET(cpuid); #ifdef SMP CPU_SET_ATOMIC(cpuid, &pmap->pm_active); From owner-svn-src-stable-12@freebsd.org Mon Nov 18 15:27:53 2019 Return-Path: Delivered-To: svn-src-stable-12@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 F3C451C24D9; Mon, 18 Nov 2019 15:27:52 +0000 (UTC) (envelope-from markj@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GtBJ4RC7z3Mdp; Mon, 18 Nov 2019 15:27:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75DDB2BE72; Mon, 18 Nov 2019 15:27:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIFRq1a033654; Mon, 18 Nov 2019 15:27:52 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIFRqJD033653; Mon, 18 Nov 2019 15:27:52 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911181527.xAIFRqJD033653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 18 Nov 2019 15:27:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354813 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 354813 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 15:27:53 -0000 Author: markj Date: Mon Nov 18 15:27:52 2019 New Revision: 354813 URL: https://svnweb.freebsd.org/changeset/base/354813 Log: MFC r354629: Fix handling of PIPE_EOF in the direct write path. Modified: stable/12/sys/kern/sys_pipe.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/sys_pipe.c ============================================================================== --- stable/12/sys/kern/sys_pipe.c Mon Nov 18 14:12:33 2019 (r354812) +++ stable/12/sys/kern/sys_pipe.c Mon Nov 18 15:27:52 2019 (r354813) @@ -972,15 +972,8 @@ retry: goto error1; } - while (wpipe->pipe_map.cnt != 0) { - if (wpipe->pipe_state & PIPE_EOF) { - wpipe->pipe_map.cnt = 0; - pipe_destroy_write_buffer(wpipe); - pipeselwakeup(wpipe); - pipeunlock(wpipe); - error = EPIPE; - goto error1; - } + while (wpipe->pipe_map.cnt != 0 && + (wpipe->pipe_state & PIPE_EOF) == 0) { if (wpipe->pipe_state & PIPE_WANTR) { wpipe->pipe_state &= ~PIPE_WANTR; wakeup(wpipe); @@ -995,12 +988,16 @@ retry: break; } - if (wpipe->pipe_state & PIPE_EOF) + if ((wpipe->pipe_state & PIPE_EOF) != 0) { + wpipe->pipe_map.cnt = 0; + pipe_destroy_write_buffer(wpipe); + pipeselwakeup(wpipe); error = EPIPE; - if (error == EINTR || error == ERESTART) + } else if (error == EINTR || error == ERESTART) { pipe_clone_write_buffer(wpipe); - else + } else { pipe_destroy_write_buffer(wpipe); + } pipeunlock(wpipe); KASSERT((wpipe->pipe_state & PIPE_DIRECTW) == 0, ("pipe %p leaked PIPE_DIRECTW", wpipe)); From owner-svn-src-stable-12@freebsd.org Mon Nov 18 15:28:12 2019 Return-Path: Delivered-To: svn-src-stable-12@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 539171C2534; Mon, 18 Nov 2019 15:28:12 +0000 (UTC) (envelope-from markj@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GtBh05WBz3NPW; Mon, 18 Nov 2019 15:28:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7AB5F2BE73; Mon, 18 Nov 2019 15:28:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIFSBxt033732; Mon, 18 Nov 2019 15:28:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIFSBES033730; Mon, 18 Nov 2019 15:28:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911181528.xAIFSBES033730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 18 Nov 2019 15:28:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354814 - in stable/12/sys/amd64: amd64 include X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/sys/amd64: amd64 include X-SVN-Commit-Revision: 354814 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 15:28:12 -0000 Author: markj Date: Mon Nov 18 15:28:10 2019 New Revision: 354814 URL: https://svnweb.freebsd.org/changeset/base/354814 Log: MFC r353672: Introduce pmap_change_prot() for amd64. Modified: stable/12/sys/amd64/amd64/pmap.c stable/12/sys/amd64/include/pmap.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Mon Nov 18 15:27:52 2019 (r354813) +++ stable/12/sys/amd64/amd64/pmap.c Mon Nov 18 15:28:10 2019 (r354814) @@ -1105,10 +1105,11 @@ static caddr_t crashdumpmap; /* * Internal flags for pmap_mapdev_internal() and - * pmap_change_attr_locked(). + * pmap_change_props_locked(). */ -#define MAPDEV_FLUSHCACHE 0x0000001 /* Flush cache after mapping. */ -#define MAPDEV_SETATTR 0x0000002 /* Modify existing attrs. */ +#define MAPDEV_FLUSHCACHE 0x00000001 /* Flush cache after mapping. */ +#define MAPDEV_SETATTR 0x00000002 /* Modify existing attrs. */ +#define MAPDEV_ASSERTVALID 0x00000004 /* Assert mapping validity. */ static void free_pv_chunk(struct pv_chunk *pc); static void free_pv_entry(pmap_t pmap, pv_entry_t pv); @@ -1129,8 +1130,8 @@ static void pmap_pvh_free(struct md_page *pvh, pmap_t static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap, vm_offset_t va); -static int pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode, - int flags); +static int pmap_change_props_locked(vm_offset_t va, vm_size_t size, + vm_prot_t prot, int mode, int flags); static boolean_t pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va); static boolean_t pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, struct rwlock **lockp); @@ -1153,14 +1154,13 @@ static void pmap_invalidate_pde_page(pmap_t pmap, vm_o static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode); static vm_page_t pmap_large_map_getptp_unlocked(void); static vm_paddr_t pmap_large_map_kextract(vm_offset_t va); -static void pmap_pde_attr(pd_entry_t *pde, int cache_bits, int mask); #if VM_NRESERVLEVEL > 0 static void pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, struct rwlock **lockp); #endif static boolean_t pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot); -static void pmap_pte_attr(pt_entry_t *pte, int cache_bits, int mask); +static void pmap_pte_props(pt_entry_t *pte, u_long bits, u_long mask); static void pmap_pti_add_kva_locked(vm_offset_t sva, vm_offset_t eva, bool exec); static pdp_entry_t *pmap_pti_pdpe(vm_offset_t va); @@ -7797,40 +7797,20 @@ restart: * Miscellaneous support routines follow */ -/* Adjust the cache mode for a 4KB page mapped via a PTE. */ +/* Adjust the properties for a leaf page table entry. */ static __inline void -pmap_pte_attr(pt_entry_t *pte, int cache_bits, int mask) +pmap_pte_props(pt_entry_t *pte, u_long bits, u_long mask) { - u_int opte, npte; + u_long opte, npte; - /* - * The cache mode bits are all in the low 32-bits of the - * PTE, so we can just spin on updating the low 32-bits. - */ + opte = *(u_long *)pte; do { - opte = *(u_int *)pte; npte = opte & ~mask; - npte |= cache_bits; - } while (npte != opte && !atomic_cmpset_int((u_int *)pte, opte, npte)); + npte |= bits; + } while (npte != opte && !atomic_fcmpset_long((u_long *)pte, &opte, + npte)); } -/* Adjust the cache mode for a 2MB page mapped via a PDE. */ -static __inline void -pmap_pde_attr(pd_entry_t *pde, int cache_bits, int mask) -{ - u_int opde, npde; - - /* - * The cache mode bits are all in the low 32-bits of the - * PDE, so we can just spin on updating the low 32-bits. - */ - do { - opde = *(u_int *)pde; - npde = opde & ~mask; - npde |= cache_bits; - } while (npde != opde && !atomic_cmpset_int((u_int *)pde, opde, npde)); -} - /* * Map a set of physical memory pages into the kernel virtual * address space. Return a pointer to where it is mapped. This @@ -7884,7 +7864,8 @@ pmap_mapdev_internal(vm_paddr_t pa, vm_size_t size, in va = PHYS_TO_DMAP(pa); if ((flags & MAPDEV_SETATTR) != 0) { PMAP_LOCK(kernel_pmap); - i = pmap_change_attr_locked(va, size, mode, flags); + i = pmap_change_props_locked(va, size, + PROT_NONE, mode, flags); PMAP_UNLOCK(kernel_pmap); } else i = 0; @@ -8070,21 +8051,46 @@ pmap_change_attr(vm_offset_t va, vm_size_t size, int m int error; PMAP_LOCK(kernel_pmap); - error = pmap_change_attr_locked(va, size, mode, MAPDEV_FLUSHCACHE); + error = pmap_change_props_locked(va, size, PROT_NONE, mode, + MAPDEV_FLUSHCACHE); PMAP_UNLOCK(kernel_pmap); return (error); } +/* + * Changes the specified virtual address range's protections to those + * specified by "prot". Like pmap_change_attr(), protections for aliases + * in the direct map are updated as well. Protections on aliasing mappings may + * be a subset of the requested protections; for example, mappings in the direct + * map are never executable. + */ +int +pmap_change_prot(vm_offset_t va, vm_size_t size, vm_prot_t prot) +{ + int error; + + /* Only supported within the kernel map. */ + if (va < VM_MIN_KERNEL_ADDRESS) + return (EINVAL); + + PMAP_LOCK(kernel_pmap); + error = pmap_change_props_locked(va, size, prot, -1, + MAPDEV_ASSERTVALID); + PMAP_UNLOCK(kernel_pmap); + return (error); +} + static int -pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode, int flags) +pmap_change_props_locked(vm_offset_t va, vm_size_t size, vm_prot_t prot, + int mode, int flags) { vm_offset_t base, offset, tmpva; vm_paddr_t pa_start, pa_end, pa_end1; pdp_entry_t *pdpe; - pd_entry_t *pde; - pt_entry_t *pte; - int cache_bits_pte, cache_bits_pde, error; - boolean_t changed; + pd_entry_t *pde, pde_bits, pde_mask; + pt_entry_t *pte, pte_bits, pte_mask; + int error; + bool changed; PMAP_LOCK_ASSERT(kernel_pmap, MA_OWNED); base = trunc_page(va); @@ -8098,9 +8104,33 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size if (base < DMAP_MIN_ADDRESS) return (EINVAL); - cache_bits_pde = pmap_cache_bits(kernel_pmap, mode, 1); - cache_bits_pte = pmap_cache_bits(kernel_pmap, mode, 0); - changed = FALSE; + /* + * Construct our flag sets and masks. "bits" is the subset of + * "mask" that will be set in each modified PTE. + * + * Mappings in the direct map are never allowed to be executable. + */ + pde_bits = pte_bits = 0; + pde_mask = pte_mask = 0; + if (mode != -1) { + pde_bits |= pmap_cache_bits(kernel_pmap, mode, true); + pde_mask |= X86_PG_PDE_CACHE; + pte_bits |= pmap_cache_bits(kernel_pmap, mode, false); + pte_mask |= X86_PG_PTE_CACHE; + } + if (prot != VM_PROT_NONE) { + if ((prot & VM_PROT_WRITE) != 0) { + pde_bits |= X86_PG_RW; + pte_bits |= X86_PG_RW; + } + if ((prot & VM_PROT_EXECUTE) == 0 || + va < VM_MIN_KERNEL_ADDRESS) { + pde_bits |= pg_nx; + pte_bits |= pg_nx; + } + pde_mask |= X86_PG_RW | pg_nx; + pte_mask |= X86_PG_RW | pg_nx; + } /* * Pages that aren't mapped aren't supported. Also break down 2MB pages @@ -8108,15 +8138,18 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size */ for (tmpva = base; tmpva < base + size; ) { pdpe = pmap_pdpe(kernel_pmap, tmpva); - if (pdpe == NULL || *pdpe == 0) + if (pdpe == NULL || *pdpe == 0) { + KASSERT((flags & MAPDEV_ASSERTVALID) == 0, + ("%s: addr %#lx is not mapped", __func__, tmpva)); return (EINVAL); + } if (*pdpe & PG_PS) { /* * If the current 1GB page already has the required - * memory type, then we need not demote this page. Just + * properties, then we need not demote this page. Just * increment tmpva to the next 1GB page frame. */ - if ((*pdpe & X86_PG_PDE_CACHE) == cache_bits_pde) { + if ((*pdpe & pde_mask) == pde_bits) { tmpva = trunc_1gpage(tmpva) + NBPDP; continue; } @@ -8135,15 +8168,18 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size return (ENOMEM); } pde = pmap_pdpe_to_pde(pdpe, tmpva); - if (*pde == 0) + if (*pde == 0) { + KASSERT((flags & MAPDEV_ASSERTVALID) == 0, + ("%s: addr %#lx is not mapped", __func__, tmpva)); return (EINVAL); + } if (*pde & PG_PS) { /* * If the current 2MB page already has the required - * memory type, then we need not demote this page. Just + * properties, then we need not demote this page. Just * increment tmpva to the next 2MB page frame. */ - if ((*pde & X86_PG_PDE_CACHE) == cache_bits_pde) { + if ((*pde & pde_mask) == pde_bits) { tmpva = trunc_2mpage(tmpva) + NBPDR; continue; } @@ -8162,24 +8198,27 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size return (ENOMEM); } pte = pmap_pde_to_pte(pde, tmpva); - if (*pte == 0) + if (*pte == 0) { + KASSERT((flags & MAPDEV_ASSERTVALID) == 0, + ("%s: addr %#lx is not mapped", __func__, tmpva)); return (EINVAL); + } tmpva += PAGE_SIZE; } error = 0; /* * Ok, all the pages exist, so run through them updating their - * cache mode if required. + * properties if required. */ + changed = false; pa_start = pa_end = 0; for (tmpva = base; tmpva < base + size; ) { pdpe = pmap_pdpe(kernel_pmap, tmpva); if (*pdpe & PG_PS) { - if ((*pdpe & X86_PG_PDE_CACHE) != cache_bits_pde) { - pmap_pde_attr(pdpe, cache_bits_pde, - X86_PG_PDE_CACHE); - changed = TRUE; + if ((*pdpe & pde_mask) != pde_bits) { + pmap_pte_props(pdpe, pde_bits, pde_mask); + changed = true; } if (tmpva >= VM_MIN_KERNEL_ADDRESS && (*pdpe & PG_PS_FRAME) < dmaplimit) { @@ -8191,9 +8230,10 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size pa_end += NBPDP; else { /* Run ended, update direct map. */ - error = pmap_change_attr_locked( + error = pmap_change_props_locked( PHYS_TO_DMAP(pa_start), - pa_end - pa_start, mode, flags); + pa_end - pa_start, prot, mode, + flags); if (error != 0) break; /* Start physical address run. */ @@ -8206,10 +8246,9 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size } pde = pmap_pdpe_to_pde(pdpe, tmpva); if (*pde & PG_PS) { - if ((*pde & X86_PG_PDE_CACHE) != cache_bits_pde) { - pmap_pde_attr(pde, cache_bits_pde, - X86_PG_PDE_CACHE); - changed = TRUE; + if ((*pde & pde_mask) != pde_bits) { + pmap_pte_props(pde, pde_bits, pde_mask); + changed = true; } if (tmpva >= VM_MIN_KERNEL_ADDRESS && (*pde & PG_PS_FRAME) < dmaplimit) { @@ -8221,9 +8260,10 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size pa_end += NBPDR; else { /* Run ended, update direct map. */ - error = pmap_change_attr_locked( + error = pmap_change_props_locked( PHYS_TO_DMAP(pa_start), - pa_end - pa_start, mode, flags); + pa_end - pa_start, prot, mode, + flags); if (error != 0) break; /* Start physical address run. */ @@ -8234,10 +8274,9 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size tmpva = trunc_2mpage(tmpva) + NBPDR; } else { pte = pmap_pde_to_pte(pde, tmpva); - if ((*pte & X86_PG_PTE_CACHE) != cache_bits_pte) { - pmap_pte_attr(pte, cache_bits_pte, - X86_PG_PTE_CACHE); - changed = TRUE; + if ((*pte & pte_mask) != pte_bits) { + pmap_pte_props(pte, pte_bits, pte_mask); + changed = true; } if (tmpva >= VM_MIN_KERNEL_ADDRESS && (*pte & PG_FRAME) < dmaplimit) { @@ -8249,9 +8288,10 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size pa_end += PAGE_SIZE; else { /* Run ended, update direct map. */ - error = pmap_change_attr_locked( + error = pmap_change_props_locked( PHYS_TO_DMAP(pa_start), - pa_end - pa_start, mode, flags); + pa_end - pa_start, prot, mode, + flags); if (error != 0) break; /* Start physical address run. */ @@ -8265,8 +8305,8 @@ pmap_change_attr_locked(vm_offset_t va, vm_size_t size if (error == 0 && pa_start != pa_end && pa_start < dmaplimit) { pa_end1 = MIN(pa_end, dmaplimit); if (pa_start != pa_end1) - error = pmap_change_attr_locked(PHYS_TO_DMAP(pa_start), - pa_end1 - pa_start, mode, flags); + error = pmap_change_props_locked(PHYS_TO_DMAP(pa_start), + pa_end1 - pa_start, prot, mode, flags); } /* Modified: stable/12/sys/amd64/include/pmap.h ============================================================================== --- stable/12/sys/amd64/include/pmap.h Mon Nov 18 15:27:52 2019 (r354813) +++ stable/12/sys/amd64/include/pmap.h Mon Nov 18 15:28:10 2019 (r354814) @@ -428,6 +428,7 @@ void pmap_allow_2m_x_ept_recalculate(void); void pmap_bootstrap(vm_paddr_t *); int pmap_cache_bits(pmap_t pmap, int mode, boolean_t is_pde); int pmap_change_attr(vm_offset_t, vm_size_t, int); +int pmap_change_prot(vm_offset_t, vm_size_t, vm_prot_t); void pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, boolean_t invalidate); void pmap_flush_cache_range(vm_offset_t, vm_offset_t); void pmap_flush_cache_phys_range(vm_paddr_t, vm_paddr_t, vm_memattr_t); From owner-svn-src-stable-12@freebsd.org Mon Nov 18 16:37:22 2019 Return-Path: Delivered-To: svn-src-stable-12@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 B506E1C3DF8; Mon, 18 Nov 2019 16:37:22 +0000 (UTC) (envelope-from tsoome@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47GvkV2x1Kz47x7; Mon, 18 Nov 2019 16:37:22 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2268A2CB22; Mon, 18 Nov 2019 16:37:22 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIGbL8c075255; Mon, 18 Nov 2019 16:37:21 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIGbLMb075254; Mon, 18 Nov 2019 16:37:21 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911181637.xAIGbLMb075254@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 18 Nov 2019 16:37:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354817 - stable/12/stand/efi/libefi X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12/stand/efi/libefi X-SVN-Commit-Revision: 354817 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 16:37:22 -0000 Author: tsoome Date: Mon Nov 18 16:37:21 2019 New Revision: 354817 URL: https://svnweb.freebsd.org/changeset/base/354817 Log: MFC r354743, r354766: loader: r354415 did miss to sort subpaths below the partitions loader: remove unused variable from efipart.c Modified: stable/12/stand/efi/libefi/efipart.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/libefi/efipart.c ============================================================================== --- stable/12/stand/efi/libefi/efipart.c Mon Nov 18 15:37:01 2019 (r354816) +++ stable/12/stand/efi/libefi/efipart.c Mon Nov 18 16:37:21 2019 (r354817) @@ -506,9 +506,12 @@ efipart_initcd(void) static bool efipart_hdinfo_add_node(pdinfo_t *hd, EFI_DEVICE_PATH *node) { - pdinfo_t *pd, *last; - VENDOR_DEVICE_PATH *ven_node; + pdinfo_t *pd, *ptr; + if (node == NULL) + return (false); + + /* Find our disk device. */ STAILQ_FOREACH(pd, &hdinfo, pd_link) { if (efi_devpath_is_prefix(pd->pd_devpath, hd->pd_devpath)) break; @@ -516,13 +519,28 @@ efipart_hdinfo_add_node(pdinfo_t *hd, EFI_DEVICE_PATH if (pd == NULL) return (false); + /* If the node is not MEDIA_HARDDRIVE_DP, it is sub-partition. */ + if (DevicePathSubType(node) != MEDIA_HARDDRIVE_DP) { + STAILQ_FOREACH(ptr, &pd->pd_part, pd_link) { + if (efi_devpath_is_prefix(ptr->pd_devpath, + hd->pd_devpath)) + break; + } + /* + * ptr == NULL means we have handles in unexpected order + * and we would need to re-order the partitions later. + */ + if (ptr != NULL) + pd = ptr; + } + /* Add the partition. */ if (DevicePathSubType(node) == MEDIA_HARDDRIVE_DP) { hd->pd_unit = ((HARDDRIVE_DEVICE_PATH *)node)->PartitionNumber; } else { - last = STAILQ_LAST(&pd->pd_part, pdinfo, pd_link); - if (last != NULL) - hd->pd_unit = last->pd_unit + 1; + ptr = STAILQ_LAST(&pd->pd_part, pdinfo, pd_link); + if (ptr != NULL) + hd->pd_unit = ptr->pd_unit + 1; else hd->pd_unit = 0; } @@ -536,7 +554,7 @@ efipart_hdinfo_add_node(pdinfo_t *hd, EFI_DEVICE_PATH static void efipart_hdinfo_add(pdinfo_t *hd, EFI_DEVICE_PATH *node) { - pdinfo_t *pd, *last; + pdinfo_t *last; if (efipart_hdinfo_add_node(hd, node)) return; From owner-svn-src-stable-12@freebsd.org Mon Nov 18 16:40:04 2019 Return-Path: Delivered-To: svn-src-stable-12@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 7056B1C3EFB; Mon, 18 Nov 2019 16:40:04 +0000 (UTC) (envelope-from tsoome@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Gvnc0TMsz4G4C; Mon, 18 Nov 2019 16:40:04 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF3502CB27; Mon, 18 Nov 2019 16:40:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIGe3J7075558; Mon, 18 Nov 2019 16:40:03 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIGe3hF075557; Mon, 18 Nov 2019 16:40:03 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201911181640.xAIGe3hF075557@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 18 Nov 2019 16:40:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354818 - stable/12/stand/common X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12/stand/common X-SVN-Commit-Revision: 354818 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 16:40:04 -0000 Author: tsoome Date: Mon Nov 18 16:40:03 2019 New Revision: 354818 URL: https://svnweb.freebsd.org/changeset/base/354818 Log: MFC r354746: loader: add support for hybrid PMBR for GPT partition table Note hybrid table is nor really UEFI specification compliant. Sample hybrid partition table: > ::mbr Format: unknown Signature: 0xaa55 (valid) UniqueMBRDiskSignature: 0 PART TYPE ACTIVE STARTCHS ENDCHS SECTOR NUMSECT 0 EFI_PMBR:0xee 0 1023/254/63 1023/254/63 1 409639 1 0xff 0 1023/254/63 1023/254/63 409640 978508408 2 FDISK_EXT_WIN:0xc 0 1023/254/63 1023/254/63 978918048 31250000 3 0xff 0 1023/254/63 1023/254/63 1010168048 32 > Modified: stable/12/stand/common/part.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/common/part.c ============================================================================== --- stable/12/stand/common/part.c Mon Nov 18 16:37:21 2019 (r354817) +++ stable/12/stand/common/part.c Mon Nov 18 16:40:03 2019 (r354818) @@ -651,7 +651,7 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sect struct dos_partition *dp; struct ptable *table; uint8_t *buf; - int i, count; + int i; #ifdef LOADER_MBR_SUPPORT struct pentry *entry; uint32_t start, end; @@ -713,28 +713,23 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sect } /* Check that we have PMBR. Also do some validation. */ dp = (struct dos_partition *)(buf + DOSPARTOFF); - for (i = 0, count = 0; i < NDOSPART; i++) { + /* + * In mac we can have PMBR partition in hybrid MBR; + * that is, MBR partition which has DOSPTYP_PMBR entry defined as + * start sector 1. After DOSPTYP_PMBR, there may be other partitions. + * UEFI compliant PMBR has no other partitions. + */ + for (i = 0; i < NDOSPART; i++) { if (dp[i].dp_flag != 0 && dp[i].dp_flag != 0x80) { DPRINTF("invalid partition flag %x", dp[i].dp_flag); goto out; } #ifdef LOADER_GPT_SUPPORT - if (dp[i].dp_typ == DOSPTYP_PMBR) { + if (dp[i].dp_typ == DOSPTYP_PMBR && dp[i].dp_start == 1) { table->type = PTABLE_GPT; DPRINTF("PMBR detected"); } #endif - if (dp[i].dp_typ != 0) - count++; - } - /* Do we have some invalid values? */ - if (table->type == PTABLE_GPT && count > 1) { - if (dp[1].dp_typ != DOSPTYP_HFS) { - table->type = PTABLE_NONE; - DPRINTF("Incorrect PMBR, ignore it"); - } else { - DPRINTF("Bootcamp detected"); - } } #ifdef LOADER_GPT_SUPPORT if (table->type == PTABLE_GPT) { From owner-svn-src-stable-12@freebsd.org Mon Nov 18 17:19:17 2019 Return-Path: Delivered-To: svn-src-stable-12@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 4B5E51C4A77; Mon, 18 Nov 2019 17:19:17 +0000 (UTC) (envelope-from markj@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Gwfs13bkz4FQM; Mon, 18 Nov 2019 17:19:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 079DD2D22F; Mon, 18 Nov 2019 17:19:17 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAIHJGtN098808; Mon, 18 Nov 2019 17:19:16 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAIHJGHm098807; Mon, 18 Nov 2019 17:19:16 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911181719.xAIHJGHm098807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 18 Nov 2019 17:19:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354819 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 354819 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Nov 2019 17:19:17 -0000 Author: markj Date: Mon Nov 18 17:19:16 2019 New Revision: 354819 URL: https://svnweb.freebsd.org/changeset/base/354819 Log: MFC r353729: Apply mapping protections to .o kernel modules. Modified: stable/12/sys/kern/link_elf_obj.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/link_elf_obj.c ============================================================================== --- stable/12/sys/kern/link_elf_obj.c Mon Nov 18 16:40:03 2019 (r354818) +++ stable/12/sys/kern/link_elf_obj.c Mon Nov 18 17:19:16 2019 (r354819) @@ -70,8 +70,8 @@ __FBSDID("$FreeBSD$"); typedef struct { void *addr; Elf_Off size; - int flags; - int sec; /* Original section */ + int flags; /* Section flags. */ + int sec; /* Original section number. */ char *name; } Elf_progent; @@ -196,6 +196,119 @@ link_elf_init(void *arg) SYSINIT(link_elf_obj, SI_SUB_KLD, SI_ORDER_SECOND, link_elf_init, NULL); +static void +link_elf_protect_range(elf_file_t ef, vm_offset_t start, vm_offset_t end, + vm_prot_t prot) +{ + int error __unused; + + KASSERT(start <= end && start >= (vm_offset_t)ef->address && + end <= round_page((vm_offset_t)ef->address + ef->lf.size), + ("link_elf_protect_range: invalid range %#jx-%#jx", + (uintmax_t)start, (uintmax_t)end)); + + if (start == end) + return; + error = vm_map_protect(kernel_map, start, end, prot, FALSE); + KASSERT(error == KERN_SUCCESS, + ("link_elf_protect_range: vm_map_protect() returned %d", error)); +} + +/* + * Restrict permissions on linker file memory based on section flags. + * Sections need not be page-aligned, so overlap within a page is possible. + */ +static void +link_elf_protect(elf_file_t ef) +{ + vm_offset_t end, segend, segstart, start; + vm_prot_t gapprot, prot, segprot; + int i; + + /* + * If the file was preloaded, the last page may contain other preloaded + * data which may need to be writeable. ELF files are always + * page-aligned, but other preloaded data, such as entropy or CPU + * microcode may be loaded with a smaller alignment. + */ + gapprot = ef->preloaded ? VM_PROT_RW : VM_PROT_READ; + + start = end = (vm_offset_t)ef->address; + prot = VM_PROT_READ; + for (i = 0; i < ef->nprogtab; i++) { + /* + * VNET and DPCPU sections have their memory allocated by their + * respective subsystems. + */ + if (ef->progtab[i].name != NULL && ( +#ifdef VIMAGE + strcmp(ef->progtab[i].name, VNET_SETNAME) == 0 || +#endif + strcmp(ef->progtab[i].name, DPCPU_SETNAME) == 0)) + continue; + + segstart = trunc_page((vm_offset_t)ef->progtab[i].addr); + segend = round_page((vm_offset_t)ef->progtab[i].addr + + ef->progtab[i].size); + segprot = VM_PROT_READ; + if ((ef->progtab[i].flags & SHF_WRITE) != 0) + segprot |= VM_PROT_WRITE; + if ((ef->progtab[i].flags & SHF_EXECINSTR) != 0) + segprot |= VM_PROT_EXECUTE; + + if (end <= segstart) { + /* + * Case 1: there is no overlap between the previous + * segment and this one. Apply protections to the + * previous segment, and protect the gap between the + * previous and current segments, if any. + */ + link_elf_protect_range(ef, start, end, prot); + link_elf_protect_range(ef, end, segstart, gapprot); + + start = segstart; + end = segend; + prot = segprot; + } else if (start < segstart && end == segend) { + /* + * Case 2: the current segment is a subrange of the + * previous segment. Apply protections to the + * non-overlapping portion of the previous segment. + */ + link_elf_protect_range(ef, start, segstart, prot); + + start = segstart; + prot |= segprot; + } else if (end < segend) { + /* + * Case 3: there is partial overlap between the previous + * and current segments. Apply protections to the + * non-overlapping portion of the previous segment, and + * then the overlap, which must use the union of the two + * segments' protections. + */ + link_elf_protect_range(ef, start, segstart, prot); + link_elf_protect_range(ef, segstart, end, + prot | segprot); + start = end; + end = segend; + prot = segprot; + } else { + /* + * Case 4: the two segments reside in the same page. + */ + prot |= segprot; + } + } + + /* + * Fix up the last unprotected segment and trailing data. + */ + link_elf_protect_range(ef, start, end, prot); + link_elf_protect_range(ef, end, + round_page((vm_offset_t)ef->address + ef->lf.size), gapprot); +} + static int link_elf_link_preload(linker_class_t cls, const char *filename, linker_file_t *result) @@ -358,6 +471,7 @@ link_elf_link_preload(linker_class_t cls, const char * else ef->progtab[pb].name = "<>"; ef->progtab[pb].size = shdr[i].sh_size; + ef->progtab[pb].flags = shdr[i].sh_flags; ef->progtab[pb].sec = i; if (ef->shstrtab && shdr[i].sh_name != 0) ef->progtab[pb].name = @@ -783,7 +897,9 @@ link_elf_load_file(linker_class_t cls, const char *fil /* * In order to satisfy amd64's architectural requirements on the * location of code and data in the kernel's address space, request a - * mapping that is above the kernel. + * mapping that is above the kernel. + * + * Protections will be restricted once relocations are applied. */ #ifdef __amd64__ mapbase = KERNBASE; @@ -884,6 +1000,7 @@ link_elf_load_file(linker_class_t cls, const char *fil goto out; } ef->progtab[pb].size = shdr[i].sh_size; + ef->progtab[pb].flags = shdr[i].sh_flags; ef->progtab[pb].sec = i; if (shdr[i].sh_type == SHT_PROGBITS #ifdef __amd64__ @@ -1023,9 +1140,8 @@ link_elf_load_file(linker_class_t cls, const char *fil goto out; #endif - /* Invoke .ctors */ + link_elf_protect(ef); link_elf_invoke_ctors(lf->ctors_addr, lf->ctors_size); - *result = lf; out: From owner-svn-src-stable-12@freebsd.org Tue Nov 19 07:19:35 2019 Return-Path: Delivered-To: svn-src-stable-12@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 CA10A17FB36; Tue, 19 Nov 2019 07:19:35 +0000 (UTC) (envelope-from avg@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HHJR5XP8z46fh; Tue, 19 Nov 2019 07:19:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A0FF36D1E; Tue, 19 Nov 2019 07:19:35 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJ7JZn8098701; Tue, 19 Nov 2019 07:19:35 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJ7JXwX098691; Tue, 19 Nov 2019 07:19:33 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911190719.xAJ7JXwX098691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 19 Nov 2019 07:19:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354848 - in stable/12: cddl/contrib/opensolaris/lib/libzpool/common cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/ope... X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12: cddl/contrib/opensolaris/lib/libzpool/common cddl/contrib/opensolaris/lib/libzpool/common/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zf... X-SVN-Commit-Revision: 354848 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 07:19:35 -0000 Author: avg Date: Tue Nov 19 07:19:33 2019 New Revision: 354848 URL: https://svnweb.freebsd.org/changeset/base/354848 Log: MFC r353618,r353625,r353627: MFV r353617: 9425 allow channel programs to be stopped via signals Modified: stable/12/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c stable/12/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Tue Nov 19 07:19:33 2019 (r354848) @@ -321,6 +321,18 @@ cv_wait(kcondvar_t *cv, kmutex_t *mp) mp->m_owner = curthread; } +/* + * NB: this emulates FreeBSD cv_wait_sig(9), not the illumos one. + * Meanings of the return code are different. + * NB: this does not actually catch any signals. + */ +int +cv_wait_sig(kcondvar_t *cv, kmutex_t *mp) +{ + cv_wait(cv, mp); + return (0); +} + clock_t cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime) { Modified: stable/12/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h Tue Nov 19 07:19:33 2019 (r354848) @@ -330,6 +330,7 @@ typedef cond_t kcondvar_t; extern void cv_init(kcondvar_t *cv, char *name, int type, void *arg); extern void cv_destroy(kcondvar_t *cv); extern void cv_wait(kcondvar_t *cv, kmutex_t *mp); +extern int cv_wait_sig(kcondvar_t *cv, kmutex_t *mp); extern clock_t cv_timedwait(kcondvar_t *cv, kmutex_t *mp, clock_t abstime); extern clock_t cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res, int flag); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c Tue Nov 19 07:19:33 2019 (r354848) @@ -41,7 +41,7 @@ dsl_null_checkfunc(void *arg, dmu_tx_t *tx) static int dsl_sync_task_common(const char *pool, dsl_checkfunc_t *checkfunc, - dsl_syncfunc_t *syncfunc, void *arg, + dsl_syncfunc_t *syncfunc, dsl_sigfunc_t *sigfunc, void *arg, int blocks_modified, zfs_space_check_t space_check, boolean_t early) { spa_t *spa; @@ -85,6 +85,11 @@ top: dmu_tx_commit(tx); + if (sigfunc != NULL && txg_wait_synced_sig(dp, dst.dst_txg)) { + /* current contract is to call func once */ + sigfunc(arg, tx); + sigfunc = NULL; /* in case of an EAGAIN retry */ + } txg_wait_synced(dp, dst.dst_txg); if (dst.dst_error == EAGAIN) { @@ -124,7 +129,7 @@ dsl_sync_task(const char *pool, dsl_checkfunc_t *check dsl_syncfunc_t *syncfunc, void *arg, int blocks_modified, zfs_space_check_t space_check) { - return (dsl_sync_task_common(pool, checkfunc, syncfunc, arg, + return (dsl_sync_task_common(pool, checkfunc, syncfunc, NULL, arg, blocks_modified, space_check, B_FALSE)); } @@ -146,8 +151,21 @@ dsl_early_sync_task(const char *pool, dsl_checkfunc_t dsl_syncfunc_t *syncfunc, void *arg, int blocks_modified, zfs_space_check_t space_check) { - return (dsl_sync_task_common(pool, checkfunc, syncfunc, arg, + return (dsl_sync_task_common(pool, checkfunc, syncfunc, NULL, arg, blocks_modified, space_check, B_TRUE)); +} + +/* + * A standard synctask that can be interrupted from a signal. The sigfunc + * is called once if a signal occurred while waiting for the task to sync. + */ +int +dsl_sync_task_sig(const char *pool, dsl_checkfunc_t *checkfunc, + dsl_syncfunc_t *syncfunc, dsl_sigfunc_t *sigfunc, void *arg, + int blocks_modified, zfs_space_check_t space_check) +{ + return (dsl_sync_task_common(pool, checkfunc, syncfunc, sigfunc, arg, + blocks_modified, space_check, B_FALSE)); } static void Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h Tue Nov 19 07:19:33 2019 (r354848) @@ -37,6 +37,7 @@ struct dsl_pool; typedef int (dsl_checkfunc_t)(void *, dmu_tx_t *); typedef void (dsl_syncfunc_t)(void *, dmu_tx_t *); +typedef void (dsl_sigfunc_t)(void *, dmu_tx_t *); typedef enum zfs_space_check { /* @@ -116,6 +117,8 @@ int dsl_early_sync_task(const char *, dsl_checkfunc_t dsl_syncfunc_t *, void *, int, zfs_space_check_t); void dsl_early_sync_task_nowait(struct dsl_pool *, dsl_syncfunc_t *, void *, int, zfs_space_check_t, dmu_tx_t *); +int dsl_sync_task_sig(const char *, dsl_checkfunc_t *, dsl_syncfunc_t *, + dsl_sigfunc_t *, void *, int, zfs_space_check_t); #ifdef __cplusplus } Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h Tue Nov 19 07:19:33 2019 (r354848) @@ -88,6 +88,11 @@ extern void txg_kick(struct dsl_pool *dp); extern void txg_wait_synced(struct dsl_pool *dp, uint64_t txg); /* + * Wait as above. Returns true if the thread was signaled while waiting. + */ +extern boolean_t txg_wait_synced_sig(struct dsl_pool *dp, uint64_t txg); + +/* * Wait until the given transaction group, or one after it, is * the open transaction group. Try to make this happen as soon * as possible (eg. kick off any necessary syncs immediately). Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zcp.h Tue Nov 19 07:19:33 2019 (r354848) @@ -52,6 +52,12 @@ typedef struct zcp_cleanup_handler { list_node_t zch_node; } zcp_cleanup_handler_t; +typedef struct zcp_alloc_arg { + boolean_t aa_must_succeed; + int64_t aa_alloc_remaining; + int64_t aa_alloc_limit; +} zcp_alloc_arg_t; + typedef struct zcp_run_info { dsl_pool_t *zri_pool; @@ -94,6 +100,11 @@ typedef struct zcp_run_info { boolean_t zri_timed_out; /* + * Channel program was canceled by user + */ + boolean_t zri_canceled; + + /* * Boolean indicating whether or not we are running in syncing * context. */ @@ -104,6 +115,26 @@ typedef struct zcp_run_info { * triggered in the event of a fatal error. */ list_t zri_cleanup_handlers; + + /* + * The Lua state context of our channel program. + */ + lua_State *zri_state; + + /* + * Lua memory allocator arguments. + */ + zcp_alloc_arg_t *zri_allocargs; + + /* + * Contains output values from zcp script or error string. + */ + nvlist_t *zri_outnvl; + + /* + * The errno number returned to caller of zcp_eval(). + */ + int zri_result; } zcp_run_info_t; zcp_run_info_t *zcp_run_info(lua_State *); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Tue Nov 19 07:19:33 2019 (r354848) @@ -638,8 +638,8 @@ txg_delay(dsl_pool_t *dp, uint64_t txg, hrtime_t delay mutex_exit(&tx->tx_sync_lock); } -void -txg_wait_synced(dsl_pool_t *dp, uint64_t txg) +static boolean_t +txg_wait_synced_impl(dsl_pool_t *dp, uint64_t txg, boolean_t wait_sig) { tx_state_t *tx = &dp->dp_tx; @@ -658,9 +658,51 @@ txg_wait_synced(dsl_pool_t *dp, uint64_t txg) "tx_synced=%llu waiting=%llu dp=%p\n", tx->tx_synced_txg, tx->tx_sync_txg_waiting, dp); cv_broadcast(&tx->tx_sync_more_cv); - cv_wait(&tx->tx_sync_done_cv, &tx->tx_sync_lock); + if (wait_sig) { + /* + * Condition wait here but stop if the thread receives a + * signal. The caller may call txg_wait_synced*() again + * to resume waiting for this txg. + */ +#ifdef __FreeBSD__ + /* + * FreeBSD returns EINTR or ERESTART if there is + * a pending signal, zero if the conditional variable + * is signaled. illumos returns zero in the former case + * and >0 in the latter. + */ + if (cv_wait_sig(&tx->tx_sync_done_cv, + &tx->tx_sync_lock) != 0) { +#else + if (cv_wait_sig(&tx->tx_sync_done_cv, + &tx->tx_sync_lock) == 0) { +#endif + + mutex_exit(&tx->tx_sync_lock); + return (B_TRUE); + } + } else { + cv_wait(&tx->tx_sync_done_cv, &tx->tx_sync_lock); + } } mutex_exit(&tx->tx_sync_lock); + return (B_FALSE); +} + +void +txg_wait_synced(dsl_pool_t *dp, uint64_t txg) +{ + VERIFY0(txg_wait_synced_impl(dp, txg, B_FALSE)); +} + +/* + * Similar to a txg_wait_synced but it can be interrupted from a signal. + * Returns B_TRUE if the thread was signaled while waiting. + */ +boolean_t +txg_wait_synced_sig(dsl_pool_t *dp, uint64_t txg) +{ + return (txg_wait_synced_impl(dp, txg, B_TRUE)); } void Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zcp.c Tue Nov 19 07:19:33 2019 (r354848) @@ -122,21 +122,6 @@ static int zcp_nvpair_value_to_lua(lua_State *, nvpair static int zcp_lua_to_nvlist_impl(lua_State *, int, nvlist_t *, const char *, int); -typedef struct zcp_alloc_arg { - boolean_t aa_must_succeed; - int64_t aa_alloc_remaining; - int64_t aa_alloc_limit; -} zcp_alloc_arg_t; - -typedef struct zcp_eval_arg { - lua_State *ea_state; - zcp_alloc_arg_t *ea_allocargs; - cred_t *ea_cred; - nvlist_t *ea_outnvl; - int ea_result; - uint64_t ea_instrlimit; -} zcp_eval_arg_t; - /* * The outer-most error callback handler for use with lua_pcall(). On * error Lua will call this callback with a single argument that @@ -456,7 +441,7 @@ zcp_lua_to_nvlist_helper(lua_State *state) static void zcp_convert_return_values(lua_State *state, nvlist_t *nvl, - const char *key, zcp_eval_arg_t *evalargs) + const char *key, int *result) { int err; VERIFY3U(1, ==, lua_gettop(state)); @@ -468,7 +453,7 @@ zcp_convert_return_values(lua_State *state, nvlist_t * err = lua_pcall(state, 3, 0, 0); /* zcp_lua_to_nvlist_helper */ if (err != 0) { zcp_lua_to_nvlist(state, 1, nvl, ZCP_RET_ERROR); - evalargs->ea_result = SET_ERROR(ECHRNG); + *result = SET_ERROR(ECHRNG); } } @@ -795,13 +780,24 @@ zcp_lua_alloc(void *ud, void *ptr, size_t osize, size_ static void zcp_lua_counthook(lua_State *state, lua_Debug *ar) { - /* - * If we're called, check how many instructions the channel program has - * executed so far, and compare against the limit. - */ lua_getfield(state, LUA_REGISTRYINDEX, ZCP_RUN_INFO_KEY); zcp_run_info_t *ri = lua_touserdata(state, -1); + /* + * Check if we were canceled while waiting for the + * txg to sync or from our open context thread + */ + if (ri->zri_canceled || + (!ri->zri_sync && issig(JUSTLOOKING) && issig(FORREAL))) { + ri->zri_canceled = B_TRUE; + (void) lua_pushstring(state, "Channel program was canceled."); + (void) lua_error(state); + } + + /* + * Check how many instructions the channel program has + * executed so far, and compare against the limit. + */ ri->zri_curinstrs += zfs_lua_check_instrlimit_interval; if (ri->zri_maxinstrs != 0 && ri->zri_curinstrs > ri->zri_maxinstrs) { ri->zri_timed_out = B_TRUE; @@ -820,31 +816,25 @@ zcp_panic_cb(lua_State *state) } static void -zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_arg_t *evalargs) +zcp_eval_impl(dmu_tx_t *tx, zcp_run_info_t *ri) { int err; - zcp_run_info_t ri; - lua_State *state = evalargs->ea_state; + lua_State *state = ri->zri_state; VERIFY3U(3, ==, lua_gettop(state)); + /* finish initializing our runtime state */ + ri->zri_pool = dmu_tx_pool(tx); + ri->zri_tx = tx; + list_create(&ri->zri_cleanup_handlers, sizeof (zcp_cleanup_handler_t), + offsetof(zcp_cleanup_handler_t, zch_node)); + /* * Store the zcp_run_info_t struct for this run in the Lua registry. * Registry entries are not directly accessible by the Lua scripts but * can be accessed by our callbacks. */ - ri.zri_space_used = 0; - ri.zri_pool = dmu_tx_pool(tx); - ri.zri_cred = evalargs->ea_cred; - ri.zri_tx = tx; - ri.zri_timed_out = B_FALSE; - ri.zri_sync = sync; - list_create(&ri.zri_cleanup_handlers, sizeof (zcp_cleanup_handler_t), - offsetof(zcp_cleanup_handler_t, zch_node)); - ri.zri_curinstrs = 0; - ri.zri_maxinstrs = evalargs->ea_instrlimit; - - lua_pushlightuserdata(state, &ri); + lua_pushlightuserdata(state, ri); lua_setfield(state, LUA_REGISTRYINDEX, ZCP_RUN_INFO_KEY); VERIFY3U(3, ==, lua_gettop(state)); @@ -861,7 +851,7 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a * off control to the channel program. Channel programs that use too * much memory should die with ENOSPC. */ - evalargs->ea_allocargs->aa_must_succeed = B_FALSE; + ri->zri_allocargs->aa_must_succeed = B_FALSE; /* * Call the Lua function that open-context passed us. This pops the @@ -873,14 +863,14 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a /* * Let Lua use KM_SLEEP while we interpret the return values. */ - evalargs->ea_allocargs->aa_must_succeed = B_TRUE; + ri->zri_allocargs->aa_must_succeed = B_TRUE; /* * Remove the error handler callback from the stack. At this point, * there shouldn't be any cleanup handler registered in the handler * list (zri_cleanup_handlers), regardless of whether it ran or not. */ - list_destroy(&ri.zri_cleanup_handlers); + list_destroy(&ri->zri_cleanup_handlers); lua_remove(state, 1); switch (err) { @@ -900,16 +890,16 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a int return_count = lua_gettop(state); if (return_count == 1) { - evalargs->ea_result = 0; - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_RETURN, evalargs); + ri->zri_result = 0; + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_RETURN, &ri->zri_result); } else if (return_count > 1) { - evalargs->ea_result = SET_ERROR(ECHRNG); + ri->zri_result = SET_ERROR(ECHRNG); lua_settop(state, 0); (void) lua_pushfstring(state, "Multiple return " "values not supported"); - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); } break; } @@ -923,14 +913,16 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a * stack. */ VERIFY3U(1, ==, lua_gettop(state)); - if (ri.zri_timed_out) { - evalargs->ea_result = SET_ERROR(ETIME); + if (ri->zri_timed_out) { + ri->zri_result = SET_ERROR(ETIME); + } else if (ri->zri_canceled) { + ri->zri_result = SET_ERROR(EINTR); } else { - evalargs->ea_result = SET_ERROR(ECHRNG); + ri->zri_result = SET_ERROR(ECHRNG); } - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); break; } case LUA_ERRERR: { @@ -941,14 +933,16 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a * return the error message. */ VERIFY3U(1, ==, lua_gettop(state)); - if (ri.zri_timed_out) { - evalargs->ea_result = SET_ERROR(ETIME); + if (ri->zri_timed_out) { + ri->zri_result = SET_ERROR(ETIME); + } else if (ri->zri_canceled) { + ri->zri_result = SET_ERROR(EINTR); } else { - evalargs->ea_result = SET_ERROR(ECHRNG); + ri->zri_result = SET_ERROR(ECHRNG); } - zcp_convert_return_values(state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); break; } case LUA_ERRMEM: @@ -956,7 +950,7 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a * Lua ran out of memory while running the channel program. * There's not much we can do. */ - evalargs->ea_result = SET_ERROR(ENOSPC); + ri->zri_result = SET_ERROR(ENOSPC); break; default: VERIFY0(err); @@ -964,21 +958,35 @@ zcp_eval_impl(dmu_tx_t *tx, boolean_t sync, zcp_eval_a } static void -zcp_pool_error(zcp_eval_arg_t *evalargs, const char *poolname) +zcp_pool_error(zcp_run_info_t *ri, const char *poolname) { - evalargs->ea_result = SET_ERROR(ECHRNG); - lua_settop(evalargs->ea_state, 0); - (void) lua_pushfstring(evalargs->ea_state, "Could not open pool: %s", + ri->zri_result = SET_ERROR(ECHRNG); + lua_settop(ri->zri_state, 0); + (void) lua_pushfstring(ri->zri_state, "Could not open pool: %s", poolname); - zcp_convert_return_values(evalargs->ea_state, evalargs->ea_outnvl, - ZCP_RET_ERROR, evalargs); + zcp_convert_return_values(ri->zri_state, ri->zri_outnvl, + ZCP_RET_ERROR, &ri->zri_result); } +/* + * This callback is called when txg_wait_synced_sig encountered a signal. + * The txg_wait_synced_sig will continue to wait for the txg to complete + * after calling this callback. + */ +/* ARGSUSED */ static void +zcp_eval_sig(void *arg, dmu_tx_t *tx) +{ + zcp_run_info_t *ri = arg; + + ri->zri_canceled = B_TRUE; +} + +static void zcp_eval_sync(void *arg, dmu_tx_t *tx) { - zcp_eval_arg_t *evalargs = arg; + zcp_run_info_t *ri = arg; /* * Open context should have setup the stack to contain: @@ -986,15 +994,14 @@ zcp_eval_sync(void *arg, dmu_tx_t *tx) * 2: Script to run (converted to a Lua function) * 3: nvlist input to function (converted to Lua table or nil) */ - VERIFY3U(3, ==, lua_gettop(evalargs->ea_state)); + VERIFY3U(3, ==, lua_gettop(ri->zri_state)); - zcp_eval_impl(tx, B_TRUE, evalargs); + zcp_eval_impl(tx, ri); } static void -zcp_eval_open(zcp_eval_arg_t *evalargs, const char *poolname) +zcp_eval_open(zcp_run_info_t *ri, const char *poolname) { - int error; dsl_pool_t *dp; dmu_tx_t *tx; @@ -1002,11 +1009,11 @@ zcp_eval_open(zcp_eval_arg_t *evalargs, const char *po /* * See comment from the same assertion in zcp_eval_sync(). */ - VERIFY3U(3, ==, lua_gettop(evalargs->ea_state)); + VERIFY3U(3, ==, lua_gettop(ri->zri_state)); error = dsl_pool_hold(poolname, FTAG, &dp); if (error != 0) { - zcp_pool_error(evalargs, poolname); + zcp_pool_error(ri, poolname); return; } @@ -1021,7 +1028,7 @@ zcp_eval_open(zcp_eval_arg_t *evalargs, const char *po */ tx = dmu_tx_create_dd(dp->dp_mos_dir); - zcp_eval_impl(tx, B_FALSE, evalargs); + zcp_eval_impl(tx, ri); dmu_tx_abort(tx); @@ -1034,7 +1041,7 @@ zcp_eval(const char *poolname, const char *program, bo { int err; lua_State *state; - zcp_eval_arg_t evalargs; + zcp_run_info_t runinfo; if (instrlimit > zfs_lua_max_instrlimit) return (SET_ERROR(EINVAL)); @@ -1134,24 +1141,29 @@ zcp_eval(const char *poolname, const char *program, bo } VERIFY3U(3, ==, lua_gettop(state)); - evalargs.ea_state = state; - evalargs.ea_allocargs = &allocargs; - evalargs.ea_instrlimit = instrlimit; - evalargs.ea_cred = CRED(); - evalargs.ea_outnvl = outnvl; - evalargs.ea_result = 0; + runinfo.zri_state = state; + runinfo.zri_allocargs = &allocargs; + runinfo.zri_outnvl = outnvl; + runinfo.zri_result = 0; + runinfo.zri_cred = CRED(); + runinfo.zri_timed_out = B_FALSE; + runinfo.zri_canceled = B_FALSE; + runinfo.zri_sync = sync; + runinfo.zri_space_used = 0; + runinfo.zri_curinstrs = 0; + runinfo.zri_maxinstrs = instrlimit; if (sync) { - err = dsl_sync_task(poolname, NULL, - zcp_eval_sync, &evalargs, 0, ZFS_SPACE_CHECK_ZCP_EVAL); + err = dsl_sync_task_sig(poolname, NULL, zcp_eval_sync, + zcp_eval_sig, &runinfo, 0, ZFS_SPACE_CHECK_ZCP_EVAL); if (err != 0) - zcp_pool_error(&evalargs, poolname); + zcp_pool_error(&runinfo, poolname); } else { - zcp_eval_open(&evalargs, poolname); + zcp_eval_open(&runinfo, poolname); } lua_close(state); - return (evalargs.ea_result); + return (runinfo.zri_result); } /* Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Nov 19 04:30:23 2019 (r354847) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Nov 19 07:19:33 2019 (r354848) @@ -6865,7 +6865,7 @@ zfsdev_ioctl(struct cdev *dev, u_long zcmd, caddr_t ar error = vec->zvec_func(zc->zc_name, innvl, outnvl); /* - * Some commands can partially execute, modfiy state, and still + * Some commands can partially execute, modify state, and still * return an error. In these cases, attempt to record what * was modified. */ From owner-svn-src-stable-12@freebsd.org Tue Nov 19 15:32:16 2019 Return-Path: Delivered-To: svn-src-stable-12@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 1754F1B5E27; Tue, 19 Nov 2019 15:32:16 +0000 (UTC) (envelope-from kib@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HVDv6cMDz4cMt; Tue, 19 Nov 2019 15:32:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C6214C80B; Tue, 19 Nov 2019 15:32:15 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJFWFlI096736; Tue, 19 Nov 2019 15:32:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJFWFru096735; Tue, 19 Nov 2019 15:32:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911191532.xAJFWFru096735@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 19 Nov 2019 15:32:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354856 - stable/12/sys/amd64/amd64 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/amd64/amd64 X-SVN-Commit-Revision: 354856 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 15:32:16 -0000 Author: kib Date: Tue Nov 19 15:32:15 2019 New Revision: 354856 URL: https://svnweb.freebsd.org/changeset/base/354856 Log: MFC r354644: amd64: assert that size of the software prototype table for gdt is equal to the size of hardware gdt. Modified: stable/12/sys/amd64/amd64/machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/machdep.c Tue Nov 19 14:53:13 2019 (r354855) +++ stable/12/sys/amd64/amd64/machdep.c Tue Nov 19 15:32:15 2019 (r354856) @@ -812,6 +812,7 @@ struct soft_segment_descriptor gdt_segs[] = { .ssd_def32 = 0, .ssd_gran = 0 }, }; +_Static_assert(nitems(gdt_segs) == NGDT, "Stale NGDT"); void setidt(int idx, inthand_t *func, int typ, int dpl, int ist) From owner-svn-src-stable-12@freebsd.org Tue Nov 19 17:28:43 2019 Return-Path: Delivered-To: svn-src-stable-12@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 35C1C1B9074; Tue, 19 Nov 2019 17:28:43 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47HXqH0Wy6z3FNS; Tue, 19 Nov 2019 17:28:42 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id C86E9260184; Tue, 19 Nov 2019 17:10:50 +0100 (CET) Subject: Re: svn commit: r354856 - stable/12/sys/amd64/amd64 To: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201911191532.xAJFWFru096735@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <5b2560fa-78b8-457a-a6ba-a48547bae438@selasky.org> Date: Tue, 19 Nov 2019 17:08:13 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <201911191532.xAJFWFru096735@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47HXqH0Wy6z3FNS X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.89 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; NEURAL_HAM_LONG(-0.90)[-0.899,0]; REPLY(-4.00)[] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 17:28:43 -0000 On 2019-11-19 16:32, Konstantin Belousov wrote: > +_Static_assert(nitems(gdt_segs) == NGDT, "Stale NGDT"); Why are you not using the CTASSERT() macro? Is _Static_assert() portable? --HPS From owner-svn-src-stable-12@freebsd.org Tue Nov 19 18:33:58 2019 Return-Path: Delivered-To: svn-src-stable-12@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 C3B141BA607; Tue, 19 Nov 2019 18:33:58 +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) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47HZGY6SPJz3JLT; Tue, 19 Nov 2019 18:33:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xAJIXoxr088215 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 19 Nov 2019 20:33:53 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xAJIXoxr088215 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xAJIXojc088214; Tue, 19 Nov 2019 20:33:50 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 19 Nov 2019 20:33:50 +0200 From: Konstantin Belousov To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: Re: svn commit: r354856 - stable/12/sys/amd64/amd64 Message-ID: <20191119183349.GA2707@kib.kiev.ua> References: <201911191532.xAJFWFru096735@repo.freebsd.org> <5b2560fa-78b8-457a-a6ba-a48547bae438@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5b2560fa-78b8-457a-a6ba-a48547bae438@selasky.org> User-Agent: Mutt/1.12.2 (2019-09-21) 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.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 47HZGY6SPJz3JLT 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 [-2.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; RCPT_COUNT_FIVE(0.00)[5]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; IP_SCORE(0.00)[ip: (-2.78), ipnet: 2001:470::/32(-4.63), asn: 6939(-3.50), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 18:33:58 -0000 On Tue, Nov 19, 2019 at 05:08:13PM +0100, Hans Petter Selasky wrote: > On 2019-11-19 16:32, Konstantin Belousov wrote: > > +_Static_assert(nitems(gdt_segs) == NGDT, "Stale NGDT"); > > Why are you not using the CTASSERT() macro? Is _Static_assert() portable? _Static_assert() is the feature of C11, while CTASSERT() is an old FreeBSD macro, which historically has very serious usability issues (they were fixed by redefining CTASSERT() to just _Static_assert() with useless message). In this sense yes, _Static_assert() is more portable, but I also do not see a reason to introduce new uses of CTASSERT(). From owner-svn-src-stable-12@freebsd.org Tue Nov 19 21:15:13 2019 Return-Path: Delivered-To: svn-src-stable-12@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 A92221BE567; Tue, 19 Nov 2019 21:15:13 +0000 (UTC) (envelope-from vmaffione@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hdrd40M2z3xZb; Tue, 19 Nov 2019 21:15:13 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C4E91870F; Tue, 19 Nov 2019 21:15:13 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAJLFDfJ096787; Tue, 19 Nov 2019 21:15:13 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAJLFC8l096782; Tue, 19 Nov 2019 21:15:12 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201911192115.xAJLFC8l096782@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Tue, 19 Nov 2019 21:15:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354866 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 354866 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Nov 2019 21:15:13 -0000 Author: vmaffione Date: Tue Nov 19 21:15:12 2019 New Revision: 354866 URL: https://svnweb.freebsd.org/changeset/base/354866 Log: MFC r354288: bhyve: add backend rx backpressure to virtio-net If a VM is flooded with more ingress packets than the guest OS can handle, the current virtio-net code will keep reading those packets and drop most of them as no space is available in the receive queue. This is an undesirable receive livelock, which is a waste of CPU and memory resources and potentially opens to DoS attacks. With this change, virtio-net uses the new netbe_rx_disable() function to disable ingress operation in the backend while the guest is short on RX buffers. Once the guest makes more buffers available to the RX virtqueue, ingress operation is enabled again by calling netbe_rx_enable(). Reviewed by: bryanv, jhb Differential Revision: https://reviews.freebsd.org/D20987 Modified: stable/12/usr.sbin/bhyve/mevent.c stable/12/usr.sbin/bhyve/mevent.h stable/12/usr.sbin/bhyve/net_backends.c stable/12/usr.sbin/bhyve/pci_e82545.c stable/12/usr.sbin/bhyve/pci_virtio_net.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/mevent.c ============================================================================== --- stable/12/usr.sbin/bhyve/mevent.c Tue Nov 19 21:14:15 2019 (r354865) +++ stable/12/usr.sbin/bhyve/mevent.c Tue Nov 19 21:15:12 2019 (r354866) @@ -321,6 +321,14 @@ mevent_add(int tfd, enum ev_type type, return mevent_add_state(tfd, type, func, param, MEV_ADD); } +struct mevent * +mevent_add_disabled(int tfd, enum ev_type type, + void (*func)(int, enum ev_type, void *), void *param) +{ + + return mevent_add_state(tfd, type, func, param, MEV_ADD_DISABLED); +} + static int mevent_update(struct mevent *evp, int newstate) { Modified: stable/12/usr.sbin/bhyve/mevent.h ============================================================================== --- stable/12/usr.sbin/bhyve/mevent.h Tue Nov 19 21:14:15 2019 (r354865) +++ stable/12/usr.sbin/bhyve/mevent.h Tue Nov 19 21:15:12 2019 (r354866) @@ -43,6 +43,9 @@ struct mevent; struct mevent *mevent_add(int fd, enum ev_type type, void (*func)(int, enum ev_type, void *), void *param); +struct mevent *mevent_add_disabled(int fd, enum ev_type type, + void (*func)(int, enum ev_type, void *), + void *param); int mevent_enable(struct mevent *evp); int mevent_disable(struct mevent *evp); int mevent_delete(struct mevent *evp); Modified: stable/12/usr.sbin/bhyve/net_backends.c ============================================================================== --- stable/12/usr.sbin/bhyve/net_backends.c Tue Nov 19 21:14:15 2019 (r354865) +++ stable/12/usr.sbin/bhyve/net_backends.c Tue Nov 19 21:15:12 2019 (r354866) @@ -220,7 +220,7 @@ tap_init(struct net_backend *be, const char *devname, errx(EX_OSERR, "Unable to apply rights for sandbox"); #endif - priv->mevp = mevent_add(be->fd, EVF_READ, cb, param); + priv->mevp = mevent_add_disabled(be->fd, EVF_READ, cb, param); if (priv->mevp == NULL) { WPRINTF(("Could not register event\n")); goto error; @@ -432,7 +432,7 @@ netmap_init(struct net_backend *be, const char *devnam priv->cb_param = param; be->fd = priv->nmd->fd; - priv->mevp = mevent_add(be->fd, EVF_READ, cb, param); + priv->mevp = mevent_add_disabled(be->fd, EVF_READ, cb, param); if (priv->mevp == NULL) { WPRINTF(("Could not register event\n")); return (-1); Modified: stable/12/usr.sbin/bhyve/pci_e82545.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_e82545.c Tue Nov 19 21:14:15 2019 (r354865) +++ stable/12/usr.sbin/bhyve/pci_e82545.c Tue Nov 19 21:15:12 2019 (r354866) @@ -2351,6 +2351,8 @@ e82545_init(struct vmctx *ctx, struct pci_devinst *pi, net_genmac(pi, sc->esc_mac.octet); } + netbe_rx_enable(sc->esc_be); + /* H/w initiated reset */ e82545_reset(sc, 0); Modified: stable/12/usr.sbin/bhyve/pci_virtio_net.c ============================================================================== --- stable/12/usr.sbin/bhyve/pci_virtio_net.c Tue Nov 19 21:14:15 2019 (r354865) +++ stable/12/usr.sbin/bhyve/pci_virtio_net.c Tue Nov 19 21:15:12 2019 (r354866) @@ -101,7 +101,6 @@ struct pci_vtnet_softc { net_backend_t *vsc_be; - int vsc_rx_ready; int resetting; /* protected by tx_mtx */ uint64_t vsc_features; /* negotiated features */ @@ -156,7 +155,6 @@ pci_vtnet_reset(void *vsc) pthread_mutex_lock(&sc->tx_mtx); } - sc->vsc_rx_ready = 0; sc->rx_merge = 1; sc->rx_vhdrlen = sizeof(struct virtio_net_rxhdr); @@ -180,30 +178,29 @@ pci_vtnet_rx(struct pci_vtnet_softc *sc) int len, n; uint16_t idx; - if (!sc->vsc_rx_ready) { - /* - * The rx ring has not yet been set up. - * Drop the packet and try later. - */ - netbe_rx_discard(sc->vsc_be); - return; - } - - /* - * Check for available rx buffers - */ vq = &sc->vsc_queues[VTNET_RXQ]; - if (!vq_has_descs(vq)) { + for (;;) { /* - * No available rx buffers. Drop the packet and try later. - * Interrupt on empty, if that's negotiated. + * Check for available rx buffers. */ - netbe_rx_discard(sc->vsc_be); - vq_endchains(vq, /*used_all_avail=*/1); - return; - } + if (!vq_has_descs(vq)) { + /* No rx buffers. Enable RX kicks and double check. */ + vq_kick_enable(vq); + if (!vq_has_descs(vq)) { + /* + * Still no buffers. Interrupt if needed + * (including for NOTIFY_ON_EMPTY), and + * disable the backend until the next kick. + */ + vq_endchains(vq, /*used_all_avail=*/1); + netbe_rx_disable(sc->vsc_be); + return; + } - do { + /* More rx buffers found, so keep going. */ + vq_kick_disable(vq); + } + /* * Get descriptor chain. */ @@ -215,7 +212,8 @@ pci_vtnet_rx(struct pci_vtnet_softc *sc) if (len <= 0) { /* * No more packets (len == 0), or backend errored - * (err < 0). Return unused available buffers. + * (err < 0). Return unused available buffers + * and stop. */ vq_retchain(vq); /* Interrupt if needed/appropriate and stop. */ @@ -225,10 +223,8 @@ pci_vtnet_rx(struct pci_vtnet_softc *sc) /* Publish the info to the guest */ vq_relchain(vq, idx, (uint32_t)len); - } while (vq_has_descs(vq)); + } - /* Interrupt if needed, including for NOTIFY_ON_EMPTY. */ - vq_endchains(vq, /*used_all_avail=*/1); } /* @@ -254,13 +250,11 @@ pci_vtnet_ping_rxq(void *vsc, struct vqueue_info *vq) struct pci_vtnet_softc *sc = vsc; /* - * A qnotify means that the rx process can now begin + * A qnotify means that the rx process can now begin. */ pthread_mutex_lock(&sc->rx_mtx); - if (sc->vsc_rx_ready == 0) { - sc->vsc_rx_ready = 1; - vq_kick_disable(vq); - } + vq_kick_disable(vq); + netbe_rx_enable(sc->vsc_be); pthread_mutex_unlock(&sc->rx_mtx); } From owner-svn-src-stable-12@freebsd.org Wed Nov 20 08:34:25 2019 Return-Path: Delivered-To: svn-src-stable-12@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 7CB3D1AE5A4; Wed, 20 Nov 2019 08:34:25 +0000 (UTC) (envelope-from avg@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HwwK2g9Wz4VlM; Wed, 20 Nov 2019 08:34:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3EB9F2014E; Wed, 20 Nov 2019 08:34:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK8YPQc096369; Wed, 20 Nov 2019 08:34:25 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK8YPlE096368; Wed, 20 Nov 2019 08:34:25 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911200834.xAK8YPlE096368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 20 Nov 2019 08:34:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354879 - stable/12/sys/dev/ow X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/ow X-SVN-Commit-Revision: 354879 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 08:34:25 -0000 Author: avg Date: Wed Nov 20 08:34:24 2019 New Revision: 354879 URL: https://svnweb.freebsd.org/changeset/base/354879 Log: MFC r354180: ow(4): increase regular mode recovery time, t_rec, to 15 us Modified: stable/12/sys/dev/ow/ow.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ow/ow.c ============================================================================== --- stable/12/sys/dev/ow/ow.c Wed Nov 20 05:34:02 2019 (r354878) +++ stable/12/sys/dev/ow/ow.c Wed Nov 20 08:34:24 2019 (r354879) @@ -78,7 +78,7 @@ static struct ow_timing timing_regular = { .t_low0 = 60, /* really 60 to 120 */ .t_low1 = 1, /* really 1 to 15 */ .t_release = 45, /* <= 45us */ - .t_rec = 1, /* at least 1us */ + .t_rec = 15, /* at least 1us */ .t_rdv = 15, /* 15us */ .t_rstl = 480, /* 480us or more */ .t_rsth = 480, /* 480us or more */ From owner-svn-src-stable-12@freebsd.org Wed Nov 20 08:35:55 2019 Return-Path: Delivered-To: svn-src-stable-12@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 345EA1AE67C; Wed, 20 Nov 2019 08:35:55 +0000 (UTC) (envelope-from avg@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hwy30YhNz4Vsb; Wed, 20 Nov 2019 08:35:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA5352014F; Wed, 20 Nov 2019 08:35:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK8Zslj096531; Wed, 20 Nov 2019 08:35:54 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK8Zsro096530; Wed, 20 Nov 2019 08:35:54 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911200835.xAK8Zsro096530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 20 Nov 2019 08:35:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354880 - stable/12/sys/dev/ow X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/ow X-SVN-Commit-Revision: 354880 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 08:35:55 -0000 Author: avg Date: Wed Nov 20 08:35:54 2019 New Revision: 354880 URL: https://svnweb.freebsd.org/changeset/base/354880 Log: MFC r354181: ow(4): protocol timings can now be changed as sysctl-s / tunables Modified: stable/12/sys/dev/ow/ow.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ow/ow.c ============================================================================== --- stable/12/sys/dev/ow/ow.c Wed Nov 20 08:34:24 2019 (r354879) +++ stable/12/sys/dev/ow/ow.c Wed Nov 20 08:35:54 2019 (r354880) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -73,34 +74,137 @@ static void ow_release_bus(device_t ndev, device_t pde static MALLOC_DEFINE(M_OW, "ow", "House keeping data for 1wire bus"); +static const struct ow_timing timing_regular_min = { + .t_slot = 60, + .t_low0 = 60, + .t_low1 = 1, + .t_release = 0, + .t_rec = 1, + .t_rdv = 15, /* fixed */ + .t_rstl = 480, + .t_rsth = 480, + .t_pdl = 60, + .t_pdh = 15, + .t_lowr = 1, +}; + +static const struct ow_timing timing_regular_max = { + .t_slot = 120, + .t_low0 = 120, + .t_low1 = 15, + .t_release = 45, + .t_rec = 960, /* infinity */ + .t_rdv = 15, /* fixed */ + .t_rstl = 960, /* infinity */ + .t_rsth = 960, /* infinity */ + .t_pdl = 240, /* 60us to 240us */ + .t_pdh = 60, /* 15us to 60us */ + .t_lowr = 15, /* 1us */ +}; + static struct ow_timing timing_regular = { - .t_slot = 60, /* 60 to 120 */ - .t_low0 = 60, /* really 60 to 120 */ - .t_low1 = 1, /* really 1 to 15 */ - .t_release = 45, /* <= 45us */ - .t_rec = 15, /* at least 1us */ - .t_rdv = 15, /* 15us */ - .t_rstl = 480, /* 480us or more */ - .t_rsth = 480, /* 480us or more */ - .t_pdl = 60, /* 60us to 240us */ - .t_pdh = 60, /* 15us to 60us */ - .t_lowr = 1, /* 1us */ + .t_slot = 60, /* 60 <= t < 120 */ + .t_low0 = 60, /* 60 <= t < t_slot < 120 */ + .t_low1 = 1, /* 1 <= t < 15 */ + .t_release = 45, /* 0 <= t < 45 */ + .t_rec = 15, /* 1 <= t < inf */ + .t_rdv = 15, /* t == 15 */ + .t_rstl = 480, /* 480 <= t < inf */ + .t_rsth = 480, /* 480 <= t < inf */ + .t_pdl = 60, /* 60 <= t < 240 */ + .t_pdh = 60, /* 15 <= t < 60 */ + .t_lowr = 1, /* 1 <= t < 15 */ }; /* NB: Untested */ +static const struct ow_timing timing_overdrive_min = { + .t_slot = 6, + .t_low0 = 6, + .t_low1 = 1, + .t_release = 0, + .t_rec = 1, + .t_rdv = 2, /* fixed */ + .t_rstl = 48, + .t_rsth = 48, + .t_pdl = 8, + .t_pdh = 2, + .t_lowr = 1, +}; + +static const struct ow_timing timing_overdrive_max = { + .t_slot = 16, + .t_low0 = 16, + .t_low1 = 2, + .t_release = 4, + .t_rec = 960, /* infinity */ + .t_rdv = 2, /* fixed */ + .t_rstl = 80, + .t_rsth = 960, /* infinity */ + .t_pdl = 24, + .t_pdh = 6, + .t_lowr = 2, +}; + static struct ow_timing timing_overdrive = { - .t_slot = 11, /* 6us to 16us */ - .t_low0 = 6, /* really 6 to 16 */ - .t_low1 = 1, /* really 1 to 2 */ - .t_release = 4, /* <= 4us */ - .t_rec = 1, /* at least 1us */ - .t_rdv = 2, /* 2us */ - .t_rstl = 48, /* 48us to 80us */ - .t_rsth = 48, /* 48us or more */ - .t_pdl = 8, /* 8us to 24us */ - .t_pdh = 2, /* 2us to 6us */ - .t_lowr = 1, /* 1us */ + .t_slot = 11, /* 6 <= t < 16 */ + .t_low0 = 6, /* 6 <= t < t_slot < 16 */ + .t_low1 = 1, /* 1 <= t < 2 */ + .t_release = 4, /* 0 <= t < 4 */ + .t_rec = 1, /* 1 <= t < inf */ + .t_rdv = 2, /* t == 2 */ + .t_rstl = 48, /* 48 <= t < 80 */ + .t_rsth = 48, /* 48 <= t < inf */ + .t_pdl = 8, /* 8 <= t < 24 */ + .t_pdh = 2, /* 2 <= t < 6 */ + .t_lowr = 1, /* 1 <= t < 2 */ }; + +SYSCTL_DECL(_hw); +SYSCTL_NODE(_hw, OID_AUTO, ow, CTLFLAG_RD, 0, "1-Wire protocol"); +SYSCTL_NODE(_hw_ow, OID_AUTO, regular, CTLFLAG_RD, 0, + "Regular mode timings"); +SYSCTL_NODE(_hw_ow, OID_AUTO, overdrive, CTLFLAG_RD, 0, + "Overdrive mode timings"); + +#define _OW_TIMING_SYSCTL(mode, param) \ + static int \ + sysctl_ow_timing_ ## mode ## _ ## param(SYSCTL_HANDLER_ARGS) \ + { \ + int val = timing_ ## mode.param; \ + int err; \ + err = sysctl_handle_int(oidp, &val, 0, req); \ + if (err != 0 || req->newptr == NULL) \ + return (err); \ + if (val < timing_ ## mode ## _min.param) \ + return (EINVAL); \ + else if (val >= timing_ ## mode ## _max.param) \ + return (EINVAL); \ + timing_ ## mode.param = val; \ + return (0); \ + } \ +SYSCTL_PROC(_hw_ow_ ## mode, OID_AUTO, param, \ + CTLTYPE_INT | CTLFLAG_RWTUN, 0, sizeof(int), \ + sysctl_ow_timing_ ## mode ## _ ## param, "I", \ + "1-Wire timing parameter in microseconds (-1 resets to default)") + +#define OW_TIMING_SYSCTL(param) \ + _OW_TIMING_SYSCTL(regular, param); \ + _OW_TIMING_SYSCTL(overdrive, param) + +OW_TIMING_SYSCTL(t_slot); +OW_TIMING_SYSCTL(t_low0); +OW_TIMING_SYSCTL(t_low1); +OW_TIMING_SYSCTL(t_release); +OW_TIMING_SYSCTL(t_rec); +OW_TIMING_SYSCTL(t_rdv); +OW_TIMING_SYSCTL(t_rstl); +OW_TIMING_SYSCTL(t_rsth); +OW_TIMING_SYSCTL(t_pdl); +OW_TIMING_SYSCTL(t_pdh); +OW_TIMING_SYSCTL(t_lowr); + +#undef _OW_TIMING_SYSCTL +#undef OW_TIMING_SYSCTL static void ow_send_byte(device_t lldev, struct ow_timing *t, uint8_t byte) From owner-svn-src-stable-12@freebsd.org Wed Nov 20 08:37:23 2019 Return-Path: Delivered-To: svn-src-stable-12@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 9C0481AE70B; Wed, 20 Nov 2019 08:37:23 +0000 (UTC) (envelope-from avg@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hwzl3c81z4W0v; Wed, 20 Nov 2019 08:37:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F0D820157; Wed, 20 Nov 2019 08:37:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK8bNj2096671; Wed, 20 Nov 2019 08:37:23 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK8bNGh096670; Wed, 20 Nov 2019 08:37:23 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911200837.xAK8bNGh096670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 20 Nov 2019 08:37:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354881 - stable/12/sys/dev/ow X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/ow X-SVN-Commit-Revision: 354881 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 08:37:23 -0000 Author: avg Date: Wed Nov 20 08:37:22 2019 New Revision: 354881 URL: https://svnweb.freebsd.org/changeset/base/354881 Log: MFC r354183: ow(4): clean up stray white space Modified: stable/12/sys/dev/ow/ow.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ow/ow.c ============================================================================== --- stable/12/sys/dev/ow/ow.c Wed Nov 20 08:35:54 2019 (r354880) +++ stable/12/sys/dev/ow/ow.c Wed Nov 20 08:37:22 2019 (r354881) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); typedef int ow_enum_fn(device_t, device_t); typedef int ow_found_fn(device_t, romid_t); -struct ow_softc +struct ow_softc { device_t dev; /* Newbus driver back pointer */ struct mtx mtx; /* bus mutex */ @@ -210,7 +210,7 @@ static void ow_send_byte(device_t lldev, struct ow_timing *t, uint8_t byte) { int i; - + for (i = 0; i < 8; i++) if (byte & (1 << i)) OWLL_WRITE_ONE(lldev, t); @@ -224,7 +224,7 @@ ow_read_byte(device_t lldev, struct ow_timing *t, uint int i; uint8_t byte = 0; int bit; - + for (i = 0; i < 8; i++) { OWLL_READ_DATA(lldev, t, &bit); byte |= bit << i; From owner-svn-src-stable-12@freebsd.org Wed Nov 20 08:39:21 2019 Return-Path: Delivered-To: svn-src-stable-12@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 B6C4E1AE806; Wed, 20 Nov 2019 08:39:21 +0000 (UTC) (envelope-from avg@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hx214RNzz4W7c; Wed, 20 Nov 2019 08:39:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BC7E2015A; Wed, 20 Nov 2019 08:39:21 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK8dLSF096853; Wed, 20 Nov 2019 08:39:21 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK8dLxC096852; Wed, 20 Nov 2019 08:39:21 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911200839.xAK8dLxC096852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 20 Nov 2019 08:39:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354882 - stable/12/sys/dev/ow X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/ow X-SVN-Commit-Revision: 354882 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 08:39:21 -0000 Author: avg Date: Wed Nov 20 08:39:21 2019 New Revision: 354882 URL: https://svnweb.freebsd.org/changeset/base/354882 Log: MFC r354205: Remove redundant hw sysctl declaration. gcc CI complains, but clang doesn't. Modified: stable/12/sys/dev/ow/ow.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ow/ow.c ============================================================================== --- stable/12/sys/dev/ow/ow.c Wed Nov 20 08:37:22 2019 (r354881) +++ stable/12/sys/dev/ow/ow.c Wed Nov 20 08:39:21 2019 (r354882) @@ -159,7 +159,6 @@ static struct ow_timing timing_overdrive = { .t_lowr = 1, /* 1 <= t < 2 */ }; -SYSCTL_DECL(_hw); SYSCTL_NODE(_hw, OID_AUTO, ow, CTLFLAG_RD, 0, "1-Wire protocol"); SYSCTL_NODE(_hw_ow, OID_AUTO, regular, CTLFLAG_RD, 0, "Regular mode timings"); From owner-svn-src-stable-12@freebsd.org Wed Nov 20 08:41:01 2019 Return-Path: Delivered-To: svn-src-stable-12@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 9E60F1AE8D9; Wed, 20 Nov 2019 08:41:01 +0000 (UTC) (envelope-from avg@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hx3x4VJPz4WHF; Wed, 20 Nov 2019 08:41:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6550720189; Wed, 20 Nov 2019 08:41:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK8f192099304; Wed, 20 Nov 2019 08:41:01 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK8f1Ip099303; Wed, 20 Nov 2019 08:41:01 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911200841.xAK8f1Ip099303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 20 Nov 2019 08:41:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354883 - stable/12/sys/dev/nctgpio X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/nctgpio X-SVN-Commit-Revision: 354883 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 08:41:01 -0000 Author: avg Date: Wed Nov 20 08:41:01 2019 New Revision: 354883 URL: https://svnweb.freebsd.org/changeset/base/354883 Log: MFC r353887: nctgpio: improve performance (latency) of operation Modified: stable/12/sys/dev/nctgpio/nctgpio.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/nctgpio/nctgpio.c ============================================================================== --- stable/12/sys/dev/nctgpio/nctgpio.c Wed Nov 20 08:39:21 2019 (r354882) +++ stable/12/sys/dev/nctgpio/nctgpio.c Wed Nov 20 08:41:01 2019 (r354883) @@ -69,21 +69,49 @@ #define NCT_LDF_GPIO0_OUTCFG 0xe0 #define NCT_LDF_GPIO1_OUTCFG 0xe1 +/* Direct I/O port access. */ +#define NCT_IO_GSR 0 +#define NCT_IO_IOR 1 +#define NCT_IO_DAT 2 +#define NCT_IO_INV 3 #define NCT_MAX_PIN 15 #define NCT_IS_VALID_PIN(_p) ((_p) >= 0 && (_p) <= NCT_MAX_PIN) -#define NCT_PIN_BIT(_p) (1 << ((_p) % 8)) +#define NCT_PIN_BIT(_p) (1 << ((_p) & 7)) #define NCT_GPIO_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL | \ GPIO_PIN_INVIN | GPIO_PIN_INVOUT) +/* + * Note that the values are important. + * They match actual register offsets. + */ +typedef enum { + REG_IOR = 0, + REG_DAT = 1, + REG_INV = 2, +} reg_t; + struct nct_softc { device_t dev; device_t dev_f; device_t busdev; struct mtx mtx; + struct resource *iores; + int iorid; + int curgrp; + struct { + /* direction, 1: pin is input */ + uint8_t ior[2]; + /* output value */ + uint8_t out[2]; + /* whether out is valid */ + uint8_t out_known[2]; + /* inversion, 1: pin is inverted */ + uint8_t inv[2]; + } cache; struct gpio_pin pins[NCT_MAX_PIN + 1]; }; @@ -113,97 +141,142 @@ struct nuvoton_vendor_device_id { }, }; -/* - * Get the GPIO Input/Output register address - * for a pin. - */ +static void +nct_io_set_group(struct nct_softc *sc, int group) +{ + + GPIO_ASSERT_LOCKED(sc); + if (group != sc->curgrp) { + bus_write_1(sc->iores, NCT_IO_GSR, group); + sc->curgrp = group; + } +} + static uint8_t -nct_ior_addr(uint32_t pin_num) +nct_io_read(struct nct_softc *sc, int group, uint8_t reg) { - uint8_t addr; + nct_io_set_group(sc, group); + return (bus_read_1(sc->iores, reg)); +} - addr = NCT_LD7_GPIO0_IOR; - if (pin_num > 7) - addr = NCT_LD7_GPIO1_IOR; +static void +nct_io_write(struct nct_softc *sc, int group, uint8_t reg, uint8_t val) +{ + nct_io_set_group(sc, group); + return (bus_write_1(sc->iores, reg, val)); +} - return (addr); +static uint8_t +nct_get_ioreg(struct nct_softc *sc, reg_t reg, int group) +{ + uint8_t ioreg; + + if (sc->iores != NULL) + ioreg = NCT_IO_IOR + reg; + else if (group == 0) + ioreg = NCT_LD7_GPIO0_IOR + reg; + else + ioreg = NCT_LD7_GPIO1_IOR + reg; + return (ioreg); } -/* - * Get the GPIO Data register address for a pin. - */ static uint8_t -nct_dat_addr(uint32_t pin_num) +nct_read_reg(struct nct_softc *sc, reg_t reg, int group) { - uint8_t addr; + uint8_t ioreg; + uint8_t val; - addr = NCT_LD7_GPIO0_DAT; - if (pin_num > 7) - addr = NCT_LD7_GPIO1_DAT; + ioreg = nct_get_ioreg(sc, reg, group); + if (sc->iores != NULL) + val = nct_io_read(sc, group, ioreg); + else + val = superio_read(sc->dev, ioreg); - return (addr); + return (val); } -/* - * Get the GPIO Inversion register address - * for a pin. - */ -static uint8_t -nct_inv_addr(uint32_t pin_num) +#define GET_BIT(v, b) (((v) >> (b)) & 1) +static bool +nct_get_pin_reg(struct nct_softc *sc, reg_t reg, uint32_t pin_num) { - uint8_t addr; + uint8_t bit; + uint8_t group; + uint8_t val; - addr = NCT_LD7_GPIO0_INV; - if (pin_num > 7) - addr = NCT_LD7_GPIO1_INV; + KASSERT(NCT_IS_VALID_PIN(pin_num), ("%s: invalid pin number %d", + __func__, pin_num)); - return (addr); + group = pin_num >> 3; + bit = pin_num & 7; + val = nct_read_reg(sc, reg, group); + return (GET_BIT(val, bit)); } -/* - * Get the GPIO Output Configuration/Mode - * register address for a pin. - */ -static uint8_t -nct_outcfg_addr(uint32_t pin_num) +static int +nct_get_pin_cache(struct nct_softc *sc, uint32_t pin_num, uint8_t *cache) { - uint8_t addr; + uint8_t bit; + uint8_t group; + uint8_t val; - addr = NCT_LDF_GPIO0_OUTCFG; - if (pin_num > 7) - addr = NCT_LDF_GPIO1_OUTCFG; + KASSERT(NCT_IS_VALID_PIN(pin_num), ("%s: invalid pin number %d", + __func__, pin_num)); - return (addr); + group = pin_num >> 3; + bit = pin_num & 7; + val = cache[group]; + return (GET_BIT(val, bit)); } -/* - * Set a pin to output mode. - */ static void -nct_set_pin_is_output(struct nct_softc *sc, uint32_t pin_num) +nct_write_reg(struct nct_softc *sc, reg_t reg, int group, uint8_t val) { - uint8_t reg; - uint8_t ior; + uint8_t ioreg; - reg = nct_ior_addr(pin_num); - ior = superio_read(sc->dev, reg); - ior &= ~(NCT_PIN_BIT(pin_num)); - superio_write(sc->dev, reg, ior); + ioreg = nct_get_ioreg(sc, reg, group); + if (sc->iores != NULL) + nct_io_write(sc, group, ioreg, val); + else + superio_write(sc->dev, ioreg, val); } +static void +nct_set_pin_reg(struct nct_softc *sc, reg_t reg, uint32_t pin_num, bool val) +{ + uint8_t *cache; + uint8_t bit; + uint8_t bitval; + uint8_t group; + uint8_t mask; + + KASSERT(NCT_IS_VALID_PIN(pin_num), + ("%s: invalid pin number %d", __func__, pin_num)); + KASSERT(reg == REG_IOR || reg == REG_INV, + ("%s: unsupported register %d", __func__, reg)); + + group = pin_num >> 3; + bit = pin_num & 7; + mask = (uint8_t)1 << bit; + bitval = (uint8_t)val << bit; + + if (reg == REG_IOR) + cache = &sc->cache.ior[group]; + else + cache = &sc->cache.inv[group]; + if ((*cache & mask) == bitval) + return; + *cache &= ~mask; + *cache |= bitval; + nct_write_reg(sc, reg, group, *cache); +} + /* - * Set a pin to input mode. + * Set a pin to input (val is true) or output (val is false) mode. */ static void -nct_set_pin_is_input(struct nct_softc *sc, uint32_t pin_num) +nct_set_pin_input(struct nct_softc *sc, uint32_t pin_num, bool val) { - uint8_t reg; - uint8_t ior; - - reg = nct_ior_addr(pin_num); - ior = superio_read(sc->dev, reg); - ior |= NCT_PIN_BIT(pin_num); - superio_write(sc->dev, reg, ior); + nct_set_pin_reg(sc, REG_IOR, pin_num, val); } /* @@ -212,80 +285,98 @@ nct_set_pin_is_input(struct nct_softc *sc, uint32_t pi static bool nct_pin_is_input(struct nct_softc *sc, uint32_t pin_num) { - uint8_t reg; - uint8_t ior; + return (nct_get_pin_cache(sc, pin_num, sc->cache.ior)); +} - reg = nct_ior_addr(pin_num); - ior = superio_read(sc->dev, reg); +/* + * Set a pin to inverted (val is true) or normal (val is false) mode. + */ +static void +nct_set_pin_inverted(struct nct_softc *sc, uint32_t pin_num, bool val) +{ + nct_set_pin_reg(sc, REG_INV, pin_num, val); +} - return (ior & NCT_PIN_BIT(pin_num)); +static bool +nct_pin_is_inverted(struct nct_softc *sc, uint32_t pin_num) +{ + return (nct_get_pin_cache(sc, pin_num, sc->cache.inv)); } /* * Write a value to an output pin. + * NB: the hardware remembers last output value across switching from + * output mode to input mode and back. + * Writes to a pin in input mode are not allowed here as they cannot + * have any effect and would corrupt the output value cache. */ static void -nct_write_pin(struct nct_softc *sc, uint32_t pin_num, uint8_t data) +nct_write_pin(struct nct_softc *sc, uint32_t pin_num, bool val) { - uint8_t reg; - uint8_t value; + uint8_t bit; + uint8_t group; - reg = nct_dat_addr(pin_num); - value = superio_read(sc->dev, reg); - if (data) - value |= NCT_PIN_BIT(pin_num); + KASSERT(!nct_pin_is_input(sc, pin_num), ("attempt to write input pin")); + group = pin_num >> 3; + bit = pin_num & 7; + if (GET_BIT(sc->cache.out_known[group], bit) && + GET_BIT(sc->cache.out[group], bit) == val) { + /* The pin is already in requested state. */ + return; + } + sc->cache.out_known[group] |= 1 << bit; + if (val) + sc->cache.out[group] |= 1 << bit; else - value &= ~(NCT_PIN_BIT(pin_num)); - - superio_write(sc->dev, reg, value); + sc->cache.out[group] &= ~(1 << bit); + nct_write_reg(sc, REG_DAT, group, sc->cache.out[group]); } +/* + * NB: state of an input pin cannot be cached, of course. + * For an output we can either take the value from the cache if it's valid + * or read the state from the hadrware and cache it. + */ static bool nct_read_pin(struct nct_softc *sc, uint32_t pin_num) { - uint8_t reg; + uint8_t bit; + uint8_t group; + bool val; - reg = nct_dat_addr(pin_num); + if (nct_pin_is_input(sc, pin_num)) + return (nct_get_pin_reg(sc, REG_DAT, pin_num)); - return (superio_read(sc->dev, reg) & NCT_PIN_BIT(pin_num)); -} + group = pin_num >> 3; + bit = pin_num & 7; + if (GET_BIT(sc->cache.out_known[group], bit)) + return (GET_BIT(sc->cache.out[group], bit)); -static void -nct_set_pin_is_inverted(struct nct_softc *sc, uint32_t pin_num) -{ - uint8_t reg; - uint8_t inv; - - reg = nct_inv_addr(pin_num); - inv = superio_read(sc->dev, reg); - inv |= (NCT_PIN_BIT(pin_num)); - superio_write(sc->dev, reg, inv); + val = nct_get_pin_reg(sc, REG_DAT, pin_num); + sc->cache.out_known[group] |= 1 << bit; + if (val) + sc->cache.out[group] |= 1 << bit; + else + sc->cache.out[group] &= ~(1 << bit); + return (val); } -static void -nct_set_pin_not_inverted(struct nct_softc *sc, uint32_t pin_num) +static uint8_t +nct_outcfg_addr(uint32_t pin_num) { - uint8_t reg; - uint8_t inv; - - reg = nct_inv_addr(pin_num); - inv = superio_read(sc->dev, reg); - inv &= ~(NCT_PIN_BIT(pin_num)); - superio_write(sc->dev, reg, inv); + KASSERT(NCT_IS_VALID_PIN(pin_num), ("%s: invalid pin number %d", + __func__, pin_num)); + if ((pin_num >> 3) == 0) + return (NCT_LDF_GPIO0_OUTCFG); + else + return (NCT_LDF_GPIO1_OUTCFG); } -static bool -nct_pin_is_inverted(struct nct_softc *sc, uint32_t pin_num) -{ - uint8_t reg; - uint8_t inv; - - reg = nct_inv_addr(pin_num); - inv = superio_read(sc->dev, reg); - - return (inv & NCT_PIN_BIT(pin_num)); -} - +/* + * NB: PP/OD can be configured only via configuration registers. + * Also, the registers are in a different logical device. + * So, this is a special case. No caching too. + */ static void nct_set_pin_opendrain(struct nct_softc *sc, uint32_t pin_num) { @@ -353,6 +444,9 @@ static int nct_attach(device_t dev) { struct nct_softc *sc; + device_t dev_8; + uint16_t iobase; + int err; int i; sc = device_get_softc(dev); @@ -364,12 +458,67 @@ nct_attach(device_t dev) return (ENXIO); } + /* + * As strange as it may seem, I/O port base is configured in the + * Logical Device 8 which is primarily used for WDT, but also plays + * a role in GPIO configuration. + */ + iobase = 0; + dev_8 = superio_find_dev(device_get_parent(dev), SUPERIO_DEV_WDT, 8); + if (dev_8 != NULL) + iobase = superio_get_iobase(dev_8); + if (iobase != 0 && iobase != 0xffff) { + sc->curgrp = -1; + sc->iorid = 0; + err = bus_set_resource(dev, SYS_RES_IOPORT, sc->iorid, + iobase, 7); + if (err == 0) { + sc->iores = bus_alloc_resource_any(dev, SYS_RES_IOPORT, + &sc->iorid, RF_ACTIVE); + if (sc->iores == NULL) { + device_printf(dev, "can't map i/o space, " + "iobase=0x%04x\n", iobase); + } + } else { + device_printf(dev, + "failed to set io port resource at 0x%x\n", iobase); + } + } + /* Enable gpio0 and gpio1. */ superio_dev_enable(dev, 0x03); GPIO_LOCK_INIT(sc); GPIO_LOCK(sc); + sc->cache.inv[0] = nct_read_reg(sc, REG_INV, 0); + sc->cache.inv[1] = nct_read_reg(sc, REG_INV, 1); + sc->cache.ior[0] = nct_read_reg(sc, REG_IOR, 0); + sc->cache.ior[1] = nct_read_reg(sc, REG_IOR, 1); + + /* + * Caching input values is meaningless as an input can be changed at any + * time by an external agent. But outputs are controlled by this + * driver, so it can cache their state. Also, the hardware remembers + * the output state of a pin when the pin is switched to input mode and + * then back to output mode. So, the cache stays valid. + * The only problem is with pins that are in input mode at the attach + * time. For them the output state is not known until it is set by the + * driver for the first time. + * 'out' and 'out_known' bits form a tri-state output cache: + * |-----+-----------+---------| + * | out | out_known | cache | + * |-----+-----------+---------| + * | X | 0 | invalid | + * | 0 | 1 | 0 | + * | 1 | 1 | 1 | + * |-----+-----------+---------| + */ + sc->cache.out[0] = nct_read_reg(sc, REG_DAT, 0); + sc->cache.out[1] = nct_read_reg(sc, REG_DAT, 1); + sc->cache.out_known[0] = ~sc->cache.ior[0]; + sc->cache.out_known[1] = ~sc->cache.ior[1]; + for (i = 0; i <= NCT_MAX_PIN; i++) { struct gpio_pin *pin; @@ -398,7 +547,6 @@ nct_attach(device_t dev) sc->busdev = gpiobus_attach_bus(dev); if (sc->busdev == NULL) { - GPIO_ASSERT_UNLOCKED(sc); GPIO_LOCK_DESTROY(sc); return (ENXIO); } @@ -414,6 +562,8 @@ nct_detach(device_t dev) sc = device_get_softc(dev); gpiobus_detach_bus(dev); + if (sc->iores != NULL) + bus_release_resource(dev, SYS_RES_IOPORT, sc->iorid, sc->iores); GPIO_ASSERT_UNLOCKED(sc); GPIO_LOCK_DESTROY(sc); @@ -447,8 +597,11 @@ nct_gpio_pin_set(device_t dev, uint32_t pin_num, uint3 return (EINVAL); sc = device_get_softc(dev); - GPIO_ASSERT_UNLOCKED(sc); GPIO_LOCK(sc); + if ((sc->pins[pin_num].gp_flags & GPIO_PIN_OUTPUT) == 0) { + GPIO_UNLOCK(sc); + return (EINVAL); + } nct_write_pin(sc, pin_num, pin_value); GPIO_UNLOCK(sc); @@ -483,6 +636,10 @@ nct_gpio_pin_toggle(device_t dev, uint32_t pin_num) sc = device_get_softc(dev); GPIO_ASSERT_UNLOCKED(sc); GPIO_LOCK(sc); + if ((sc->pins[pin_num].gp_flags & GPIO_PIN_OUTPUT) == 0) { + GPIO_UNLOCK(sc); + return (EINVAL); + } if (nct_read_pin(sc, pin_num)) nct_write_pin(sc, pin_num, 0); else @@ -558,53 +715,41 @@ nct_gpio_pin_setflags(device_t dev, uint32_t pin_num, if ((flags & pin->gp_caps) != flags) return (EINVAL); - GPIO_ASSERT_UNLOCKED(sc); - GPIO_LOCK(sc); - if (flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) { - if ((flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) == - (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) { - GPIO_UNLOCK(sc); - return (EINVAL); - } - - if (flags & GPIO_PIN_INPUT) - nct_set_pin_is_input(sc, pin_num); - else - nct_set_pin_is_output(sc, pin_num); + if ((flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) == + (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) { + return (EINVAL); } - - if (flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) { - if (flags & GPIO_PIN_INPUT) { - GPIO_UNLOCK(sc); + if ((flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) == + (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) { return (EINVAL); - } + } + if ((flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) == + (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) { + return (EINVAL); + } - if ((flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) == - (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) { - GPIO_UNLOCK(sc); - return (EINVAL); - } - + GPIO_ASSERT_UNLOCKED(sc); + GPIO_LOCK(sc); + if ((flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) != 0) { + nct_set_pin_input(sc, pin_num, (flags & GPIO_PIN_INPUT) != 0); + pin->gp_flags &= ~(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT); + pin->gp_flags |= flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT); + } + if ((flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) != 0) { + nct_set_pin_inverted(sc, pin_num, + (flags & GPIO_PIN_INVIN) != 0); + pin->gp_flags &= ~(GPIO_PIN_INVIN | GPIO_PIN_INVOUT); + pin->gp_flags |= flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT); + } + if ((flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) != 0) { if (flags & GPIO_PIN_OPENDRAIN) nct_set_pin_opendrain(sc, pin_num); else nct_set_pin_pushpull(sc, pin_num); + pin->gp_flags &= ~(GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL); + pin->gp_flags |= + flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL); } - - if (flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) { - if ((flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) != - (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) { - GPIO_UNLOCK(sc); - return (EINVAL); - } - - if (flags & GPIO_PIN_INVIN) - nct_set_pin_is_inverted(sc, pin_num); - else - nct_set_pin_not_inverted(sc, pin_num); - } - - pin->gp_flags = flags; GPIO_UNLOCK(sc); return (0); From owner-svn-src-stable-12@freebsd.org Wed Nov 20 08:44:30 2019 Return-Path: Delivered-To: svn-src-stable-12@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 778EB1AEC1D; Wed, 20 Nov 2019 08:44:30 +0000 (UTC) (envelope-from avg@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Hx7y2S9Zz4Wh7; Wed, 20 Nov 2019 08:44:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 373842030F; Wed, 20 Nov 2019 08:44:30 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAK8iULp002554; Wed, 20 Nov 2019 08:44:30 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAK8iTDi002550; Wed, 20 Nov 2019 08:44:29 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911200844.xAK8iTDi002550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 20 Nov 2019 08:44:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354884 - stable/12/usr.sbin/mpsutil X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/usr.sbin/mpsutil X-SVN-Commit-Revision: 354884 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 08:44:30 -0000 Author: avg Date: Wed Nov 20 08:44:29 2019 New Revision: 354884 URL: https://svnweb.freebsd.org/changeset/base/354884 Log: MFC r351812: mpsutil slot set status It allows to set the status of an enclosure slot. Practically, this means controlling whatever slot status LEDs the enclosure provides. At present, the new command does not have sanity checks or any conveniences. That means that it is possible to issue the command for an invalid slot and an enclosure. But the worst I have seen happening is either the command failing or simply being ignored. Also, at the moment, the status has to be specified as a numeric bit mask. The bit definitions can be found in sys/dev/mps/mpi/mpi2_init.h, they are prefixed with MPI2_SEP_REQ_SLOTSTATUS_. The only way to address a slot is by the enclosure handle and the slot number. Both are readily available from mpsutil show commands. The new command is useful alternative to 'sas2ircu locate' command. First, sas2ircu is a proprietary blob. Second, it supports setting only locate / identify status bit. Added: stable/12/usr.sbin/mpsutil/mps_slot.c - copied unchanged from r351812, head/usr.sbin/mpsutil/mps_slot.c Modified: stable/12/usr.sbin/mpsutil/Makefile stable/12/usr.sbin/mpsutil/mps_cmd.c stable/12/usr.sbin/mpsutil/mpsutil.h Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/mpsutil/Makefile ============================================================================== --- stable/12/usr.sbin/mpsutil/Makefile Wed Nov 20 08:41:01 2019 (r354883) +++ stable/12/usr.sbin/mpsutil/Makefile Wed Nov 20 08:44:29 2019 (r354884) @@ -1,7 +1,7 @@ # $FreeBSD$ PROG= mpsutil -SRCS= mps_cmd.c mps_debug.c mps_flash.c mps_show.c mpsutil.c +SRCS= mps_cmd.c mps_debug.c mps_flash.c mps_show.c mps_slot.c mpsutil.c MAN= mpsutil.8 WARNS?= 3 Modified: stable/12/usr.sbin/mpsutil/mps_cmd.c ============================================================================== --- stable/12/usr.sbin/mpsutil/mps_cmd.c Wed Nov 20 08:41:01 2019 (r354883) +++ stable/12/usr.sbin/mpsutil/mps_cmd.c Wed Nov 20 08:44:29 2019 (r354884) @@ -283,6 +283,29 @@ mps_map_btdh(int fd, uint16_t *devhandle, uint16_t *bu } int +mps_set_slot_status(int fd, U16 handle, U16 slot, U32 status) +{ + MPI2_SEP_REQUEST req; + MPI2_SEP_REPLY reply; + + bzero(&req, sizeof(req)); + req.Function = MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR; + req.Action = MPI2_SEP_REQ_ACTION_WRITE_STATUS; + req.Flags = MPI2_SEP_REQ_FLAGS_ENCLOSURE_SLOT_ADDRESS; + req.EnclosureHandle = handle; + req.Slot = slot; + req.SlotStatus = status; + + if (mps_pass_command(fd, &req, sizeof(req), &reply, sizeof(reply), + NULL, 0, NULL, 0, 30) != 0) + return (errno); + + if (!IOC_STATUS_SUCCESS(reply.IOCStatus)) + return (EIO); + return (0); +} + +int mps_read_config_page_header(int fd, U8 PageType, U8 PageNumber, U32 PageAddress, MPI2_CONFIG_PAGE_HEADER *header, U16 *IOCStatus) { Copied: stable/12/usr.sbin/mpsutil/mps_slot.c (from r351812, head/usr.sbin/mpsutil/mps_slot.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/usr.sbin/mpsutil/mps_slot.c Wed Nov 20 08:44:29 2019 (r354884, copy of r351812, head/usr.sbin/mpsutil/mps_slot.c) @@ -0,0 +1,114 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Andriy Gapon + * + * 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 +__RCSID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mpsutil.h" + +MPS_TABLE(top, slot); + +static int +slot_set(int argc, char **argv) +{ + char *endptr; + unsigned long ux; + long x; + int error; + int fd; + U32 status; + U16 handle; + U16 slot; + + if (argc != 5) { + warnx("Incorrect number of arguments"); + return (EINVAL); + } + + if (strcmp(argv[1], "status") != 0) { + warnx("Invalid argument '%s', expecting 'status'", + argv[1]); + return (EINVAL); + } + + errno = 0; + x = strtol(argv[2], &endptr, 0); + if (*endptr != '\0' || errno != 0 || x < 0 || x > UINT16_MAX) { + warnx("Invalid enclosure handle argument '%s'", argv[2]); + return (EINVAL); + } + handle = x; + + errno = 0; + x = strtol(argv[3], &endptr, 0); + if (*endptr != '\0' || errno != 0 || x < 0 || x > UINT16_MAX) { + warnx("Invalid slot argument '%s'", argv[3]); + return (EINVAL); + } + slot = x; + + errno = 0; + ux = strtoul(argv[4], &endptr, 0); + if (*endptr != '\0' || errno != 0 || ux > UINT32_MAX) { + warnx("Invalid status argument '%s'", argv[4]); + return (EINVAL); + } + status = ux; + + fd = mps_open(mps_unit); + if (fd < 0) { + error = errno; + warn("mps_open"); + return (error); + } + + if (mps_set_slot_status(fd, handle, slot, status) != 0) { + warnx("Failed to set status"); + close(fd); + return (1); + } + + close(fd); + printf("Successfully set slot status\n"); + return (0); +} + +MPS_COMMAND(slot, set, slot_set, "status " + "", "Set status of the slot in the directly attached enclosure"); Modified: stable/12/usr.sbin/mpsutil/mpsutil.h ============================================================================== --- stable/12/usr.sbin/mpsutil/mpsutil.h Wed Nov 20 08:41:01 2019 (r354883) +++ stable/12/usr.sbin/mpsutil/mpsutil.h Wed Nov 20 08:44:29 2019 (r354884) @@ -128,6 +128,7 @@ int mps_map_btdh(int fd, uint16_t *devhandle, uint16_t const char *mps_ioc_status(U16 IOCStatus); int mps_firmware_send(int fd, unsigned char *buf, uint32_t len, bool bios); int mps_firmware_get(int fd, unsigned char **buf, bool bios); +int mps_set_slot_status(int fd, U16 handle, U16 slot, U32 status); static __inline void * mps_read_man_page(int fd, U8 PageNumber, U16 *IOCStatus) From owner-svn-src-stable-12@freebsd.org Wed Nov 20 10:25:50 2019 Return-Path: Delivered-To: svn-src-stable-12@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 DF82E1B1BDD; Wed, 20 Nov 2019 10:25:50 +0000 (UTC) (envelope-from kib@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HzNt5ZlDz4cML; Wed, 20 Nov 2019 10:25:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2F982151E; Wed, 20 Nov 2019 10:25:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKAPoKU061888; Wed, 20 Nov 2019 10:25:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKAPoxm061887; Wed, 20 Nov 2019 10:25:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911201025.xAKAPoxm061887@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 20 Nov 2019 10:25:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354887 - stable/12/sys/amd64/amd64 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/amd64/amd64 X-SVN-Commit-Revision: 354887 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 10:25:50 -0000 Author: kib Date: Wed Nov 20 10:25:50 2019 New Revision: 354887 URL: https://svnweb.freebsd.org/changeset/base/354887 Log: MFC r354788: amd64 copyout: remove irrelevant comment. Modified: stable/12/sys/amd64/amd64/support.S Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/support.S ============================================================================== --- stable/12/sys/amd64/amd64/support.S Wed Nov 20 08:56:01 2019 (r354886) +++ stable/12/sys/amd64/amd64/support.S Wed Nov 20 10:25:50 2019 (r354887) @@ -671,13 +671,7 @@ END(fillw) movq $copy_fault,PCB_ONFAULT(%r11) /* - * Check explicitly for non-user addresses. If 486 write protection - * is being used, this check is essential because we are in kernel - * mode so the h/w does not provide any protection against writing - * kernel addresses. - */ - - /* + * Check explicitly for non-user addresses. * First, prevent address wrapping. */ movq %rsi,%rax From owner-svn-src-stable-12@freebsd.org Wed Nov 20 10:27:44 2019 Return-Path: Delivered-To: svn-src-stable-12@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 2286B1B1C9B; Wed, 20 Nov 2019 10:27:44 +0000 (UTC) (envelope-from kib@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47HzR409P9z4cVJ; Wed, 20 Nov 2019 10:27:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE3F321520; Wed, 20 Nov 2019 10:27:43 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKARho6062019; Wed, 20 Nov 2019 10:27:43 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKARhRq062018; Wed, 20 Nov 2019 10:27:43 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201911201027.xAKARhRq062018@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 20 Nov 2019 10:27:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354888 - stable/12/lib/libc/gen X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/lib/libc/gen X-SVN-Commit-Revision: 354888 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 10:27:44 -0000 Author: kib Date: Wed Nov 20 10:27:43 2019 New Revision: 354888 URL: https://svnweb.freebsd.org/changeset/base/354888 Log: MFC r354787: Document required size of buffer for elf_aux_info(3). Modified: stable/12/lib/libc/gen/auxv.3 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/gen/auxv.3 ============================================================================== --- stable/12/lib/libc/gen/auxv.3 Wed Nov 20 10:25:50 2019 (r354887) +++ stable/12/lib/libc/gen/auxv.3 Wed Nov 20 10:27:43 2019 (r354888) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 25, 2019 +.Dd November 17, 2019 .Dt ELF_AUX_INFO 3 .Os .Sh NAME @@ -44,24 +44,35 @@ function retrieves the auxiliary info vector requested The information is stored into the provided buffer if it will fit. The following values, defined in .In sys/elf_common.h -can be requested: +can be requested (corresponding buffer sizes are specified in parenthesis): .Bl -tag -width AT_OSRELDATE .It AT_CANARY -The canary value for SSP. +The canary value for SSP (arbitrary sized buffer, as many bytes are +returned as it fits into it, rest is zeroed). .It AT_HWCAP -CPU / hardware feature flags. +CPU / hardware feature flags +.Dv (sizeof(u_long)). .It AT_HWCAP2 -CPU / hardware feature flags. +CPU / hardware feature flags +.Dv (sizeof(u_long)). .It AT_NCPUS -Number of CPUs. +Number of CPUs +.Dv (sizeof(int)). .It AT_OSRELDATE -Kernel OSRELDATE. +The +.Dv OSRELDATE +of the kernel or jail the program is running on +.Dv (sizeof(int)). .It AT_PAGESIZES -Vector of page sizes. +Vector of page sizes (arbitrary sized buffer, as many elements of the +.Dv pagesizes +array are returned as it fits). .It AT_PAGESZ -Page size in bytes. +Page size in bytes +.Dv (sizeof(int)). .It AT_TIMEKEEP -Pointer to VDSO timehands (for library internal use). +Pointer to VDSO timehands (for library internal use, +.Dv sizeof(void *)). .El .Sh RETURN VALUES Returns zero on success, or an error number on failure. From owner-svn-src-stable-12@freebsd.org Wed Nov 20 23:09:22 2019 Return-Path: Delivered-To: svn-src-stable-12@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 7FA721C4DE2; Wed, 20 Nov 2019 23:09:22 +0000 (UTC) (envelope-from brooks@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JJKt2lV1z4VD2; Wed, 20 Nov 2019 23:09:22 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 419F41F6E; Wed, 20 Nov 2019 23:09:22 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKN9MJv015463; Wed, 20 Nov 2019 23:09:22 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKN9Mha015462; Wed, 20 Nov 2019 23:09:22 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911202309.xAKN9Mha015462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 20 Nov 2019 23:09:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354921 - stable/12/sys/mips/mips X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/sys/mips/mips X-SVN-Commit-Revision: 354921 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 23:09:22 -0000 Author: brooks Date: Wed Nov 20 23:09:21 2019 New Revision: 354921 URL: https://svnweb.freebsd.org/changeset/base/354921 Log: MFC r354688: Fix a typo in the PMAP_PTE_SET_CACHE_BITS macro. The second argument should have been "pa" not "ps". It worked by accident because the argument was always "pa" which was an in-scope local variable. Submitted by: sson Reviewed by: jhb, kevans Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22338 Modified: stable/12/sys/mips/mips/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/mips/mips/pmap.c ============================================================================== --- stable/12/sys/mips/mips/pmap.c Wed Nov 20 22:25:49 2019 (r354920) +++ stable/12/sys/mips/mips/pmap.c Wed Nov 20 23:09:21 2019 (r354921) @@ -323,7 +323,7 @@ pmap_pte_cache_bits(vm_paddr_t pa, vm_page_t m) ma = VM_MEMATTR_UNCACHEABLE; return PTE_C(ma); } -#define PMAP_PTE_SET_CACHE_BITS(pte, ps, m) { \ +#define PMAP_PTE_SET_CACHE_BITS(pte, pa, m) { \ pte &= ~PTE_C_MASK; \ pte |= pmap_pte_cache_bits(pa, m); \ } From owner-svn-src-stable-12@freebsd.org Wed Nov 20 23:49:48 2019 Return-Path: Delivered-To: svn-src-stable-12@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 DAD851C5BFC; Wed, 20 Nov 2019 23:49:48 +0000 (UTC) (envelope-from mav@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JKDX5Bssz4XG9; Wed, 20 Nov 2019 23:49:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 912A42695; Wed, 20 Nov 2019 23:49:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAKNnmXk039061; Wed, 20 Nov 2019 23:49:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAKNnmu3039059; Wed, 20 Nov 2019 23:49:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201911202349.xAKNnmu3039059@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 20 Nov 2019 23:49:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354923 - stable/12/sys/dev/ahci X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/ahci X-SVN-Commit-Revision: 354923 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Nov 2019 23:49:48 -0000 Author: mav Date: Wed Nov 20 23:49:47 2019 New Revision: 354923 URL: https://svnweb.freebsd.org/changeset/base/354923 Log: MFC r351589: Fix AHCI Enclosure Management, broken by r351356. ivars value of -1 was used to distinguish EM device, and r351356 left some wrong checks for it. Give EM device separate flag there instead. Modified: stable/12/sys/dev/ahci/ahci.c stable/12/sys/dev/ahci/ahci.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ahci/ahci.c ============================================================================== --- stable/12/sys/dev/ahci/ahci.c Wed Nov 20 23:45:31 2019 (r354922) +++ stable/12/sys/dev/ahci/ahci.c Wed Nov 20 23:49:47 2019 (r354923) @@ -362,7 +362,7 @@ ahci_attach(device_t dev) if (child == NULL) device_printf(dev, "failed to add enclosure device\n"); else - device_set_ivars(child, (void *)(intptr_t)-1); + device_set_ivars(child, (void *)(intptr_t)AHCI_EM_UNIT); } bus_generic_attach(dev); return (0); @@ -562,23 +562,25 @@ ahci_alloc_resource(device_t dev, device_t child, int struct resource *res; rman_res_t st; int offset, size, unit; - bool is_remapped; + bool is_em, is_remapped; unit = (intptr_t)device_get_ivars(child); + is_em = is_remapped = false; if (unit & AHCI_REMAPPED_UNIT) { - unit &= ~AHCI_REMAPPED_UNIT; + unit &= AHCI_UNIT; unit -= ctlr->channels; is_remapped = true; - } else - is_remapped = false; + } else if (unit & AHCI_EM_UNIT) { + unit &= AHCI_UNIT; + is_em = true; + } res = NULL; switch (type) { case SYS_RES_MEMORY: if (is_remapped) { offset = ctlr->remap_offset + unit * ctlr->remap_size; size = ctlr->remap_size; - } - else if (unit >= 0) { + } else if (!is_em) { offset = AHCI_OFFSET + (unit << 7); size = 128; } else if (*rid == 0) { @@ -639,7 +641,7 @@ ahci_setup_intr(device_t dev, device_t child, struct r void *argument, void **cookiep) { struct ahci_controller *ctlr = device_get_softc(dev); - int unit = (intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; + int unit = (intptr_t)device_get_ivars(child) & AHCI_UNIT; if (filter != NULL) { printf("ahci.c: we cannot use a filter here\n"); @@ -655,7 +657,7 @@ ahci_teardown_intr(device_t dev, device_t child, struc void *cookie) { struct ahci_controller *ctlr = device_get_softc(dev); - int unit = (intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; + int unit = (intptr_t)device_get_ivars(child) & AHCI_UNIT; ctlr->interrupt[unit].function = NULL; ctlr->interrupt[unit].argument = NULL; @@ -665,12 +667,13 @@ ahci_teardown_intr(device_t dev, device_t child, struc int ahci_print_child(device_t dev, device_t child) { - int retval, channel; + intptr_t ivars; + int retval; retval = bus_print_child_header(dev, child); - channel = (int)(intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; - if (channel >= 0) - retval += printf(" at channel %d", channel); + ivars = (intptr_t)device_get_ivars(child); + if ((ivars & AHCI_EM_UNIT) == 0) + retval += printf(" at channel %d", (int)ivars & AHCI_UNIT); retval += bus_print_child_footer(dev, child); return (retval); } @@ -679,11 +682,11 @@ int ahci_child_location_str(device_t dev, device_t child, char *buf, size_t buflen) { - int channel; + intptr_t ivars; - channel = (int)(intptr_t)device_get_ivars(child) & ~AHCI_REMAPPED_UNIT; - if (channel >= 0) - snprintf(buf, buflen, "channel=%d", channel); + ivars = (intptr_t)device_get_ivars(child); + if ((ivars & AHCI_EM_UNIT) == 0) + snprintf(buf, buflen, "channel=%d", (int)ivars & AHCI_UNIT); return (0); } Modified: stable/12/sys/dev/ahci/ahci.h ============================================================================== --- stable/12/sys/dev/ahci/ahci.h Wed Nov 20 23:45:31 2019 (r354922) +++ stable/12/sys/dev/ahci/ahci.h Wed Nov 20 23:49:47 2019 (r354923) @@ -319,9 +319,10 @@ /* Total main work area. */ #define AHCI_WORK_SIZE (AHCI_CT_OFFSET + AHCI_CT_SIZE * ch->numslots) - -/* NVMe remapped device */ -#define AHCI_REMAPPED_UNIT (1 << 31) +/* ivars value fields */ +#define AHCI_REMAPPED_UNIT (1 << 31) /* NVMe remapped device. */ +#define AHCI_EM_UNIT (1 << 30) /* Enclosure Mgmt device. */ +#define AHCI_UNIT 0xff /* Channel number. */ struct ahci_dma_prd { u_int64_t dba; From owner-svn-src-stable-12@freebsd.org Thu Nov 21 00:34:41 2019 Return-Path: Delivered-To: svn-src-stable-12@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 2D5ED1C719D; Thu, 21 Nov 2019 00:34:41 +0000 (UTC) (envelope-from markj@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JLDK18B9z4Zqt; Thu, 21 Nov 2019 00:34:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09E202F98; Thu, 21 Nov 2019 00:34:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL0Yes7068457; Thu, 21 Nov 2019 00:34:40 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL0YeFW068452; Thu, 21 Nov 2019 00:34:40 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201911210034.xAL0YeFW068452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 21 Nov 2019 00:34:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354927 - in stable/12: share/man/man4 sys/conf sys/contrib/dev/iwm sys/dev/iwm sys/modules/iwm sys/modules/iwmfw sys/modules/iwmfw/iwm9000fw sys/modules/iwmfw/iwm9260fw X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/conf sys/contrib/dev/iwm sys/dev/iwm sys/modules/iwm sys/modules/iwmfw sys/modules/iwmfw/iwm9000fw sys/modules/iwmfw/iwm9260fw X-SVN-Commit-Revision: 354927 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 00:34:41 -0000 Author: markj Date: Thu Nov 21 00:34:39 2019 New Revision: 354927 URL: https://svnweb.freebsd.org/changeset/base/354927 Log: MFC r354201, r354276, r354492-r354517, r354562: Add firmware images and support for Intel 9000-series devices. Added: stable/12/sys/contrib/dev/iwm/iwm-9000-34.fw.uu - copied unchanged from r354276, head/sys/contrib/dev/iwm/iwm-9000-34.fw.uu stable/12/sys/contrib/dev/iwm/iwm-9260-34.fw.uu - copied unchanged from r354276, head/sys/contrib/dev/iwm/iwm-9260-34.fw.uu stable/12/sys/dev/iwm/if_iwm_9000.c - copied, changed from r354504, head/sys/dev/iwm/if_iwm_9000.c stable/12/sys/dev/iwm/if_iwm_9260.c - copied, changed from r354504, head/sys/dev/iwm/if_iwm_9260.c stable/12/sys/modules/iwmfw/iwm9000fw/ - copied from r354201, head/sys/modules/iwmfw/iwm9000fw/ stable/12/sys/modules/iwmfw/iwm9260fw/ - copied from r354201, head/sys/modules/iwmfw/iwm9260fw/ Modified: stable/12/share/man/man4/iwm.4 stable/12/share/man/man4/iwmfw.4 stable/12/sys/conf/files stable/12/sys/dev/iwm/if_iwm.c stable/12/sys/dev/iwm/if_iwm_config.h stable/12/sys/dev/iwm/if_iwm_pcie_trans.c stable/12/sys/dev/iwm/if_iwm_pcie_trans.h stable/12/sys/dev/iwm/if_iwm_scan.c stable/12/sys/dev/iwm/if_iwm_sta.c stable/12/sys/dev/iwm/if_iwmreg.h stable/12/sys/dev/iwm/if_iwmvar.h stable/12/sys/modules/iwm/Makefile stable/12/sys/modules/iwmfw/Makefile stable/12/sys/modules/iwmfw/iwm9000fw/Makefile stable/12/sys/modules/iwmfw/iwm9260fw/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/iwm.4 ============================================================================== --- stable/12/share/man/man4/iwm.4 Thu Nov 21 00:17:14 2019 (r354926) +++ stable/12/share/man/man4/iwm.4 Thu Nov 21 00:34:39 2019 (r354927) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 29, 2017 +.Dd November 7, 2019 .Dt IWM 4 .Os .Sh NAME @@ -51,6 +51,8 @@ Choose one from: .Cd "device iwm7265fw" .Cd "device iwm8000Cfw" .Cd "device iwm8265fw" +.Cd "device iwm9000fw" +.Cd "device iwm9260fw" .Ed .Pp Or you can use @@ -71,6 +73,8 @@ iwm7260fw_load="YES" iwm7265fw_load="YES" iwm8000Cfw_load="YES" iwm8265fw_load="YES" +iwm9000fw_load="YES" +iwm9260fw_load="YES" .Ed .Sh DESCRIPTION The @@ -84,6 +88,10 @@ driver provides support for: .It Intel Dual Band Wireless AC 7260 .It Intel Dual Band Wireless AC 7265 .It Intel Dual Band Wireless AC 8260 +.It Intel Dual Band Wireless AC 9260 +.It Intel Dual Band Wireless AC 9270 +.It Intel Dual Band Wireless AC 946X +.It Intel Dual Band Wireless AC 9560 .El .Pp .Nm Modified: stable/12/share/man/man4/iwmfw.4 ============================================================================== --- stable/12/share/man/man4/iwmfw.4 Thu Nov 21 00:17:14 2019 (r354926) +++ stable/12/share/man/man4/iwmfw.4 Thu Nov 21 00:34:39 2019 (r354927) @@ -22,7 +22,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 29, 2017 +.Dd November 7, 2019 .Dt IWMFW 4 .Os .Sh NAME @@ -48,10 +48,12 @@ of the following: .Cd "device iwm7265fw" .Cd "device iwm8000Cfw" .Cd "device iwm8265fw" +.Cd "device iwm9000fw" +.Cd "device iwm9260fw" .Ed .Pp Alternatively, to load the driver as a -module at boot time, place the following line in +module at boot time, place one of the following lines in .Xr loader.conf 5 : .Bd -literal -offset indent iwm3160fw_load="YES" @@ -61,13 +63,14 @@ iwm7265fw_load="YES" iwm7265Dfw_load="YES" iwm8000Cfw_load="YES" iwm8265fw_load="YES" +iwm9000fw_load="YES" +iwm9260fw_load="YES" .Ed .Sh DESCRIPTION This module provides access to firmware sets for the -Intel Dual Band Wireless WiFi 3160, 3165, 3168, 7260, 7265, 8000, and 8260 series of -IEEE 802.11n/11ac adapters. -It may be -statically linked into the kernel, or loaded as a module. +Intel Dual Band Wireless WiFi 3160, 3165, 3168, 7260, 7265, 8000, 8260, +9000 and 9260 series of IEEE 802.11n/11ac adapters. +It may be statically linked into the kernel, or loaded as a module. .Sh SEE ALSO .Xr iwm 4 , .Xr firmware 9 Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Thu Nov 21 00:17:14 2019 (r354926) +++ stable/12/sys/conf/files Thu Nov 21 00:34:39 2019 (r354927) @@ -1989,6 +1989,8 @@ iwi_monitor.fw optional iwimonitorfw | iwifw \ dev/iwm/if_iwm.c optional iwm dev/iwm/if_iwm_7000.c optional iwm dev/iwm/if_iwm_8000.c optional iwm +dev/iwm/if_iwm_9000.c optional iwm +dev/iwm/if_iwm_9260.c optional iwm dev/iwm/if_iwm_binding.c optional iwm dev/iwm/if_iwm_fw.c optional iwm dev/iwm/if_iwm_led.c optional iwm Copied: stable/12/sys/contrib/dev/iwm/iwm-9000-34.fw.uu (from r354276, head/sys/contrib/dev/iwm/iwm-9000-34.fw.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/contrib/dev/iwm/iwm-9000-34.fw.uu Thu Nov 21 00:34:39 2019 (r354927, copy of r354276, head/sys/contrib/dev/iwm/iwm-9000-34.fw.uu) @@ -0,0 +1,59521 @@ +begin 644 iwm-9000-34.fw.uu +M`````$E73`I.+W)E;&5A````"`````````!_,\^='@````@````!```` +M9@(``!X````(`````@```-]N$P`>````"`````,`````````'````!`````` +M````````````````````&P````0````"````(`````0`````L`,`,P````P` +M``````````"```"``0`S````#`````$``````(@``(```#,````,`````@`` +M````0```\`@`$P```+P"````0$``!@```*$```````$``````(:````H`A@@ +M!N0!`$````!``````0```!$;4+H````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````=MVF>*UJ,X$=>E_#W#VH;^Y5X_")L7/N5&48I:=UN +M=OPMR]FQQ%&!P_PF,A#PO7[_+OHX#*W0W$5"LNL7A_V-1"Y%N?O6$_R?,_,Q +MH7!AQ7JCM2"8+L(&I4Q2(YO'@MBVP2/M6BT*$ +MWS3'.%W">-0+NW6P<'ZIQ_]GT*9T>$%]>%ZQ9J`9P0 +MD=26W:3.O3:.C=I+DJBO!S/(O!91O.M[V6-#)B#L6&0TXBL7=G +M9X@.6_26K`M&JWRN,LXA-S@-"P]LO+"VZ$AKL6>KEOQ4%O13B:NU[Q46=^"W +M53'<&XEQ<\.SX^^YYN:99<,S0`\/ST$+DA.L\KJVKUNMF*Y1IVLR!9IWZ@N^ +M>TMC(Y6^OR01P3]2J%J%:MSKO&%[-JGYNT7L'FGZ:NI0O'"/,A.C%?92ZZ:< +MPL==[*>`XX"8_;]G*S4?%%(NAS/M"!;>H?\0=P!&(!^$8'P`( +M8@``&R4!`!LD```%)0$`!20`"`4Y`0`%8H@@P!$"``4D``@%.0$`!6*,(,`1 +M!``%)``(!3D!``5BD"#`$0@`!20`"`4Y`0`%8I0@P!$0``4D``@%.0$`!6*8 +M(,`1(``%)``(!3D!``5BG"#`$4``!20`"`4Y`0`%8J`@P!$```@E```()(@' +MX1F$!^$9/`?`$@$`&W`#``!AZ!W`$!``&S#H'<`1+`?`$@$`&W`%``!A#QP= +M(@0`'2;H'<`0`0`;,.@=P!&V#P!A```;)(``&R7D'<`1"`!?<`D``&'0!L`2 +M``D;*,P&@($``,`7U`;`$@`)&RC(!H"!``#`%Z@/`&',!L`2X`:`@0``P!?( +M!L`2W`:`@0``P!>A#P!A```;)``!&R7D'<`1"`!?<)P/`&$```4EX@0%)-0& +MP!(`"1LH``4;*=P&@($``,`7T`;`$@`)&R@`!1LIX`:`@0``P!>/#P!A```; +M)``"&R7D'<`1"`!?<`P``&'8'<`0__\;,]@=P!'.[@TE@ID-)`\--R)L(,`0 +M#QLW(O__#24._PTD#PTW(GX/`&'8'<`0```;,=@=P!'.[@TE@ID-)`\--R)L +M(,`0#QLW(O__#26._PTD#PTW(G(/`&$```!A```;(S@XP!$```!AW!W`$``` +M'20````A`0`3(P3\S1$#`!,D!"#,$>P*P!),(@=P!#F_Q,R__\3,^@=P!$```$D"``!)0\!8R(!`%(D"``';@(` +M`&$``!4D````(0X``&'H'<`0$/@!)/__`24``1,Y#Q,!(BP'P!(``1,XZ!W` +M$0$`4B1X1<`0`0`3<`(``&$(`&0QX0\`8>0*P!(!`!-N1@``8<[N#24!@`TD +M#PTW(@]<-R(L#("!``#`%@8!$V($",`0!``39`]<`"(*``!```8``*P!(``,T1 +M#TT3(@00Q1$"`!,D\!S`$0$`$R3L',`1```3)'``$R40',`1```3(^`[[ZMWN^^K=[O +MOJW>[[ZMWN^^K=[OOJW>[[ZMWN^^K=[OOJW>```````````````````````` +M````````````````````````X@0``-`'``````````````$!`0$!`0$!O1\` +M`&,N``#_____``````````````````````(`````````,@`````````````` +M```````````(```````````````````````````````````````````````` +M`````````````````````````````````````````````````````0`````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````S +M$`(`$1`````````````````@```````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````$0`@``````````````````````````````````\#(`````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````````````````````````````#0XL+ +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````````V'D```4```($````\$Z````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````@``````````````````````````````````````````````````` +M``````````````````````````````````````````````````9D```````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````````````````````IQ +MR;Z\```````````````````````````````````````````````````````` +M`````````````````/]_````````_W\```````#_?P```````/]_```````` +M_W\```````#_?P```````/]_````````_W\```````#_?P````#_?P`````` +M``````````$```````````````````````````````8``````````````"3@ +M@-(5T@S2%=$3T1+1$-(1TA31@](0T1'1"1$1$0[2`.`!T!+2$])0T`1#`40/ +MT`""(($IX`;0`````#\`/P``````/P`_```````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````"8'@````"<'@````"D'@````"H'@````#`'@````"X'@`` +M``"\'@``````'0`````@'0````!`'0````!@'0````"`'0````"@'0````#` +M'0````#@'0`````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````````````````````````````$`@` +M``#_`P#L"0```/\%`'`(````_RT`3`@```#_/0"X!P```/\$`-P'````_R4` +M,`@```#_/``8R````/_=```)````_TP`U`D```#_(@"4"````/\F`'0)```` +M_R@`],<````@``#X!P```/\'`"@)````_R`````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````0````$````````````````````````````````````````` +M``````````````````````````````````````````````````````$````" +M`````P````````#_````_P```/\```#_```````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````````````!,"*``2`B@ +M`$0(H`"0"8`````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````````````````````\` +M#P`/``\`#P`/``\`#P`````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````)@`````!)@`````*)@`````+)@`````#)@`````()@` +M`````0`````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````@```````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````!``$``````,``D`#0```````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````0$(/`,#&+0`#S@,4`P```````````````````)!9`0`%```` +M`````/!.@`````````````````"L6`$`!0````````#P3H``D%D!`*Q8`0`< +M60$`J%@!`.18`0`````````````````````````````````````````````` +M```````````````````!_P`````````````````````````````````````` +M`````````````?\```````````````````````````````````D````-```` +M```````````````````````````````````````````````````````````` +M``````````'_```````````````````````````````````````````````` +M```!_P``````````````````````````````````"0````T````````````` +M```````````````````````````````````````````````````````````` +M`?\```````````````````````````````````````````````````'_```` +M```````````````````````````````)````#0`````````````````````` +M```````````````````````````````````````````````````!_P`````` +M`````````````````````````````````````````````?\````````````` +M``````````````````````D````-````````````````````!`````````#_ +M____6!&`````````````````````````$````-````!`````P`````````!@ +M`@``X`(``-`!``"``0``@````$````!@`````````*`!``#@`@``T`$`@``` +M```````````````````"````````````````````_P``````````@``````` +M_P```````````@```````````````````/\``````````(```````/\````` +M``````(```````````````````#_``````````"```````#_```````````" +M````````````````````_P``````````@```````_P```````````@`````` +M`````````````/\``````````(```````/\```````````(````````````` +M``````#_``````````"```````#_```````````"```````````````````` +M_P``````````@```````_P```````````@```````````````````/\````` +M`````(```````/\```````````(```````````````````#_``````````"` +M``````#_```````````"````````````````````_P``````````@``````` +M_P```````````@```````````````````/\``````````(```````/\````` +M``````(```````````````````#_``````````"```````#_```````````" +M````````````````````_P``````````@```````_P```````````@`````` +M`````````````/\``````````(```````/\```````````(````````````` +M``````#_``````````"```````#_```````````"```````````````````` +M_P``````````@```````_P`````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````8(*``'""@`"@@H``L(*`` +M.""@`"`@H``D(*``,""@`#0@H``\(*``0"&@`$0AH`!H(:``;"&@`'@AH`!( +M(:``3"&@`'`AH`!T(:``?"&@````````````_P`````````````````````` +M``#_`````````````````````````/\`````````````````````````_P`` +M``````````````````````````````````````````````````````!$(``` +M!0````0```#P3H``\$Z``/!.@`"`(:``M""@`&P@H```,````'`````````` +M````%$^``!1/@`"`(:``I""@`#@@H``!````!P``````````````.$^``#A/ +M@`"`(:``J""@`#P@H``0````.```````````````7$^``%Q/@`"`(:``K""@ +M`'@AH`!``0``P`$`````````````@$^``(!/@`"`(:``L""@`'PAH```#``` +M``X`````````````_P```/\````````````````````````````````````` +M````````````````````````````````````````````````````_P`````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``#__P``__\````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````````````````````````'``P`#``(``4``P`!H`! +M``(`"(````````````L`(``@``L`"P`+``:``0`"``B````````````*``H` +M"@`*``D`"P`&@`$``@`(@``````````#`````@````````````````````8` +M````````!@````(!``"````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````/\`````````````````````````````````````````6%0!`!!4`0"P +M5`$`9%8!``16`0`,50$`G%4!`-!5`0#D4P$`````````````````3$4```4` +M```$````\$Z``````````````````/Q>```%````!````/!.@``````````` +M``````"`8```!0````0```#P3H`````````````````````````````````` +M`````````````````````````````@(``@("``("`@`"`@("``````0%!00" +M`@``!``'!P<'!P<````````````(+IZ>-D6>GIZ>GHF>;W="9Y>!3)Z>GIZ> +M15]%&9Z/CT)^GIY%16QL;```!`4%!`("``!R96%D(&UE;6]R>2!B;&]C:SH@ +M4D9(7T=%3E]#1D<`2!B;&]C:SH@4D9(7U%?55)"1$-"7U=)1%@`@`X`!X`$`!R`#H`'@`"`P0%``#@(@0` +MI448`,KT)P#*]"<`.@$"`=4`WP`Z`:(`=0!_`,H!2@'B`/D`R@'J`((`F0`! +M`P\'?'Q\?&=G9V<%!0H*``````H4-VYJ`1H!V0#H`&H!N@!Y`(@`=-%%%^BB +MBRX0&*``#!B@``@0$`(0"```$!F@``P9H``0&$`&$"```#``"``-#0T-#@X. +M#@X/#P\/#Q`0$!`1$1$1$A(2$A,3$Q,4%!05%145%A86%Q<7&!@8&1D:&AH; +M&QL<'!T='1X>'Q\@("$A(B(C(R0D)24F)BWQ^@(*$AHB*C(Z0DI26F)J=GZ&CIJBKK;"RM;>Z +MO<#"Q0` +MF`#D`)@`Y`"8`-P"W`)N`=P";@'H`6X!]`!N`?0`;@'T`+(%L@79`K(%V0+, +M`]D"Y@'9`N8!V0+F`40!1`'F`40!Y@&P`>8!'`+F`1P"Y@$<`H@"B`+,`X@" +MS`-@`\P#.`3,`S@$S`,X!,P#S`.R!$AX2'@`!`@$#!@````0(!!`0```H`"@`,``L`"P`*``\`#0`+``L`#P` +M-``P`"P`5`!$`'__!P\?/P$#!0`'`@,$!@8-!04)"0D)"0D)"0D!!P\?/W__ +M____________````@%55554```!`T%Y">V@OH3V:'Q8IM)?0'CB.XS@PG'<1P'`0$!`0$!`0%!P0$!`0$!`0$!0<$! +M`0$!`0$!`4%!`0$!`0$!`0%!P0$!`0$!`0$!04$!`0$!`0$!`4%!`0$!`0$! +M`0%!00$!`0$!`0$!0D)!04%!04%!04%!04%!04%!04)"0D%!04%!0L)"0D-! +M04%!0D)"0T-#04%!04%!04)"0D%!04%"0D)#0T-!04%"0D-#1$3$04%"0D-$ +M1,1&1@$"`P29F0,`G=B)G4[LQ$XT2(,T)W9B)QJD01H3.[$3$1B!$0_\P`\- +MTB`-"[W0"S0`:`!H`-``T``X`3@!.`&@`:`!;`#8`-@`L`&P`8@"B`*(`F`# +M8`/J`-0!U`&H`Z@#?`5\!7P%4`=0!]0!J`.H`U`'4`?X"O@*^`J@#J`.&@`T +M`$X`:`"<`-``Z@`$`3@!6P&&`;$!-@!L`*(`V`!$`;`!Y@$<`H@"T`(J`X0# +M=0#J`%\!U`&^`J@#'022!'P%&`;;!IX'Z@#4`;X"J`-\!5`'.@@D"?@*,`RV +M#3P/"0D%!0D)#0T%!@$"`P0``)*-C(J*BHF(B(B2BHB'AX:&AH:&CHF(AX:& +MAH6%A9*.C8R,C(R,C(PM+34V-S@^0D9&+3,U.S]`0$='1S(V.#HZ04!'1T<] +M/CY(2$=*4%!0#0\%!PD+`0,H`"@`-``P`"P`+`!$`#P`5555`4MH+P%5554% +MXSB.`ZJJJ@)Q',GI[?'Q]?7U^?GY^ +M?W]_?W]_?W^`!`P,"!04!`1`````@``````!`````@````0```!```!````` +M0````#0#4`-[`[H#%02;!/0$_@,?!$@$@P3;!&(%NP6Z!NP&.`>Q!W@(FPE: +M"J$'WP'@<```(``@8&!@8&!@8&!@0`````!O8& +M]O;V&P`(6QM;(0`````````!`````0```````````````0`````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````!%R!``0````$````!`````0````$```````````````````````````` +M``````````````````````````````````````````````\`"``&``,``P`` +M```1`!````````````````````````````$``````````````$`````````` +M```````````!````````$`````!``````````````````````0```,R%@``` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````````````````````````%]?8@`````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````````````````````#_ +M______\````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``#_______\````````````````````````````````````````````````` +M`````````@`0`````$`````````````````````!````V'B````````````` +M`````````````````````````````0$"`0("`P$"`@,"`P,$``()`0,```#P +M10(`9$$"`"SX`@`L^`(`+/@"`"SX`@`L^`(`^$<"`%CX`@!81P(`+/@"`"SX +M`@`L^`(`+/@"`"SX`@`L^`(`+/@"`"SX`@`L^`(`!````"SX`@`L^`(`+/@" +M`"SX`@`L^`(`+/@"`"SX`@`L^`(```````\`/P`"````#P`_``(````/`#\` +M`@````\`/P`"````#P`_``(@```````````$"`P,````````!`@,#``````` +M``0(#`P````````$"`P,!@`-`$(`8P"&`*``_P```*JJJJJJJJJJJJJJ[JJJ +MJJHH_P#,JJH``*JJ`,RJJ@```$``P`!``,``4`#P`%``\``````````````` +M`````````````````````````````````````````````````*JJJJJJJJJJ +MJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ``````````````````````!L;6YO +M<'%R+<"``"E10`@Q$4`+/@"`"SX`@`L^`(` +M$````%B@10#8K$4`,*U%`*3#10`L^`(`+/@"`(2?10`0GT4`+/@"`"SX`@`L +M^`(`+/@"`"SX`@`L^`(`+/@"`%3X`@!8^`(`,/@"`"SX`@`L^`(`+/@"`"SX +M`@`L^`(`+/@"`"SX`@`L^`(`+/@"``0````L^`(`+/@"`"SX`@`L^`(````` +M`````````````````!A,1@!4048`H#Y&`+!(1@`L2T8`K#]&`$!01@`,2$8` +M6/@"`&A"1@"0148`S$=&`*1"1@`H1$8`0$E&`/A01@!<2$8`W$I&`&!"1@`( +M`0``+/@"`"SX`@`L^`(`+/@"``1!1@!02T8`+/@"`"SX`@`!`04!`P$!`0@! +M`@$(``@``0$#`0$!`P`#`0(!!0$!`00````0!48`+/@"`(`!1@`L!$8`+/@" +M`#`"1@`D!D8`!`1&`%CX`@`P^`(`+/@"`"SX`@!<`D8`1`-&`"SX`@`L^`(` +M+/@"`"SX`@`L^`(`$````"SX`@`L^`(`+/@"`"SX`@`L^`(`+/@"`"SX`@#\ +M`D8```````\`/P`!````#P`_``$````/`#\``0````\`/P`!````#P`_``$` +M```"`````@````8````&````!0````4````$````!`````,````#`````0`` +M`````````````````*!)10!T244`<$E%`)A)10"<244`+/@"`"SX`@"4244` +M6/@"`)!)10`L^`(`+/@"`"SX`@`L^`(`+/@"`"SX`@`L^`(`+/@"`"SX`@`0 +M````+/@"````````````+/@"```````````````````````L^`(`+/@"`.P] +M1@`D/D8`=#Y&`"SX`@`L^`(`5/@"`%CX`@`P^`(`+/@"`"SX`@`L^`(`+/@" +M`"SX`@`L^`(`+/@"`"SX`@`L^`(`$````"SX`@`L^`(`+/@"`"SX`@`L^`(` +M+/@"`"SX`@`L^`(``.<0YR#G,.<`[Q#O(.\P[P#B`.,`Y`#E`.H`ZP#L`.TL +M^`(`+/@"`%121@`L^`(`+/@"`%A21@`L^`(`5/@"`%CX`@`P^`(`+/@"`"SX +M`@`L^`(`+/@"`"SX`@`L^`(`+/@"`"SX`@`L^`(`$````"SX`@`L^`(`+/@" +M`"SX`@`L^`(`+/@"`"SX`@`L^`(``0$!``(```"<_QC\``!D`&(```!O`&,` +ML`1P`&T`T`=Q`&\`H`]R`'$`0!]S`'(`$"=T`',`X"YU`&``F#H``)69G:&E +M````_T%55555`0````("`B````"`B(B(B```$0```#16`@`#````?'8"``$` +M```D,0,``````-2I`@`8````)(,"``P```!@?@(`'````(Q?`@`$````,)0` +M`!,```#86P(`&P```!Q7`@`1````<%8"`!@```!`A0(`&0```-"9`@`:```` +M/*,"``<````PB@(``P```"AY`@`,````-($"``0```"$G0``-*D"`#A7`@#D +M5@(`N)H"`-RC`@#47P(`2'T"`/B'`@`X6@(`L)0``*1V`@#46@(`!C!0<(2A +M```&,`````#__P`!`/\```$$```$_P``_@`!`/\!`0((`P$#"0,!`03_`0`& +M"`$!!P$!`0`"`0`!!`(`_P8"`P7_`@("!P("`P<"`@3_`@(``@(``00"`0?_ +M`@`&"`,`__\#`P0%`P(#_P,!!_\#``8(`P,``@,``00``@`````%_P```?\" +M`/\"`@,%_P(`!@$"``$!`P#_`P,#!00#`0/_`P("!0,`!@$#``$!`0#_!P$! +M!P8!`07_`00!_P$#"`@$`/\)!`0%_P0`"`H$!`/_)````"@````L````,``` +M`#0````X````/````$````!$````2````$P```!0````5````%@```!<```` +M8````&0```!H````;````'````!T````>````'P```"`````A````(@```", +M````D````)4```"9````G0```*$```"E````J0```*T```"Q````*@```#H` +M``!*````6@```&H```!Z````B@```)L```"K`````@````0````&`````P`` +M``L````3````&P```",````K````,P```#H```!"`````0`````````$```` +M!0``````````````````````_P```/X!```"_P```_\``0#_`0`!`@$"`O\" +M`/\#`@#^!`(``_\```````````````"@;44`"@````0```#P3H`````````` +M````````M&U%``H````$````\$Z````````````````````````````````` +M```````````````````````>````'H@>B%H```!6````5HA6B`(!``"J```` +MJHBJB/X!``","@``5(Q4C*0?```````````````````H"@(`"@````0```#P +M3H``````````````````K`H"``4````$````\$Z``````````````````-2[ +M10`DOD4`4+U%`-B]10!(N44`'+E%`/`T10#8N$4`C#5%``@S10!@,T4`!$T" +M````````````````````````````````````_PD```#_```'_P`!"0H```K_ +M`0#_!@$"```!`P'_`0,"_P$#`_\!`0W_`0$$_P$"!0`!`0O_`0(,_P$$!@@! +M`0?_`0`(_P$`"O\"`@#_`@,!_P(#`O\"`P/_`@$-`0(!!`$"`@4``@$+`0(" +M#`$"!`8(`@('``(`"`$"``H!`P#_`@,#`/\#`P'_`P,"_P,#`P0#`00%`P$- +M!P,"!0`#`0L%`P(,!0,$!@@#`P?_`P`(!0,`"@4#`/X#!`0`_P0$`?\$!`+_ +M!`0#_P0$#?\$!`3_!`0%_P0$"_\$!`S_!`0&"`0$!P@$``C_!``*_P`````` +M``````#_`````0,``@("``,``@``!?\```;_```$_P``!P0```S_`0#_`0$! +M``,!`@$"`0("`@$`!/\!`0<$`0`,_P("``4"`@(%`@`%_P(`!O\"`@0%`@(' +M!0(#"@("`@D"`@`(_P(`#`4#`P`%`P,!!0,#`@4#`07_`P`&_P,#!`4#`P<% +M`P()`@,#"@(#``L#`P`(_P,`#`4``````!```/8/``#8#P``I@\``&$/```) +M#P``G0X``"`.``"1#0``\0P``$$,``"""P``M`H``-D)``#R"`````@```,' +M``#^!0``\00``-X#``#'`@``K`$``(X```````````````````````````$` +M```!```````````````!`````0````$```````````````$``!CA@``>``'4 +MY@(``0`$T.4"``$`!````/!#@``0``&H#H```@`!``"```$` +M`SA\@``!``&DX(```0`#J."```$``Z3F`@`"``0``"`````@```````````` +M`````````````(A>`P`%```"!````/!.@`#_`````'F``+SK@``````````` +M````````````````````````````````````````````U0#6``$`+0"`!Q`* +M_0#^`"8`@0J""J$(,0L``/\````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````"DJ@(`,S,#````!``R +M504````(`*NJ"@````P`S@````````1J`````` +M``0\H```````"#R@```````8/*```````!P\H```````(#R@```````D/*`` +M`````"@\H```````+#R@```````P/*```````#0\H```````.#R@```````\ +M/*```````$`\H```````1#R@``````!(/*```````$P\H```````4#R@```` +M``!4/*```````%@\H```````7#R@``````!@/*```````&0\H```````:#R@ +M``````!\/*```````'@\H````````````````````````````)C=`0!0W0$` +M`````.A[@`#H>X```````````````````````````````````````,#!@`#` +MP8``P,&``,#!@``````````````````````````````````````````````` +M``#^RJVK`````````````````````"`"`````"$"`````"("`````","```` +M`"0"`````"4"`````"($`````",$`````"0$`````"4$`````"8$`````"<$ +M`````"@$`````"D$`````"H$`````"L$`````"P$`````"T$`````"X$```` +M`"\$`````#`$`````#$$``````D$`````!<``0```!@P8,`````````````` +M`````````````*!O10`*`````````/!.@`````````````````````````#_ +M```!`_\```D!```*_P`#!`(```#_``#^`P$`_P0!`0D%`0$*!0$``?\!`P0" +M`0$"_P$!"/\!``#_`0#^!@(`_P<"`@D(`@(*"`("!PD"``'_`@$#_P(#!`H" +M`@+_`@``"P,#"0P#`PH,`P0%#0,#`@X#```/!`#_$`0$"1$$!`H1!`(&_P0" +M`A($!`C_!```_P0`_A,```````````````#X)$4`"@````````#P3H`````` +M``````#4.D4`8#M%`/0A10!8.T4`O&Y%`"AO10`0;T4`,")%`&PC10#$(D4` +M)")%`&0C10`8(D4``")%``@B10`0(D4`C&M%`/AK10#$:T4`O&M%`/______ +M______________\$````________________`P```/____\``````````/__ +M__\``````````/____\```````````,````0`````P```/\```#_````_P`` +M`/\````#```````````````````````````````````````````````````` +M````````````````_P```/\````>```````````````````````````````` +M``````````````````````````````````````````````!D````9````&0` +M``!D````R````)`!``#H`P``T`<```#_`````````````/\`````!@$#`@`` +M```````#0>```` +M`#@>`````#P>`````$P>`````%`>`````%0>`````%@>`````%P>`````&0> +M`````'@>`````'P>`````(P>`````)`>`````)0>`````)@>`````)P>```` +M`*`>`````,`>`````,0>`````-`>`````-0>``````0?`````-P>`````'0? +M`````'@?`````'P?`````/@?`````"8`````````````````````````$``` +M`!\````````````````````````````````````````````````````````` +M````````````````````````````````$``````````````````````````` +M```````````````0```````````````4```````````````E````Y?____G_ +M__\O````W?____C___\```````````$````````````````````````````` +M`````````````````````````````````````````````````/\````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M````````````````````/SP```````````````````,`````````_P`````` +M````````````````````````````````````````__\````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````( +M`````````````````````````````````````````````````````````/__ +M________````````````````C`0"``H````$````\$Z`````````````Z`8" +M```(`@`X!P(`0`8"`#`(`@#$!P(`E`8"`/`%`@```0````$$`0$!``(!`0$# +M`0`"!P$!!`0!`04%`0(#_P(!`08"``('B!,````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-12@freebsd.org Thu Nov 21 00:40:14 2019 Return-Path: Delivered-To: svn-src-stable-12@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 0585A1C72F3; Thu, 21 Nov 2019 00:40:14 +0000 (UTC) (envelope-from brooks@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JLLj6L75z4b1c; Thu, 21 Nov 2019 00:40:13 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B86B12F9D; Thu, 21 Nov 2019 00:40:13 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL0eD6B068781; Thu, 21 Nov 2019 00:40:13 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL0eD7P068779; Thu, 21 Nov 2019 00:40:13 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201911210040.xAL0eD7P068779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 21 Nov 2019 00:40:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354928 - in stable/12: lib/libc/gen sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/12: lib/libc/gen sys/sys X-SVN-Commit-Revision: 354928 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 00:40:14 -0000 Author: brooks Date: Thu Nov 21 00:40:12 2019 New Revision: 354928 URL: https://svnweb.freebsd.org/changeset/base/354928 Log: MFC r354694, r354699 r354694: elf_aux_info: Add support for AT_EXECPATH. Reviewed by: emaste, sef Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22353 r354699: Improve the description of AT_EXECPATH availability. Reported by: kib Sponsored by: DARPA, AFRL Modified: stable/12/lib/libc/gen/auxv.3 stable/12/lib/libc/gen/auxv.c stable/12/sys/sys/param.h Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/gen/auxv.3 ============================================================================== --- stable/12/lib/libc/gen/auxv.3 Thu Nov 21 00:34:39 2019 (r354927) +++ stable/12/lib/libc/gen/auxv.3 Thu Nov 21 00:40:12 2019 (r354928) @@ -49,6 +49,12 @@ can be requested (corresponding buffer sizes are speci .It AT_CANARY The canary value for SSP (arbitrary sized buffer, as many bytes are returned as it fits into it, rest is zeroed). +.It AT_EXECPATH +The path of executed program +.Dv (MAXPATHLEN). +This may not be present if the process was initialized by +.Xr fexecve 2 +and the namecache no longer contains the file's name. .It AT_HWCAP CPU / hardware feature flags .Dv (sizeof(u_long)). Modified: stable/12/lib/libc/gen/auxv.c ============================================================================== --- stable/12/lib/libc/gen/auxv.c Thu Nov 21 00:34:39 2019 (r354927) +++ stable/12/lib/libc/gen/auxv.c Thu Nov 21 00:40:12 2019 (r354928) @@ -69,7 +69,7 @@ __init_elf_aux_vector(void) static pthread_once_t aux_once = PTHREAD_ONCE_INIT; static int pagesize, osreldate, canary_len, ncpus, pagesizes_len; static int hwcap_present, hwcap2_present; -static char *canary, *pagesizes; +static char *canary, *pagesizes, *execpath; static void *timekeep; static u_long hwcap, hwcap2; @@ -88,6 +88,10 @@ init_aux(void) canary_len = aux->a_un.a_val; break; + case AT_EXECPATH: + execpath = (char *)(aux->a_un.a_ptr); + break; + case AT_HWCAP: hwcap_present = 1; hwcap = (u_long)(aux->a_un.a_val); @@ -146,6 +150,18 @@ _elf_aux_info(int aux, void *buf, int buflen) res = 0; } else res = ENOENT; + break; + case AT_EXECPATH: + if (execpath == NULL) + res = ENOENT; + else if (buf == NULL) + res = EINVAL; + else { + if (strlcpy(buf, execpath, buflen) >= buflen) + res = EINVAL; + else + res = 0; + } break; case AT_HWCAP: if (hwcap_present && buflen == sizeof(u_long)) { Modified: stable/12/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Thu Nov 21 00:34:39 2019 (r354927) +++ stable/12/sys/sys/param.h Thu Nov 21 00:40:12 2019 (r354928) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1201502 /* Master, propagated to newvers */ +#define __FreeBSD_version 1201503 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable-12@freebsd.org Thu Nov 21 07:29:29 2019 Return-Path: Delivered-To: svn-src-stable-12@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 E48B41B1EF0; Thu, 21 Nov 2019 07:29:29 +0000 (UTC) (envelope-from delphij@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JWQx5z1Lz40mn; Thu, 21 Nov 2019 07:29:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95A4B7C6D; Thu, 21 Nov 2019 07:29:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL7TT8t011430; Thu, 21 Nov 2019 07:29:29 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL7TQa5011412; Thu, 21 Nov 2019 07:29:26 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201911210729.xAL7TQa5011412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 21 Nov 2019 07:29:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354938 - in stable/12: contrib/file contrib/file/doc contrib/file/magic contrib/file/magic/Magdir contrib/file/src contrib/file/tests lib/libmagic X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/12: contrib/file contrib/file/doc contrib/file/magic contrib/file/magic/Magdir contrib/file/src contrib/file/tests lib/libmagic X-SVN-Commit-Revision: 354938 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 07:29:30 -0000 Author: delphij Date: Thu Nov 21 07:29:25 2019 New Revision: 354938 URL: https://svnweb.freebsd.org/changeset/base/354938 Log: MFC r354595, r354802: MFV r354582: file 5.37 MFV r354798: Apply vendor fixes: 06de62c Detect multiplication overflow when computing sector position 46a8443 Limit the number of elements in a vector (found by oss-fuzz) Security: CVE-2019-18218 Added: stable/12/contrib/file/magic/Magdir/biosig - copied unchanged from r354595, head/contrib/file/magic/Magdir/biosig stable/12/contrib/file/magic/Magdir/clojure - copied unchanged from r354595, head/contrib/file/magic/Magdir/clojure stable/12/contrib/file/magic/Magdir/edid - copied unchanged from r354595, head/contrib/file/magic/Magdir/edid stable/12/contrib/file/magic/Magdir/espressif - copied unchanged from r354595, head/contrib/file/magic/Magdir/espressif stable/12/contrib/file/magic/Magdir/glibc - copied unchanged from r354595, head/contrib/file/magic/Magdir/glibc stable/12/contrib/file/magic/Magdir/hardware - copied unchanged from r354595, head/contrib/file/magic/Magdir/hardware stable/12/contrib/file/magic/Magdir/kicad - copied unchanged from r354595, head/contrib/file/magic/Magdir/kicad stable/12/contrib/file/magic/Magdir/numpy - copied unchanged from r354595, head/contrib/file/magic/Magdir/numpy stable/12/contrib/file/magic/Magdir/rpmsg - copied unchanged from r354595, head/contrib/file/magic/Magdir/rpmsg stable/12/contrib/file/src/is_json.c - copied unchanged from r354595, head/contrib/file/src/is_json.c stable/12/contrib/file/tests/CVE-2014-1943.result - copied unchanged from r354595, head/contrib/file/tests/CVE-2014-1943.result stable/12/contrib/file/tests/CVE-2014-1943.testfile - copied unchanged from r354595, head/contrib/file/tests/CVE-2014-1943.testfile stable/12/contrib/file/tests/fit-map-data.result - copied unchanged from r354595, head/contrib/file/tests/fit-map-data.result stable/12/contrib/file/tests/fit-map-data.testfile - copied unchanged from r354595, head/contrib/file/tests/fit-map-data.testfile stable/12/contrib/file/tests/issue359xlsx.result - copied unchanged from r354595, head/contrib/file/tests/issue359xlsx.result stable/12/contrib/file/tests/issue359xlsx.testfile - copied unchanged from r354595, head/contrib/file/tests/issue359xlsx.testfile stable/12/contrib/file/tests/json1.result - copied unchanged from r354595, head/contrib/file/tests/json1.result stable/12/contrib/file/tests/json1.testfile - copied unchanged from r354595, head/contrib/file/tests/json1.testfile stable/12/contrib/file/tests/json2.result - copied unchanged from r354595, head/contrib/file/tests/json2.result stable/12/contrib/file/tests/json2.testfile - copied unchanged from r354595, head/contrib/file/tests/json2.testfile stable/12/contrib/file/tests/json3.result - copied unchanged from r354595, head/contrib/file/tests/json3.result stable/12/contrib/file/tests/json3.testfile - copied unchanged from r354595, head/contrib/file/tests/json3.testfile stable/12/contrib/file/tests/regex-eol.magic - copied unchanged from r354595, head/contrib/file/tests/regex-eol.magic stable/12/contrib/file/tests/regex-eol.result - copied unchanged from r354595, head/contrib/file/tests/regex-eol.result stable/12/contrib/file/tests/regex-eol.testfile - copied unchanged from r354595, head/contrib/file/tests/regex-eol.testfile stable/12/contrib/file/tests/zstd-3-skippable-frames.result - copied unchanged from r354595, head/contrib/file/tests/zstd-3-skippable-frames.result stable/12/contrib/file/tests/zstd-dictionary-0.result - copied unchanged from r354595, head/contrib/file/tests/zstd-dictionary-0.result stable/12/contrib/file/tests/zstd-dictionary-1.result - copied unchanged from r354595, head/contrib/file/tests/zstd-dictionary-1.result stable/12/contrib/file/tests/zstd-dictionary-2.result - copied unchanged from r354595, head/contrib/file/tests/zstd-dictionary-2.result stable/12/contrib/file/tests/zstd-skippable-frame-0.result - copied unchanged from r354595, head/contrib/file/tests/zstd-skippable-frame-0.result stable/12/contrib/file/tests/zstd-skippable-frame-4.result - copied unchanged from r354595, head/contrib/file/tests/zstd-skippable-frame-4.result stable/12/contrib/file/tests/zstd-skippable-frame-8.result - copied unchanged from r354595, head/contrib/file/tests/zstd-skippable-frame-8.result stable/12/contrib/file/tests/zstd-skippable-frame-C.result - copied unchanged from r354595, head/contrib/file/tests/zstd-skippable-frame-C.result stable/12/contrib/file/tests/zstd-v0.2-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.2-FF.result stable/12/contrib/file/tests/zstd-v0.2-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.2-FF.testfile stable/12/contrib/file/tests/zstd-v0.3-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.3-FF.result stable/12/contrib/file/tests/zstd-v0.3-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.3-FF.testfile stable/12/contrib/file/tests/zstd-v0.4-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.4-FF.result stable/12/contrib/file/tests/zstd-v0.4-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.4-FF.testfile stable/12/contrib/file/tests/zstd-v0.5-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.5-FF.result stable/12/contrib/file/tests/zstd-v0.5-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.5-FF.testfile stable/12/contrib/file/tests/zstd-v0.6-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.6-FF.result stable/12/contrib/file/tests/zstd-v0.6-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.6-FF.testfile stable/12/contrib/file/tests/zstd-v0.7-00.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.7-00.result stable/12/contrib/file/tests/zstd-v0.7-21.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.7-21.result stable/12/contrib/file/tests/zstd-v0.7-21.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.7-21.testfile stable/12/contrib/file/tests/zstd-v0.7-22.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.7-22.result stable/12/contrib/file/tests/zstd-v0.7-22.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.7-22.testfile stable/12/contrib/file/tests/zstd-v0.8-00.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-00.result stable/12/contrib/file/tests/zstd-v0.8-01.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-01.result stable/12/contrib/file/tests/zstd-v0.8-01.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-01.testfile stable/12/contrib/file/tests/zstd-v0.8-02.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-02.result stable/12/contrib/file/tests/zstd-v0.8-02.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-02.testfile stable/12/contrib/file/tests/zstd-v0.8-03.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-03.result stable/12/contrib/file/tests/zstd-v0.8-03.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-03.testfile stable/12/contrib/file/tests/zstd-v0.8-16.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-16.result stable/12/contrib/file/tests/zstd-v0.8-16.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-16.testfile stable/12/contrib/file/tests/zstd-v0.8-20.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-20.result stable/12/contrib/file/tests/zstd-v0.8-20.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-20.testfile stable/12/contrib/file/tests/zstd-v0.8-21.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-21.result stable/12/contrib/file/tests/zstd-v0.8-21.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-21.testfile stable/12/contrib/file/tests/zstd-v0.8-22.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-22.result stable/12/contrib/file/tests/zstd-v0.8-22.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-22.testfile stable/12/contrib/file/tests/zstd-v0.8-23.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-23.result stable/12/contrib/file/tests/zstd-v0.8-23.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-23.testfile stable/12/contrib/file/tests/zstd-v0.8-F4.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-F4.result stable/12/contrib/file/tests/zstd-v0.8-F4.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-F4.testfile stable/12/contrib/file/tests/zstd-v0.8-FF.result - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-FF.result stable/12/contrib/file/tests/zstd-v0.8-FF.testfile - copied unchanged from r354595, head/contrib/file/tests/zstd-v0.8-FF.testfile Modified: stable/12/contrib/file/AUTHORS stable/12/contrib/file/COPYING stable/12/contrib/file/ChangeLog stable/12/contrib/file/NEWS stable/12/contrib/file/README stable/12/contrib/file/config.h.in stable/12/contrib/file/configure stable/12/contrib/file/configure.ac stable/12/contrib/file/doc/file.man stable/12/contrib/file/doc/libmagic.man stable/12/contrib/file/doc/magic.man stable/12/contrib/file/magic/Header stable/12/contrib/file/magic/Magdir/acorn stable/12/contrib/file/magic/Magdir/adventure stable/12/contrib/file/magic/Magdir/algol68 stable/12/contrib/file/magic/Magdir/amigaos stable/12/contrib/file/magic/Magdir/android stable/12/contrib/file/magic/Magdir/animation stable/12/contrib/file/magic/Magdir/apple stable/12/contrib/file/magic/Magdir/archive stable/12/contrib/file/magic/Magdir/audio stable/12/contrib/file/magic/Magdir/basis stable/12/contrib/file/magic/Magdir/ber stable/12/contrib/file/magic/Magdir/bioinformatics stable/12/contrib/file/magic/Magdir/blcr stable/12/contrib/file/magic/Magdir/blender stable/12/contrib/file/magic/Magdir/c-lang stable/12/contrib/file/magic/Magdir/cad stable/12/contrib/file/magic/Magdir/cafebabe stable/12/contrib/file/magic/Magdir/coff stable/12/contrib/file/magic/Magdir/commands stable/12/contrib/file/magic/Magdir/compress stable/12/contrib/file/magic/Magdir/console stable/12/contrib/file/magic/Magdir/coverage stable/12/contrib/file/magic/Magdir/ctf stable/12/contrib/file/magic/Magdir/cups stable/12/contrib/file/magic/Magdir/database stable/12/contrib/file/magic/Magdir/dataone stable/12/contrib/file/magic/Magdir/dbpf stable/12/contrib/file/magic/Magdir/dolby stable/12/contrib/file/magic/Magdir/dyadic stable/12/contrib/file/magic/Magdir/ebml stable/12/contrib/file/magic/Magdir/elf stable/12/contrib/file/magic/Magdir/erlang stable/12/contrib/file/magic/Magdir/esri stable/12/contrib/file/magic/Magdir/filesystems stable/12/contrib/file/magic/Magdir/finger stable/12/contrib/file/magic/Magdir/flash stable/12/contrib/file/magic/Magdir/fonts stable/12/contrib/file/magic/Magdir/fsav stable/12/contrib/file/magic/Magdir/games stable/12/contrib/file/magic/Magdir/geo stable/12/contrib/file/magic/Magdir/gnome stable/12/contrib/file/magic/Magdir/gnu stable/12/contrib/file/magic/Magdir/graphviz stable/12/contrib/file/magic/Magdir/guile stable/12/contrib/file/magic/Magdir/hitachi-sh stable/12/contrib/file/magic/Magdir/hp stable/12/contrib/file/magic/Magdir/ibm6000 stable/12/contrib/file/magic/Magdir/images stable/12/contrib/file/magic/Magdir/intel stable/12/contrib/file/magic/Magdir/isz stable/12/contrib/file/magic/Magdir/java stable/12/contrib/file/magic/Magdir/jpeg stable/12/contrib/file/magic/Magdir/keepass stable/12/contrib/file/magic/Magdir/kerberos stable/12/contrib/file/magic/Magdir/kml stable/12/contrib/file/magic/Magdir/linux stable/12/contrib/file/magic/Magdir/lisp stable/12/contrib/file/magic/Magdir/llvm stable/12/contrib/file/magic/Magdir/lua stable/12/contrib/file/magic/Magdir/m4 stable/12/contrib/file/magic/Magdir/macintosh stable/12/contrib/file/magic/Magdir/mail.news stable/12/contrib/file/magic/Magdir/map stable/12/contrib/file/magic/Magdir/marc21 stable/12/contrib/file/magic/Magdir/matroska stable/12/contrib/file/magic/Magdir/mercurial stable/12/contrib/file/magic/Magdir/metastore stable/12/contrib/file/magic/Magdir/microfocus stable/12/contrib/file/magic/Magdir/misctools stable/12/contrib/file/magic/Magdir/modem stable/12/contrib/file/magic/Magdir/mozilla stable/12/contrib/file/magic/Magdir/msdos stable/12/contrib/file/magic/Magdir/msooxml stable/12/contrib/file/magic/Magdir/msvc stable/12/contrib/file/magic/Magdir/neko stable/12/contrib/file/magic/Magdir/netbsd stable/12/contrib/file/magic/Magdir/nitpicker stable/12/contrib/file/magic/Magdir/ole2compounddocs stable/12/contrib/file/magic/Magdir/palm stable/12/contrib/file/magic/Magdir/parrot stable/12/contrib/file/magic/Magdir/pbf stable/12/contrib/file/magic/Magdir/pc98 stable/12/contrib/file/magic/Magdir/pgp stable/12/contrib/file/magic/Magdir/polyml stable/12/contrib/file/magic/Magdir/printer stable/12/contrib/file/magic/Magdir/psl stable/12/contrib/file/magic/Magdir/pwsafe stable/12/contrib/file/magic/Magdir/python stable/12/contrib/file/magic/Magdir/qt stable/12/contrib/file/magic/Magdir/revision stable/12/contrib/file/magic/Magdir/riff stable/12/contrib/file/magic/Magdir/ruby stable/12/contrib/file/magic/Magdir/scientific stable/12/contrib/file/magic/Magdir/selinux stable/12/contrib/file/magic/Magdir/sendmail stable/12/contrib/file/magic/Magdir/sequent stable/12/contrib/file/magic/Magdir/sgml stable/12/contrib/file/magic/Magdir/sniffer stable/12/contrib/file/magic/Magdir/sql stable/12/contrib/file/magic/Magdir/sun stable/12/contrib/file/magic/Magdir/sysex stable/12/contrib/file/magic/Magdir/tcl stable/12/contrib/file/magic/Magdir/terminfo stable/12/contrib/file/magic/Magdir/tex stable/12/contrib/file/magic/Magdir/tplink stable/12/contrib/file/magic/Magdir/unicode stable/12/contrib/file/magic/Magdir/varied.script stable/12/contrib/file/magic/Magdir/virtual stable/12/contrib/file/magic/Magdir/warc stable/12/contrib/file/magic/Magdir/webassembly stable/12/contrib/file/magic/Magdir/windows stable/12/contrib/file/magic/Magdir/wordprocessors stable/12/contrib/file/magic/Magdir/wsdl stable/12/contrib/file/magic/Magdir/xwindows stable/12/contrib/file/magic/Magdir/yara stable/12/contrib/file/magic/Magdir/zip stable/12/contrib/file/magic/Makefile.am stable/12/contrib/file/magic/Makefile.in stable/12/contrib/file/src/Makefile.am stable/12/contrib/file/src/Makefile.in stable/12/contrib/file/src/apprentice.c stable/12/contrib/file/src/apptype.c stable/12/contrib/file/src/ascmagic.c stable/12/contrib/file/src/asprintf.c stable/12/contrib/file/src/buffer.c stable/12/contrib/file/src/cdf.c stable/12/contrib/file/src/cdf.h stable/12/contrib/file/src/cdf_time.c stable/12/contrib/file/src/compress.c stable/12/contrib/file/src/der.c stable/12/contrib/file/src/dprintf.c stable/12/contrib/file/src/elfclass.h stable/12/contrib/file/src/encoding.c stable/12/contrib/file/src/file.c stable/12/contrib/file/src/file.h stable/12/contrib/file/src/fmtcheck.c stable/12/contrib/file/src/fsmagic.c stable/12/contrib/file/src/funcs.c stable/12/contrib/file/src/getopt_long.c stable/12/contrib/file/src/is_tar.c stable/12/contrib/file/src/magic.c stable/12/contrib/file/src/magic.h.in stable/12/contrib/file/src/mygetopt.h stable/12/contrib/file/src/print.c stable/12/contrib/file/src/readcdf.c stable/12/contrib/file/src/readelf.c stable/12/contrib/file/src/readelf.h stable/12/contrib/file/src/seccomp.c stable/12/contrib/file/src/softmagic.c stable/12/contrib/file/src/vasprintf.c stable/12/contrib/file/tests/Makefile.am stable/12/contrib/file/tests/Makefile.in stable/12/lib/libmagic/Makefile stable/12/lib/libmagic/config.h Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/file/AUTHORS ============================================================================== --- stable/12/contrib/file/AUTHORS Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/AUTHORS Thu Nov 21 07:29:25 2019 (r354938) @@ -1 +1 @@ -See COPYING. \ No newline at end of file +See COPYING. Modified: stable/12/contrib/file/COPYING ============================================================================== --- stable/12/contrib/file/COPYING Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/COPYING Thu Nov 21 07:29:25 2019 (r354938) @@ -1,4 +1,4 @@ -$File: COPYING,v 1.1 2008/02/05 19:08:11 christos Exp $ +$File: COPYING,v 1.2 2018/09/09 20:33:28 christos Exp $ Copyright (c) Ian F. Darwin 1986, 1987, 1989, 1990, 1991, 1992, 1994, 1995. Software written by Ian F. Darwin and others; maintained 1994- Christos Zoulas. @@ -15,7 +15,7 @@ are met: 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 Modified: stable/12/contrib/file/ChangeLog ============================================================================== --- stable/12/contrib/file/ChangeLog Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/ChangeLog Thu Nov 21 07:29:25 2019 (r354938) @@ -1,3 +1,75 @@ +2019-05-14 22:26 Christos Zoulas + + * release 5.37 + +2019-05-09 22:27 Christos Zoulas + + * Make sure that continuation separators are printed + with -k within softmagic + +2019-05-06 22:27 Christos Zoulas + + * Change SIGPIPE saving and restoring during compression to use + sigaction(2) instead of signal(3) and cache it. (Denys Vlasenko) + * Cache stat(2) calls more to reduce number of calls (Denys Vlasenko) + +2019-05-06 17:25 Christos Zoulas + + * PR/77: Handle --mime-type and -k correctly. + +2019-05-03 15:26 Christos Zoulas + + * Switch decompression code to use vfork() because + tools like rpmdiff and rpmbuild call libmagic + with large process footprints (Denys Vlasenko) + +2019-04-07 14:05 Christos Zoulas + + * PR/75: --enable-zlib, did not work. + +2019-02-27 11:54 Christos Zoulas + + * Improve regex efficiency (Michael Schroeder) by: + 1. Prefixing regex searches with regular search + for keywords where possible + 2. Using memmem(3) where available + +2019-02-20 10:16 Christos Zoulas + + * release 5.36 + +2019-02-19 15:30 Christos Zoulas + + * Fix cast to use cast macros + * Add UCS-32 builtin detection (PR/61) reported by tmc + +2019-02-18 18:24 Christos Zoulas + + * Fix stack read (PR/62) and write (PR/64) stack overflows + reported by spinpx + +2018-10-18 19:32 Christos Zoulas + + * release 5.35 + +2018-09-10 20:38 Christos Zoulas + + * Add FreeBSD ELF core file support (John Baldwin) + +2018-08-20 18:40 Christos Zoulas + + * PR/30: Allow all parameter values to be set (don't treat 0 specially) + * handle default annotations on the softmagic match instead at the + end. + +2018-07-25 10:17 Christos Zoulas + + * PR/23: Recognize JSON files + +2018-07-25 10:17 Christos Zoulas + + * PR/18: file --mime-encoding should not print mime-type + 2018-07-25 8:50 Christos Zoulas * release 5.34 @@ -14,11 +86,11 @@ * release 5.33 -2018-02-24 14:50 Christos Zoulas +2018-02-24 14:50 Christos Zoulas * extend the support for ${x?:} expansions for magic descriptions -2018-02-21 16:25 Christos Zoulas +2018-02-21 16:25 Christos Zoulas * add support for ${x?:} in mime types to handle pie binaries. @@ -90,7 +162,7 @@ * Add missing overflow check in der magic (Jonas Wagner) 2016-10-25 10:40 Christos Zoulas - + * release 5.29 2016-10-24 11:20 Christos Zoulas @@ -131,11 +203,11 @@ - set offset to 0 on failure. 2016-05-13 12:00 Christos Zoulas - + * release 5.27 2016-04-18 9:35 Christos Zoulas - + * Errors comparing DER entries or computing offsets are just indications of malformed non-DER files. Don't print them. @@ -144,7 +216,7 @@ * Put new bytes constant in the right file (not the generated one) 2016-04-16 18:34 Christos Zoulas - + * release 5.26 2016-03-31 13:50 Christos Zoulas @@ -190,7 +262,7 @@ * PR/492: compression forking was broken with magic_buffer. 2015-09-16 9:50 Christos Zoulas - + * release 5.25 2015-09-11 13:25 Christos Zoulas @@ -218,7 +290,7 @@ * release 5.23 2015-06-09 16:10 Christos Zoulas - + * Fix issue with regex range for magic with offset * Always return true from mget with USE (success to mget not match indication). Fixes mime evaluation after USE magic @@ -271,12 +343,12 @@ * add indirect relative for TIFF/Exif 2014-12-16 18:10 Christos Zoulas - + * restructure elf note printing to avoid repeated messages * add note limit, suggested by Alexander Cherepanov 2014-12-16 16:53 Christos Zoulas - + * Bail out on partial pread()'s (Alexander Cherepanov) * Fix incorrect bounds check in file_printable (Alexander Cherepanov) @@ -287,7 +359,7 @@ more places for safety * in ELF, instead of "(uses dynamic libraries)" when PT_INTERP is present print the interpreter name. - + 2014-12-10 20:01 Christos Zoulas * release 5.21 @@ -330,7 +402,7 @@ on a byte by byte basis, so that we don't get issues with locale's trying to interpret random byte streams as UTF-8 and having printf error out with EILSEQ. - + 2014-10-17 11:48 Christos Zoulas * fix bounds in note reading (Francisco Alonso / Red Hat) @@ -361,7 +433,7 @@ * release 5.19 2014-06-09 9:04 Christos Zoulas - + * Misc buffer overruns and missing buffer size tests in cdf parsing (Francisco Alonso, Jan Kaluza) @@ -391,7 +463,7 @@ 2014-05-04 14:55 Christos Zoulas - * PR/351: Fix compilation of empty files + * PR/351: Fix compilation of empty files 2014-04-30 17:39 Christos Zoulas @@ -495,7 +567,7 @@ * Don't treat magic as an error if offset was past EOF (Christoph Biedl) 2013-05-28 17:25 Christos Zoulas - + * Fix spacing issues in softmagic and elf (Jan Kaluza) 2013-05-02 18:00 Christos Zoulas @@ -551,7 +623,7 @@ * Make getline public so that file can link against it. Perhaps it is better to rename it, or hide it differently. Fixes builds on platforms that do not provide it. - + 2013-01-07 16:30 Christos Zoulas * Add SuS d{,1,2,4,8}, u{,1,2,4,8} and document @@ -901,7 +973,7 @@ (Cheng Renquan) 2009-05-08 13:40 Christos Zoulas - + * lint fixes and more from NetBSD 2009-05-06 10:25 Christos Zoulas @@ -921,7 +993,7 @@ 2009-03-27 18:43 Christos Zoulas - * don't print \012- separators in the same magic entry + * don't print \012- separators in the same magic entry if it consists of multiple magic printing lines. 2009-03-23 10:20 Christos Zoulas Modified: stable/12/contrib/file/NEWS ============================================================================== --- stable/12/contrib/file/NEWS Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/NEWS Thu Nov 21 07:29:25 2019 (r354938) @@ -1 +1 @@ -See ChangeLog. \ No newline at end of file +See ChangeLog. Modified: stable/12/contrib/file/README ============================================================================== --- stable/12/contrib/file/README Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/README Thu Nov 21 07:29:25 2019 (r354938) @@ -1,6 +1,6 @@ -## README for file(1) Command ## +## README for file(1) Command and the libmagic(3) library ## - @(#) $File: README,v 1.54 2018/05/30 03:06:56 christos Exp $ + @(#) $File: README,v 1.57 2019/02/06 00:20:56 christos Exp $ Mailing List: file@astron.com Mailing List archives: http://mailman.astron.com/pipermail/file/ @@ -63,53 +63,54 @@ magic numbers assigned to all sorts of data files that are in reasonable circulation. Send your magic numbers, in magic(5) format please, to the maintainer, Christos Zoulas. -COPYING - read this first. -README - read this second (you are currently reading this file). +COPYING - read this first. +README - read this second (you are currently reading this file). INSTALL - read on how to install -src/apprentice.c - parses /etc/magic to learn magic -src/apptype.c - used for OS/2 specific application type magic -src/ascmagic.c - third & last set of tests, based on hardwired assumptions. -src/asctime_r.c - replacement for OS's that don't have it. -src/asprintf.c - replacement for OS's that don't have it. -src/asctime_r.c - replacement for OS's that don't have it. -src/asprintf.c - replacement for OS's that don't have it. +src/apprentice.c - parses /etc/magic to learn magic +src/apptype.c - used for OS/2 specific application type magic +src/ascmagic.c - third & last set of tests, based on hardwired assumptions. +src/asctime_r.c - replacement for OS's that don't have it. +src/asprintf.c - replacement for OS's that don't have it. +src/asctime_r.c - replacement for OS's that don't have it. +src/asprintf.c - replacement for OS's that don't have it. src/buffer.c - buffer handling functions. -src/cdf.[ch] - parser for Microsoft Compound Document Files -src/cdf_time.c - time converter for CDF. -src/compress.c - handles decompressing files to look inside. -src/ctime_r.c - replacement for OS's that don't have it. +src/cdf.[ch] - parser for Microsoft Compound Document Files +src/cdf_time.c - time converter for CDF. +src/compress.c - handles decompressing files to look inside. +src/ctime_r.c - replacement for OS's that don't have it. src/der.[ch] - parser for Distinguished Encoding Rules src/dprintf.c - replacement for OS's that don't have it. src/elfclass.h - common code for elf 32/64. -src/encoding.c - handles unicode encodings -src/file.c - the main program -src/file.h - header file +src/encoding.c - handles unicode encodings +src/file.c - the main program +src/file.h - header file src/file_opts.h - list of options -src/fmtcheck.c - replacement for OS's that don't have it. -src/fsmagic.c - first set of tests the program runs, based on filesystem info -src/funcs.c - utilility functions -src/getline.c - replacement for OS's that don't have it. -src/getopt_long.c - replacement for OS's that don't have it. -src/gmtime_r.c - replacement for OS's that don't have it. -src/is_tar.c, tar.h - knows about Tape ARchive format (courtesy John Gilmore). -src/localtime_r.c - replacement for OS's that don't have it. +src/fmtcheck.c - replacement for OS's that don't have it. +src/fsmagic.c - first set of tests the program runs, based on filesystem info +src/funcs.c - utilility functions +src/getline.c - replacement for OS's that don't have it. +src/getopt_long.c - replacement for OS's that don't have it. +src/gmtime_r.c - replacement for OS's that don't have it. +src/is_json.c - knows about JavaScript Object Notation format (RFC 8259). +src/is_tar.c, tar.h - knows about Tape ARchive format (courtesy John Gilmore). +src/localtime_r.c - replacement for OS's that don't have it. src/magic.h.in - source file for magic.h -src/mygetopt.h - replacement for OS's that don't have it. -src/magic.c - the libmagic api -src/names.h - header file for ascmagic.c -src/pread.c - replacement for OS's that don't have it. -src/print.c - print results, errors, warnings. -src/readcdf.c - CDF wrapper. -src/readelf.[ch] - Stand-alone elf parsing code. -src/softmagic.c - 2nd set of tests, based on /etc/magic -src/mygetopt.h - replacement for OS's that don't have it. -src/strcasestr.c - replacement for OS's that don't have it. -src/strlcat.c - replacement for OS's that don't have it. -src/strlcpy.c - replacement for OS's that don't have it. -src/strndup.c - replacement for OS's that don't have it. +src/mygetopt.h - replacement for OS's that don't have it. +src/magic.c - the libmagic api +src/names.h - header file for ascmagic.c +src/pread.c - replacement for OS's that don't have it. +src/print.c - print results, errors, warnings. +src/readcdf.c - CDF wrapper. +src/readelf.[ch] - Stand-alone elf parsing code. +src/softmagic.c - 2nd set of tests, based on /etc/magic +src/mygetopt.h - replacement for OS's that don't have it. +src/strcasestr.c - replacement for OS's that don't have it. +src/strlcat.c - replacement for OS's that don't have it. +src/strlcpy.c - replacement for OS's that don't have it. +src/strndup.c - replacement for OS's that don't have it. src/tar.h - tar file definitions -src/vasprintf.c - for systems that don't have it. -doc/file.man - man page for the command +src/vasprintf.c - for systems that don't have it. +doc/file.man - man page for the command doc/magic.man - man page for the magic file, courtesy Guy Harris. Install as magic.4 on USG and magic.5 on V7 or Berkeley; cf Makefile. Modified: stable/12/contrib/file/config.h.in ============================================================================== --- stable/12/contrib/file/config.h.in Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/config.h.in Thu Nov 21 07:29:25 2019 (r354938) @@ -83,12 +83,6 @@ /* Define to 1 if you have the `z' library (-lz). */ #undef HAVE_LIBZ -/* Define to 1 if you have the header file. */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LOCALE_H - /* Define to 1 if you have the `localtime_r' function. */ #undef HAVE_LOCALTIME_R @@ -98,6 +92,9 @@ /* Define to 1 if declares mbstate_t. */ #undef HAVE_MBSTATE_T +/* Define to 1 if you have the `memmem' function. */ +#undef HAVE_MEMMEM + /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H @@ -116,18 +113,9 @@ /* Define to 1 if you have the `pread' function. */ #undef HAVE_PREAD -/* Define to 1 if you have the `setlocale' function. */ -#undef HAVE_SETLOCALE - -/* Define to 1 if you have the header file. */ -#undef HAVE_SIGNAL_H - /* Have sig_t type */ #undef HAVE_SIG_T -/* Define to 1 if you have the header file. */ -#undef HAVE_STDDEF_H - /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H @@ -137,9 +125,6 @@ /* Define to 1 if you have the `strcasestr' function. */ #undef HAVE_STRCASESTR -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H @@ -158,9 +143,6 @@ /* Define to 1 if you have the `strtof' function. */ #undef HAVE_STRTOF -/* Define to 1 if you have the `strtoul' function. */ -#undef HAVE_STRTOUL - /* HAVE_STRUCT_OPTION */ #undef HAVE_STRUCT_OPTION @@ -181,6 +163,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSMACROS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H Modified: stable/12/contrib/file/configure ============================================================================== --- stable/12/contrib/file/configure Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/configure Thu Nov 21 07:29:25 2019 (r354938) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for file 5.34. +# Generated by GNU Autoconf 2.69 for file 5.37. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='file' PACKAGE_TARNAME='file' -PACKAGE_VERSION='5.34' -PACKAGE_STRING='file 5.34' +PACKAGE_VERSION='5.37' +PACKAGE_STRING='file 5.37' PACKAGE_BUGREPORT='christos@astron.com' PACKAGE_URL='' @@ -1329,7 +1329,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures file 5.34 to adapt to many kinds of systems. +\`configure' configures file 5.37 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1399,7 +1399,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of file 5.34:";; + short | recursive ) echo "Configuration of file 5.37:";; esac cat <<\_ACEOF @@ -1511,7 +1511,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -file configure 5.34 +file configure 5.37 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2167,7 +2167,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by file $as_me 5.34, which was +It was created by file $as_me 5.37, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3033,7 +3033,7 @@ fi # Define the identity of the package. PACKAGE='file' - VERSION='5.34' + VERSION='5.37' cat >>confdefs.h <<_ACEOF @@ -12784,7 +12784,7 @@ $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi -for ac_header in stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h +for ac_header in stdint.h fcntl.h inttypes.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -12797,7 +12797,7 @@ fi done -for ac_header in stddef.h utime.h wchar.h wctype.h limits.h +for ac_header in utime.h wchar.h wctype.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -12810,7 +12810,7 @@ fi done -for ac_header in getopt.h err.h xlocale.h signal.h +for ac_header in getopt.h err.h xlocale.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -12823,7 +12823,7 @@ fi done -for ac_header in sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h +for ac_header in sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h sys/sysmacros.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -12850,10 +12850,7 @@ fi done fi -ac_fn_c_check_type "$LINENO" "sig_t" "ac_cv_type_sig_t" " -#ifdef HAVE_SIGNAL_H -#include -#endif +ac_fn_c_check_type "$LINENO" "sig_t" "ac_cv_type_sig_t" "#include " if test "x$ac_cv_type_sig_t" = xyes; then : @@ -12976,7 +12973,8 @@ _ACEOF fi -ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "$ac_includes_default" +ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "#include +" if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes; then : cat >>confdefs.h <<_ACEOF @@ -14229,7 +14227,7 @@ fi fi -for ac_func in strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale +for ac_func in strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -14583,7 +14581,8 @@ if test "$enable_zlib" = "yes"; then if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" != "yesyes"; then as_fn_error $? "zlib support requested but not found" "$LINENO" 5 fi -elif test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then +fi +if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then $as_echo "#define ZLIBSUPPORT 1" >>confdefs.h @@ -15134,7 +15133,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by file $as_me 5.34, which was +This file was extended by file $as_me 5.37, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15200,7 +15199,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -file config.status 5.34 +file config.status 5.37 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: stable/12/contrib/file/configure.ac ============================================================================== --- stable/12/contrib/file/configure.ac Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/configure.ac Thu Nov 21 07:29:25 2019 (r354938) @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([file],[5.34],[christos@astron.com]) +AC_INIT([file],[5.37],[christos@astron.com]) AM_INIT_AUTOMAKE([subdir-objects foreign]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) @@ -35,12 +35,12 @@ fi], [ ]) AC_MSG_CHECKING(for zlib support) -AC_ARG_ENABLE(zlib, +AC_ARG_ENABLE([zlib], [AS_HELP_STRING([--disable-zlib], [disable zlib compression support @<:@default=auto@:>@])]) AC_MSG_RESULT($enable_zlib) AC_MSG_CHECKING(for libseccomp support) -AC_ARG_ENABLE(libseccomp, +AC_ARG_ENABLE([libseccomp], [AS_HELP_STRING([--disable-libseccomp], [disable libseccomp sandboxing @<:@default=auto@:>@])]) AC_MSG_RESULT($enable_libseccomp) @@ -90,17 +90,14 @@ dnl Checks for headers AC_HEADER_STDC AC_HEADER_MAJOR AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h) -AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h) -AC_CHECK_HEADERS(getopt.h err.h xlocale.h signal.h) -AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h) +AC_CHECK_HEADERS(stdint.h fcntl.h inttypes.h unistd.h) +AC_CHECK_HEADERS(utime.h wchar.h wctype.h) +AC_CHECK_HEADERS(getopt.h err.h xlocale.h) +AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h sys/sysmacros.h) if test "$enable_zlib" != "no"; then AC_CHECK_HEADERS(zlib.h) fi -AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[ -#ifdef HAVE_SIGNAL_H -#include -#endif]) +AC_CHECK_TYPE([sig_t],[AC_DEFINE([HAVE_SIG_T],1,[Have sig_t type])],,[#include ]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST @@ -108,7 +105,7 @@ AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_CHECK_MEMBERS([struct stat.st_rdev]) -AC_CHECK_MEMBERS([struct tm.tm_gmtoff]) +AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include ]) AC_STRUCT_TIMEZONE AC_STRUCT_TIMEZONE_DAYLIGHT AC_SYS_LARGEFILE @@ -154,7 +151,7 @@ else fi]) dnl Checks for functions -AC_CHECK_FUNCS(strerror strndup strtoul mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale setlocale) +AC_CHECK_FUNCS(strndup mkstemp mkostemp utimes utime wcwidth strtof newlocale uselocale freelocale memmem) dnl Provide implementation of some required functions if necessary AC_REPLACE_FUNCS(getopt_long asprintf vasprintf strlcpy strlcat getline ctime_r asctime_r localtime_r gmtime_r pread strcasestr fmtcheck dprintf) @@ -178,7 +175,8 @@ if test "$enable_zlib" = "yes"; then if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" != "yesyes"; then AC_MSG_ERROR([zlib support requested but not found]) fi -elif test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then +fi +if test "$ac_cv_header_zlib_h$ac_cv_lib_z_gzopen" = "yesyes"; then AC_DEFINE([ZLIBSUPPORT], 1, [Enable zlib compression support]) fi Modified: stable/12/contrib/file/doc/file.man ============================================================================== --- stable/12/contrib/file/doc/file.man Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/doc/file.man Thu Nov 21 07:29:25 2019 (r354938) @@ -1,5 +1,5 @@ -.\" $File: file.man,v 1.131 2018/07/24 21:33:56 christos Exp $ -.Dd July 25, 2018 +.\" $File: file.man,v 1.135 2019/03/03 02:32:40 christos Exp $ +.Dd February 18, 2019 .Dt FILE __CSECTION__ .Os .Sh NAME @@ -159,7 +159,7 @@ two groups, so they are performed last. The language test routines also test for some miscellany (such as .Xr tar 1 -archives). +archives, JSON files). .Pp Any file that cannot be identified as having been written in any of the character sets listed above is simply said to be @@ -171,6 +171,8 @@ Causes the file command to output the file type and cr used by older MacOS versions. The code consists of eight letters, the first describing the file type, the latter the creator. +This option works properly only for file formats that have the +apple-style output defined. .It Fl b , Fl Fl brief Do not prepend filenames to output lines (brief mode). .It Fl C , Fl Fl compile @@ -213,6 +215,8 @@ Checks for, and looks inside, compressed files. .It elf Prints ELF file details, provided soft magic tests are enabled and the elf magic is found. +.It json +Examines JSON (RFC-7159) files by parsing them for compliance. .It soft Consults magic files. .It tar @@ -629,11 +633,11 @@ were written by John Gilmore from his public-domain program, and are not covered by the above license. .Sh BUGS Please report bugs and send patches to the bug tracker at -.Pa http://bugs.astron.com/ +.Pa https://bugs.astron.com/ or the mailing list at .Aq file@astron.com (visit -.Pa http://mailman.astron.com/mailman/listinfo/file +.Pa https://mailman.astron.com/mailman/listinfo/file first to subscribe). .Sh TODO Fix output so that tests for MIME and APPLE flags are not needed all Modified: stable/12/contrib/file/doc/libmagic.man ============================================================================== --- stable/12/contrib/file/doc/libmagic.man Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/doc/libmagic.man Thu Nov 21 07:29:25 2019 (r354938) @@ -1,6 +1,6 @@ -.\" $File: libmagic.man,v 1.41 2017/05/23 21:54:07 christos Exp $ +.\" $File: libmagic.man,v 1.44 2018/09/09 20:33:28 christos Exp $ .\" -.\" Copyright (c) Christos Zoulas 2003. +.\" Copyright (c) Christos Zoulas 2003, 2018. .\" All Rights Reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -25,7 +25,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd May 23, 2017 +.Dd August 18, 2018 .Dt LIBMAGIC 3 .Os .Sh NAME @@ -159,6 +159,8 @@ Don't examine tar files. Don't check for various types of text files. .It Dv MAGIC_NO_CHECK_TOKENS Don't look for known tokens inside ascii files. +.It Dv MAGIC_NO_CHECK_JSON +Don't example JSON files. .El .Pp The @@ -391,6 +393,19 @@ The compiled default magic database. .Sh SEE ALSO .Xr file __CSECTION__ , .Xr magic __FSECTION__ +.Sh BUGS +The results from +.Fn magic_buffer +and +.Fn magic_file +where the buffer and the file contain the same data +can produce different results, because in the +.Fn magic_file +case, the program can +.Xr lseek 2 +and +.Xr stat 2 +the file descriptor. .Sh AUTHORS .An M\(oans Rullg\(oard Initial libmagic implementation, and configuration. Modified: stable/12/contrib/file/doc/magic.man ============================================================================== --- stable/12/contrib/file/doc/magic.man Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/doc/magic.man Thu Nov 21 07:29:25 2019 (r354938) @@ -1,6 +1,5 @@ -.It S2 -.\" $File: magic.man,v 1.93 2018/06/22 20:39:49 christos Exp $ -.Dd June 22, 2018 +.\" $File: magic.man,v 1.96 2019/01/21 14:56:53 christos Exp $ +.Dd January 21, 2019 .Dt MAGIC __FSECTION__ .Os .\" install as magic.4 on USG, magic.5 on V7, Berkeley and Linux systems. @@ -117,13 +116,13 @@ The following modifiers are supported: .It B A byte length (default). .It H -A 4 byte big endian length. -.It h A 2 byte big endian length. +.It h +A 2 byte little endian length. .It L -A 4 byte little endian length. +A 4 byte big endian length. .It l -A 2 byte little endian length. +A 4 byte little endian length. .It J The length includes itself in its count. .El Modified: stable/12/contrib/file/magic/Header ============================================================================== --- stable/12/contrib/file/magic/Header Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/magic/Header Thu Nov 21 07:29:25 2019 (r354938) @@ -2,4 +2,4 @@ # Format is described in magic(files), where: # files is 5 on V7 and BSD, 4 on SV, and ?? on SVID. # Don't edit this file, edit /etc/magic or send your magic improvements -# to the maintainers, at file@mx.gw.com +# to the maintainers, at file@astron.com Modified: stable/12/contrib/file/magic/Magdir/acorn ============================================================================== --- stable/12/contrib/file/magic/Magdir/acorn Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/magic/Magdir/acorn Thu Nov 21 07:29:25 2019 (r354938) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: acorn,v 1.6 2017/10/19 16:40:37 christos Exp $ +# $File: acorn,v 1.7 2019/04/19 00:42:27 christos Exp $ # acorn: file(1) magic for files found on Acorn systems # @@ -83,7 +83,7 @@ # compression mode y (0 - 4) for GIF LZW with a maximum n bits # (y~n,0~12,1~13,2~14,3~15,4~16) >>>5 ulelong+12 x \b, LZW %u-bits compression -# http://www.filebase.org.uk/filetypes +# https://www.filebase.org.uk/filetypes # !Packdir compressed archive has three hexadecimal digits code 68E !:mime application/x-acorn-68E !:ext pkd/bin Modified: stable/12/contrib/file/magic/Magdir/adventure ============================================================================== --- stable/12/contrib/file/magic/Magdir/adventure Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/magic/Magdir/adventure Thu Nov 21 07:29:25 2019 (r354938) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: adventure,v 1.17 2017/07/03 16:03:40 christos Exp $ +# $File: adventure,v 1.18 2019/04/19 00:42:27 christos Exp $ # adventure: file(1) magic for Adventure game files # # from Allen Garvin @@ -21,8 +21,8 @@ # Updated by Adam Buchbinder # #http://www.gnelson.demon.co.uk/zspec/sect11.html -#http://www.jczorkmid.net/~jpenney/ZSpec11-latest.txt -#http://en.wikipedia.org/wiki/Z-machine +#https://www.jczorkmid.net/~jpenney/ZSpec11-latest.txt +#https://en.wikipedia.org/wiki/Z-machine # The first byte is the Z-machine revision; it is always between 1 and 8. We # had false matches (for instance, inbig5.ocp from the Omega TeX extension as # well as an occasional MP3 file), so we sanity-check the version number. @@ -111,7 +111,7 @@ # Danny Milosavljevic # These are ADRIFT (adventure game standard) game files, extension .taf # Checked from source at (http://www.adrift.co/) and various taf files -# found at the Interactive Fiction Archive (http://ifarchive.org/) +# found at the Interactive Fiction Archive (https://ifarchive.org/) 0 belong 0x3C423FC9 >4 belong 0x6A87C2CF Adrift game file version >>8 belong 0x94453661 3.80 Modified: stable/12/contrib/file/magic/Magdir/algol68 ============================================================================== --- stable/12/contrib/file/magic/Magdir/algol68 Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/magic/Magdir/algol68 Thu Nov 21 07:29:25 2019 (r354938) @@ -1,17 +1,17 @@ #------------------------------------------------------------------------------ -# $File: algol68,v 1.2 2016/10/17 14:17:48 christos Exp $ +# $File: algol68,v 1.3 2018/10/19 01:04:21 christos Exp $ # algol68: file(1) magic for Algol 68 source # 0 search/8192 (input, Algol 68 source text !:mime text/x-Algol68 -0 regex \^PROC Algol 68 source text +0 regex/1024 \^PROC Algol 68 source text !:mime text/x-Algol68 -0 regex MODE[\t\ ] Algol 68 source text +0 regex/1024 \bMODE[\t\ ] Algol 68 source text !:mime text/x-Algol68 -0 regex REF[\t\ ] Algol 68 source text +0 regex/1024 \bREF[\t\ ] Algol 68 source text !:mime text/x-Algol68 -0 regex FLEX[\t\ ]\*\\[ Algol 68 source text +0 regex/1024 \bFLEX[\t\ ]\*\\[ Algol 68 source text !:mime text/x-Algol68 #0 regex [\t\ ]OD Algol 68 source text #!:mime text/x-Algol68 Modified: stable/12/contrib/file/magic/Magdir/amigaos ============================================================================== --- stable/12/contrib/file/magic/Magdir/amigaos Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/magic/Magdir/amigaos Thu Nov 21 07:29:25 2019 (r354938) @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ -# $File: amigaos,v 1.16 2017/03/17 21:35:28 christos Exp $ +# $File: amigaos,v 1.17 2018/10/16 18:57:19 christos Exp $ # amigaos: file(1) magic for AmigaOS binary formats: # @@ -66,3 +66,22 @@ # From: Przemek Kramarczyk 0 string .KEY AmigaDOS script 0 string .key AmigaDOS script + +# AMOS Basic file formats +# https://www.exotica.org.uk/wiki/AMOS_file_formats +0 string AMOS\040Basic\040 AMOS Basic source code +>11 byte =0x56 \b, tested +>11 byte =0x76 \b, untested +0 string AMOS\040Pro AMOS Basic source code +>11 byte =0x56 \b, tested +>11 byte =0x76 \b, untested +0 string AmSp AMOS Basic sprite bank +>4 beshort x \b, %d sprites +0 string AmIc AMOS Basic icon bank +>4 beshort x \b, %d icons +0 string AmBk AMOS Basic memory bank +>4 beshort x \b, bank number %d +>8 belong&0xFFFFFFF x \b, length %d +>12 regex .{8} \b, type %s +0 string AmBs AMOS Basic memory banks +>4 beshort x \b, %d banks Modified: stable/12/contrib/file/magic/Magdir/android ============================================================================== --- stable/12/contrib/file/magic/Magdir/android Thu Nov 21 06:48:30 2019 (r354937) +++ stable/12/contrib/file/magic/Magdir/android Thu Nov 21 07:29:25 2019 (r354938) @@ -1,6 +1,6 @@ #------------------------------------------------------------ -# $File: android,v 1.10 2017/03/17 21:35:28 christos Exp $ +# $File: android,v 1.12 2019/04/19 00:42:27 christos Exp $ # Various android related magic entries #------------------------------------------------------------ @@ -32,33 +32,68 @@ # Android Backup archive # From: Ariel Shkedi -# File extension: .ab -# No mime-type defined +# Update: Joerg Jenderek # URL: https://github.com/android/platform_frameworks_base/blob/\ # 0bacfd2ba68d21a68a3df345b830bc2a1e515b5a/services/java/com/\ # android/server/BackupManagerService.java#L2367 +# Reference: https://sourceforge.net/projects/adbextractor/ +# android-backup-extractor/perl/backupencrypt.pl +# Note: only unix line feeds "\n" found # After the header comes a tar file # If compressed, the entire tar file is compressed with JAVA deflate # # Include the version number hardcoded with the magic string to avoid # false positives -0 string/b ANDROID\ BACKUP\n1\n Android Backup +0 string/b ANDROID\ BACKUP\n Android Backup +# maybe look for some more characteristics like linefeed '\n' or version +#>16 string \n +# No mime-type defined offically +!:mime application/x-google-ab +!:ext ab +# on 2nd line version (often 1, 2 on kitkat 4.4.3+, 4 on 7.1.2) +>15 string >\0 \b, version %s +# "1" on 3rd line means compressed >17 string 0\n \b, Not-Compressed >17 string 1\n \b, Compressed +# The 4th line is encryption "none" or "AES-256" # any string as long as it's not the word none (which is matched below) +>19 string none\n \b, Not-Encrypted +# look for backup content after line with encryption info +#>>19 search/7 \n +# data part after header for not encrypted Android Backup +#>>>&0 ubequad x \b, content 0x%16.16llx... +# look for zlib compressed by ./compress after message with 1 space at end +#>>>&0 indirect x \b; contains +# look for tar archive block by ./archive for package name manifest +>>288 string ustar \b; contains +>>>31 use tar-file +# look for zip/jar archive by ./archive ./zip after message with 1 space at end +#>>2079 search/1025/s PK\003\004 \b; contains +#>>>&0 indirect x +>19 string !none >>19 regex/1l \^([^n\n]|n[^o]|no[^n]|non[^e]|none.+).* \b, Encrypted (%s) ->>19 string none\n \b, Not-Encrypted # Commented out because they don't seem useful to print # (but they are part of the header - the tar file comes after them): +# The 5th line is User Password Salt (128 Hex) +# string length too high with standard src configuration +#>>>&1 string >\0 \b, PASSWORD salt: "%-128.128s" #>>>&1 regex/1l .* \b, Password salt: %s +# The 6th line is Master Key Checksum Salt (128 Hex) #>>>>&1 regex/1l .* \b, Master salt: %s +# The 7th line is Number of PBDKF2 Rounds (10000) #>>>>>&1 regex/1l .* \b, PBKDF2 rounds: %s +# The 8th line is User key Initialization Vector (IV) (32 Hex) #>>>>>>&1 regex/1l .* \b, IV: %s +#>>>>>>&1 regex/1l .* \b, IV: %s +# The 9th line is Master IV+Key+Checksum (192 Hex) #>>>>>>>&1 regex/1l .* \b, Key: %s +# look for new line separator char after line number 9 +#>>>0x204 ubyte 0x0a NL found +#>>>>&1 ubequad x \b, Content magic %16.16llx # *.pit files by Joerg Jenderek -# http://forum.xda-developers.com/showthread.php?p=9122369 -# http://forum.xda-developers.com/showthread.php?t=816449 +# https://forum.xda-developers.com/showthread.php?p=9122369 +# https://forum.xda-developers.com/showthread.php?t=816449 # Partition Information Table for Samsung's smartphone with Android *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-12@freebsd.org Thu Nov 21 07:48:04 2019 Return-Path: Delivered-To: svn-src-stable-12@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 3AD541B3D45; Thu, 21 Nov 2019 07:48:04 +0000 (UTC) (envelope-from avg@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JWrN0lCBz42wd; Thu, 21 Nov 2019 07:48:04 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F0E94804B; Thu, 21 Nov 2019 07:48:03 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAL7m3O3023581; Thu, 21 Nov 2019 07:48:03 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAL7m3mv023580; Thu, 21 Nov 2019 07:48:03 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201911210748.xAL7m3mv023580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 21 Nov 2019 07:48:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354940 - stable/12/sys/dev/iicbus X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/iicbus X-SVN-Commit-Revision: 354940 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 07:48:04 -0000 Author: avg Date: Thu Nov 21 07:48:03 2019 New Revision: 354940 URL: https://svnweb.freebsd.org/changeset/base/354940 Log: MFC r354212: iicbb: allow longer SCL low timeout and other improvements First, SCL low timeout is set to 25 milliseconds by default as opposed to 1 millisecond before. The new value is based on the SMBus specification. The timeout can be changed on a per bus basis using dev.iicbb.N.scl_low_timeout sysctl. The driver uses DELAY to wait for high SCL up to 1 millisecond, then it switches to pause_sbt(SBT_1MS) for the rest of the timeout. While here I made a number of other changes. 'udelay' that's used for timing clock and data signals is now calculated based on the requested bus frequency (dev.iicbus.N.frequency) instead of being hardcoded to 10 microseconds. The calculations are done in such a fashion that the default bus frequency of 100000 is converted to udelay of 10 us. This is for backward compatibility. The actual frequency will be less than a quarter (I think) of the requested frequency. Also, I added detection of stuck low SCL in a few places. Previously, the code would just carry on after the SCL low timeout and that might potentially lead to misinterpreted bits. Finally, I fixed several style issues near the code that I changed. Many more are still remaining. Modified: stable/12/sys/dev/iicbus/iicbb.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/iicbus/iicbb.c ============================================================================== --- stable/12/sys/dev/iicbus/iicbb.c Thu Nov 21 07:39:33 2019 (r354939) +++ stable/12/sys/dev/iicbus/iicbb.c Thu Nov 21 07:48:03 2019 (r354940) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #ifdef FDT @@ -68,9 +69,13 @@ __FBSDID("$FreeBSD$"); #include "iicbus_if.h" #include "iicbb_if.h" +/* Based on the SMBus specification. */ +#define DEFAULT_SCL_LOW_TIMEOUT (25 * 1000) + struct iicbb_softc { device_t iicbus; - int udelay; /* signal toggle delay in usec */ + u_int udelay; /* signal toggle delay in usec */ + u_int scl_low_timeout; }; static int iicbb_attach(device_t); @@ -86,6 +91,7 @@ static int iicbb_write(device_t, const char *, int, in static int iicbb_read(device_t, char *, int, int *, int, int); static int iicbb_reset(device_t, u_char, u_char, u_char *); static int iicbb_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs); +static void iicbb_set_speed(struct iicbb_softc *sc, u_char); #ifdef FDT static phandle_t iicbb_get_node(device_t, device_t); #endif @@ -142,9 +148,19 @@ iicbb_attach(device_t dev) sc->iicbus = device_add_child(dev, "iicbus", -1); if (!sc->iicbus) return (ENXIO); - sc->udelay = 10; /* 10 uS default */ - bus_generic_attach(dev); + sc->scl_low_timeout = DEFAULT_SCL_LOW_TIMEOUT; + + SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + "delay", CTLFLAG_RD, &sc->udelay, + 0, "Signal change delay controlled by bus frequency, microseconds"); + + SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + "scl_low_timeout", CTLFLAG_RWTUN, &sc->scl_low_timeout, + 0, "SCL low timeout, microseconds"); + bus_generic_attach(dev); return (0); } @@ -201,24 +217,17 @@ iicbb_print_child(device_t bus, device_t dev) return (retval); } -#define I2C_SETSDA(sc,dev,val) do { \ - IICBB_SETSDA(device_get_parent(dev), val); \ +#define I2C_GETSDA(dev) (IICBB_GETSDA(device_get_parent(dev))) +#define I2C_SETSDA(dev, x) (IICBB_SETSDA(device_get_parent(dev), x)) +#define I2C_GETSCL(dev) (IICBB_GETSCL(device_get_parent(dev))) +#define I2C_SETSCL(dev, x) (IICBB_SETSCL(device_get_parent(dev), x)) + +#define I2C_SET(sc, dev, ctrl, val) do { \ + iicbb_setscl(dev, ctrl); \ + I2C_SETSDA(dev, val); \ DELAY(sc->udelay); \ } while (0) -#define I2C_SETSCL(dev,val) do { \ - iicbb_setscl(dev, val, 100); \ - } while (0) - -#define I2C_SET(sc,dev,ctrl,data) do { \ - I2C_SETSCL(dev, ctrl); \ - I2C_SETSDA(sc, dev, data); \ - } while (0) - -#define I2C_GETSDA(dev) (IICBB_GETSDA(device_get_parent(dev))) - -#define I2C_GETSCL(dev) (IICBB_GETSCL(device_get_parent(dev))) - static int i2c_debug = 0; #define I2C_DEBUG(x) do { \ if (i2c_debug) (x); \ @@ -229,20 +238,37 @@ static int i2c_debug = 0; } while (0) static void -iicbb_setscl(device_t dev, int val, int timeout) +iicbb_setscl(device_t dev, int val) { struct iicbb_softc *sc = device_get_softc(dev); - int k = 0; + sbintime_t now, end; + int fast_timeout; - IICBB_SETSCL(device_get_parent(dev), val); + I2C_SETSCL(dev, val); DELAY(sc->udelay); - while (val && !I2C_GETSCL(dev) && k++ < timeout) { - IICBB_SETSCL(device_get_parent(dev), val); + /* Pulling low cannot fail. */ + if (!val) + return; + + /* Use DELAY for up to 1 ms, then switch to pause. */ + end = sbinuptime() + sc->scl_low_timeout * SBT_1US; + fast_timeout = MIN(sc->scl_low_timeout, 1000); + while (fast_timeout > 0) { + if (I2C_GETSCL(dev)) + return; + I2C_SETSCL(dev, 1); /* redundant ? */ DELAY(sc->udelay); + fast_timeout -= sc->udelay; } - return; + while (!I2C_GETSCL(dev)) { + now = sbinuptime(); + if (now >= end) + break; + pause_sbt("iicbb-scl-low", SBT_1MS, C_PREL(8), 0); + } + } static void @@ -290,6 +316,11 @@ iicbb_ack(device_t dev, int timeout) I2C_SET(sc,dev,0,1); I2C_SET(sc,dev,1,1); + + /* SCL must be high now. */ + if (!I2C_GETSCL(dev)) + return (IIC_ETIMEOUT); + do { noack = I2C_GETSDA(dev); if (!noack) @@ -301,14 +332,14 @@ iicbb_ack(device_t dev, int timeout) I2C_SET(sc,dev,0,1); I2C_DEBUG(printf("%c ",noack?'-':'+')); - return (noack); + return (noack ? IIC_ENOACK : 0); } static void iicbb_sendbyte(device_t dev, u_char data, int timeout) { int i; - + for (i=7; i>=0; i--) { if (data&(1<")); I2C_DEBUG(printf("\n")); + + /* SCL must be high now. */ + if (!I2C_GETSCL(dev)) + return (IIC_ETIMEOUT); return (0); } @@ -408,15 +445,13 @@ iicbb_write(device_t dev, const char *buf, int len, in iicbb_sendbyte(dev,(u_char)*buf++, timeout); /* check for ack */ - if (iicbb_ack(dev, timeout)) { - error = IIC_ENOACK; - goto error; - } - bytes ++; - len --; + error = iicbb_ack(dev, timeout); + if (error != 0) + break; + bytes++; + len--; } -error: *sent = bytes; return (error); } @@ -452,6 +487,24 @@ iicbb_transfer(device_t dev, struct iic_msg *msgs, uin IICBB_POST_XFER(device_get_parent(dev)); return (error); +} + +static void +iicbb_set_speed(struct iicbb_softc *sc, u_char speed) +{ + u_int busfreq, period; + + /* + * NB: the resulting frequency will be a quarter (even less) of the + * configured bus frequency. This is for historic reasons. The default + * bus frequency is 100 kHz. And the historic default udelay is 10 + * microseconds. The cycle of sending a bit takes four udelay-s plus + * SCL is kept low for extra two udelay-s. The actual I/O toggling also + * has an overhead. + */ + busfreq = IICBUS_GET_FREQUENCY(sc->iicbus, speed); + period = 1000000 / busfreq; /* Hz -> uS */ + sc->udelay = MAX(period, 1); } DRIVER_MODULE(iicbus, iicbb, iicbus_driver, iicbus_devclass, 0, 0); From owner-svn-src-stable-12@freebsd.org Thu Nov 21 12:28:42 2019 Return-Path: Delivered-To: svn-src-stable-12@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 AE8E11BD006; Thu, 21 Nov 2019 12:28:42 +0000 (UTC) (envelope-from lwhsu@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Jf4B45Q6z4KKl; Thu, 21 Nov 2019 12:28:42 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6CB3DB279; Thu, 21 Nov 2019 12:28:42 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALCSgPx088601; Thu, 21 Nov 2019 12:28:42 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALCSgpk088600; Thu, 21 Nov 2019 12:28:42 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201911211228.xALCSgpk088600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Thu, 21 Nov 2019 12:28:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354943 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 354943 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 12:28:42 -0000 Author: lwhsu Date: Thu Nov 21 12:28:41 2019 New Revision: 354943 URL: https://svnweb.freebsd.org/changeset/base/354943 Log: MFC r354800: Also clean LINT64 kernel configuration for powerpc Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/conf/makeLINT.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/makeLINT.mk ============================================================================== --- stable/12/sys/conf/makeLINT.mk Thu Nov 21 11:22:08 2019 (r354942) +++ stable/12/sys/conf/makeLINT.mk Thu Nov 21 12:28:41 2019 (r354943) @@ -14,6 +14,9 @@ clean: .if ${TARGET} == "arm" rm -f LINT-V5 LINT-V7 .endif +.if ${TARGET} == "powerpc" + rm -f LINT64 +.endif NOTES= ${.CURDIR}/../../conf/NOTES ${.CURDIR}/NOTES MAKELINT_SED= ${.CURDIR}/../../conf/makeLINT.sed From owner-svn-src-stable-12@freebsd.org Thu Nov 21 14:54:21 2019 Return-Path: Delivered-To: svn-src-stable-12@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 9D8891C168A; Thu, 21 Nov 2019 14:54:21 +0000 (UTC) (envelope-from emaste@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47JjJF3b9Yz4VxG; Thu, 21 Nov 2019 14:54:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E67FCF13; Thu, 21 Nov 2019 14:54:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xALEsLBC077203; Thu, 21 Nov 2019 14:54:21 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xALEsKxd077199; Thu, 21 Nov 2019 14:54:20 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201911211454.xALEsKxd077199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 21 Nov 2019 14:54:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354964 - stable/12/sys/dev/aacraid X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/sys/dev/aacraid X-SVN-Commit-Revision: 354964 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2019 14:54:21 -0000 Author: emaste Date: Thu Nov 21 14:54:20 2019 New Revision: 354964 URL: https://svnweb.freebsd.org/changeset/base/354964 Log: MFC r348091 by sobomax: update aacraid driver to 3.2.10 PR: 209468 Modified: stable/12/sys/dev/aacraid/aacraid.c stable/12/sys/dev/aacraid/aacraid_cam.c stable/12/sys/dev/aacraid/aacraid_reg.h stable/12/sys/dev/aacraid/aacraid_var.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/aacraid/aacraid.c ============================================================================== --- stable/12/sys/dev/aacraid/aacraid.c Thu Nov 21 14:23:16 2019 (r354963) +++ stable/12/sys/dev/aacraid/aacraid.c Thu Nov 21 14:54:20 2019 (r354964) @@ -264,7 +264,7 @@ aacraid_attach(struct aac_softc *sc) /* * Check that the firmware on the card is supported. */ - sc->msi_enabled = FALSE; + sc->msi_enabled = sc->msi_tupelo = FALSE; if ((error = aac_check_firmware(sc)) != 0) return(error); @@ -284,8 +284,8 @@ aacraid_attach(struct aac_softc *sc) */ if ((error = aac_alloc(sc)) != 0) return(error); + aac_define_int_mode(sc); if (!(sc->flags & AAC_FLAGS_SYNC_MODE)) { - aac_define_int_mode(sc); if ((error = aac_init(sc)) != 0) return(error); } @@ -728,7 +728,7 @@ aacraid_free(struct aac_softc *sc) else break; } - if (sc->msi_enabled) + if (sc->msi_enabled || sc->msi_tupelo) pci_release_msi(sc->aac_dev); /* destroy data-transfer DMA tag */ @@ -1316,6 +1316,9 @@ aacraid_map_command_sg(void *arg, bus_dma_segment_t *s fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "nseg %d", nseg); mtx_assert(&sc->aac_io_lock, MA_OWNED); + if ((sc->flags & AAC_FLAGS_SYNC_MODE) && sc->aac_sync_cm) + return; + /* copy into the FIB */ if (cm->cm_sgtable != NULL) { if (fib->Header.Command == RawIo2) { @@ -1433,11 +1436,14 @@ aacraid_map_command_sg(void *arg, bus_dma_segment_t *s cm->cm_flags |= AAC_CMD_MAPPED; - if (sc->flags & AAC_FLAGS_SYNC_MODE) { + if (cm->cm_flags & AAC_CMD_WAIT) { + aacraid_sync_command(sc, AAC_MONKER_SYNCFIB, + cm->cm_fibphys, 0, 0, 0, NULL, NULL); + } else if (sc->flags & AAC_FLAGS_SYNC_MODE) { u_int32_t wait = 0; - aacraid_sync_command(sc, AAC_MONKER_SYNCFIB, cm->cm_fibphys, 0, 0, 0, &wait, NULL); - } else if (cm->cm_flags & AAC_CMD_WAIT) { - aacraid_sync_command(sc, AAC_MONKER_SYNCFIB, cm->cm_fibphys, 0, 0, 0, NULL, NULL); + sc->aac_sync_cm = cm; + aacraid_sync_command(sc, AAC_MONKER_SYNCFIB, + cm->cm_fibphys, 0, 0, 0, &wait, NULL); } else { int count = 10000000L; while (AAC_SEND_COMMAND(sc, cm) != 0) { @@ -1617,6 +1623,7 @@ aac_check_firmware(struct aac_softc *sc) options = AAC_GET_MAILBOX(sc, 1); atu_size = AAC_GET_MAILBOX(sc, 2); sc->supported_options = options; + sc->doorbell_mask = AAC_GET_MAILBOX(sc, 3); if ((options & AAC_SUPPORTED_4GB_WINDOW) != 0 && (sc->flags & AAC_FLAGS_NO4GB) == 0) @@ -1631,13 +1638,13 @@ aac_check_firmware(struct aac_softc *sc) sc->flags |= AAC_FLAGS_SG_64BIT; } if (sc->aac_if.aif_send_command) { - if ((options & AAC_SUPPORTED_NEW_COMM_TYPE3) || - (options & AAC_SUPPORTED_NEW_COMM_TYPE4)) - sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE34; + if (options & AAC_SUPPORTED_NEW_COMM_TYPE2) + sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE2; else if (options & AAC_SUPPORTED_NEW_COMM_TYPE1) sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE1; - else if (options & AAC_SUPPORTED_NEW_COMM_TYPE2) - sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE2; + else if ((options & AAC_SUPPORTED_NEW_COMM_TYPE3) || + (options & AAC_SUPPORTED_NEW_COMM_TYPE4)) + sc->flags |= AAC_FLAGS_NEW_COMM | AAC_FLAGS_NEW_COMM_TYPE34; } if (options & AAC_SUPPORTED_64BIT_ARRAYSIZE) sc->flags |= AAC_FLAGS_ARRAY_64BIT; @@ -1851,8 +1858,30 @@ aac_define_int_mode(struct aac_softc *sc) dev = sc->aac_dev; + if (sc->flags & AAC_FLAGS_SYNC_MODE) { + device_printf(dev, "using line interrupts\n"); + sc->aac_max_msix = 1; + sc->aac_vector_cap = sc->aac_max_fibs; + return; + } + /* max. vectors from AAC_MONKER_GETCOMMPREF */ if (sc->aac_max_msix == 0) { + if (sc->aac_hwif == AAC_HWIF_SRC) { + msi_count = 1; + if ((error = pci_alloc_msi(dev, &msi_count)) != 0) { + device_printf(dev, "alloc msi failed - err=%d; " + "will use INTx\n", error); + pci_release_msi(dev); + } else { + sc->msi_tupelo = TRUE; + } + } + if (sc->msi_tupelo) + device_printf(dev, "using MSI interrupts\n"); + else + device_printf(dev, "using line interrupts\n"); + sc->aac_max_msix = 1; sc->aac_vector_cap = sc->aac_max_fibs; return; @@ -1958,7 +1987,7 @@ aac_setup_intr(struct aac_softc *sc) void *tag; msi_count = sc->aac_max_msix; - rid = (sc->msi_enabled ? 1:0); + rid = ((sc->msi_enabled || sc->msi_tupelo)? 1:0); for (i = 0; i < msi_count; i++, rid++) { if ((res = bus_alloc_resource_any(sc->aac_dev,SYS_RES_IRQ, &rid, @@ -2854,14 +2883,14 @@ aac_ioctl_send_raw_srb(struct aac_softc *sc, caddr_t a fib = cm->cm_fib; srbcmd = (struct aac_srb *)fib->data; - if ((error = copyin((void *)&user_srb->data_len, &fibsize, - sizeof (u_int32_t)) != 0)) + if ((error = copyin((void *)&user_srb->data_len, &fibsize, + sizeof (u_int32_t))) != 0) goto out; if (fibsize > (sc->aac_max_fib_size-sizeof(struct aac_fib_header))) { error = EINVAL; goto out; } - if ((error = copyin((void *)user_srb, srbcmd, fibsize) != 0)) + if ((error = copyin((void *)user_srb, srbcmd, fibsize)) != 0) goto out; srbcmd->function = 0; /* SRBF_ExecuteScsi */ @@ -2895,13 +2924,10 @@ aac_ioctl_send_raw_srb(struct aac_softc *sc, caddr_t a srb_sg_bytecount = sg.SgByteCount; srb_sg_address = sg.SgAddress; - if (srb_sg_address > 0xffffffffull && - !(sc->flags & AAC_FLAGS_SG_64BIT)) -#endif - { - error = EINVAL; - goto out; - } +#else + error = EINVAL; + goto out; +#endif } else { error = EINVAL; goto out; @@ -3701,7 +3727,7 @@ aac_get_bus_info(struct aac_softc *sc) caminf->TargetsPerBus = businfo.TargetsPerBus; caminf->BusNumber = i+1; caminf->BusType = PASSTHROUGH_BUS; - caminf->InitiatorBusId = businfo.InitiatorBusId[i]; + caminf->InitiatorBusId = -1; caminf->aac_sc = sc; caminf->sim_dev = child; caminf->aac_cam = NULL; @@ -3745,7 +3771,7 @@ aac_reset_adapter(struct aac_softc *sc) struct aac_fib *fib; struct aac_pause_command *pc; u_int32_t status, reset_mask, waitCount, max_msix_orig; - int msi_enabled_orig; + int ret, msi_enabled_orig; fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); mtx_assert(&sc->aac_io_lock, MA_OWNED); @@ -3804,50 +3830,61 @@ aac_reset_adapter(struct aac_softc *sc) AAC_MEM0_SETREG4(sc, AAC_IRCSR, AAC_IRCSR_CORES_RST); /* We need to wait for 5 seconds before accessing the MU again - * 10000 * 100us = 1000,000us = 1000ms = 1s + * 10000 * 100us = 1000,000us = 1000ms = 1s */ waitCount = 5 * 10000; while (waitCount) { DELAY(100); /* delay 100 microseconds */ waitCount--; } - } else if ((aacraid_sync_command(sc, - AAC_IOP_RESET_ALWAYS, 0, 0, 0, 0, &status, &reset_mask)) != 0) { - /* call IOP_RESET for older firmware */ - if ((aacraid_sync_command(sc, - AAC_IOP_RESET, 0, 0, 0, 0, &status, NULL)) != 0) { + } else { + ret = aacraid_sync_command(sc, AAC_IOP_RESET_ALWAYS, + 0, 0, 0, 0, &status, &reset_mask); + if (ret && !sc->doorbell_mask) { + /* call IOP_RESET for older firmware */ + if ((aacraid_sync_command(sc, AAC_IOP_RESET, 0,0,0,0, + &status, NULL)) != 0) { + if (status == AAC_SRB_STS_INVALID_REQUEST) { + device_printf(sc->aac_dev, + "IOP_RESET not supported\n"); + } else { + /* probably timeout */ + device_printf(sc->aac_dev, + "IOP_RESET failed\n"); + } - if (status == AAC_SRB_STS_INVALID_REQUEST) - device_printf(sc->aac_dev, "IOP_RESET not supported\n"); - else - /* probably timeout */ - device_printf(sc->aac_dev, "IOP_RESET failed\n"); + /* unwind aac_shutdown() */ + aac_alloc_sync_fib(sc, &fib); + pc = (struct aac_pause_command *)&fib->data[0]; + pc->Command = VM_ContainerConfig; + pc->Type = CT_PAUSE_IO; + pc->Timeout = 1; + pc->Min = 1; + pc->NoRescan = 1; - /* unwind aac_shutdown() */ - aac_alloc_sync_fib(sc, &fib); - pc = (struct aac_pause_command *)&fib->data[0]; - pc->Command = VM_ContainerConfig; - pc->Type = CT_PAUSE_IO; - pc->Timeout = 1; - pc->Min = 1; - pc->NoRescan = 1; + (void) aac_sync_fib(sc, ContainerCommand, 0, + fib, sizeof (struct aac_pause_command)); + aac_release_sync_fib(sc); - (void) aac_sync_fib(sc, ContainerCommand, 0, fib, - sizeof (struct aac_pause_command)); - aac_release_sync_fib(sc); - - goto finish; + goto finish; + } + } else if (sc->doorbell_mask) { + ret = 0; + reset_mask = sc->doorbell_mask; } - } else if (sc->aac_support_opt2 & AAC_SUPPORTED_DOORBELL_RESET) { - AAC_MEM0_SETREG4(sc, AAC_SRC_IDBR, reset_mask); - /* - * We need to wait for 5 seconds before accessing the doorbell - * again, 10000 * 100us = 1000,000us = 1000ms = 1s - */ - waitCount = 5 * 10000; - while (waitCount) { - DELAY(100); /* delay 100 microseconds */ - waitCount--; + if (!ret && + (sc->aac_support_opt2 & AAC_SUPPORTED_DOORBELL_RESET)) { + AAC_MEM0_SETREG4(sc, AAC_SRC_IDBR, reset_mask); + /* + * We need to wait for 5 seconds before accessing the + * doorbell again; + * 10000 * 100us = 1000,000us = 1000ms = 1s + */ + waitCount = 5 * 10000; + while (waitCount) { + DELAY(100); /* delay 100 microseconds */ + waitCount--; + } } } Modified: stable/12/sys/dev/aacraid/aacraid_cam.c ============================================================================== --- stable/12/sys/dev/aacraid/aacraid_cam.c Thu Nov 21 14:23:16 2019 (r354963) +++ stable/12/sys/dev/aacraid/aacraid_cam.c Thu Nov 21 14:54:20 2019 (r354964) @@ -1017,8 +1017,8 @@ aac_cam_action(struct cam_sim *sim, union ccb *ccb) cpi->version_num = 1; cpi->target_sprt = 0; cpi->hba_eng_cnt = 0; - cpi->max_target = camsc->inf->TargetsPerBus; - cpi->max_lun = 8; /* Per the controller spec */ + cpi->max_target = camsc->inf->TargetsPerBus - 1; + cpi->max_lun = 7; /* Per the controller spec */ cpi->initiator_id = camsc->inf->InitiatorBusId; cpi->bus_id = camsc->inf->BusNumber; #if __FreeBSD_version >= 800000 @@ -1389,15 +1389,9 @@ aacraid_startio(struct aac_softc *sc) * Try to get a command that's been put off for lack of * resources */ - if (sc->flags & AAC_FLAGS_SYNC_MODE) { - /* sync. transfer mode */ - if (sc->aac_sync_cm) - break; - cm = aac_dequeue_ready(sc); - sc->aac_sync_cm = cm; - } else { - cm = aac_dequeue_ready(sc); - } + if ((sc->flags & AAC_FLAGS_SYNC_MODE) && sc->aac_sync_cm) + break; + cm = aac_dequeue_ready(sc); /* nothing to do? */ if (cm == NULL) Modified: stable/12/sys/dev/aacraid/aacraid_reg.h ============================================================================== --- stable/12/sys/dev/aacraid/aacraid_reg.h Thu Nov 21 14:23:16 2019 (r354963) +++ stable/12/sys/dev/aacraid/aacraid_reg.h Thu Nov 21 14:54:20 2019 (r354964) @@ -42,7 +42,7 @@ /* * Misc. magic numbers. */ -#define AAC_MAX_CONTAINERS 64 +#define AAC_MAX_CONTAINERS 240 #define AAC_BLOCK_SIZE 512 /* Modified: stable/12/sys/dev/aacraid/aacraid_var.h ============================================================================== --- stable/12/sys/dev/aacraid/aacraid_var.h Thu Nov 21 14:23:16 2019 (r354963) +++ stable/12/sys/dev/aacraid/aacraid_var.h Thu Nov 21 14:54:20 2019 (r354964) @@ -49,7 +49,7 @@ #define AAC_DRIVER_MAJOR_VERSION 3 #define AAC_DRIVER_MINOR_VERSION 2 -#define AAC_DRIVER_BUGFIX_LEVEL 5 +#define AAC_DRIVER_BUGFIX_LEVEL 10 #define AAC_DRIVER_TYPE AAC_TYPE_RELEASE #ifndef AAC_DRIVER_BUILD @@ -481,9 +481,12 @@ struct aac_softc u_int32_t aac_feature_bits; /* feature bits from suppl. info */ u_int32_t aac_support_opt2; /* supp. options from suppl. info */ u_int32_t aac_max_aif; /* max. AIF count */ + u_int32_t doorbell_mask; /* for IOP reset */ u_int32_t aac_max_msix; /* max. MSI-X vectors */ u_int32_t aac_vector_cap; /* MSI-X vector capab.*/ int msi_enabled; /* MSI/MSI-X enabled */ + int msi_tupelo; /* Series 6 support for */ + /* single MSI interrupt */ #define AAC_CAM_TARGET_WILDCARD ~0 void (*cam_rescan_cb)(struct aac_softc *, uint32_t, uint32_t); From owner-svn-src-stable-12@freebsd.org Fri Nov 22 14:18:13 2019 Return-Path: Delivered-To: svn-src-stable-12@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 2F7BC1B94BB; Fri, 22 Nov 2019 14:18:13 +0000 (UTC) (envelope-from hselasky@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KJS50Vtsz3LNQ; Fri, 22 Nov 2019 14:18:13 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E994324CBC; Fri, 22 Nov 2019 14:18:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMEICh0001856; Fri, 22 Nov 2019 14:18:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMEIC2d001855; Fri, 22 Nov 2019 14:18:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911221418.xAMEIC2d001855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 22 Nov 2019 14:18:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354993 - in stable/12/sys: contrib/rdma/krping ofed/include/rdma X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: contrib/rdma/krping ofed/include/rdma X-SVN-Commit-Revision: 354993 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 14:18:13 -0000 Author: hselasky Date: Fri Nov 22 14:18:12 2019 New Revision: 354993 URL: https://svnweb.freebsd.org/changeset/base/354993 Log: MFC r354727: Correct MR length field to be 64-bit in ibcore. Linux commit: edd31551148c09608feee6b8756ad148d550ee3b Sponsored by: Mellanox Technologies Modified: stable/12/sys/contrib/rdma/krping/krping.c stable/12/sys/ofed/include/rdma/ib_verbs.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/contrib/rdma/krping/krping.c ============================================================================== --- stable/12/sys/contrib/rdma/krping/krping.c Fri Nov 22 10:15:15 2019 (r354992) +++ stable/12/sys/contrib/rdma/krping/krping.c Fri Nov 22 14:18:12 2019 (r354993) @@ -736,7 +736,7 @@ static u32 krping_rdma_rkey(struct krping_cb *cb, u64 post_inv, cb->reg_mr_wr.key, cb->reg_mr->page_size, - cb->reg_mr->length, + (unsigned)cb->reg_mr->length, (unsigned long long)cb->reg_mr->iova); if (post_inv) Modified: stable/12/sys/ofed/include/rdma/ib_verbs.h ============================================================================== --- stable/12/sys/ofed/include/rdma/ib_verbs.h Fri Nov 22 10:15:15 2019 (r354992) +++ stable/12/sys/ofed/include/rdma/ib_verbs.h Fri Nov 22 14:18:12 2019 (r354993) @@ -1559,7 +1559,7 @@ struct ib_mr { u32 lkey; u32 rkey; u64 iova; - u32 length; + u64 length; unsigned int page_size; bool need_inval; union { From owner-svn-src-stable-12@freebsd.org Fri Nov 22 14:23:12 2019 Return-Path: Delivered-To: svn-src-stable-12@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 5698F1B97D1; Fri, 22 Nov 2019 14:23:12 +0000 (UTC) (envelope-from hselasky@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KJYr1gKcz3LtF; Fri, 22 Nov 2019 14:23:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D5EA24E71; Fri, 22 Nov 2019 14:23:12 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMENBEV007555; Fri, 22 Nov 2019 14:23:11 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMENBuh007554; Fri, 22 Nov 2019 14:23:11 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201911221423.xAMENBuh007554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 22 Nov 2019 14:23:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354995 - stable/12/sys/ofed/include/rdma X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/ofed/include/rdma X-SVN-Commit-Revision: 354995 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 14:23:12 -0000 Author: hselasky Date: Fri Nov 22 14:23:11 2019 New Revision: 354995 URL: https://svnweb.freebsd.org/changeset/base/354995 Log: MFC r354728: Prevent potential underflow in ibcore. Linux commit: a9018adfde809d44e71189b984fa61cc89682b5e Sponsored by: Mellanox Technologies Modified: stable/12/sys/ofed/include/rdma/ib_verbs.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/ofed/include/rdma/ib_verbs.h ============================================================================== --- stable/12/sys/ofed/include/rdma/ib_verbs.h Fri Nov 22 14:21:55 2019 (r354994) +++ stable/12/sys/ofed/include/rdma/ib_verbs.h Fri Nov 22 14:23:11 2019 (r354995) @@ -285,7 +285,7 @@ enum ib_cq_creation_flags { struct ib_cq_init_attr { unsigned int cqe; - int comp_vector; + u32 comp_vector; u32 flags; }; From owner-svn-src-stable-12@freebsd.org Fri Nov 22 17:06:33 2019 Return-Path: Delivered-To: svn-src-stable-12@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 4D0721BC596; Fri, 22 Nov 2019 17:06:33 +0000 (UTC) (envelope-from jgh@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KNBK1H6Qz40k6; Fri, 22 Nov 2019 17:06:33 +0000 (UTC) (envelope-from jgh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AAB726B11; Fri, 22 Nov 2019 17:06:33 +0000 (UTC) (envelope-from jgh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAMH6WrY002755; Fri, 22 Nov 2019 17:06:32 GMT (envelope-from jgh@FreeBSD.org) Received: (from jgh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAMH6WsE002754; Fri, 22 Nov 2019 17:06:32 GMT (envelope-from jgh@FreeBSD.org) Message-Id: <201911221706.xAMH6WsE002754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jgh set sender to jgh@FreeBSD.org using -f From: Jason Helfman Date: Fri, 22 Nov 2019 17:06:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355007 - stable/12/share/man/man5 X-SVN-Group: stable-12 X-SVN-Commit-Author: jgh X-SVN-Commit-Paths: stable/12/share/man/man5 X-SVN-Commit-Revision: 355007 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Nov 2019 17:06:33 -0000 Author: jgh (doc,ports committer) Date: Fri Nov 22 17:06:32 2019 New Revision: 355007 URL: https://svnweb.freebsd.org/changeset/base/355007 Log: MFH: r351820 - correct HISTORY section - while here clarify wording PR: 240260 (based on) Submitted by: gbergling@gmail.com Modified: stable/12/share/man/man5/passwd.5 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man5/passwd.5 ============================================================================== --- stable/12/share/man/man5/passwd.5 Fri Nov 22 16:53:30 2019 (r355006) +++ stable/12/share/man/man5/passwd.5 Fri Nov 22 17:06:32 2019 (r355007) @@ -438,8 +438,8 @@ BEGIN { FS = ":"} .Sh HISTORY A .Nm -file format appeared in -.At v6 . +file format first appeared in +.At v1 . .Pp The .Tn NIS From owner-svn-src-stable-12@freebsd.org Sat Nov 23 07:06:18 2019 Return-Path: Delivered-To: svn-src-stable-12@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 125791AC269; Sat, 23 Nov 2019 07:06:18 +0000 (UTC) (envelope-from scottl@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47KkqF6kdfz3Cx1; Sat, 23 Nov 2019 07:06:17 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA58D8424; Sat, 23 Nov 2019 07:06:17 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xAN76HRf000599; Sat, 23 Nov 2019 07:06:17 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xAN76GLE000595; Sat, 23 Nov 2019 07:06:16 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201911230706.xAN76GLE000595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sat, 23 Nov 2019 07:06:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355028 - in stable/12: share/man/man4 sys/dev/hpt27xx sys/dev/trm X-SVN-Group: stable-12 X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/hpt27xx sys/dev/trm X-SVN-Commit-Revision: 355028 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 07:06:18 -0000 Author: scottl Date: Sat Nov 23 07:06:16 2019 New Revision: 355028 URL: https://svnweb.freebsd.org/changeset/base/355028 Log: MFC 355012 and 355021. Mark trm and hpt27xx for removal in 13.0 Modified: stable/12/share/man/man4/hpt27xx.4 stable/12/share/man/man4/trm.4 stable/12/sys/dev/hpt27xx/hpt27xx_osm_bsd.c stable/12/sys/dev/trm/trm.c Modified: stable/12/share/man/man4/hpt27xx.4 ============================================================================== --- stable/12/share/man/man4/hpt27xx.4 Sat Nov 23 03:38:26 2019 (r355027) +++ stable/12/share/man/man4/hpt27xx.4 Sat Nov 23 07:06:16 2019 (r355028) @@ -44,6 +44,9 @@ module at boot time, place the following line in .Bd -literal -offset indent hpt27xx_load="YES" .Ed +.Sh DEPRECATION NOTICE +This driver is scheduled for removal prior to the release of +.Fx 13.0 . .Sh DESCRIPTION The .Nm Modified: stable/12/share/man/man4/trm.4 ============================================================================== --- stable/12/share/man/man4/trm.4 Sat Nov 23 03:38:26 2019 (r355027) +++ stable/12/share/man/man4/trm.4 Sat Nov 23 07:06:16 2019 (r355028) @@ -48,6 +48,9 @@ module at boot time, place the following line in .Bd -literal -offset indent trm_load="YES" .Ed +.Sh DEPRECATION NOTICE +This driver is scheduled for removal prior to the release of +.Fx 13.0 .Sh DESCRIPTION The .Nm Modified: stable/12/sys/dev/hpt27xx/hpt27xx_osm_bsd.c ============================================================================== --- stable/12/sys/dev/hpt27xx/hpt27xx_osm_bsd.c Sat Nov 23 03:38:26 2019 (r355027) +++ stable/12/sys/dev/hpt27xx/hpt27xx_osm_bsd.c Sat Nov 23 07:06:16 2019 (r355028) @@ -76,7 +76,9 @@ static int hpt_attach(device_t dev) HPT_UINT size; PVBUS vbus; PVBUS_EXT vbus_ext; - + + gone_in(13, "Giant locked CAM drivers"); + KdPrint(("hpt_attach(%d/%d/%d)", pci_get_bus(dev), pci_get_slot(dev), pci_get_function(dev))); him = hpt_match(dev, 1); Modified: stable/12/sys/dev/trm/trm.c ============================================================================== --- stable/12/sys/dev/trm/trm.c Sat Nov 23 03:38:26 2019 (r355027) +++ stable/12/sys/dev/trm/trm.c Sat Nov 23 07:06:16 2019 (r355028) @@ -3376,7 +3376,9 @@ trm_attach(device_t dev) PACB pACB = 0; int rid = 0; int unit = device_get_unit(dev); - + + gone_in(13, "Giant locked CAM drivers"); + device_id = pci_get_devid(dev); /* * These cards do not allow memory mapped accesses From owner-svn-src-stable-12@freebsd.org Sat Nov 23 13:20:24 2019 Return-Path: Delivered-To: svn-src-stable-12@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 E2F8C1B5527; Sat, 23 Nov 2019 13:20:24 +0000 (UTC) (envelope-from karels@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Kv6w5gNcz43Jd; Sat, 23 Nov 2019 13:20:24 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A25E1C75F; Sat, 23 Nov 2019 13:20:24 +0000 (UTC) (envelope-from karels@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xANDKOxJ022544; Sat, 23 Nov 2019 13:20:24 GMT (envelope-from karels@FreeBSD.org) Received: (from karels@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xANDKOf0022543; Sat, 23 Nov 2019 13:20:24 GMT (envelope-from karels@FreeBSD.org) Message-Id: <201911231320.xANDKOf0022543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: karels set sender to karels@FreeBSD.org using -f From: Mike Karels Date: Sat, 23 Nov 2019 13:20:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355029 - stable/12/usr.bin/netstat X-SVN-Group: stable-12 X-SVN-Commit-Author: karels X-SVN-Commit-Paths: stable/12/usr.bin/netstat X-SVN-Commit-Revision: 355029 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Nov 2019 13:20:25 -0000 Author: karels Date: Sat Nov 23 13:20:24 2019 New Revision: 355029 URL: https://svnweb.freebsd.org/changeset/base/355029 Log: MFC r354633: Fix netstat -gs with ip_mroute module and/or vnet The code for "netstat -gs -f inet" failed if the kernel namelist did not include the _mrtstat symbol. However, that symbol is not in a standard kernel even with the ip_mroute module loaded, where the functionality is available. It is also not in a kernel with MROUTING but also VIMAGE, as there can be multiple sets of stats. However, when running the command on a live system, the symbol is not used; a sysctl is used. Go ahead and try the sysctl in any case, and complain that IPv4 MROUTING is not present only if the sysctl fails with ENOENT. Also fail if _mrtstat is not defined when running on a core file; netstat doesn't know about vnets, so can only work if MROUTING was included, and VIMAGE was not. Reviewed by: bz Modified: stable/12/usr.bin/netstat/mroute.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/netstat/mroute.c ============================================================================== --- stable/12/usr.bin/netstat/mroute.c Sat Nov 23 07:06:16 2019 (r355028) +++ stable/12/usr.bin/netstat/mroute.c Sat Nov 23 13:20:24 2019 (r355029) @@ -409,14 +409,12 @@ mrt_stats() mstaddr = nl[N_MRTSTAT].n_value; - if (mstaddr == 0) { - fprintf(stderr, "No IPv4 MROUTING kernel support.\n"); - return; - } - if (fetch_stats("net.inet.ip.mrtstat", mstaddr, &mrtstat, - sizeof(mrtstat), kread_counters) != 0) + sizeof(mrtstat), kread_counters) != 0) { + if ((live && errno == ENOENT) || (!live && mstaddr == 0)) + fprintf(stderr, "No IPv4 MROUTING kernel support.\n"); return; + } xo_emit("{T:IPv4 multicast forwarding}:\n");