svn commit: r365967 - head/sbin/nvmecontrol
Author: dab Date: Mon Sep 21 18:34:13 2020 New Revision: 365967 URL: https://svnweb.freebsd.org/changeset/base/365967 Log: Whitespace fix after r365948 MFC after:1 week Sponsored by: Dell EMC Isilon Modified: head/sbin/nvmecontrol/firmware.c Modified: head/sbin/nvmecontrol/firmware.c == --- head/sbin/nvmecontrol/firmware.cMon Sep 21 18:32:57 2020 (r365966) +++ head/sbin/nvmecontrol/firmware.cMon Sep 21 18:34:13 2020 (r365967) @@ -168,9 +168,9 @@ update_firmware(int fd, uint8_t *payload, int32_t payl if (fwug != 0 && fwug != 0xFF) max_xfer_size = ((uint64_t)fwug << 12); else if (ioctl(fd, NVME_GET_MAX_XFER_SIZE, &max_xfer_size) < 0) - err(1, "query max transfer size failed"); - if (max_xfer_size > NVME_MAX_XFER_SIZE) - max_xfer_size = NVME_MAX_XFER_SIZE; + err(1, "query max transfer size failed"); + if (max_xfer_size > NVME_MAX_XFER_SIZE) + max_xfer_size = NVME_MAX_XFER_SIZE; if ((chunk = aligned_alloc(PAGE_SIZE, max_xfer_size)) == NULL) errx(1, "unable to malloc %zd bytes", (size_t)max_xfer_size); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r365948 - head/sbin/nvmecontrol
Author: dab Date: Mon Sep 21 15:45:49 2020 New Revision: 365948 URL: https://svnweb.freebsd.org/changeset/base/365948 Log: Honor the FWUG value of some drives in nvmecontrol nvmecontrol tries to upload firmware in chunks as large as it thinks the device permits. It fails to take into account the FWUG value used by some drives to advertise the size and alignment limits for firmware chunks. - Use the firwmare update granularity value from the - If the granularity is not reported or not restricted, fall back to the previously existing logic that calculates the max transfer size based on MDTS. - Add firmware update granularity to the identify-controller output. Reviewed by: imp (previous version), chuck Obtained from:Dell EMC Isilon MFC after:1 week Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D26390 Modified: head/sbin/nvmecontrol/firmware.c head/sbin/nvmecontrol/identify_ext.c Modified: head/sbin/nvmecontrol/firmware.c == --- head/sbin/nvmecontrol/firmware.cMon Sep 21 15:44:23 2020 (r365947) +++ head/sbin/nvmecontrol/firmware.cMon Sep 21 15:45:49 2020 (r365948) @@ -155,21 +155,29 @@ read_image_file(const char *path, void **buf, int32_t } static void -update_firmware(int fd, uint8_t *payload, int32_t payload_size) +update_firmware(int fd, uint8_t *payload, int32_t payload_size, uint8_t fwug) { struct nvme_pt_command pt; + uint64_tmax_xfer_size; int32_t off, resid, size; void*chunk; off = 0; resid = payload_size; - if ((chunk = aligned_alloc(PAGE_SIZE, NVME_MAX_XFER_SIZE)) == NULL) - errx(1, "unable to malloc %d bytes", NVME_MAX_XFER_SIZE); + if (fwug != 0 && fwug != 0xFF) + max_xfer_size = ((uint64_t)fwug << 12); + else if (ioctl(fd, NVME_GET_MAX_XFER_SIZE, &max_xfer_size) < 0) + err(1, "query max transfer size failed"); + if (max_xfer_size > NVME_MAX_XFER_SIZE) + max_xfer_size = NVME_MAX_XFER_SIZE; + if ((chunk = aligned_alloc(PAGE_SIZE, max_xfer_size)) == NULL) + errx(1, "unable to malloc %zd bytes", (size_t)max_xfer_size); + while (resid > 0) { - size = (resid >= NVME_MAX_XFER_SIZE) ? - NVME_MAX_XFER_SIZE : resid; + size = (resid >= (int32_t)max_xfer_size) ? + max_xfer_size : resid; memcpy(chunk, payload + off, size); memset(&pt, 0, sizeof(pt)); @@ -333,7 +341,7 @@ firmware(const struct cmd *f, int argc, char *argv[]) } if (opt.fw_img != NULL) { - update_firmware(fd, buf, size); + update_firmware(fd, buf, size, cdata.fwug); if (opt.activate) activate_action = NVME_AA_REPLACE_ACTIVATE; else Modified: head/sbin/nvmecontrol/identify_ext.c == --- head/sbin/nvmecontrol/identify_ext.cMon Sep 21 15:44:23 2020 (r365947) +++ head/sbin/nvmecontrol/identify_ext.cMon Sep 21 15:45:49 2020 (r365948) @@ -56,6 +56,7 @@ nvme_print_controller(struct nvme_controller_data *cda uint8_t ns_smart; uint8_t sqes_max, sqes_min; uint8_t cqes_max, cqes_min; + uint8_t fwug; oncs = cdata->oncs; compare = (oncs >> NVME_CTRLR_DATA_ONCS_COMPARE_SHIFT) & @@ -79,6 +80,7 @@ nvme_print_controller(struct nvme_controller_data *cda NVME_CTRLR_DATA_FRMW_NUM_SLOTS_MASK; fw_slot1_ro = (cdata->frmw >> NVME_CTRLR_DATA_FRMW_SLOT1_RO_SHIFT) & NVME_CTRLR_DATA_FRMW_SLOT1_RO_MASK; + fwug = cdata->fwug; ns_smart = (cdata->lpa >> NVME_CTRLR_DATA_LPA_NS_SMART_SHIFT) & NVME_CTRLR_DATA_LPA_NS_SMART_MASK; @@ -192,6 +194,13 @@ nvme_print_controller(struct nvme_controller_data *cda uint128_to_str(to128(cdata->untncap.unvmcap), cbuf, sizeof(cbuf))); } + printf("Firmware Update Granularity: %02x ", fwug); + if (fwug == 0) + printf("(Not Reported)\n"); + else if (fwug == 0xFF) + printf("(No Granularity)\n"); + else + printf("(%d bytes)\n", ((uint32_t)fwug << 12)); printf("Host Buffer Preferred Size: %llu bytes\n", (long long unsigned)cdata->hmpre * 4096); printf("Host Buffer Minimum Size:%llu bytes\n", ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r365946 - head/sys/dev/nvme
Author: dab Date: Mon Sep 21 15:41:47 2020 New Revision: 365946 URL: https://svnweb.freebsd.org/changeset/base/365946 Log: Add an ioctl to get an NVMe device's maximum transfer size Reviewed by: imp, chuck Obtained from:Dell EMC Isilon MFC after:1 week Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D26390 Modified: head/sys/dev/nvme/nvme.h head/sys/dev/nvme/nvme_ctrlr.c Modified: head/sys/dev/nvme/nvme.h == --- head/sys/dev/nvme/nvme.hMon Sep 21 15:24:44 2020(r365945) +++ head/sys/dev/nvme/nvme.hMon Sep 21 15:41:47 2020(r365946) @@ -41,6 +41,7 @@ #defineNVME_PASSTHROUGH_CMD_IOWR('n', 0, struct nvme_pt_command) #defineNVME_RESET_CONTROLLER _IO('n', 1) #defineNVME_GET_NSID _IOR('n', 2, struct nvme_get_nsid) +#defineNVME_GET_MAX_XFER_SIZE _IOR('n', 3, uint64_t) #defineNVME_IO_TEST_IOWR('n', 100, struct nvme_io_test) #defineNVME_BIO_TEST _IOWR('n', 101, struct nvme_io_test) Modified: head/sys/dev/nvme/nvme_ctrlr.c == --- head/sys/dev/nvme/nvme_ctrlr.c Mon Sep 21 15:24:44 2020 (r365945) +++ head/sys/dev/nvme/nvme_ctrlr.c Mon Sep 21 15:41:47 2020 (r365946) @@ -1345,6 +1345,9 @@ nvme_ctrlr_ioctl(struct cdev *cdev, u_long cmd, caddr_ gnsid->nsid = 0; break; } + case NVME_GET_MAX_XFER_SIZE: + *(uint64_t *)arg = ctrlr->max_xfer_size; + break; default: return (ENOTTY); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r362634 - head/lib/libutil
Author: dab Date: Thu Jun 25 21:34:43 2020 New Revision: 362634 URL: https://svnweb.freebsd.org/changeset/base/362634 Log: Add CAP_EVENT to pidfiles. CAP_EVENT was omitted on pidfiles (in pidfile_open()). There seems no reason why a process that creates and writes a pidfile cannot monitor events on that file. This mod adds the capability. Reviewed by: cem@ MFC after:2 weeks Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D25363 Modified: head/lib/libutil/pidfile.c Modified: head/lib/libutil/pidfile.c == --- head/lib/libutil/pidfile.c Thu Jun 25 20:43:21 2020(r362633) +++ head/lib/libutil/pidfile.c Thu Jun 25 21:34:43 2020(r362634) @@ -196,7 +196,7 @@ pidfile_open(const char *pathp, mode_t mode, pid_t *pi } if (cap_rights_limit(fd, cap_rights_init(&caprights, CAP_PWRITE, - CAP_FSTAT, CAP_FTRUNCATE)) < 0 && + CAP_FSTAT, CAP_FTRUNCATE, CAP_EVENT)) < 0 && errno != ENOSYS) { goto failed; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r360568 - head/sys/dev/nvme
Author: dab Date: Sat May 2 20:47:58 2020 New Revision: 360568 URL: https://svnweb.freebsd.org/changeset/base/360568 Log: Fix various Coverity-detected errors in nvme driver This fixes several Coverity-detected errors in the nvme driver. CIDs addressed: 1008344, 1009377, 1009380, 1193740, 1305470, 1403975, 1403980 Reviewed by: imp@, vangyzen@ MFC after:5 days Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D24532 Modified: head/sys/dev/nvme/nvme.c head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_ns.c head/sys/dev/nvme/nvme_pci.c head/sys/dev/nvme/nvme_qpair.c head/sys/dev/nvme/nvme_sysctl.c head/sys/dev/nvme/nvme_test.c Modified: head/sys/dev/nvme/nvme.c == --- head/sys/dev/nvme/nvme.cSat May 2 20:14:59 2020(r360567) +++ head/sys/dev/nvme/nvme.cSat May 2 20:47:58 2020(r360568) @@ -138,7 +138,8 @@ nvme_attach(device_t dev) ctrlr->config_hook.ich_func = nvme_ctrlr_start_config_hook; ctrlr->config_hook.ich_arg = ctrlr; - config_intrhook_establish(&ctrlr->config_hook); + if (config_intrhook_establish(&ctrlr->config_hook) != 0) + return (ENOMEM); return (0); } Modified: head/sys/dev/nvme/nvme_ctrlr.c == --- head/sys/dev/nvme/nvme_ctrlr.c Sat May 2 20:14:59 2020 (r360567) +++ head/sys/dev/nvme/nvme_ctrlr.c Sat May 2 20:47:58 2020 (r360568) @@ -1335,6 +1335,7 @@ nvme_ctrlr_ioctl(struct cdev *cdev, u_long cmd, caddr_ struct nvme_get_nsid *gnsid = (struct nvme_get_nsid *)arg; strncpy(gnsid->cdev, device_get_nameunit(ctrlr->dev), sizeof(gnsid->cdev)); + gnsid->cdev[sizeof(gnsid->cdev) - 1] = '\0'; gnsid->nsid = 0; break; } @@ -1619,12 +1620,12 @@ nvme_ctrlr_resume(struct nvme_controller *ctrlr) goto fail; /* -* Now that we're reset the hardware, we can restart the controller. Any +* Now that we've reset the hardware, we can restart the controller. Any * I/O that was pending is requeued. Any admin commands are aborted with * an error. Once we've restarted, take the controller out of reset. */ nvme_ctrlr_start(ctrlr, true); - atomic_cmpset_32(&ctrlr->is_resetting, 1, 0); + (void)atomic_cmpset_32(&ctrlr->is_resetting, 1, 0); return (0); fail: @@ -1635,6 +1636,6 @@ fail: */ nvme_printf(ctrlr, "Failed to reset on resume, failing.\n"); nvme_ctrlr_fail(ctrlr); - atomic_cmpset_32(&ctrlr->is_resetting, 1, 0); + (void)atomic_cmpset_32(&ctrlr->is_resetting, 1, 0); return (0); } Modified: head/sys/dev/nvme/nvme_ns.c == --- head/sys/dev/nvme/nvme_ns.c Sat May 2 20:14:59 2020(r360567) +++ head/sys/dev/nvme/nvme_ns.c Sat May 2 20:47:58 2020(r360568) @@ -87,6 +87,7 @@ nvme_ns_ioctl(struct cdev *cdev, u_long cmd, caddr_t a struct nvme_get_nsid *gnsid = (struct nvme_get_nsid *)arg; strncpy(gnsid->cdev, device_get_nameunit(ctrlr->dev), sizeof(gnsid->cdev)); + gnsid->cdev[sizeof(gnsid->cdev) - 1] = '\0'; gnsid->nsid = ns->id; break; } Modified: head/sys/dev/nvme/nvme_pci.c == --- head/sys/dev/nvme/nvme_pci.cSat May 2 20:14:59 2020 (r360567) +++ head/sys/dev/nvme/nvme_pci.cSat May 2 20:47:58 2020 (r360568) @@ -243,11 +243,9 @@ nvme_ctrlr_configure_intx(struct nvme_controller *ctrl return (ENOMEM); } - bus_setup_intr(ctrlr->dev, ctrlr->res, + if (bus_setup_intr(ctrlr->dev, ctrlr->res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_ctrlr_intx_handler, - ctrlr, &ctrlr->tag); - - if (ctrlr->tag == NULL) { + ctrlr, &ctrlr->tag) != 0) { nvme_printf(ctrlr, "unable to setup intx handler\n"); return (ENOMEM); } Modified: head/sys/dev/nvme/nvme_qpair.c == --- head/sys/dev/nvme/nvme_qpair.c Sat May 2 20:14:59 2020 (r360567) +++ head/sys/dev/nvme/nvme_qpair.c Sat May 2 20:47:58 2020 (r360568) @@ -671,9 +671,12 @@ nvme_qpair_construct(struct nvme_qpair *qpair, qpair->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, &qpair->rid, RF_ACTIVE); - bus_setup_intr(ctrlr->dev, qpair->res, + if (bus_setup_intr(ctrlr->dev, qpair->res, INTR_TYPE_MISC | INTR_MP
svn commit: r359717 - in head: etc/mtree sbin/nvmecontrol sbin/nvmecontrol/tests
Author: dab Date: Tue Apr 7 20:26:42 2020 New Revision: 359717 URL: https://svnweb.freebsd.org/changeset/base/359717 Log: Add a basic test for nvmecontrol I recently made some bug fixes in nvmecontrol. It occurred to me that since nvmecontrol lacks any kyua tests, I should convert the informal testing I did into a more formal automated test. The test in this change should be considered just a starting point; it is neither complete nor thorough. While converting the test to ATF/kyua, I discovered a small bug in nvmecontrol; the nvmecontrol devlist command would always exit with an unsuccessful status. So I included the fix for that, too, so that the test won't fail. Reviewed by: imp@ MFC after:3 days Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D24269 Added: head/sbin/nvmecontrol/tests/ head/sbin/nvmecontrol/tests/Makefile (contents, props changed) head/sbin/nvmecontrol/tests/basic.sh (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/sbin/nvmecontrol/Makefile head/sbin/nvmecontrol/devlist.c Modified: head/etc/mtree/BSD.tests.dist == --- head/etc/mtree/BSD.tests.dist Tue Apr 7 19:46:00 2020 (r359716) +++ head/etc/mtree/BSD.tests.dist Tue Apr 7 20:26:42 2020 (r359717) @@ -438,6 +438,8 @@ .. mdconfig .. +nvmecontrol +.. pfctl files .. Modified: head/sbin/nvmecontrol/Makefile == --- head/sbin/nvmecontrol/Makefile Tue Apr 7 19:46:00 2020 (r359716) +++ head/sbin/nvmecontrol/Makefile Tue Apr 7 20:26:42 2020 (r359717) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + PACKAGE=runtime PROG= nvmecontrol SRCS= comnd.c nvmecontrol.c @@ -11,6 +13,8 @@ MAN= nvmecontrol.8 LDFLAGS+= -rdynamic LIBADD+= util SUBDIR=modules +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .PATH: ${SRCTOP}/sys/dev/nvme Modified: head/sbin/nvmecontrol/devlist.c == --- head/sbin/nvmecontrol/devlist.c Tue Apr 7 19:46:00 2020 (r359716) +++ head/sbin/nvmecontrol/devlist.c Tue Apr 7 20:26:42 2020 (r359717) @@ -122,8 +122,10 @@ devlist(const struct cmd *f, int argc, char *argv[]) close(fd); } - if (found == 0) + if (found == 0) { printf("No NVMe controllers found.\n"); + exit(1); + } - exit(1); + exit(0); } Added: head/sbin/nvmecontrol/tests/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/nvmecontrol/tests/MakefileTue Apr 7 20:26:42 2020 (r359717) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +PACKAGE= tests +ATF_TESTS_SH+= basic + +.include Added: head/sbin/nvmecontrol/tests/basic.sh == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/nvmecontrol/tests/basic.shTue Apr 7 20:26:42 2020 (r359717) @@ -0,0 +1,236 @@ +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright (c) 2020 David A. Bright +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +#notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +#notice, this list of conditions and the following disclaimer in the +#documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ + +# +# A basic test for nvmecontrol. This isn't a thorough or complete test +# of nvmecontrol functionality; it is more of a sanity check that +# nvmecontrol basically works. +# + +DANGEROUS=false # Set to true to run "dang
svn commit: r359562 - in head/sbin/nvmecontrol: . modules/wdc
Author: dab Date: Thu Apr 2 13:52:54 2020 New Revision: 359562 URL: https://svnweb.freebsd.org/changeset/base/359562 Log: Fix various Coverity-detected errors in nvmecontrol This fixes several Coverity-detected errors in nvmecontrol. While in here, a couple additional errors with shift/mask confusion that were not diagnosed by Coverity are also fixed. CIDs addressed: 1040299, 1040300, 1403972, 1403973, 1403985, 1403988, 1403990, 1404374, 1404427, 1404469, 1404510, 1404534, 1418118 CID 1403657 (resource leak of shared library handle) was marked "intentional" in the Coverity scan database. Reviewed by: vangyzen, robert.herndon_dell.com Reviewed by: daniel.william.ryan_gmail.com (earlier version) Reviewed by: rramsden_isilon.com (earlier version), imp MFC after:5 days Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D24203 Modified: head/sbin/nvmecontrol/firmware.c head/sbin/nvmecontrol/identify.c head/sbin/nvmecontrol/logpage.c head/sbin/nvmecontrol/modules/wdc/wdc.c head/sbin/nvmecontrol/nsid.c head/sbin/nvmecontrol/passthru.c head/sbin/nvmecontrol/power.c head/sbin/nvmecontrol/reset.c Modified: head/sbin/nvmecontrol/firmware.c == --- head/sbin/nvmecontrol/firmware.cThu Apr 2 11:08:19 2020 (r359561) +++ head/sbin/nvmecontrol/firmware.cThu Apr 2 13:52:54 2020 (r359562) @@ -151,6 +151,7 @@ read_image_file(const char *path, void **buf, int32_t errx(1, "error reading '%s' (read %d bytes, requested %d bytes)", path, *size, filesize); + close(fd); } static void @@ -188,6 +189,7 @@ update_firmware(int fd, uint8_t *payload, int32_t payl resid -= size; off += size; } + free(chunk); } static int Modified: head/sbin/nvmecontrol/identify.c == --- head/sbin/nvmecontrol/identify.cThu Apr 2 11:08:19 2020 (r359561) +++ head/sbin/nvmecontrol/identify.cThu Apr 2 13:52:54 2020 (r359562) @@ -94,7 +94,7 @@ print_namespace(struct nvme_namespace_data *nsdata) NVME_NS_DATA_DPC_PIT3_MASK) ? "Type 3, " : "", ((nsdata->dpc >> NVME_NS_DATA_DPC_PIT2_SHIFT) & NVME_NS_DATA_DPC_PIT2_MASK) ? "Type 2, " : "", - ((nsdata->dpc >> NVME_NS_DATA_DPC_PIT2_MASK) & + ((nsdata->dpc >> NVME_NS_DATA_DPC_PIT1_SHIFT) & NVME_NS_DATA_DPC_PIT1_MASK) ? "Type 1" : ""); printf("Data Protection Settings:"); ptype = (nsdata->dps >> NVME_NS_DATA_DPS_PIT_SHIFT) & @@ -238,7 +238,8 @@ identify(const struct cmd *f, int argc, char *argv[]) int fd; uint32_tnsid; - arg_parse(argc, argv, f); + if (arg_parse(argc, argv, f)) + return; open_dev(opt.dev, &fd, 1, 1); get_nsid(fd, &path, &nsid); Modified: head/sbin/nvmecontrol/logpage.c == --- head/sbin/nvmecontrol/logpage.c Thu Apr 2 11:08:19 2020 (r359561) +++ head/sbin/nvmecontrol/logpage.c Thu Apr 2 13:52:54 2020 (r359562) @@ -570,11 +570,11 @@ print_log_sanitize_status(const struct nvme_controller printf("Unknown"); break; } - p = (ss->sstat & NVME_SS_PAGE_SSTAT_PASSES_SHIFT) >> + p = (ss->sstat >> NVME_SS_PAGE_SSTAT_PASSES_SHIFT) & NVME_SS_PAGE_SSTAT_PASSES_MASK; if (p > 0) printf(", %d passes", p); - if ((ss->sstat & NVME_SS_PAGE_SSTAT_GDE_SHIFT) >> + if ((ss->sstat >> NVME_SS_PAGE_SSTAT_GDE_SHIFT) & NVME_SS_PAGE_SSTAT_GDE_MASK) printf(", Global Data Erased"); printf("\n"); Modified: head/sbin/nvmecontrol/modules/wdc/wdc.c == --- head/sbin/nvmecontrol/modules/wdc/wdc.c Thu Apr 2 11:08:19 2020 (r359561) +++ head/sbin/nvmecontrol/modules/wdc/wdc.c Thu Apr 2 13:52:54 2020 (r359562) @@ -275,7 +275,7 @@ print_hgst_info_subpage_gen(void *buf, uint16_t subtyp wsp++; /* Flags, just ignore */ plen = *wsp++; param = 0; - for (i = 0; i < plen; i++) + for (i = 0; i < plen && wsp < esp; i++) param |= (uint64_t)*wsp++ << (i * 8); printf(" %-30s: %jd\n", kv_lookup(kv, kv_count, ptype), (uintmax_t)param); } Modified: head/sbin/nvmecontrol/nsid.c == --- head/sbin/nvmecontrol/nsid.cThu Apr 2 11:08:19 2020 (r359561) +++ head/sbin/nvmecontrol/nsid.cThu Apr 2 13:52:54 2020
svn commit: r359129 - head/sys/cam/nvme
Author: dab Date: Thu Mar 19 12:22:20 2020 New Revision: 359129 URL: https://svnweb.freebsd.org/changeset/base/359129 Log: Fix parameter reversal potentially causing buffer overrun. Two arguments were reversed in calls to cam_strvis() in nvme_da.c. This was found by a Coverity scan of this code within Dell (Isilon). These are also marked in the FreeBSD Coverity scan as CIDs 1400526 & 1400531. Submitted by: robert.hern...@dell.com Reviewed by: vangyzen@, imp@ MFC after:3 days Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D24117 Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c == --- head/sys/cam/nvme/nvme_da.c Thu Mar 19 10:32:38 2020(r359128) +++ head/sys/cam/nvme/nvme_da.c Thu Mar 19 12:22:20 2020(r359129) @@ -815,9 +815,9 @@ ndaregister(struct cam_periph *periph, void *arg) * the serial or model number strings. */ cam_strvis(disk->d_descr, cd->mn, - sizeof(disk->d_descr), NVME_MODEL_NUMBER_LENGTH); + NVME_MODEL_NUMBER_LENGTH, sizeof(disk->d_descr)); cam_strvis(disk->d_ident, cd->sn, - sizeof(disk->d_ident), NVME_SERIAL_NUMBER_LENGTH); + NVME_SERIAL_NUMBER_LENGTH, sizeof(disk->d_ident)); disk->d_hba_vendor = cpi.hba_vendor; disk->d_hba_device = cpi.hba_device; disk->d_hba_subvendor = cpi.hba_subvendor; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r354854 - head/sys/sys
Author: dab Date: Tue Nov 19 14:46:28 2019 New Revision: 354854 URL: https://svnweb.freebsd.org/changeset/base/354854 Log: Don't sanitize linker_set The assumptions of linker_set don't play nicely with AddressSanitizer. AddressSanitizer adds a 'redzone' of zeros around globals (including those in named sections), whereas linker_set assumes they are all packed consecutively like a pointer array. So: let's annotate linker_set so that AddressSanitizer ignores it. Submitted by: Matthew Bryan Reviewed by: kib, rang_acm.org Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D22239 Modified: head/sys/sys/cdefs.h head/sys/sys/linker_set.h Modified: head/sys/sys/cdefs.h == --- head/sys/sys/cdefs.hTue Nov 19 13:28:59 2019(r354853) +++ head/sys/sys/cdefs.hTue Nov 19 14:46:28 2019(r354854) @@ -872,6 +872,13 @@ /* Function should not be analyzed. */ #define__no_lock_analysis __lock_annotate(no_thread_safety_analysis) +/* Function or variable should not be sanitized, ie. by AddressSanitizer */ +#if __has_attribute(no_sanitize) +#define __nosanitizeaddress__attribute__((no_sanitize("address"))) +#else +#define __nosanitizeaddress +#endif + /* Guard variables and structure members by lock. */ #define__guarded_by(x) __lock_annotate(guarded_by(x)) #define__pt_guarded_by(x) __lock_annotate(pt_guarded_by(x)) Modified: head/sys/sys/linker_set.h == --- head/sys/sys/linker_set.h Tue Nov 19 13:28:59 2019(r354853) +++ head/sys/sys/linker_set.h Tue Nov 19 14:46:28 2019(r354854) @@ -61,6 +61,7 @@ __GLOBL(__CONCAT(__stop_set_,set)); \ static void const * qv \ __set_##set##_sym_##sym __section("set_" #set) \ + __nosanitizeaddress \ __used = &(sym) #define __MAKE_SET(set, sym) __MAKE_SET_QV(set, sym, __MAKE_SET_CONST) #else /* !__GNUCLIKE___SECTION */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r354808 - in head: contrib/openbsm/etc contrib/openbsm/sys/bsm sys/bsm sys/compat/freebsd32 sys/kern sys/security/audit sys/sys tests/sys/posixshm
Author: dab Date: Mon Nov 18 13:31:16 2019 New Revision: 354808 URL: https://svnweb.freebsd.org/changeset/base/354808 Log: Jail and capability mode for shm_rename; add audit support for shm_rename Co-mingling two things here: * Addressing some feedback from Konstantin and Kyle re: jail, capability mode, and a few other things * Adding audit support as promised. The audit support change includes a partial refresh of OpenBSM from upstream, where the change to add shm_rename has already been accepted. Matthew doesn't plan to work on refreshing anything else to support audit for those new event types. Submitted by: Matthew Bryan Reviewed by: kib Relnotes: Yes Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D22083 Modified: head/contrib/openbsm/etc/audit_event head/contrib/openbsm/sys/bsm/audit_kevents.h head/sys/bsm/audit_kevents.h head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/syscalls.master head/sys/kern/init_sysent.c head/sys/kern/syscalls.master head/sys/kern/uipc_shm.c head/sys/security/audit/audit_bsm.c head/sys/sys/mman.h head/sys/sys/sysproto.h head/tests/sys/posixshm/posixshm_test.c Modified: head/contrib/openbsm/etc/audit_event == --- head/contrib/openbsm/etc/audit_eventMon Nov 18 10:46:55 2019 (r354807) +++ head/contrib/openbsm/etc/audit_eventMon Nov 18 13:31:16 2019 (r354808) @@ -601,6 +601,19 @@ 43238:AUE_SETLOGINCLASS:setloginclass(2):pc 43239:AUE_POSIX_FADVISE:posix_fadvise(2):no 43240:AUE_SCTP_GENERIC_SENDMSG_IOV:sctp_generic_sendmsg_iov(2):nt +43241:AUE_ABORT2:abort(2):pc +43242:AUE_SEMTIMEDWAIT:sem_timedwait(3):ip +43243:AUE_SEMDESTROY:sem_destroy(3):ip +43244:AUE_SEMGETVALUE:sem_getvalue(3):ip +43245:AUE_SEMINIT:sem_init(3):ip +43246:AUE_SEMPOST:sem_post(3):ip +43247:AUE_SEMTRYWAIT:sem_trywait(3):ip +43258:AUE_SEMWAIT:sem_wait(3):ip +43259:AUE_FGETUUID:fgetuuid(2):ip +43260:AUE_GETUUID:getuuid(2):ip +43261:AUE_LGETUUID:lgetuuid(2):ip +43262:AUE_EXECVEAT:execveat(2):pc,ex +43263:AUE_SHMRENAME:shm_rename(2):ip # # Solaris userspace events. # Modified: head/contrib/openbsm/sys/bsm/audit_kevents.h == --- head/contrib/openbsm/sys/bsm/audit_kevents.hMon Nov 18 10:46:55 2019(r354807) +++ head/contrib/openbsm/sys/bsm/audit_kevents.hMon Nov 18 13:31:16 2019(r354808) @@ -640,6 +640,19 @@ #defineAUE_SETLOGINCLASS 43238 /* FreeBSD-specific. */ #defineAUE_POSIX_FADVISE 43239 /* FreeBSD-specific. */ #defineAUE_SCTP_GENERIC_SENDMSG_IOV43240 /* FreeBSD-specific. */ +#defineAUE_ABORT2 43241 /* FreeBSD-specific. */ +#defineAUE_SEMTIMEDWAIT43242 /* FreeBSD-specific. */ +#defineAUE_SEMDESTROY 43243 /* FreeBSD-specific. */ +#defineAUE_SEMGETVALUE 43244 /* FreeBSD-specific. */ +#defineAUE_SEMINIT 43245 /* FreeBSD-specific. */ +#defineAUE_SEMPOST 43246 /* FreeBSD-specific. */ +#defineAUE_SEMTRYWAIT 43247 /* FreeBSD-specific. */ +#defineAUE_SEMWAIT 43258 /* FreeBSD-specific. */ +#defineAUE_FGETUUID43259 /* CADETS. */ +#defineAUE_GETUUID 43260 /* CADETS. */ +#defineAUE_LGETUUID43261 /* CADETS. */ +#defineAUE_EXECVEAT43262 /* FreeBSD/Linux. */ +#defineAUE_SHMRENAME 43263 /* FreeBSD-specific. */ /* * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the @@ -794,12 +807,6 @@ #defineAUE_REMOVEXATTR AUE_NULL #defineAUE_SBRKAUE_NULL #defineAUE_SELECT AUE_NULL -#defineAUE_SEMDESTROY AUE_NULL -#defineAUE_SEMGETVALUE AUE_NULL -#defineAUE_SEMINIT AUE_NULL -#defineAUE_SEMPOST AUE_NULL -#defineAUE_SEMTRYWAIT AUE_NULL -#defineAUE_SEMWAIT AUE_NULL #defineAUE_SEMWAITSIGNAL AUE_NULL #defineAUE_SETITIMER AUE_NULL #defineAUE_SETSGROUPS AUE_NULL Modified: head/sys/bsm/audit_kevents.h == --- head/sys/bsm/audit_kevents.hMon Nov 18 10:46:55 2019 (r354807) +++ head/sys/bsm/audit_kevents.hMon Nov 18 13:31:16 2019 (r354808) @@ -644,6 +644,19 @@ #defineAUE_SETLOGINCLASS 43238 /* FreeBSD-specific. */ #defineAUE_POSIX_FADVISE 43239 /* FreeBSD-specific. */ #defineAUE_SCTP_GENERIC_SENDMSG_IOV43240 /* FreeBSD-specific. */ +#defineAUE_ABORT2 43241
svn commit: r352756 - head/lib/libc/sys
Author: dab Date: Thu Sep 26 16:13:17 2019 New Revision: 352756 URL: https://svnweb.freebsd.org/changeset/base/352756 Log: Correct mistake in MLINKS introduced in r352747 Messed up a merge conflict resolution and didn't catch that before commit. Sponsored by: Dell EMC Isilon Modified: head/lib/libc/sys/Makefile.inc Modified: head/lib/libc/sys/Makefile.inc == --- head/lib/libc/sys/Makefile.inc Thu Sep 26 16:09:28 2019 (r352755) +++ head/lib/libc/sys/Makefile.inc Thu Sep 26 16:13:17 2019 (r352756) @@ -478,7 +478,7 @@ MLINKS+=setuid.2 setegid.2 \ MLINKS+=shmat.2 shmdt.2 MLINKS+=shm_open.2 memfd_create.3 \ shm_open.2 shm_unlink.2 \ - shm_rename.2 + shm_open.2 shm_rename.2 MLINKS+=sigwaitinfo.2 sigtimedwait.2 MLINKS+=stat.2 fstat.2 \ stat.2 fstatat.2 \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r352751 - in head/sys: compat/freebsd32 kern sys
Author: dab Date: Thu Sep 26 15:41:10 2019 New Revision: 352751 URL: https://svnweb.freebsd.org/changeset/base/352751 Log: sysent: regenerate after r352747. Sponsored by: Dell EMC Isilon Modified: head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_syscall.h == --- head/sys/compat/freebsd32/freebsd32_syscall.h Thu Sep 26 15:38:06 2019(r352750) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Thu Sep 26 15:41:10 2019(r352751) @@ -498,4 +498,5 @@ #defineFREEBSD32_SYS_copy_file_range 569 #defineFREEBSD32_SYS_freebsd32___sysctlbyname 570 #defineFREEBSD32_SYS_shm_open2 571 -#defineFREEBSD32_SYS_MAXSYSCALL572 +#defineFREEBSD32_SYS_shm_rename572 +#defineFREEBSD32_SYS_MAXSYSCALL573 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c == --- head/sys/compat/freebsd32/freebsd32_syscalls.c Thu Sep 26 15:38:06 2019(r352750) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Thu Sep 26 15:41:10 2019(r352751) @@ -608,4 +608,5 @@ const char *freebsd32_syscallnames[] = { "copy_file_range", /* 569 = copy_file_range */ "freebsd32___sysctlbyname", /* 570 = freebsd32___sysctlbyname */ "shm_open2",/* 571 = shm_open2 */ + "shm_rename", /* 572 = shm_rename */ }; Modified: head/sys/compat/freebsd32/freebsd32_sysent.c == --- head/sys/compat/freebsd32/freebsd32_sysent.cThu Sep 26 15:38:06 2019(r352750) +++ head/sys/compat/freebsd32/freebsd32_sysent.cThu Sep 26 15:41:10 2019(r352751) @@ -661,4 +661,5 @@ struct sysent freebsd32_sysent[] = { { AS(copy_file_range_args), (sy_call_t *)sys_copy_file_range, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },/* 569 = copy_file_range */ { AS(freebsd32___sysctlbyname_args), (sy_call_t *)freebsd32___sysctlbyname, AUE_SYSCTL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },/* 570 = freebsd32___sysctlbyname */ { AS(shm_open2_args), (sy_call_t *)sys_shm_open2, AUE_SHMOPEN, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 571 = shm_open2 */ + { AS(shm_rename_args), (sy_call_t *)sys_shm_rename, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 572 = shm_rename */ }; Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c == --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Thu Sep 26 15:38:06 2019(r352750) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Thu Sep 26 15:41:10 2019(r352751) @@ -3346,6 +3346,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 5; break; } + /* shm_rename */ + case 572: { + struct shm_rename_args *p = params; + uarg[0] = (intptr_t) p->path_from; /* const char * */ + uarg[1] = (intptr_t) p->path_to; /* const char * */ + iarg[2] = p->flags; /* int */ + *n_args = 3; + break; + } default: *n_args = 0; break; @@ -9016,6 +9025,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; + /* shm_rename */ + case 572: + switch(ndx) { + case 0: + p = "userland const char *"; + break; + case 1: + p = "userland const char *"; + break; + case 2: + p = "int"; + break; + default: + break; + }; + break; default: break; }; @@ -10897,6 +10922,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char * break; /* shm_open2 */ case 571: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* shm_rename */ + case 572: if (ndx == 0 || ndx == 1) p = "int"; break; Modified: head/sys/kern/init_sysent.c =
svn commit: r352747 - in head: lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys tests/sys/posixshm usr.bin/truss
Author: dab Date: Thu Sep 26 15:32:28 2019 New Revision: 352747 URL: https://svnweb.freebsd.org/changeset/base/352747 Log: Add an shm_rename syscall Add an atomic shm rename operation, similar in spirit to a file rename. Atomically unlink an shm from a source path and link it to a destination path. If an existing shm is linked at the destination path, unlink it as part of the same atomic operation. The caller needs the same permissions as shm_unlink to the shm being renamed, and the same permissions for the shm at the destination which is being unlinked, if it exists. If those fail, EACCES is returned, as with the other shm_* syscalls. truss support is included; audit support will come later. This commit includes only the implementation; the sysent-generated bits will come in a follow-on commit. Submitted by: Matthew Bryan Reviewed by: jilles (earlier revision) Reviewed by: brueffer (manpages, earlier revision) Relnotes: yes Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D21423 Modified: head/lib/libc/sys/Makefile.inc head/lib/libc/sys/Symbol.map head/lib/libc/sys/shm_open.2 head/sys/compat/freebsd32/syscalls.master head/sys/kern/syscalls.master head/sys/kern/uipc_shm.c head/sys/sys/mman.h head/tests/sys/posixshm/posixshm_test.c head/usr.bin/truss/syscalls.c Modified: head/lib/libc/sys/Makefile.inc == --- head/lib/libc/sys/Makefile.inc Thu Sep 26 15:18:57 2019 (r352746) +++ head/lib/libc/sys/Makefile.inc Thu Sep 26 15:32:28 2019 (r352747) @@ -477,7 +477,8 @@ MLINKS+=setuid.2 setegid.2 \ setuid.2 setgid.2 MLINKS+=shmat.2 shmdt.2 MLINKS+=shm_open.2 memfd_create.3 \ - shm_open.2 shm_unlink.2 + shm_open.2 shm_unlink.2 \ + shm_rename.2 MLINKS+=sigwaitinfo.2 sigtimedwait.2 MLINKS+=stat.2 fstat.2 \ stat.2 fstatat.2 \ Modified: head/lib/libc/sys/Symbol.map == --- head/lib/libc/sys/Symbol.mapThu Sep 26 15:18:57 2019 (r352746) +++ head/lib/libc/sys/Symbol.mapThu Sep 26 15:32:28 2019 (r352747) @@ -410,6 +410,7 @@ FBSD_1.6 { getfhat; funlinkat; memfd_create; + shm_rename; }; FBSDprivate_1.0 { Modified: head/lib/libc/sys/shm_open.2 == --- head/lib/libc/sys/shm_open.2Thu Sep 26 15:18:57 2019 (r352746) +++ head/lib/libc/sys/shm_open.2Thu Sep 26 15:32:28 2019 (r352747) @@ -28,11 +28,11 @@ .\" .\" $FreeBSD$ .\" -.Dd September 24, 2019 +.Dd September 26, 2019 .Dt SHM_OPEN 2 .Os .Sh NAME -.Nm memfd_create , shm_open , shm_unlink +.Nm memfd_create , shm_open , shm_rename, shm_unlink .Nd "shared memory object operations" .Sh LIBRARY .Lb libc @@ -45,6 +45,8 @@ .Ft int .Fn shm_open "const char *path" "int flags" "mode_t mode" .Ft int +.Fn shm_rename "const char *path_from" "const char *path_to" "int flags" +.Ft int .Fn shm_unlink "const char *path" .Sh DESCRIPTION The @@ -112,8 +114,9 @@ see and .Xr fcntl 2 . .Pp -As a FreeBSD extension, -the constant +As a +.Fx +extension, the constant .Dv SHM_ANON may be used for the .Fa path @@ -122,7 +125,9 @@ argument to In this case, an anonymous, unnamed shared memory object is created. Since the object has no name, it cannot be removed via a subsequent call to -.Fn shm_unlink . +.Fn shm_unlink , +or moved with a call to +.Fn shm_rename . Instead, the shared memory object will be garbage collected when the last reference to the shared memory object is removed. @@ -138,6 +143,31 @@ will fail with All other flags are ignored. .Pp The +.Fn shm_rename +system call atomically removes a shared memory object named +.Fa path_from +and relinks it at +.Fa path_to . +If another object is already linked at +.Fa path_to , +that object will be unlinked, unless one of the following flags are provided: +.Bl -tag -offset indent -width Er +.It Er SHM_RENAME_EXCHANGE +Atomically exchange the shms at +.Fa path_from +and +.Fa path_to . +.It Er SHM_RENAME_NOREPLACE +Return an error if an shm exists at +.Fa path_to , +rather than unlinking it. +.El +.Fn shm_rename +is also a +.Fx +extension. +.Pp +The .Fn shm_unlink system call removes a shared memory object named .Fa path . @@ -196,15 +226,20 @@ and .Fn shm_open both return a non-negative integer, and +.Fn shm_rename +and .Fn shm_unlink -returns zero. -All three functions return -1 on failure, and set +return zero. +All functions return -1 on failure, and set .Va errno to indicate the error. .Sh COMPATIBILITY The -.Fa path -argument does not necessarily represent a pathname (although it does in +.Fa path , +.Fa path_from , +and +.Fa path_to +arguments do not necessarily represent a pathname (although they do in most oth
Re: svn commit: r345009 - head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini
On Mar 11, 2019, at 9:26 AM, David Bright wrote: > > Author: dab > Date: Mon Mar 11 14:26:45 2019 > New Revision: 345009 > URL: https://svnweb.freebsd.org/changeset/base/345009 > > Log: > Fix a scribbler in the PMS driver. Oops. Reviewed by:Anton Rang http://rang_acm.org/>>, imp@ -- David Bright d...@freebsd.org ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r345009 - head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini
Author: dab Date: Mon Mar 11 14:26:45 2019 New Revision: 345009 URL: https://svnweb.freebsd.org/changeset/base/345009 Log: Fix a scribbler in the PMS driver. The ESGL bit was left uninitialized when executing the REPORT LUNS ioctl. This could allow a zeroed data buffer to be treated as a scatter/gather list. The firmware would eventually walk past the end of the data buffer, potentially find what looked like a valid address/length pair, and write the result to semi-random memory. Obtained from:Dell EMC Isilon MFC after:1 week Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D19398 Modified: head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c Modified: head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c == --- head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c Mon Mar 11 14:21:14 2019(r345008) +++ head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c Mon Mar 11 14:26:45 2019(r345009) @@ -1874,7 +1874,9 @@ tiNumOfLunIOCTLreq( agSSPFrame->dataLength = REPORT_LUN_LEN; agSSPFrame->agSgl.len =sizeof(agsaSSPCmdInfoUnit_t); - +agSSPFrame->agSgl.extReserved = 0; +CLEAR_ESGL_EXTEND(agSSPFrame->agSgl.extReserved); + status = saSSPStart(agRoot, agIORequest, 0, agDevHandle, agRequestType,agSASRequestBody,agNULL, &ossaSSPIoctlCompleted); if(status != AGSA_RC_SUCCESS) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r344553 - head/sys/dev/asmc
Author: dab Date: Mon Feb 25 21:59:01 2019 New Revision: 344553 URL: https://svnweb.freebsd.org/changeset/base/344553 Log: asmc: Add support for Mac mini 2,1 PR: 235798 Submitted by: Trev Reported by: Trev MFC after:1 week Modified: head/sys/dev/asmc/asmc.c head/sys/dev/asmc/asmcvar.h Modified: head/sys/dev/asmc/asmc.c == --- head/sys/dev/asmc/asmc.cMon Feb 25 21:58:19 2019(r344552) +++ head/sys/dev/asmc/asmc.cMon Feb 25 21:59:01 2019(r344553) @@ -259,6 +259,15 @@ struct asmc_model asmc_models[] = { ASMC_MM_TEMPS, ASMC_MM_TEMPNAMES, ASMC_MM_TEMPDESCS }, +/* The Mac Mini 2,1 has no SMS */ +{ + "Macmini2,1", "Apple SMC Mac Mini 2,1", + ASMC_SMS_FUNCS_DISABLED, + ASMC_FAN_FUNCS, + ASMC_LIGHT_FUNCS_DISABLED, + ASMC_MM21_TEMPS, ASMC_MM21_TEMPNAMES, ASMC_MM21_TEMPDESCS +}, + /* The Mac Mini 3,1 has no SMS */ { "Macmini3,1", "Apple SMC Mac Mini 3,1", Modified: head/sys/dev/asmc/asmcvar.h == --- head/sys/dev/asmc/asmcvar.h Mon Feb 25 21:58:19 2019(r344552) +++ head/sys/dev/asmc/asmcvar.h Mon Feb 25 21:59:01 2019(r344553) @@ -341,6 +341,24 @@ struct asmc_softc { #define ASMC_MM_TEMPDESCS { "Northbridge Point 1", \ "Northbridge Point 2" } +#define ASMC_MM21_TEMPS{ "TA0P", "TC0D", \ + "TC0H", "TC0P", \ + "TC1P", "TN0P", \ + "TN1P", NULL } + +#define ASMC_MM21_TEMPNAMES{ "ambient_air", "cpu_die", \ + "cpu_heatsink", "cpu_proximity1", \ + "cpu_proximity2", "northbridge_proximity1", \ + "northbridge_proximity2", } + +#define ASMC_MM21_TEMPDESCS{ "Ambient Air Temperature" \ + "CPU Die Core Temperature", \ + "CPU Heatsink Temperature", \ + "CPU Proximity 1 Temperature", \ + "CPU Proximity 2 Temperature", \ + "Northbridge Proximity 1 Temperature", \ + "Northbridge Proximity 2 Temperature", } + #define ASMC_MM31_TEMPS{ "TC0D", "TC0H", \ "TC0P", "TH0P", \ "TN0D", "TN0P", \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r344473 - head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini
Author: dab Date: Fri Feb 22 18:43:27 2019 New Revision: 344473 URL: https://svnweb.freebsd.org/changeset/base/344473 Log: CID 1332000: Logically dead code in sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c A pointer is first tested for NULL. If non-NULL, another pointer is set equal to the first. The second pointer is then checked for NULL and an error path taken if so. This second test and the associated path is dead code as the pointer value, having just been checked for NULL, cannot be NULL at this point. Remove the dead code. Reported by: Coverity Reviewed by: daniel.william.ryan_gmail.com, vangyzen Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D19165 Modified: head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c Modified: head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c == --- head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c Fri Feb 22 18:24:57 2019(r344472) +++ head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c Fri Feb 22 18:43:27 2019(r344473) @@ -1820,12 +1820,6 @@ tiNumOfLunIOCTLreq( break; } tdIORequestBody = (tdIORequestBody_t *)tiRequestBody; - -if(tdIORequestBody == agNULL) -{ - status = IOCTL_CALL_FAIL; - break; -} tdIORequestBody->tiIORequest = tiIORequest; /* save context if we need to abort later */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r344470 - head/usr.sbin/newsyslog
Author: dab Date: Fri Feb 22 15:31:50 2019 New Revision: 344470 URL: https://svnweb.freebsd.org/changeset/base/344470 Log: Fix several Coverity-detected issues in newsyslog. - CID 1394815, CID 1305673: Dereference before null check - memory was allocated and the allocation checked for NULL with a call to errx() if it failed. Code below that was guaranteed that the pointer was non-NULL, but there was another check for NULL at the exit of the function (after the memory had already been referenced). Eliminate the useless NULL check. - CID 1007452: Resource leak - Storage intended to be allocated and returned to the caller was never freed. This was the result of a regression in the function signature introduced in r208648 (2010) (thanks for that find, @cem!). Fixed by altering the function signature and passing the allocated memory to the caller as intended. This also fixes PR158794. - CID 1008620: Logically dead code in newsyslog.c - This was a direct result of CID 1007452. Since the memory allocated as described there was not returned to the caller, a subsequent check for the memory having been allocated was dead code. Returning the memory re-animates the code that is the subject of this CID. - CID 1006131: Unused value - in parsing a configuration file, a pointer to the end of the last field was saved, but not used after that. Rewrite to use the pointer value. This could have been fixed by avoiding the assignment altogether, but this solutions more closely follows the pattern used in the preceding code. PR: 158794 Reported by: Coverity, Ken-ichi EZURA (PR158794) Reviewed by: cem, markj MFC after:1 week Differential Revision:https://reviews.freebsd.org/D19105 Modified: head/usr.sbin/newsyslog/newsyslog.c Modified: head/usr.sbin/newsyslog/newsyslog.c == --- head/usr.sbin/newsyslog/newsyslog.c Fri Feb 22 15:15:36 2019 (r344469) +++ head/usr.sbin/newsyslog/newsyslog.c Fri Feb 22 15:31:50 2019 (r344470) @@ -253,7 +253,7 @@ static const char *path_syslogpid = _PATH_SYSLOGPID; static struct cflist *get_worklist(char **files); static void parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p, - struct conf_entry *defconf_p, struct ilist *inclist); + struct conf_entry **defconf, struct ilist *inclist); static void add_to_queue(const char *fname, struct ilist *inclist); static char *sob(char *p); static char *son(char *p); @@ -841,7 +841,7 @@ get_worklist(char **files) if (verbose) printf("Processing %s\n", inc->file); - parse_file(f, filelist, globlist, defconf, &inclist); + parse_file(f, filelist, globlist, &defconf, &inclist); (void) fclose(f); } @@ -858,7 +858,6 @@ get_worklist(char **files) if (defconf != NULL) free_entry(defconf); return (filelist); - /* NOTREACHED */ } /* @@ -915,7 +914,7 @@ get_worklist(char **files) * for a "glob" entry which does match. */ gmatch = 0; - if (verbose > 2 && globlist != NULL) + if (verbose > 2) printf("\t+ Checking globs for %s\n", *given); STAILQ_FOREACH(ent, globlist, cf_nextp) { fnres = fnmatch(ent->log, *given, FNM_PATHNAME); @@ -1046,7 +1045,7 @@ expand_globs(struct cflist *work_p, struct cflist *glo */ static void parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p, -struct conf_entry *defconf_p, struct ilist *inclist) +struct conf_entry **defconf_p, struct ilist *inclist) { char line[BUFSIZ], *parse, *q; char *cp, *errline, *group; @@ -1137,12 +1136,12 @@ parse_file(FILE *cf, struct cflist *work_p, struct cfl working = init_entry(q, NULL); if (strcasecmp(DEFAULT_MARKER, q) == 0) { special = 1; - if (defconf_p != NULL) { + if (*defconf_p != NULL) { warnx("Ignoring duplicate entry for %s!", q); free_entry(working); continue; } - defconf_p = working; + *defconf_p = working; } q = parse = missing_field(sob(parse + 1), errline); @@ -1357,7 +1356,8 @@ no_trimat: q = NULL; else { q = parse = sob(parse + 1); /* Optional field */ - *(parse = son(parse)) = '\0'; + parse = son(parse); + *parse = '\0';
Re: svn commit: r344389 - head/usr.sbin/newsyslog
[… other discussion omitted…] On Feb 21, 2019, at 12:22 PM, John Baldwin wrote: > > > I'm +1 on Bruce's point on this. I find it similar to the recent spate of > adding pointless '__dead2' annotations to usage functions that unconditionally > call exit() (and thus are already inferred as __dead2 by any compiler > written in this millenium) I’ve reverted (r344468) the two commits that contained the memory leak fixes at issue. Thanks for the feedback. -- David Bright d...@freebsd.org ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r344468 - head/usr.sbin/newsyslog
Author: dab Date: Fri Feb 22 14:59:40 2019 New Revision: 344468 URL: https://svnweb.freebsd.org/changeset/base/344468 Log: Revert r344389 & r343906 - Fix Coverity errors in newsyslog It was pointed out that a couple of the "memory leak" CIDs that I fixed were arguably Coverity errors rather than errors in the newsyslog code and the cure was worse than the disease. Revert both changes. The first change, which included fixes for other Coverity errors, will be re-worked to omit the troublesome changes and then re-committed with the remaining fixes. Reported by: bde Sponsored by: Dell EMC Isilon Modified: head/usr.sbin/newsyslog/newsyslog.c Modified: head/usr.sbin/newsyslog/newsyslog.c == --- head/usr.sbin/newsyslog/newsyslog.c Fri Feb 22 12:27:25 2019 (r344467) +++ head/usr.sbin/newsyslog/newsyslog.c Fri Feb 22 14:59:40 2019 (r344468) @@ -253,7 +253,7 @@ static const char *path_syslogpid = _PATH_SYSLOGPID; static struct cflist *get_worklist(char **files); static void parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p, - struct conf_entry **defconf, struct ilist *inclist); + struct conf_entry *defconf_p, struct ilist *inclist); static void add_to_queue(const char *fname, struct ilist *inclist); static char *sob(char *p); static char *son(char *p); @@ -374,8 +374,6 @@ main(int argc, char **argv) while (wait(NULL) > 0 || errno == EINTR) ; - free(timefnamefmt); - free(requestor); return (0); } @@ -793,9 +791,6 @@ usage(void) fprintf(stderr, "usage: newsyslog [-CFNPnrsv] [-a directory] [-d directory] [-f config_file]\n" " [-S pidfile] [-t timefmt] [[-R tagname] file ...]\n"); - /* Free global dynamically-allocated storage. */ - free(timefnamefmt); - free(requestor); exit(1); } @@ -846,7 +841,7 @@ get_worklist(char **files) if (verbose) printf("Processing %s\n", inc->file); - parse_file(f, filelist, globlist, &defconf, &inclist); + parse_file(f, filelist, globlist, defconf, &inclist); (void) fclose(f); } @@ -863,6 +858,7 @@ get_worklist(char **files) if (defconf != NULL) free_entry(defconf); return (filelist); + /* NOTREACHED */ } /* @@ -919,7 +915,7 @@ get_worklist(char **files) * for a "glob" entry which does match. */ gmatch = 0; - if (verbose > 2) + if (verbose > 2 && globlist != NULL) printf("\t+ Checking globs for %s\n", *given); STAILQ_FOREACH(ent, globlist, cf_nextp) { fnres = fnmatch(ent->log, *given, FNM_PATHNAME); @@ -1050,7 +1046,7 @@ expand_globs(struct cflist *work_p, struct cflist *glo */ static void parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p, -struct conf_entry **defconf_p, struct ilist *inclist) +struct conf_entry *defconf_p, struct ilist *inclist) { char line[BUFSIZ], *parse, *q; char *cp, *errline, *group; @@ -1141,12 +1137,12 @@ parse_file(FILE *cf, struct cflist *work_p, struct cfl working = init_entry(q, NULL); if (strcasecmp(DEFAULT_MARKER, q) == 0) { special = 1; - if (*defconf_p != NULL) { + if (defconf_p != NULL) { warnx("Ignoring duplicate entry for %s!", q); free_entry(working); continue; } - *defconf_p = working; + defconf_p = working; } q = parse = missing_field(sob(parse + 1), errline); @@ -1361,8 +1357,7 @@ no_trimat: q = NULL; else { q = parse = sob(parse + 1); /* Optional field */ - parse = son(parse); - *parse = '\0'; + *(parse = son(parse)) = '\0'; } working->sig = SIGHUP; @@ -2015,6 +2010,7 @@ do_zipwork(struct zipwork_entry *zwork) const char **args, *pgm_name, *pgm_path; char *zresult; + command = NULL; assert(zwork != NULL); assert(zwork->zw_conf != NULL); assert(zwork->zw_conf->compress > COMPRESS_NONE); @@ -2118,7 +2114,8 @@ do_zipwork(struct zipwork_entry *zwork) change_attrs(zresult, zwork->zw_conf); out: - sbuf_delete(command); + if (command != NULL) + sbuf_delete(command); free(args); free(zresult); } ___
svn commit: r344389 - head/usr.sbin/newsyslog
Author: dab Date: Wed Feb 20 22:05:44 2019 New Revision: 344389 URL: https://svnweb.freebsd.org/changeset/base/344389 Log: Complete fix for CID 1007454, CID 1007453: Resource leak in newsyslog The result of a strdup() was stored in a global variable and not freed before program exit. This is a follow-up to r343906. That change attempted to plug these resource leaks but managed to miss a code path on which the leak still occurs. Plug the leak on that path, too. MFC after:3 days Sponsored by: Dell EMC Isilon Modified: head/usr.sbin/newsyslog/newsyslog.c Modified: head/usr.sbin/newsyslog/newsyslog.c == --- head/usr.sbin/newsyslog/newsyslog.c Wed Feb 20 21:24:56 2019 (r344388) +++ head/usr.sbin/newsyslog/newsyslog.c Wed Feb 20 22:05:44 2019 (r344389) @@ -793,6 +793,9 @@ usage(void) fprintf(stderr, "usage: newsyslog [-CFNPnrsv] [-a directory] [-d directory] [-f config_file]\n" " [-S pidfile] [-t timefmt] [[-R tagname] file ...]\n"); + /* Free global dynamically-allocated storage. */ + free(timefnamefmt); + free(requestor); exit(1); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r344024 - head/sys/cam/scsi
Author: dab Date: Mon Feb 11 22:09:26 2019 New Revision: 344024 URL: https://svnweb.freebsd.org/changeset/base/344024 Log: CID 1009492: Logically dead code in sys/cam/scsi/scsi_xpt.c In `probedone()`, for the `PROBE_REPORT_LUNS` case, all paths that fall to the bottom of the case set `lp` to `NULL`, so the test for a non-NULL value of `lp` and call to `free()` if true is dead code as the test can never be true. Fix by eliminating the whole if statement. To guard against a possible future change that accidentally violates this assumption, use a `KASSERT()` to catch if `lp` is non-NULL. Reviewed by: cem MFC after:1 week Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D19109 Modified: head/sys/cam/scsi/scsi_xpt.c Modified: head/sys/cam/scsi/scsi_xpt.c == --- head/sys/cam/scsi/scsi_xpt.cMon Feb 11 21:31:26 2019 (r344023) +++ head/sys/cam/scsi/scsi_xpt.cMon Feb 11 22:09:26 2019 (r344024) @@ -1385,6 +1385,12 @@ out: probe_purge_old(path, lp, softc->flags); lp = NULL; } + /* The processing above should either exit via a `goto +* out` or leave the `lp` variable `NULL` and (if +* applicable) `free()` the storage to which it had +* pointed. Assert here that is the case. +*/ + KASSERT(lp == NULL, ("%s: lp is not NULL", __func__)); inq_buf = &path->device->inq_data; if (path->device->flags & CAM_DEV_INQUIRY_DATA_VALID && (SID_QUAL(inq_buf) == SID_QUAL_LU_CONNECTED || @@ -1397,9 +1403,6 @@ out: xpt_release_ccb(done_ccb); xpt_schedule(periph, priority); goto out; - } - if (lp) { - free(lp, M_CAMXPT); } PROBE_SET_ACTION(softc, PROBE_INVALID); xpt_release_ccb(done_ccb); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r343906 - head/usr.sbin/newsyslog
Author: dab Date: Fri Feb 8 13:54:16 2019 New Revision: 343906 URL: https://svnweb.freebsd.org/changeset/base/343906 Log: Fix several Coverity-detected issues in newsyslog. - CID 1394815, CID 1305673: Dereference before null check - memory was allocated and the allocation checked for NULL with a call to errx() if it failed. Code below that was guaranteed that the pointer was non-NULL, but there was another check for NULL at the exit of the function (after the memory had already been referenced). Eliminate the useless NULL check. - CID 1007454, CID 1007453: Resource leak - The result of a strdup() was stored in a global variable and not freed before program exit. - CID 1007452: Resource leak - Storage intended to be allocated and returned to the caller was never freed. This was the result of a regression in the function signature introduced in r208648 (2010) (thanks for that find, @cem!). Fixed by altering the function signature and passing the allocated memory to the caller as intended. This also fixes PR158794. - CID 1008620: Logically dead code in newsyslog.c - This was a direct result of CID 1007452. Since the memory allocated as described there was not returned to the caller, a subsequent check for the memory having been allocated was dead code. Returning the memory re-animates the code that is the subject of this CID. - CID 1006131: Unused value - in parsing a configuration file, a pointer to the end of the last field was saved, but not used after that. Rewrite to use the pointer value. This could have been fixed by avoiding the assignment altogether, but this solutions more closely follows the pattern used in the preceding code. PR: 158794 Reported by: Coverity, Ken-ichi EZURA (PR158794) Reviewed by: cem, markj MFC after:1 week Sponsored by: Dell EMC Isilon Modified: head/usr.sbin/newsyslog/newsyslog.c Modified: head/usr.sbin/newsyslog/newsyslog.c == --- head/usr.sbin/newsyslog/newsyslog.c Fri Feb 8 13:10:45 2019 (r343905) +++ head/usr.sbin/newsyslog/newsyslog.c Fri Feb 8 13:54:16 2019 (r343906) @@ -253,7 +253,7 @@ static const char *path_syslogpid = _PATH_SYSLOGPID; static struct cflist *get_worklist(char **files); static void parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p, - struct conf_entry *defconf_p, struct ilist *inclist); + struct conf_entry **defconf, struct ilist *inclist); static void add_to_queue(const char *fname, struct ilist *inclist); static char *sob(char *p); static char *son(char *p); @@ -374,6 +374,8 @@ main(int argc, char **argv) while (wait(NULL) > 0 || errno == EINTR) ; + free(timefnamefmt); + free(requestor); return (0); } @@ -841,7 +843,7 @@ get_worklist(char **files) if (verbose) printf("Processing %s\n", inc->file); - parse_file(f, filelist, globlist, defconf, &inclist); + parse_file(f, filelist, globlist, &defconf, &inclist); (void) fclose(f); } @@ -858,7 +860,6 @@ get_worklist(char **files) if (defconf != NULL) free_entry(defconf); return (filelist); - /* NOTREACHED */ } /* @@ -915,7 +916,7 @@ get_worklist(char **files) * for a "glob" entry which does match. */ gmatch = 0; - if (verbose > 2 && globlist != NULL) + if (verbose > 2) printf("\t+ Checking globs for %s\n", *given); STAILQ_FOREACH(ent, globlist, cf_nextp) { fnres = fnmatch(ent->log, *given, FNM_PATHNAME); @@ -1046,7 +1047,7 @@ expand_globs(struct cflist *work_p, struct cflist *glo */ static void parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p, -struct conf_entry *defconf_p, struct ilist *inclist) +struct conf_entry **defconf_p, struct ilist *inclist) { char line[BUFSIZ], *parse, *q; char *cp, *errline, *group; @@ -1137,12 +1138,12 @@ parse_file(FILE *cf, struct cflist *work_p, struct cfl working = init_entry(q, NULL); if (strcasecmp(DEFAULT_MARKER, q) == 0) { special = 1; - if (defconf_p != NULL) { + if (*defconf_p != NULL) { warnx("Ignoring duplicate entry for %s!", q); free_entry(working); continue; } - defconf_p = working; + *defconf_p = working; } q = parse = missing_field(sob(parse + 1), errline); @@ -1357,7 +13
Re: svn commit: r343906 - head/usr.sbin/newsyslog
On Feb 8, 2019, at 7:54 AM, David Bright wrote: > > Author: dab > Date: Fri Feb 8 13:54:16 2019 > New Revision: 343906 > URL: https://svnweb.freebsd.org/changeset/base/343906 > > Log: > Fix several Coverity-detected issues in newsyslog. Oops: Differential Revision: https://reviews.freebsd.org/D19105 -- David Bright d...@freebsd.org ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342822 - head/sys/dev/asmc
Author: dab Date: Sun Jan 6 23:43:12 2019 New Revision: 342822 URL: https://svnweb.freebsd.org/changeset/base/342822 Log: asmc: Add support for Mac mini 4,1 (Mid-2010) MFC after:1 week Modified: head/sys/dev/asmc/asmc.c head/sys/dev/asmc/asmcvar.h Modified: head/sys/dev/asmc/asmc.c == --- head/sys/dev/asmc/asmc.cSun Jan 6 22:50:16 2019(r342821) +++ head/sys/dev/asmc/asmc.cSun Jan 6 23:43:12 2019(r342822) @@ -151,6 +151,8 @@ static struct asmc_model *asmc_match(device_t dev); asmc_mbp_sysctl_light_right, \ asmc_mbp_sysctl_light_control +#define ASMC_LIGHT_FUNCS_DISABLED NULL, NULL, NULL + struct asmc_model asmc_models[] = { { "MacBook1,1", "Apple SMC MacBook Core Duo", @@ -264,6 +266,15 @@ struct asmc_model asmc_models[] = { ASMC_FAN_FUNCS, NULL, NULL, NULL, ASMC_MM31_TEMPS, ASMC_MM31_TEMPNAMES, ASMC_MM31_TEMPDESCS + }, + + /* The Mac Mini 4,1 (Mid-2010) has no SMS */ + { + "Macmini4,1", "Apple SMC Mac mini 4,1 (Mid-2010)", + ASMC_SMS_FUNCS_DISABLED, + ASMC_FAN_FUNCS, + ASMC_LIGHT_FUNCS_DISABLED, + ASMC_MM41_TEMPS, ASMC_MM41_TEMPNAMES, ASMC_MM41_TEMPDESCS }, /* The Mac Mini 5,2 has no SMS */ Modified: head/sys/dev/asmc/asmcvar.h == --- head/sys/dev/asmc/asmcvar.h Sun Jan 6 22:50:16 2019(r342821) +++ head/sys/dev/asmc/asmcvar.h Sun Jan 6 23:43:12 2019(r342822) @@ -360,6 +360,27 @@ struct asmc_softc { "Northbridge Proximity Temperature", \ "Wireless Module Proximity Temperature", } +#define ASMC_MM41_TEMPS{ "TA0P", "TC0D", "TC0G", "TC0H", "TC0P", \ + "TC0p", "TCPG", "TH0G", "TH0P", "TH0p", \ + "TM0G", "TM0P", "TM0p", "TN0D", "TN0G", \ + "TN0P", "TN0p", "TN1D", "TN1E", "TN1F", \ + "TN1G", "TN1S", "TNPG", "TO0P", "TO0p", \ + "TW0P", "Tm0P", "Tp0C", NULL } + +#define ASMC_MM41_TEMPNAMES{ "TA0P", "TC0D", "TC0G", "TC0H", "TC0P", \ + "TC0p", "TCPG", "TH0G", "TH0P", "TH0p", \ + "TM0G", "TM0P", "TM0p", "TN0D", "TN0G", \ + "TN0P", "TN0p", "TN1D", "TN1E", "TN1F", \ + "TN1G", "TN1S", "TNPG", "TO0P", "TO0p", \ + "TW0P", "Tm0P", "Tp0C", NULL } + +#define ASMC_MM41_TEMPDESCS{ "TA0P", "TC0D", "TC0G", "TC0H", "TC0P", \ + "TC0p", "TCPG", "TH0G", "TH0P", "TH0p", \ + "TM0G", "TM0P", "TM0p", "TN0D", "TN0G", \ + "TN0P", "TN0p", "TN1D", "TN1E", "TN1F", \ + "TN1G", "TN1S", "TNPG", "TO0P", "TO0p", \ + "TW0P", "Tm0P", "Tp0C", NULL } + #define ASMC_MM52_TEMPS{ "TA0P", "TA1P", \ "TC0D", "TC0P", \ "TG0D", "TG1D", \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342770 - head/sys/dev/asmc
Author: dab Date: Fri Jan 4 18:21:49 2019 New Revision: 342770 URL: https://svnweb.freebsd.org/changeset/base/342770 Log: asmc: Patch to add MacBook Pro 9,2 support PR: 211513 Submitted by: William Theesfeld Jr Reported by: William Theesfeld Jr MFC after:1 week Modified: head/sys/dev/asmc/asmc.c head/sys/dev/asmc/asmcvar.h Modified: head/sys/dev/asmc/asmc.c == --- head/sys/dev/asmc/asmc.cFri Jan 4 17:33:07 2019(r342769) +++ head/sys/dev/asmc/asmc.cFri Jan 4 18:21:49 2019(r342770) @@ -231,6 +231,12 @@ struct asmc_model asmc_models[] = { }, { +"MacBookPro9,2", "Apple SMC MacBook Pro (mid 2012)", + ASMC_SMS_FUNCS_DISABLED, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS, + ASMC_MBP9_TEMPS, ASMC_MBP9_TEMPNAMES, ASMC_MBP9_TEMPDESCS + }, + + { "MacBookPro11,2", "Apple SMC MacBook Pro Retina Core i7 (2013/2014)", ASMC_SMS_FUNCS_DISABLED, ASMC_FAN_FUNCS2, ASMC_LIGHT_FUNCS, ASMC_MBP112_TEMPS, ASMC_MBP112_TEMPNAMES, ASMC_MBP112_TEMPDESCS Modified: head/sys/dev/asmc/asmcvar.h == --- head/sys/dev/asmc/asmcvar.h Fri Jan 4 17:33:07 2019(r342769) +++ head/sys/dev/asmc/asmcvar.h Fri Jan 4 18:21:49 2019(r342770) @@ -257,6 +257,27 @@ struct asmc_softc { "TMBS", "TP0P", "TPCD", "TW0P", "Th1H", \ "Th2H", "Tm0P", "Ts0P", "Ts0S" } +#define ASMC_MBP9_TEMPS{ "Ts0P", "Ts0S", "TA0P", "TB1T", "TB2T", \ + "TB0T", "TC1C", "TC2C", "TC0E", "TC0F", \ + "TC0J", "TC0P", "TCFC", "TCGC", "TCSA", \ + "TCTD", "TCXC", "TG1D", "TM0P", "TM0S", \ + "TPCD", NULL } + +#define ASMC_MBP9_TEMPNAMES{ "Ts0P", "Ts0S", "TA0P", "TB1T", "TB2T", \ + "TB0T", "TC1C", "TC2C", "TC0E", "TC0F", \ + "TC0J", "TC0P", "TCFC", "TCGC", "TCSA", \ + "TCTD", "TCXC", "TG1D", "TM0P", "TM0S", \ + "TPCD" } + +#define ASMC_MBP9_TEMPDESCS{ "Palm Rest", "Memory Proximity", "Airflow 1", \ + "Battery 1", "Battery 2", "Battery TS_MAX", \ + "CPU Core 1", "CPU Core 2", "CPU1", "CPU1", \ + "TC0J", "CPU 1 Proximity", "TCFC", \ + "PECI GPU", "PECI SA", "TCTD", "PECI CPU", \ + "GPU Die", "Memory Bank A1", "Memory Module A1", \ + "PCH Die" } + + #define ASMC_MBP112_TEMPS { "TB0T", "TB1T", "TB2T", "TBXT", "TC0E", \ "TC0F", "TC0P", "TC1C", "TC2C", "TC3C", \ "TC4C", "TCFC", "TCGC", "TCSA", "TCTD", \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r342218 - head/sys/dev/asmc
Author: dab Date: Wed Dec 19 16:45:37 2018 New Revision: 342218 URL: https://svnweb.freebsd.org/changeset/base/342218 Log: asmc: Add support for MacPro1,1 PR: 203431 Submitted by: j...@alisa.org & holin...@saunalahti.fi Reported by: j...@alisa.org MFC after:1 week Modified: head/sys/dev/asmc/asmc.c head/sys/dev/asmc/asmcvar.h Modified: head/sys/dev/asmc/asmc.c == --- head/sys/dev/asmc/asmc.cWed Dec 19 16:06:08 2018(r342217) +++ head/sys/dev/asmc/asmc.cWed Dec 19 16:45:37 2018(r342218) @@ -269,13 +269,22 @@ struct asmc_model asmc_models[] = { ASMC_MM52_TEMPS, ASMC_MM52_TEMPNAMES, ASMC_MM52_TEMPDESCS }, - /* Idem for the MacPro */ + /* Idem for the Mac Pro "Quad Core" (original) */ { + "MacPro1,1", "Apple SMC Mac Pro (Quad Core)", + NULL, NULL, NULL, + ASMC_FAN_FUNCS, + NULL, NULL, NULL, + ASMC_MP1_TEMPS, ASMC_MP1_TEMPNAMES, ASMC_MP1_TEMPDESCS + }, + + /* Idem for the Mac Pro (8-core) */ + { "MacPro2", "Apple SMC Mac Pro (8-core)", NULL, NULL, NULL, ASMC_FAN_FUNCS, NULL, NULL, NULL, - ASMC_MP_TEMPS, ASMC_MP_TEMPNAMES, ASMC_MP_TEMPDESCS + ASMC_MP2_TEMPS, ASMC_MP2_TEMPNAMES, ASMC_MP2_TEMPDESCS }, /* Idem for the MacPro 2010*/ Modified: head/sys/dev/asmc/asmcvar.h == --- head/sys/dev/asmc/asmcvar.h Wed Dec 19 16:06:08 2018(r342217) +++ head/sys/dev/asmc/asmcvar.h Wed Dec 19 16:45:37 2018(r342218) @@ -374,7 +374,70 @@ struct asmc_softc { "Power Supply Temperature", \ "Wireless Module Proximity Temperature", } -#define ASMC_MP_TEMPS { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", \ +#define ASMC_MP1_TEMPS { "TA0P", \ + "TCAH", "TCBH", \ + "TC0P", "TC0C", "TC1C", \ + "TC2C", "TC3C", "THTG", \ + "TH0P", "TH1P", \ + "TH2P", "TH3P", \ + "TM0P", "TM1P", "TM2P", \ + "TM8P", "TM9P", "TMAP", \ + "TM0S", "TM1S", "TM2P", "TM3S", \ + "TM8S", "TM9S", "TMAS", "TMBS", \ + "TN0H", "TS0C", \ + "Tp0C", "Tp1C", "Tv0S", "Tv1S", NULL } + +#define ASMC_MP1_TEMPNAMES { "ambient", \ + "cpu_a_heatsink", "cpu_b_heatsink", \ + "cpu_a_proximity", "cpu_core0", "cpu_core1", \ + "cpu_core2", "cpu_core3", "THTG", \ + "hdd_bay0", "hdd_bay1", \ + "hdd_bay2", "hdd_bay3", \ + "memory_card_a_proximity0", \ + "memory_card_a_proximity1", \ + "memory_card_a_proximity2", \ + "memory_card_b_proximity0", \ + "memory_card_b_proximity1", \ + "memory_card_b_proximity2", \ + "memory_card_a_slot0", \ + "memory_card_a_slot1", \ + "memory_card_a_slot2", \ + "memory_card_a_slot3", \ + "memory_card_b_slot0", \ + "memory_card_b_slot1", \ + "memory_card_b_slot2", \ + "memory_card_b_slot3", \ + "mch_heatsink", "expansion_slots", \ + "power_supply_loc0", "power_supply_loc1", \ + "Tv0S", "Tv1S", } + +#define ASMC_MP1_TEMPDESCS { "Ambient Air", \ + "CPU A Heatsink", "CPU B Heatsink", \ + "CPU A Proximity", \ + "CPU Core 1", "CPU Core 2", \ + "CPU Core 3", "CPU Core 4", "THTG", \ + "Hard Drive Bay 1", "Hard Drive Bay 2", \ + "Hard Drive Bay 3", "Hard Drive Bay 4", \ + "Memory Riser A, Proximity 1", \ + "Memory Riser A, Proximity 2", \ + "Memory Riser A, Proximity 3", \ + "Memory Riser B, Proximity 1", \ + "Memory Riser B, Proximity 2", \ + "Memory Riser B, Proximity 3", \ +
svn commit: r342171 - head/sys/dev/asmc
Author: dab Date: Mon Dec 17 17:21:45 2018 New Revision: 342171 URL: https://svnweb.freebsd.org/changeset/base/342171 Log: asmc: Add support for mid-2011 Macmini 5,2 PR: 225911 Submitted by: trev Reported by: trev MFC after:1 week Modified: head/sys/dev/asmc/asmc.c head/sys/dev/asmc/asmcvar.h Modified: head/sys/dev/asmc/asmc.c == --- head/sys/dev/asmc/asmc.cMon Dec 17 17:11:00 2018(r342170) +++ head/sys/dev/asmc/asmc.cMon Dec 17 17:21:45 2018(r342171) @@ -260,6 +260,15 @@ struct asmc_model asmc_models[] = { ASMC_MM31_TEMPS, ASMC_MM31_TEMPNAMES, ASMC_MM31_TEMPDESCS }, + /* The Mac Mini 5,2 has no SMS */ + { + "Macmini5,2", "Apple SMC Mac Mini 5,2", + NULL, NULL, NULL, + ASMC_FAN_FUNCS2, + NULL, NULL, NULL, + ASMC_MM52_TEMPS, ASMC_MM52_TEMPNAMES, ASMC_MM52_TEMPDESCS + }, + /* Idem for the MacPro */ { "MacPro2", "Apple SMC Mac Pro (8-core)", Modified: head/sys/dev/asmc/asmcvar.h == --- head/sys/dev/asmc/asmcvar.h Mon Dec 17 17:11:00 2018(r342170) +++ head/sys/dev/asmc/asmcvar.h Mon Dec 17 17:21:45 2018(r342171) @@ -339,6 +339,41 @@ struct asmc_softc { "Northbridge Proximity Temperature", \ "Wireless Module Proximity Temperature", } +#define ASMC_MM52_TEMPS{ "TA0P", "TA1P", \ + "TC0D", "TC0P", \ + "TG0D", "TG1D", \ + "TG0P", "TG0M", \ + "TI0P", \ + "TM0S", "TMBS", \ + "TM0P", "TP0P", \ + "TPCD", "Tp0C", \ + "TW0P", NULL } + +#define ASMC_MM52_TEMPNAMES{ "ambient_air_proximity", "ambient_cpu_pch_wireless_dimm", \ + "cpu_die", "cpu_proximity", \ + "gpu_diode1", "gpu_diode2", \ + "gpu_proximity", "gpu_integrated_switcher", \ + "thunderbolt_proximity", \ + "memory_slot1", "memory_slot2", \ + "memory_proximity", "pch_controller_proximity", \ + "pch_controller_die", "pwr_supply", \ + "wireless_proximity", } + +#define ASMC_MM52_TEMPDESCS{ "Ambient Air Proximity Temperature", \ + "Combo Ambient CPU PCH Wireless DIMM Temperature", \ + "CPU Die Temperature", "CPU Proximity Temperature", \ + "GPU Diode 1 Temperature" , "GPU Diode 2 Temperature", \ + "GPU Proximity Temperature", \ + "Integrated Graphics/GPU Switcher Temperature", \ + "Thunderbolt Proximity Temperature", \ + "Memory Slot 1 Temperature", \ + "Memory Slot 2 Temperature", \ + "Memory Slots Proximity Temperature", \ + "Platform Controller Hub Proximity Temperature", \ + "Platform Controller Hub Die Temperature", \ + "Power Supply Temperature", \ + "Wireless Module Proximity Temperature", } + #define ASMC_MP_TEMPS { "TA0P", "TCAG", "TCAH", "TCBG", "TCBH", \ "TC0C", "TC0D", "TC0P", "TC1C", "TC1D", \ "TC2C", "TC2D", "TC3C", "TC3D", "THTG", \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r341988 - head/sys/dev/asmc
Author: dab Date: Wed Dec 12 13:43:55 2018 New Revision: 341988 URL: https://svnweb.freebsd.org/changeset/base/341988 Log: asmc: Add Support for Macbook Pro 8,1 PR: 217505 Submitted by: John O. Brickley , updated by Maciej Pasternacki Reported by: John O. Brickley MFC after:1 week Modified: head/sys/dev/asmc/asmc.c head/sys/dev/asmc/asmcvar.h Modified: head/sys/dev/asmc/asmc.c == --- head/sys/dev/asmc/asmc.cWed Dec 12 13:17:51 2018(r341987) +++ head/sys/dev/asmc/asmc.cWed Dec 12 13:43:55 2018(r341988) @@ -219,9 +219,15 @@ struct asmc_model asmc_models[] = { }, { + "MacBookPro8,1", "Apple SMC MacBook Pro (early 2011, 13-inch)", + ASMC_SMS_FUNCS_DISABLED, ASMC_FAN_FUNCS2, ASMC_LIGHT_FUNCS, + ASMC_MBP81_TEMPS, ASMC_MBP81_TEMPNAMES, ASMC_MBP81_TEMPDESCS + }, + + { "MacBookPro8,2", "Apple SMC MacBook Pro (early 2011)", ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS, - ASMC_MBP8_TEMPS, ASMC_MBP8_TEMPNAMES, ASMC_MBP8_TEMPDESCS + ASMC_MBP82_TEMPS, ASMC_MBP82_TEMPNAMES, ASMC_MBP82_TEMPDESCS }, { Modified: head/sys/dev/asmc/asmcvar.h == --- head/sys/dev/asmc/asmcvar.h Wed Dec 12 13:17:51 2018(r341987) +++ head/sys/dev/asmc/asmcvar.h Wed Dec 12 13:43:55 2018(r341988) @@ -218,21 +218,39 @@ struct asmc_softc { "Heatsink 2", "Memory Controller", \ "PCI Express Slot Pin", "PCI Express Slot (unk)" } -#define ASMC_MBP8_TEMPS{ "TB0T", "TB1T", "TB2T", "TC0C", "TC0D", \ +#define ASMC_MBP81_TEMPS { "TB0T", "TB1T", "TB2T", "TC0C", "TC0D", \ "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ + "TCFC", "TCGC", "TCSA", "TM0S", "TMBS", \ + "TP0P", "TPCD", "TW0P", "Th1H", "Ts0P", \ + "Ts0S", NULL } + +#define ASMC_MBP81_TEMPNAMES { "enclosure", "TB1T", "TB2T", "TC0C", "TC0D", \ + "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ + "TCFC", "TCGC", "TCSA", "TM0S", "TMBS", \ + "TP0P", "TPCD", "wireless", "Th1H", "Ts0P", \ + "Ts0S" } + +#define ASMC_MBP81_TEMPDESCS { "Enclosure Bottomside", "TB1T", "TB2T", "TC0C", "TC0D", \ + "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ + "TCFC", "TCGC", "TCSA", "TM0S", "TMBS", \ + "TP0P", "TPCD", "TW0P", "Th1H", "Ts0P", \ + "Ts0S" } + +#define ASMC_MBP82_TEMPS { "TB0T", "TB1T", "TB2T", "TC0C", "TC0D", \ + "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ "TC3C", "TC4C", "TCFC", "TCGC", "TCSA", \ "TCTD", "TG0D", "TG0P", "THSP", "TM0S", \ "TMBS", "TP0P", "TPCD", "TW0P", "Th1H", \ "Th2H", "Tm0P", "Ts0P", "Ts0S", NULL } -#define ASMC_MBP8_TEMPNAMES{ "enclosure", "TB1T", "TB2T", "TC0C", "TC0D", \ +#define ASMC_MBP82_TEMPNAMES { "enclosure", "TB1T", "TB2T", "TC0C", "TC0D", \ "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ "TC3C", "TC4C", "TCFC", "TCGC", "TCSA", \ "TCTD", "graphics", "TG0P", "THSP", "TM0S", \ "TMBS", "TP0P", "TPCD", "wireless", "Th1H", \ "Th2H", "memory", "Ts0P", "Ts0S" } -#define ASMC_MBP8_TEMPDESCS{ "Enclosure Bottomside", "TB1T", "TB2T", "TC0C", "TC0D", \ +#define ASMC_MBP82_TEMPDESCS { "Enclosure Bottomside", "TB1T", "TB2T", "TC0C", "TC0D", \ "TC0E", "TC0F", "TC0P", "TC1C", "TC2C", \ "TC3C", "TC4C", "TCFC", "TCGC", "TCSA", \ "TCTD", "TG0D", "TG0P", "THSP", "TM0S", \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r341820 - head/sys/dev/asmc
Author: dab Date: Tue Dec 11 16:35:59 2018 New Revision: 341820 URL: https://svnweb.freebsd.org/changeset/base/341820 Log: asmc: Add Support for MacBookAir 7,1 and 7,2 PR: 226172 Submitted by: James Wright Reported by: James Wright MFC after:1 week Differential Revision:https://reviews.freebsd.org/D18396 Modified: head/sys/dev/asmc/asmc.c head/sys/dev/asmc/asmcvar.h Modified: head/sys/dev/asmc/asmc.c == --- head/sys/dev/asmc/asmc.cTue Dec 11 12:08:18 2018(r341819) +++ head/sys/dev/asmc/asmc.cTue Dec 11 16:35:59 2018(r341820) @@ -300,6 +300,21 @@ struct asmc_model asmc_models[] = { ASMC_MBA5_TEMPS, ASMC_MBA5_TEMPNAMES, ASMC_MBA5_TEMPDESCS }, + { + "MacBookAir7,1", "Apple SMC MacBook Air 11-inch (Early 2015)", + ASMC_SMS_FUNCS_DISABLED, + ASMC_FAN_FUNCS2, + ASMC_LIGHT_FUNCS, + ASMC_MBA7_TEMPS, ASMC_MBA7_TEMPNAMES, ASMC_MBA7_TEMPDESCS + }, + + { + "MacBookAir7,2", "Apple SMC MacBook Air 13-inch (Early 2015)", + ASMC_SMS_FUNCS_DISABLED, + ASMC_FAN_FUNCS2, + ASMC_LIGHT_FUNCS, + ASMC_MBA7_TEMPS, ASMC_MBA7_TEMPNAMES, ASMC_MBA7_TEMPDESCS + }, { NULL, NULL } }; Modified: head/sys/dev/asmc/asmcvar.h == --- head/sys/dev/asmc/asmcvar.h Tue Dec 11 12:08:18 2018(r341819) +++ head/sys/dev/asmc/asmcvar.h Tue Dec 11 16:35:59 2018(r341820) @@ -428,3 +428,27 @@ struct asmc_softc { "TCXC", "THSP", "Memory Bank A", "PCH Die", \ "Ta0P", "Heatpipe", "Mainboard Proximity 1", "Mainboard Proximity 2", \ "Palm Rest", "Memory Proximity" } + +#defineASMC_MBA7_TEMPS { "TB0T", "TB1T", "TB2T", \ + "TC0E", "TC0F", "TC0P", \ + "TC1C", "TC2C", \ + "TCGC", "TCSA", "TCXC", \ + "THSP", "TM0P", "TPCD", \ + "TW0P" "Ta0P", "Th1H", \ + "Tm0P", "Ts0P", "Ts0S", NULL } + +#defineASMC_MBA7_TEMPNAMES { "enclosure1", "enclosure2", "enclosure3", \ + "cputemp1", "cputemp2", "cpuproximity", \ + "cpucore1", "cpucore2", \ + "pecigpu", "pecisa", "pecicpu", \ + "thunderboltproximity", "memorybank", "pchdie", \ + "wirelessproximity", "airflowproximity", "heatpipe", \ + "mainboardproximity", "palmrest", "memoryproximity" } + +#defineASMC_MBA7_TEMPDESCS { "Enclosure Bottom 1", "Enclosure Bottom 2", "Enclosure Bottom 3", \ + "CPU Temp 1", "CPU Temp 2", "CPU Proximity", \ + "CPU Core 1", "CPU Core 2", \ + "PECI GPU", "PECI SA", "PECI CPU", \ + "Thunderbolt Proximity", "Memory Bank A", "PCH Die", \ + "Wireless Proximity", "Airflow Proxmity", "Heatpipe", \ + "Mainboard Proximity", "Palm Rest", "Memory Proximity" } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r341806 - head/share/vt/keymaps
Author: dab Date: Tue Dec 11 02:14:40 2018 New Revision: 341806 URL: https://svnweb.freebsd.org/changeset/base/341806 Log: Add uk.macbook.kbd keymap (vt) PR: 215185 Submitted by: James Wright Reported by: James Wright Reviewed by: emaste (earlier version) MFC after:1 week Sponsored by: Dell EMC Isilon Differential Revision:https://reviews.freebsd.org/D18395 Added: head/share/vt/keymaps/uk.macbook.kbd (contents, props changed) Modified: head/share/vt/keymaps/INDEX.keymaps head/share/vt/keymaps/Makefile Modified: head/share/vt/keymaps/INDEX.keymaps == --- head/share/vt/keymaps/INDEX.keymaps Tue Dec 11 02:03:00 2018 (r341805) +++ head/share/vt/keymaps/INDEX.keymaps Tue Dec 11 02:14:40 2018 (r341806) @@ -520,6 +520,12 @@ uk.dvorak.kbd:fr:Royaume Uni Dvorak uk.dvorak.kbd:pt:Reino Unido Dvorak uk.dvorak.kbd:es:Británico Dvorak +uk.macbook.kbd:en:United Kingdom Macbook +uk.macbook.kbd:de:Vereinigtes Königreich Macbook +uk.macbook.kbd:fr:Royaume Uni Macbook +uk.macbook.kbd:pt:Reino Unido Macbook +uk.macbook.kbd:es:Británico Macbook + us.kbd:en:United States of America us.kbd:de:US-amerikanisch us.kbd:fr:États Unis d'Amérique Modified: head/share/vt/keymaps/Makefile == --- head/share/vt/keymaps/Makefile Tue Dec 11 02:03:00 2018 (r341805) +++ head/share/vt/keymaps/Makefile Tue Dec 11 02:14:40 2018 (r341806) @@ -74,6 +74,7 @@ FILES=INDEX.keymaps \ uk.capsctrl.kbd \ uk.dvorak.kbd \ uk.kbd \ + uk.macbook.kbd \ us.acc.kbd \ us.ctrl.kbd \ us.dvorak.kbd \ Added: head/share/vt/keymaps/uk.macbook.kbd == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/vt/keymaps/uk.macbook.kbdTue Dec 11 02:14:40 2018 (r341806) @@ -0,0 +1,115 @@ +# $FreeBSD$ +# by James Wright +# alt +# scan cntrl altalt cntrl lock +# code base shift cntrl shift altshift cntrl shift state +# -- + 000 nopnopnopnopnopnopnopnop O + 001 escescescescescescdebug esc O + 002 '1''!'nopnop'1''!'nopnop O + 003 '2''@'nulnul0x20ac '@'nulnul O + 004 '3'0xa3 nopnop'#'0xa3 nopnop O + 005 '4''$'nopnop'4''$'nopnop O + 006 '5''%'nopnop'5''%'nopnop O + 007 '6''^'rs rs '6''^'rs rs O + 008 '7''&'nopnop'7''&'nopnop O + 009 '8''*'nopnop'8''*'nopnop O + 010 '9''('nopnop'9''('nopnop O + 011 '0'')'nopnop'0'')'nopnop O + 012 '-''_'us us '-''_'us us O + 013 '=''+'nopnop'=''+'nopnop O + 014 bs bs deldelbs bs deldel O + 015 ht btab nopnopht btab nopnop O + 016 'q''Q'dc1dc1'q''Q'dc1dc1 C + 017 'w''W'etbetb'w''W'etbetb C + 018 'e''E'enqenq'e''E'enqenq C + 019 'r''R'dc2dc2'r''R'dc2dc2 C + 020 't''T'dc4dc4't''T'dc4dc4 C + 021 'y''Y'em em 'y''Y'em em C + 022 'u''U'naknak'u''U'naknak C + 023 'i''I'ht ht 'i''I'ht ht C + 024 'o''O'si si 'o''O'si si C + 025 'p''P'dledle'p''P'dledle C + 026 '[''{'escesc'[''{'escesc O + 027 ']''}'gs gs ']''}'gs gs O + 028 cr cr nl nl cr cr nl nl O + 029 lctrl lctrl lctrl lctrl lctrl lctrl lctrl lctrl O + 030 'a''A'sohsoh'a''A'sohsoh C + 031 's''S'dc3dc3's''S'dc3dc3 C + 032 'd''D'eoteot'd''D'eoteot C + 033 'f''F'ackack'f''F'ackack C + 034 'g''G'belbel'g''G'belbel C + 035 'h''H'bs bs 'h''H'bs bs C + 036 'j''J'nl nl 'j''J'nl nl C + 037 'k''K'vt vt 'k''K'vt vt C + 038 'l''L'f
svn commit: r341068 - head/tests/sys/kqueue/libkqueue
Author: dab Date: Tue Nov 27 15:12:34 2018 New Revision: 341068 URL: https://svnweb.freebsd.org/changeset/base/341068 Log: Make whitespace more consistent in libkqueue tests. After r337820, which "corrected" some spaces-instead-of-tab whitespace issues in the libkqueue tests, jmg@ pointed out that these files were originally space-based, not tab-spaced, and so the correction should have been to get rid of the tabs that had been introduced in previous changes, not the spaces. This change does that. This is a whitespace only change; no functional change is intended. Reported by: jmg@ MFC after:3 days Sponsored by: Dell EMC Isilon Modified: head/tests/sys/kqueue/libkqueue/main.c head/tests/sys/kqueue/libkqueue/proc.c head/tests/sys/kqueue/libkqueue/signal.c head/tests/sys/kqueue/libkqueue/timer.c head/tests/sys/kqueue/libkqueue/user.c head/tests/sys/kqueue/libkqueue/vnode.c Modified: head/tests/sys/kqueue/libkqueue/main.c == --- head/tests/sys/kqueue/libkqueue/main.c Tue Nov 27 14:58:19 2018 (r341067) +++ head/tests/sys/kqueue/libkqueue/main.c Tue Nov 27 15:12:34 2018 (r341068) @@ -85,7 +85,7 @@ kevent_get(int kqfd) struct kevent *kev; if ((kev = calloc(1, sizeof(*kev))) == NULL) - err(1, "out of memory"); +err(1, "out of memory"); nfds = kevent(kqfd, NULL, 0, kev, 1, NULL); if (nfds < 1) @@ -103,7 +103,7 @@ kevent_get_timeout(int kqfd, int seconds) struct timespec timeout = {seconds, 0}; if ((kev = calloc(1, sizeof(*kev))) == NULL) - err(1, "out of memory"); +err(1, "out of memory"); nfds = kevent(kqfd, NULL, 0, kev, 1, &timeout); if (nfds < 0) { @@ -123,10 +123,10 @@ kevent_fflags_dump(struct kevent *kev) #define KEVFFL_DUMP(attrib) \ if (kev->fflags & attrib) \ - strncat(buf, #attrib" ", 64); +strncat(buf, #attrib" ", 64); if ((buf = calloc(1, 1024)) == NULL) - abort(); +abort(); /* Not every filter has meaningful fflags */ if (kev->filter == EVFILT_PROC) { @@ -160,7 +160,7 @@ kevent_fflags_dump(struct kevent *kev) #endif buf[strlen(buf) - 1] = ')'; } else { - snprintf(buf, 1024, "fflags = %x", kev->fflags); +snprintf(buf, 1024, "fflags = %x", kev->fflags); } return (buf); @@ -173,10 +173,10 @@ kevent_flags_dump(struct kevent *kev) #define KEVFL_DUMP(attrib) \ if (kev->flags & attrib) \ - strncat(buf, #attrib" ", 64); +strncat(buf, #attrib" ", 64); if ((buf = calloc(1, 1024)) == NULL) - abort(); +abort(); snprintf(buf, 1024, "flags = %d (", kev->flags); KEVFL_DUMP(EV_ADD); @@ -208,17 +208,17 @@ kevent_to_str(struct kevent *kev) snprintf(&buf[0], sizeof(buf), "[ident=%ju, filter=%d, %s, %s, data=%jd, udata=%p, " - "ext=[%jx %jx %jx %jx]", +"ext=[%jx %jx %jx %jx]", (uintmax_t) kev->ident, kev->filter, flags_str, fflags_str, (uintmax_t)kev->data, kev->udata, - (uintmax_t)kev->ext[0], - (uintmax_t)kev->ext[1], - (uintmax_t)kev->ext[2], - (uintmax_t)kev->ext[3]); +(uintmax_t)kev->ext[0], +(uintmax_t)kev->ext[1], +(uintmax_t)kev->ext[2], +(uintmax_t)kev->ext[3]); free(flags_str); free(fflags_str); @@ -239,10 +239,10 @@ kevent_add(int kqfd, struct kevent *kev, EV_SET(kev, ident, filter, flags, fflags, data, NULL); if (kevent(kqfd, kev, 1, NULL, 0, NULL) < 0) { - kev_str = kevent_to_str(kev); - printf("Unable to add the following kevent:\n%s\n", - kev_str); - free(kev_str); +kev_str = kevent_to_str(kev); +printf("Unable to add the following kevent:\n%s\n", +kev_str); +free(kev_str); err(1, "kevent(): %s", strerror(errno)); } } @@ -265,12 +265,12 @@ kevent_cmp(struct kevent *k1, struct kevent *k2) k1->data != k2->data || k1->udata != k2->udata || k1->ext[0] != k2->ext[0] || k1->ext[1] != k2->ext[1] || k1->ext[0] != k2->ext[2] || k1->ext[0] != k2->ext[3]) { - kev1_str = kevent_to_str(k1); - kev2_str = kevent_to_str(k2); - printf("kevent_cmp: mismatch:\n %s !=\n %s\n", - kev1_str, kev2_str); - free(kev1_str); - free(kev2_str); +kev1_str = kevent_to_str(k1); +kev2_str = kevent_to_str(k2); +printf("kevent_cmp: mismatch:\n %s !=\n %s\n", + kev1_str, kev2_str); +free(kev1_str); +free(kev2_str); abort(); } } Modified: head/tests/sys/kqueue/libkqueue/proc.c == --- head/tests/sys/kqueue/libkqueue/proc.c Tue N
svn commit: r337820 - head/tests/sys/kqueue/libkqueue
Author: dab Date: Tue Aug 14 20:26:54 2018 New Revision: 337820 URL: https://svnweb.freebsd.org/changeset/base/337820 Log: Fix a couple whitespace errors in r337814. Reported by: Renato Botelho MFC after:3 days X-MFC-with: r337814 Sponsored by: Dell EMC Modified: head/tests/sys/kqueue/libkqueue/main.c Modified: head/tests/sys/kqueue/libkqueue/main.c == --- head/tests/sys/kqueue/libkqueue/main.c Tue Aug 14 20:24:10 2018 (r337819) +++ head/tests/sys/kqueue/libkqueue/main.c Tue Aug 14 20:26:54 2018 (r337820) @@ -239,9 +239,9 @@ kevent_add(int kqfd, struct kevent *kev, EV_SET(kev, ident, filter, flags, fflags, data, NULL); if (kevent(kqfd, kev, 1, NULL, 0, NULL) < 0) { -kev_str = kevent_to_str(kev); + kev_str = kevent_to_str(kev); printf("Unable to add the following kevent:\n%s\n", -kev_str); + kev_str); free(kev_str); err(1, "kevent(): %s", strerror(errno)); } @@ -265,9 +265,9 @@ kevent_cmp(struct kevent *k1, struct kevent *k2) k1->data != k2->data || k1->udata != k2->udata || k1->ext[0] != k2->ext[0] || k1->ext[1] != k2->ext[1] || k1->ext[0] != k2->ext[2] || k1->ext[0] != k2->ext[3]) { -kev1_str = kevent_to_str(k1); + kev1_str = kevent_to_str(k1); kev2_str = kevent_to_str(k2); -printf("kevent_cmp: mismatch:\n %s !=\n %s\n", + printf("kevent_cmp: mismatch:\n %s !=\n %s\n", kev1_str, kev2_str); free(kev1_str); free(kev2_str); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r337814 - head/tests/sys/kqueue/libkqueue
Author: dab Date: Tue Aug 14 19:31:06 2018 New Revision: 337814 URL: https://svnweb.freebsd.org/changeset/base/337814 Log: Fix several (more) memory leaks. A follow-up to r337812 to catch a couple more memory leaks that should have been included in that change. Reported by: Coverity CID: 1296064, 1296067 (for real this time) MFC after:3 days X-MFC-with: r337812 Sponsored by: Dell EMC Modified: head/tests/sys/kqueue/libkqueue/main.c Modified: head/tests/sys/kqueue/libkqueue/main.c == --- head/tests/sys/kqueue/libkqueue/main.c Tue Aug 14 19:21:31 2018 (r337813) +++ head/tests/sys/kqueue/libkqueue/main.c Tue Aug 14 19:31:06 2018 (r337814) @@ -235,10 +235,14 @@ kevent_add(int kqfd, struct kevent *kev, intptr_t data, void *udata) { +char *kev_str; + EV_SET(kev, ident, filter, flags, fflags, data, NULL); if (kevent(kqfd, kev, 1, NULL, 0, NULL) < 0) { -printf("Unable to add the following kevent:\n%s\n", -kevent_to_str(kev)); +kev_str = kevent_to_str(kev); + printf("Unable to add the following kevent:\n%s\n", +kev_str); + free(kev_str); err(1, "kevent(): %s", strerror(errno)); } } @@ -246,6 +250,9 @@ kevent_add(int kqfd, struct kevent *kev, void kevent_cmp(struct kevent *k1, struct kevent *k2) { +char *kev1_str; +char *kev2_str; + /* XXX- Workaround for inconsistent implementation of kevent(2) */ @@ -258,8 +265,12 @@ kevent_cmp(struct kevent *k1, struct kevent *k2) k1->data != k2->data || k1->udata != k2->udata || k1->ext[0] != k2->ext[0] || k1->ext[1] != k2->ext[1] || k1->ext[0] != k2->ext[2] || k1->ext[0] != k2->ext[3]) { +kev1_str = kevent_to_str(k1); + kev2_str = kevent_to_str(k2); printf("kevent_cmp: mismatch:\n %s !=\n %s\n", - kevent_to_str(k1), kevent_to_str(k2)); + kev1_str, kev2_str); + free(kev1_str); + free(kev2_str); abort(); } } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r337812 - in head: sys/dev/netmap tests/sys/kqueue/libkqueue
Author: dab Date: Tue Aug 14 19:12:45 2018 New Revision: 337812 URL: https://svnweb.freebsd.org/changeset/base/337812 Log: Fix several memory leaks. The libkqueue tests have several places that leak memory by using an idiom like: puts(kevent_to_str(kevp)); Rework to save the pointer returned from kevent_to_str() and then free() it after it has been used. Reported by: asomers (pointer to Coverity), Coverity CID: 1296063, 1296064, 1296065, 1296066, 1296067, 1350287, 1394960 Sponsored by: Dell EMC Modified: head/sys/dev/netmap/netmap_freebsd.c head/tests/sys/kqueue/libkqueue/common.h head/tests/sys/kqueue/libkqueue/main.c head/tests/sys/kqueue/libkqueue/proc.c Modified: head/sys/dev/netmap/netmap_freebsd.c == --- head/sys/dev/netmap/netmap_freebsd.cTue Aug 14 18:58:16 2018 (r337811) +++ head/sys/dev/netmap/netmap_freebsd.cTue Aug 14 19:12:45 2018 (r337812) @@ -1498,7 +1498,7 @@ netmap_kqfilter(struct cdev *dev, struct knote *kn) kn->kn_fop = (ev == EVFILT_WRITE) ? &netmap_wfiltops : &netmap_rfiltops; kn->kn_hook = priv; - knlist_add(&si->si.si_note, kn, 1); + knlist_add(&si->si.si_note, kn, 0); // XXX unlock(priv) ND("register %p %s td %p priv %p kn %p np_nifp %p kn_fp/fpop %s", na, na->ifp->if_xname, curthread, priv, kn, Modified: head/tests/sys/kqueue/libkqueue/common.h == --- head/tests/sys/kqueue/libkqueue/common.hTue Aug 14 18:58:16 2018 (r337811) +++ head/tests/sys/kqueue/libkqueue/common.hTue Aug 14 19:12:45 2018 (r337812) @@ -43,7 +43,7 @@ extern char *cur_test_id; int vnode_fd; -extern const char * kevent_to_str(struct kevent *); +extern char * kevent_to_str(struct kevent *); struct kevent * kevent_get(int); struct kevent * kevent_get_timeout(int, int); Modified: head/tests/sys/kqueue/libkqueue/main.c == --- head/tests/sys/kqueue/libkqueue/main.c Tue Aug 14 18:58:16 2018 (r337811) +++ head/tests/sys/kqueue/libkqueue/main.c Tue Aug 14 19:12:45 2018 (r337812) @@ -41,13 +41,16 @@ test_no_kevents(void) int nfds; struct timespec timeo; struct kevent kev; +char *kev_str; puts("confirming that there are no events pending"); memset(&timeo, 0, sizeof(timeo)); nfds = kevent(kqfd, NULL, 0, &kev, 1, &timeo); if (nfds != 0) { puts("\nUnexpected event:"); -puts(kevent_to_str(&kev)); +kev_str = kevent_to_str(&kev); +puts(kev_str); +free(kev_str); errx(1, "%d event(s) pending, but none expected:", nfds); } } @@ -61,12 +64,15 @@ test_no_kevents_quietly(void) int nfds; struct timespec timeo; struct kevent kev; +char *kev_str; memset(&timeo, 0, sizeof(timeo)); nfds = kevent(kqfd, NULL, 0, &kev, 1, &timeo); if (nfds != 0) { puts("\nUnexpected event:"); -puts(kevent_to_str(&kev)); +kev_str = kevent_to_str(&kev); +puts(kev_str); +free(kev_str); errx(1, "%d event(s) pending, but none expected:", nfds); } } @@ -193,18 +199,20 @@ kevent_flags_dump(struct kevent *kev) } /* Copied from ../kevent.c kevent_dump() and improved */ -const char * +char * kevent_to_str(struct kevent *kev) { char buf[512]; +char *flags_str = kevent_flags_dump(kev); +char *fflags_str = kevent_fflags_dump(kev); snprintf(&buf[0], sizeof(buf), "[ident=%ju, filter=%d, %s, %s, data=%jd, udata=%p, " "ext=[%jx %jx %jx %jx]", (uintmax_t) kev->ident, kev->filter, -kevent_flags_dump(kev), -kevent_fflags_dump(kev), +flags_str, +fflags_str, (uintmax_t)kev->data, kev->udata, (uintmax_t)kev->ext[0], @@ -212,6 +220,9 @@ kevent_to_str(struct kevent *kev) (uintmax_t)kev->ext[2], (uintmax_t)kev->ext[3]); +free(flags_str); +free(fflags_str); + return (strdup(buf)); } Modified: head/tests/sys/kqueue/libkqueue/proc.c == --- head/tests/sys/kqueue/libkqueue/proc.c Tue Aug 14 18:58:16 2018 (r337811) +++ head/tests/sys/kqueue/libkqueue/proc.c Tue Aug 14 19:12:45 2018 (r337812) @@ -172,6 +172,7 @@ proc_track(int sleep_time) int gchild_note = 0; pid_t gchild_pid = -1; int done = 0; +char *kev_str; while (!done) { @@ -182,7 +183,9 @@ proc_track(int sleep_time) if (kevp == NULL) { done = 1; } else { -printf(" -- Received kevent: %
svn commit: r336905 - head/tests/sys/kqueue/libkqueue
Author: dab Date: Mon Jul 30 14:21:49 2018 New Revision: 336905 URL: https://svnweb.freebsd.org/changeset/base/336905 Log: Correct possible misleading error message in kqtest. ian@ pointed out that in the test_abstime() function time(NULL) is used twice; once in an "if" test and again in the enclosed error message. If the true branch was taken and the process got preempted before the second time(NULL) call, by the time the error message was generated enough time could have elapsed that the message could claim that the event came "too early" but print an event time that was after the expected timeout. Correct by making the time(NULL) call only once and using that returned time in both the "if" test and the error message. Reported by: ian@ MFC after:4 days X-MFC-with: r336761, r336781, r336802 Sponsored by: Dell EMC Modified: head/tests/sys/kqueue/libkqueue/timer.c Modified: head/tests/sys/kqueue/libkqueue/timer.c == --- head/tests/sys/kqueue/libkqueue/timer.c Mon Jul 30 12:58:33 2018 (r336904) +++ head/tests/sys/kqueue/libkqueue/timer.c Mon Jul 30 14:21:49 2018 (r336905) @@ -220,16 +220,17 @@ test_abstime(void) { const char *test_id = "kevent(EVFILT_TIMER, EV_ONESHOT, NOTE_ABSTIME)"; struct kevent kev; -time_t when; +time_t start; +time_t stop; const int timeout = 3; test_begin(test_id); test_no_kevents(); -when = time(NULL); +start = time(NULL); EV_SET(&kev, vnode_fd, EVFILT_TIMER, EV_ADD | EV_ONESHOT, - NOTE_ABSTIME | NOTE_SECONDS, when + timeout, NULL); + NOTE_ABSTIME | NOTE_SECONDS, start + timeout, NULL); if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0) err(1, "%s", test_id); @@ -238,8 +239,9 @@ test_abstime(void) kev.data = 1; kev.fflags = 0; kevent_cmp(&kev, kevent_get(kqfd)); -if (time(NULL) < when + timeout) - err(1, "too early %jd %jd", (intmax_t)time(NULL), (intmax_t)(when + timeout)); +stop = time(NULL); +if (stop < start + timeout) + err(1, "too early %jd %jd", (intmax_t)stop, (intmax_t)(start + timeout)); /* Check if the event occurs again */ sleep(3); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r336802 - head/tests/sys/kqueue/libkqueue
Author: dab Date: Sat Jul 28 02:53:36 2018 New Revision: 336802 URL: https://svnweb.freebsd.org/changeset/base/336802 Log: Fix compilation error on some arches after r336761 & r336781. Another cast for printing an intmax_t was needed in a kqueue test for some arches. Pointy-hat: me (twice) MFC after:1 week X-MFC-with: r336761, r336781 Sponsored by: Dell EMC Modified: head/tests/sys/kqueue/libkqueue/timer.c Modified: head/tests/sys/kqueue/libkqueue/timer.c == --- head/tests/sys/kqueue/libkqueue/timer.c Sat Jul 28 00:59:59 2018 (r336801) +++ head/tests/sys/kqueue/libkqueue/timer.c Sat Jul 28 02:53:36 2018 (r336802) @@ -239,7 +239,7 @@ test_abstime(void) kev.fflags = 0; kevent_cmp(&kev, kevent_get(kqfd)); if (time(NULL) < when + timeout) - err(1, "too early %jd %jd", time(NULL), (intmax_t)(when + timeout)); + err(1, "too early %jd %jd", (intmax_t)time(NULL), (intmax_t)(when + timeout)); /* Check if the event occurs again */ sleep(3); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r336781 - head/tests/sys/kqueue/libkqueue
Author: dab Date: Fri Jul 27 20:14:58 2018 New Revision: 336781 URL: https://svnweb.freebsd.org/changeset/base/336781 Log: Fix compilation error on some arches after r336761. A cast for printing an intmax_t was needed in a kqueue test for some arches. MFC after:1 week X-MFC-with: r336761 Sponsored by: Dell EMC Modified: head/tests/sys/kqueue/libkqueue/timer.c Modified: head/tests/sys/kqueue/libkqueue/timer.c == --- head/tests/sys/kqueue/libkqueue/timer.c Fri Jul 27 20:07:40 2018 (r336780) +++ head/tests/sys/kqueue/libkqueue/timer.c Fri Jul 27 20:14:58 2018 (r336781) @@ -239,7 +239,7 @@ test_abstime(void) kev.fflags = 0; kevent_cmp(&kev, kevent_get(kqfd)); if (time(NULL) < when + timeout) - err(1, "too early %jd %jd", time(NULL), when + timeout); + err(1, "too early %jd %jd", time(NULL), (intmax_t)(when + timeout)); /* Check if the event occurs again */ sleep(3); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r336761 - in head: lib/libc/sys sys/kern tests/sys/kqueue/libkqueue
Author: dab Date: Fri Jul 27 13:49:17 2018 New Revision: 336761 URL: https://svnweb.freebsd.org/changeset/base/336761 Log: Allow a EVFILT_TIMER kevent to be updated. If a timer is updated (re-added) with a different time period (specified in the .data field of the kevent), the new time period has no effect; the timer will not expire until the original time has elapsed. This violates the documented behavior as the kqueue(2) man page says (in part) "Re-adding an existing event will modify the parameters of the original event, and not result in a duplicate entry." This modification, adapted from a patch submitted by cem@ to PR214987, fixes the kqueue system to allow updating a timer entry. The kevent timer behavior is changed to: * When a timer is re-added, update the timer parameters to and re-start the timer using the new parameters. * Allow updating both active and already expired timers. * When the timer has already expired, dequeue any undelivered events and clear the count of expirations. All of these changes address the original PR and also bring the FreeBSD and macOS kevent timer behaviors into agreement. A few other changes were made along the way: * Update the kqueue(2) man page to reflect the new timer behavior. * Fix man page style issues in kqueue(2) diagnosed by igor. * Update the timer libkqueue system test to test for the updated timer behavior. * Fix the (test) libkqueue common.h file so that it includes config.h which defines various HAVE_* feature defines, before the #if tests for such variables in common.h. This enables the use of the actual err(3) family of functions. * Fix the usages of the err(3) functions in the tests for incorrect type of variables. Those were formerly undiagnosed due to the disablement of the err(3) functions (see previous bullet point). PR: 214987 Reported by: Brian Wellington Reviewed by: kib MFC after:1 week Relnotes: yes Sponsored by: Dell EMC Differential Revision:https://reviews.freebsd.org/D15778 Modified: head/lib/libc/sys/kqueue.2 head/sys/kern/kern_event.c head/tests/sys/kqueue/libkqueue/common.h head/tests/sys/kqueue/libkqueue/main.c head/tests/sys/kqueue/libkqueue/timer.c Modified: head/lib/libc/sys/kqueue.2 == --- head/lib/libc/sys/kqueue.2 Fri Jul 27 13:11:05 2018(r336760) +++ head/lib/libc/sys/kqueue.2 Fri Jul 27 13:49:17 2018(r336761) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 22, 2017 +.Dd July 27, 2018 .Dt KQUEUE 2 .Os .Sh NAME @@ -154,7 +154,7 @@ struct kevent { u_int fflags; /* filter flag value */ int64_t data; /* filter data value */ void *udata; /* opaque user data identifier */ - uint64_t ext[4]; /* extentions */ + uint64_t ext[4]; /* extensions */ }; .Ed .Pp @@ -355,8 +355,8 @@ Events for this filter are not registered with .Fn kevent directly but are registered via the .Va aio_sigevent -member of an asychronous I/O request when it is scheduled via an asychronous I/O -system call such as +member of an asynchronous I/O request when it is scheduled via an +asynchronous I/O system call such as .Fn aio_read . The filter returns under the same conditions as .Fn aio_error . @@ -501,7 +501,7 @@ been marked as .Dv SIG_IGN , except for the .Dv SIGCHLD -signal, which, if ignored, won't be recorded by the filter. +signal, which, if ignored, will not be recorded by the filter. Event notification happens after normal signal delivery processing. .Va data @@ -558,6 +558,13 @@ On return, .Va fflags contains the events which triggered the filter. .Pp +If an existing timer is re-added, the existing timer will be +effectively canceled (throwing away any undelivered record of previous +timer expiration) and re-started using the new parameters contained in +.Va data +and +.Va fflags . +.Pp There is a system wide limit on the number of timers which is controlled by the .Va kern.kq_calloutmax @@ -604,9 +611,9 @@ contains the users defined flags in the lower 24 bits. .Sh CANCELLATION BEHAVIOUR If .Fa nevents -is non-zero, i.e. the function is potentially blocking, the call +is non-zero, i.e., the function is potentially blocking, the call is a cancellation point. -Otherwise, i.e. if +Otherwise, i.e., if .Fa nevents is zero, the call is not cancellable. Cancellation can only occur before any changes are made to the kqueue, @@ -782,7 +789,7 @@ The value is limited to 24 hours; longer timeouts will be silently reinterpreted as 24 hours. .Pp -In versions older than +In versions older than .Fx 12.0 , .In sys/event.h failed to parse without including Modified: head/sys/kern/kern_event.c == --- h
svn commit: r336457 - head/sys/sys
Author: dab Date: Wed Jul 18 13:04:03 2018 New Revision: 336457 URL: https://svnweb.freebsd.org/changeset/base/336457 Log: Make the definition of struct kevent in event.h match what the man page for kevent(2) says. This is a trivial comment-only fix. The man page for kevent(2) gives the definition of struct kevent, including a comment on each field. The actual definition in sys/event.h omitted the comments on some fields. Add the comments in. Not only does this make the man page and include file agree, but the comments are useful in and of themselves. Reviewed by: kib (D15778: commented that this should be a separate commit) MFC after:3 days Sponsored by: Dell EMC Modified: head/sys/sys/event.h Modified: head/sys/sys/event.h == --- head/sys/sys/event.hWed Jul 18 12:29:06 2018(r336456) +++ head/sys/sys/event.hWed Jul 18 13:04:03 2018(r336457) @@ -83,11 +83,11 @@ struct kevent { __uintptr_t ident; /* identifier for this event */ short filter; /* filter for event */ - unsigned short flags; - unsigned intfflags; - __int64_t data; + unsigned short flags; /* action flags for kqueue */ + unsigned intfflags; /* filter flag value */ + __int64_t data; /* filter data value */ void*udata; /* opaque user data identifier */ - __uint64_t ext[4]; + __uint64_t ext[4]; /* extensions */ }; #if defined(_WANT_FREEBSD11_KEVENT) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r336186 - head/sys/sys
Author: dab Date: Wed Jul 11 02:09:11 2018 New Revision: 336186 URL: https://svnweb.freebsd.org/changeset/base/336186 Log: Address some (although not all) style(9) issues in event.h after r335776. Reported by: bde@ MFC after:1 day Sponsored by: Dell EMC Modified: head/sys/sys/event.h Modified: head/sys/sys/event.h == --- head/sys/sys/event.hWed Jul 11 01:37:01 2018(r336185) +++ head/sys/sys/event.hWed Jul 11 02:09:11 2018(r336186) @@ -50,16 +50,16 @@ #define EVFILT_SYSCOUNT13 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#define EV_SET(kevp_, a, b, c, d, e, f) do { \ -*(kevp_) = (struct kevent){\ - .ident = (a), \ - .filter = (b), \ - .flags = (c), \ - .fflags = (d), \ - .data = (e),\ - .udata = (f), \ - .ext = {0}, \ -}; \ +#defineEV_SET(kevp_, a, b, c, d, e, f) do {\ + *(kevp_) = (struct kevent){ \ + .ident = (a), \ + .filter = (b), \ + .flags = (c), \ + .fflags = (d), \ + .data = (e),\ + .udata = (f), \ + .ext = {0}, \ + }; \ } while(0) #else /* Pre-C99 or not STDC (e.g., C++) */ /* The definition of the local variable kevp could possibly conflict ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r335776 - head/sys/sys
Author: dab Date: Thu Jun 28 20:37:17 2018 New Revision: 335776 URL: https://svnweb.freebsd.org/changeset/base/335776 Log: Fix compilation error in r335765 under gcc 4.2.1. The anonymous object initialization introduced in r335765 was acceptable to clang, but not gcc 4.2.1. Fix it for both. Reported by: jhibbits@ Pointy Hat: myself MFC after:1 week X-MFC-with: r335765 Sponsored by: Dell EMC Modified: head/sys/sys/event.h Modified: head/sys/sys/event.h == --- head/sys/sys/event.hThu Jun 28 20:36:21 2018(r335775) +++ head/sys/sys/event.hThu Jun 28 20:37:17 2018(r335776) @@ -58,10 +58,7 @@ .fflags = (d), \ .data = (e),\ .udata = (f), \ - .ext[0] = 0,\ - .ext[1] = 0,\ - .ext[2] = 0,\ - .ext[3] = 0,\ + .ext = {0}, \ }; \ } while(0) #else /* Pre-C99 or not STDC (e.g., C++) */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r335765 - head/sys/sys
Author: dab Date: Thu Jun 28 17:01:04 2018 New Revision: 335765 URL: https://svnweb.freebsd.org/changeset/base/335765 Log: Remove potential identifier conflict in the EV_SET macro. PR43905 pointed out a problem with the EV_SET macro if the passed struct kevent pointer were specified with an expression with side effects (e.g., "kevp++"). This was fixed in rS110241, but by using a local block that defined an internal variable (named "kevp") to get the pointer value once. This worked, but could cause issues if an existing variable named "kevp" is in scope. To avoid that issue, jilles@ pointed out that "C99 compound literals and designated initializers allow doing this cleanly using a macro". This change incorporates that suggestion, essentially verbatim from jilles@ comment on PR43905, except retaining the old definition for pre-C99 or non-STDC (e.g., C++) compilers. PR: 43905 Submitted by: Jilles Tjoelker (jilles@) Reported by: Lamont Granquist Reviewed by: jmg (no comments), jilles MFC after:1 week Sponsored by: Dell EMC Differential Revision: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=43905 Modified: head/sys/sys/event.h Modified: head/sys/sys/event.h == --- head/sys/sys/event.hThu Jun 28 15:30:51 2018(r335764) +++ head/sys/sys/event.hThu Jun 28 17:01:04 2018(r335765) @@ -49,7 +49,26 @@ #define EVFILT_EMPTY (-13) /* empty send socket buf */ #define EVFILT_SYSCOUNT13 +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define EV_SET(kevp_, a, b, c, d, e, f) do { \ +*(kevp_) = (struct kevent){\ + .ident = (a), \ + .filter = (b), \ + .flags = (c), \ + .fflags = (d), \ + .data = (e),\ + .udata = (f), \ + .ext[0] = 0,\ + .ext[1] = 0,\ + .ext[2] = 0,\ + .ext[3] = 0,\ +}; \ +} while(0) +#else /* Pre-C99 or not STDC (e.g., C++) */ +/* The definition of the local variable kevp could possibly conflict + * with a user-defined value passed in parameters a-f. + */ +#define EV_SET(kevp_, a, b, c, d, e, f) do { \ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a);\ (kevp)->filter = (b); \ @@ -62,6 +81,7 @@ (kevp)->ext[2] = 0; \ (kevp)->ext[3] = 0; \ } while(0) +#endif struct kevent { __uintptr_t ident; /* identifier for this event */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r331015 - head/etc/rc.d
Author: dab Date: Thu Mar 15 18:29:56 2018 New Revision: 331015 URL: https://svnweb.freebsd.org/changeset/base/331015 Log: Modify rc.d/fsck to handle new status from fsck/fsck_ffs r328013 introduced a new error code from fsck_ffs that indicates that it could not completely fix the file system; this happens when it prints the message PLEASE RERUN FSCK. However, this status can happen when fsck is run in "preen" mode and the rc.d/fsck script does not handle that error code. Modify rc.d/fsck so that if "fsck -p" ("preen") returns the new status code (16) it will run "fsck -y", as it currently does for a status code of 8 (the "standard error exit"). Reported by: markj Reviewed by: mckusick, markj, ian, rgrimes MFC after:3 days Sponsored by: Dell EMC Differential Revision:https://reviews.freebsd.org/D14679 Modified: head/etc/rc.d/fsck Modified: head/etc/rc.d/fsck == --- head/etc/rc.d/fsck Thu Mar 15 18:12:55 2018(r331014) +++ head/etc/rc.d/fsck Thu Mar 15 18:29:56 2018(r331015) @@ -57,7 +57,7 @@ fsck_start() echo "Reboot failed; help!" stop_boot ;; - 8) + 8|16) if checkyesno fsck_y_enable; then echo "File system preen failed, trying fsck -y ${fsck_y_flags}" fsck -y ${fsck_y_flags} ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r328013 - head/sbin/fsck_ffs
With regard to: fsck_y_flags="-T ffs:-R -T ufs:-R" # Additional flags for fsck -y I don’t know how, but I completely missed the -T option for fsck when I was investigating this issue. That would be very useful, although I wanted my solution to be applicable to file systems other than ffs/ufs. With regard to the fsck_ffs behavior being a regression because formerly the FS would be mounted successfully: That was not my experience. What I observed was that the “fsck -y” would give the “please re-run” message, exit with 0 status so the boot would continue, the subsequent mount would fail because the filesystem was not clean, and *then* the boot would stop and drop to single user. -- David Bright d...@freebsd.org ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r328013 - head/sbin/fsck_ffs
On Mar 9, 2018, at 17:31, Ian Lepore wrote: > > On Fri, 2018-03-09 at 17:09 -0500, Mark Johnston wrote: >> >> etc/rc.d/fsck doesn't know how to interpret the new exit code and now >> just drops to a single-user shell when it is encountered. […] >> >> Is there any reason etc/rc.d/fsck shouldn't automatically retry (up to This is, in fact, the reason that I made the change I did. I was trying to put in a retry loop to rc.d/fsck, but found that I couldn’t get it to work because fsck and fsck_ffs were not exiting with non-zero status. The drop to single user is not really due to the specific (new) error code of 16, it is due to the fact that fsck_ffs is now exiting with a non-zero status when it hasn’t completely cleaned the file system; /any/ non-zero status would cause the current rc.d/fsck script to go to single user. Prior to my change, fsck_ffs was exiting with a zero status even though it had not completely cleaned the filesystem and told the user to run it again. > > fsck_ffs already has a -R flag to automatically retry, wouldn't that be > a better mechanism for handling this new type of retry? That’s true; however, there is currently no way to pass that flag through the filesystem-agnostic fsck wrapper called from rc.d/fsck to the filesystem-specific fsck_ffs program that it calls. One could implement a similar flag on the fsck wrapper to be passed along to the filesystem-specific checker, but I think fsck_ffs is the only one that currently implements such a flag. -- David Bright d...@freebsd.org ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330245 - in head/usr.sbin/pw: . tests
Author: dab Date: Thu Mar 1 17:47:28 2018 New Revision: 330245 URL: https://svnweb.freebsd.org/changeset/base/330245 Log: Allow the "@" and "!" characters in passwd file GECOS fields. Two PRs (152084 & 210187) request allowing the "@" and/or "!" characters in the passwd file GECOS field. The man page for pw does not mention that those characters are disallowed, Linux supports those characters in this field, and the "@" character in particular would be useful for storing email addresses in that field. PR: 152084, 210187 Submitted by: jscha...@netmeister.org, Dave Cottlehuber Reported by: jscha...@netmeister.org, Dave Cottlehuber Reviewed by: delphij (secteam), vangyzen MFC after:1 week Sponsored by: Dell EMC Differential Revision:https://reviews.freebsd.org/D14519 Modified: head/usr.sbin/pw/pw_user.c head/usr.sbin/pw/tests/pw_useradd_test.sh Modified: head/usr.sbin/pw/pw_user.c == --- head/usr.sbin/pw/pw_user.c Thu Mar 1 17:31:36 2018(r330244) +++ head/usr.sbin/pw/pw_user.c Thu Mar 1 17:47:28 2018(r330245) @@ -632,7 +632,7 @@ pw_checkname(char *name, int gecos) reject = 0; if (gecos) { /* See if the name is valid as a gecos (comment) field. */ - badchars = ":!@"; + badchars = ":"; showtype = "gecos field"; } else { /* See if the name is valid as a userid or group. */ Modified: head/usr.sbin/pw/tests/pw_useradd_test.sh == --- head/usr.sbin/pw/tests/pw_useradd_test.sh Thu Mar 1 17:31:36 2018 (r330244) +++ head/usr.sbin/pw/tests/pw_useradd_test.sh Thu Mar 1 17:47:28 2018 (r330245) @@ -27,9 +27,9 @@ atf_test_case user_add_comments user_add_comments_body() { populate_etc_skel - atf_check -s exit:0 ${PW} useradd test -c "Test User,work,123,456" - atf_check -s exit:0 -o match:"^test:.*:Test User,work,123,456:" \ - grep "^test:.*:Test User,work,123,456:" $HOME/master.passwd + atf_check -s exit:0 ${PW} useradd test -c 'Test User,work!,123,u...@example.com' + atf_check -s exit:0 -o match:'^test:.*:Test User,work!,123,u...@example.com:' \ + grep '^test:.*:Test User,work!,123,u...@example.com:' $HOME/master.passwd } # Test add user with comments and option -N ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330085 - head/sbin/dhclient
Author: dab Date: Tue Feb 27 21:59:23 2018 New Revision: 330085 URL: https://svnweb.freebsd.org/changeset/base/330085 Log: dhclient violates RFC2131 when sending early DHCPREQUEST message to re-obtain old IP When dhclient first starts, if an old IP address exists in the dhclient.leases file, dhclient(8) sends early DHCPREQUEST message(s) in an attempt to re-obtain the old IP address again. These messages contain the old IP as a requested-IP-address option in the message body (correct) but also use the old IP address as the packet's source IP (incorrect). RFC2131 sec 4.1 states: DHCP messages broadcast by a client prior to that client obtaining its IP address must have the source address field in the IP header set to 0. The use of the old IP as the packet's source address is incorrect if (a) the computer is now on a different network or (b) it is on the same network, but the old IP has been reallocated to another host. Fix dhclient to use 0.0.0.0 as the source IP in this circumstance without removing any existing functionality. Any previously-used old IP is still requested in the body of an early DHCPREQUEST message. PR: 199378 Submitted by: J.R. Oldroyd Reported by: J.R. Oldroyd Reviewed by: cem, asomers, vangyzen MFC after:1 week Sponsored by: Dell EMC Differential Revision:https://reviews.freebsd.org/D14527 Modified: head/sbin/dhclient/dhclient.c Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Tue Feb 27 21:52:22 2018 (r330084) +++ head/sbin/dhclient/dhclient.c Tue Feb 27 21:59:23 2018 (r330085) @@ -1513,7 +1513,8 @@ cancel: memcpy(&to.s_addr, ip->client->destination.iabuf, sizeof(to.s_addr)); - if (ip->client->state != S_REQUESTING) + if (ip->client->state != S_REQUESTING && + ip->client->state != S_REBOOTING) memcpy(&from, ip->client->active->address.iabuf, sizeof(from)); else ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330034 - head/usr.sbin/syslogd
Author: dab Date: Mon Feb 26 19:27:59 2018 New Revision: 330034 URL: https://svnweb.freebsd.org/changeset/base/330034 Log: Fix two memory leaks in syslogd A memory leak in syslogd for processing of forward actions was reported. This modification adapts the patch submitted with that bug to fix the leak. While testing the modification, another leak was also found and fixed. PR: 198385 Submitted by: Sreeram Reported by: Sreeram Reviewed by: hrs MFC after:1 week Sponsored by: Dell EMC Differential Revision:https://reviews.freebsd.org/D14510 Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Mon Feb 26 19:26:59 2018 (r330033) +++ head/usr.sbin/syslogd/syslogd.c Mon Feb 26 19:27:59 2018 (r330034) @@ -180,7 +180,7 @@ static STAILQ_HEAD(, socklist) shead = STAILQ_HEAD_INI * This structure represents the files that will have log * copies printed. * We require f_file to be valid if f_type is F_FILE, F_CONSOLE, F_TTY - * or if f_type if F_PIPE and f_pid > 0. + * or if f_type is F_PIPE and f_pid > 0. */ struct filed { @@ -382,10 +382,16 @@ close_filed(struct filed *f) return; switch (f->f_type) { - case F_FILE: + case F_FORW: +if (f->f_un.f_forw.f_addr) { +freeaddrinfo(f->f_un.f_forw.f_addr); +f->f_un.f_forw.f_addr = NULL; +} +/*FALLTHROUGH*/ + +case F_FILE: case F_TTY: case F_CONSOLE: - case F_FORW: f->f_type = F_UNUSED; break; case F_PIPE: @@ -1859,6 +1865,7 @@ readconfigfile(FILE *cf, int allow_includes) f = cfline(cline, prog, host); if (f != NULL) addfile(f); +free(f); } } @@ -1956,9 +1963,11 @@ init(int signo) f = cfline("*.ERR\t/dev/console", "*", "*"); if (f != NULL) addfile(f); +free(f); f = cfline("*.PANIC\t*", "*", "*"); if (f != NULL) addfile(f); +free(f); Initialized = 1; return; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r330027 - head/sys/libkern
Author: dab Date: Mon Feb 26 18:23:36 2018 New Revision: 330027 URL: https://svnweb.freebsd.org/changeset/base/330027 Log: iconv uses strlen directly on user supplied memory `iconv_sysctl_add` from `sys/libkern/iconv.c` incorrectly limits the size of user strings, such that several out of bounds reads could have been possible. static int iconv_sysctl_add(SYSCTL_HANDLER_ARGS) { struct iconv_converter_class *dcp; struct iconv_cspair *csp; struct iconv_add_in din; struct iconv_add_out dout; int error; error = SYSCTL_IN(req, &din, sizeof(din)); if (error) return error; if (din.ia_version != ICONV_ADD_VER) return EINVAL; if (din.ia_datalen > ICONV_CSMAXDATALEN) return EINVAL; if (strlen(din.ia_from) >= ICONV_CSNMAXLEN) return EINVAL; if (strlen(din.ia_to) >= ICONV_CSNMAXLEN) return EINVAL; if (strlen(din.ia_converter) >= ICONV_CNVNMAXLEN) return EINVAL; ... Since the `din` struct is directly copied from userland, there is no guarantee that the strings supplied will be NULL terminated. The `strlen` calls could continue reading past the designated buffer sizes. Declaration of `struct iconv_add_in` is found in `sys/sys/iconv.h`: struct iconv_add_in { int ia_version; charia_converter[ICONV_CNVNMAXLEN]; charia_to[ICONV_CSNMAXLEN]; charia_from[ICONV_CSNMAXLEN]; int ia_datalen; const void *ia_data; }; Our strings are followed by the `ia_datalen` member, which is checked before the `strlen` calls: if (din.ia_datalen > ICONV_CSMAXDATALEN) Since `ICONV_CSMAXDATALEN` has value `0x41000` (and is `unsigned`), this ensures that `din.ia_datalen` contains at least 1 byte of 0, so it is not possible to trigger a read out of bounds of the `struct` however, this code is fragile and could introduce subtle bugs in the future if the `struct` is ever modified. PR: 207302 Submitted by: CTurt Reported by: CTurt Reviewed by: jhb, vangyzen MFC after:1 week Sponsored by: Dell EMC Differential Revision:https://reviews.freebsd.org/D14521 Modified: head/sys/libkern/iconv.c Modified: head/sys/libkern/iconv.c == --- head/sys/libkern/iconv.cMon Feb 26 18:14:37 2018(r330026) +++ head/sys/libkern/iconv.cMon Feb 26 18:23:36 2018(r330027) @@ -413,11 +413,11 @@ iconv_sysctl_add(SYSCTL_HANDLER_ARGS) return EINVAL; if (din.ia_datalen > ICONV_CSMAXDATALEN) return EINVAL; - if (strlen(din.ia_from) >= ICONV_CSNMAXLEN) + if (strnlen(din.ia_from, sizeof(din.ia_from)) >= ICONV_CSNMAXLEN) return EINVAL; - if (strlen(din.ia_to) >= ICONV_CSNMAXLEN) + if (strnlen(din.ia_to, sizeof(din.ia_to)) >= ICONV_CSNMAXLEN) return EINVAL; - if (strlen(din.ia_converter) >= ICONV_CNVNMAXLEN) + if (strnlen(din.ia_converter, sizeof(din.ia_converter)) >= ICONV_CNVNMAXLEN) return EINVAL; if (iconv_lookupconv(din.ia_converter, &dcp) != 0) return EINVAL; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328013 - head/sbin/fsck_ffs
Author: dab Date: Mon Jan 15 19:25:11 2018 New Revision: 328013 URL: https://svnweb.freebsd.org/changeset/base/328013 Log: Exit fsck_ffs with non-zero status when file system is not repaired. When the fsck_ffs program cannot fully repair a file system, it will output the message PLEASE RERUN FSCK. However, it does not exit with a non-zero status in this case (contradicting the man page claim that it "exits with 0 on success, and >0 if an error occurs." The fsck rc-script (when running "fsck -y") tests the status from fsck (which passes along the exit status from fsck_ffs) and issues a "stop_boot" if the status fails. However, this is not effective since fsck_ffs can return zero even on (some) errors. Effectively, it is left to a later step in the boot process when the file systems are mounted to detect the still-unclean file system and stop the boot. This change modifies fsck_ffs so that when it cannot fully repair the file system and issues the PLEASE RERUN FSCK message it also exits with a non-zero status. While here, the fsck_ffs man page has also been updated to document the failing exit status codes used by fsck_ffs. Previously, only exit status 7 was documented. Some of these exit statuses are tested for in the fsck rc-script, so they are clearly depended upon and deserve documentation. Reviewed by: mckusick, vangyzen, jilles (manpages) MFC after:1 week Sponsored by: Dell EMC Differential Revision:https://reviews.freebsd.org/D13862 Modified: head/sbin/fsck_ffs/fsck.h head/sbin/fsck_ffs/fsck_ffs.8 head/sbin/fsck_ffs/main.c Modified: head/sbin/fsck_ffs/fsck.h == --- head/sbin/fsck_ffs/fsck.h Mon Jan 15 19:02:15 2018(r328012) +++ head/sbin/fsck_ffs/fsck.h Mon Jan 15 19:25:11 2018(r328013) @@ -364,6 +364,7 @@ extern struct ufs2_dinode ufs2_zino; #defineFOUND 0x10 #defineEEXIT 8 /* Standard error exit. */ +#defineERERUN 16 /* fsck needs to be re-run. */ #defineERESTART -1 int flushentry(void); Modified: head/sbin/fsck_ffs/fsck_ffs.8 == --- head/sbin/fsck_ffs/fsck_ffs.8 Mon Jan 15 19:02:15 2018 (r328012) +++ head/sbin/fsck_ffs/fsck_ffs.8 Mon Jan 15 19:25:11 2018 (r328013) @@ -29,7 +29,7 @@ .\"@(#)fsck.8 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd February 14, 2017 +.Dd January 13, 2018 .Dt FSCK_FFS 8 .Os .Sh NAME @@ -376,11 +376,43 @@ contains default list of file systems to check. .Sh EXIT STATUS .Ex -std .Pp -If the option +Specific non-zero exit status values used are: +.Bl -tag -width indent +.It 1 +Usage error (missing or invalid command arguments). +.It 2 +The +.Fl p +option was used and a +.Dv SIGQUIT +was received, indicating that the system should be returned to single +user mode after the file system check. +.It 3 +The file system superblock cannot be read. +This could indicate that the file system device does not exist or is not yet +ready. +.It 4 +A mounted file system was modified; the system should be rebooted. +.It 5 +The +.Fl B +option was used and soft updates are not enabled on the file system. +.It 6 +The +.Fl B +option was used and the kernel lacks needed support. +.It 7 +The .Fl F -is used, +option was used and the file system is clean. +.It 8 +General error exit. +.It 16 +The file system could not be completely repaired. +The file system may be able to be repaired by running .Nm -exits 7 if the file system is clean. +on the file system again. +.El .Sh DIAGNOSTICS The diagnostics produced by .Nm Modified: head/sbin/fsck_ffs/main.c == --- head/sbin/fsck_ffs/main.c Mon Jan 15 19:02:15 2018(r328012) +++ head/sbin/fsck_ffs/main.c Mon Jan 15 19:25:11 2018(r328013) @@ -82,6 +82,7 @@ main(int argc, char *argv[]) int ch; struct rlimit rlimit; struct itimerval itimerval; + int fsret; int ret = 0; sync(); @@ -196,8 +197,9 @@ main(int argc, char *argv[]) (void)setrlimit(RLIMIT_DATA, &rlimit); } while (argc > 0) { - if (checkfilesys(*argv) == ERESTART) + if ((fsret = checkfilesys(*argv)) == ERESTART) continue; + ret |= fsret; argc--; argv++; } @@ -585,7 +587,7 @@ checkfilesys(char *filesys) sync(); return (4); } - return (0); + return (rerun ? ERERUN : 0); } static int ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r323252 - head/libexec/getty
Author: dab Date: Thu Sep 7 00:20:17 2017 New Revision: 323252 URL: https://svnweb.freebsd.org/changeset/base/323252 Log: Add a new getty/gettytab capability to generate an initial message dynamically. This modification adds a new gettytab(5) option (iM) to specify a program to run that will generate the initial (banner) message that is displayed before the login prompt. Such a capability is useful when dynamic information is needed in the banner message that cannot be supplied by the set of % substitution sequences available in the "im" option. Reviewed by: vangyzen, wblock, manpages Approved by: vangyzen (mentor) MFC after:1 week Relnotes: yes Sponsored by: Dell EMC Differential Revision:https://reviews.freebsd.org/D12108 Modified: head/libexec/getty/gettytab.5 head/libexec/getty/gettytab.h head/libexec/getty/init.c head/libexec/getty/main.c Modified: head/libexec/getty/gettytab.5 == --- head/libexec/getty/gettytab.5 Wed Sep 6 23:43:20 2017 (r323251) +++ head/libexec/getty/gettytab.5 Thu Sep 7 00:20:17 2017 (r323252) @@ -28,7 +28,7 @@ .\" from: @(#)gettytab.5 8.4 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" " -.Dd February 2, 2017 +.Dd August 23, 2017 .Dt GETTYTAB 5 .Os .Sh NAME @@ -130,6 +130,8 @@ hangup line on last close .It "igboolfalse ignore garbage characters in login name" .It "imstr" Ta Dv NULL .Ta No "initial (banner) message" +.It "iMstr" Ta Dv NULL +.Ta No "execute named file to generate initial (banner) message" .It "instr" Ta So Li ^C .Sc Ta No "interrupt character" .It "isnum unused input speed" @@ -146,7 +148,7 @@ hangup line on last close .It "mbboolfalse do flow control based on carrier" .It "ncboolfalse terminal does not supply carrier (set clocal)" .It "nlboolfalse terminal has (or might have) a newline character" -.It "npboolfalse terminal uses no parity (i.e. 8-bit characters)" +.It "npboolfalse terminal uses no parity (i.e., 8-bit characters)" .It "nxstr default next table (for auto speed selection)" .It "o0num unused tty output flags to write messages" .It "o1num unused tty output flags to read login name" Modified: head/libexec/getty/gettytab.h == --- head/libexec/getty/gettytab.h Wed Sep 6 23:43:20 2017 (r323251) +++ head/libexec/getty/gettytab.h Thu Sep 7 00:20:17 2017 (r323252) @@ -88,6 +88,7 @@ struct gettyflags { #define AC gettystrs[28].value #define AL gettystrs[29].value #define DF gettystrs[30].value +#define IMPgettystrs[31].value /* * Numeric definitions. Modified: head/libexec/getty/init.c == --- head/libexec/getty/init.c Wed Sep 6 23:43:20 2017(r323251) +++ head/libexec/getty/init.c Thu Sep 7 00:20:17 2017(r323252) @@ -82,6 +82,7 @@ structgettystrs gettystrs[] = { { "ac" }, /* modem answer-chat */ { "al" }, /* user to auto-login */ { "df", datefmt}, /* format for strftime() */ + { "iM" }, /* initial message program */ { 0 } }; Modified: head/libexec/getty/main.c == --- head/libexec/getty/main.c Wed Sep 6 23:43:20 2017(r323251) +++ head/libexec/getty/main.c Thu Sep 7 00:20:17 2017(r323252) @@ -324,6 +324,8 @@ main(int argc, char *argv[]) } first_time = 0; + if (IMP && *IMP && !(PL && PP)) + system(IMP); if (IM && *IM && !(PL && PP)) putf(IM); if (setjmp(timeout)) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r318960 - in head/usr.sbin/newsyslog: . tests
Author: dab Date: Fri May 26 16:36:30 2017 New Revision: 318960 URL: https://svnweb.freebsd.org/changeset/base/318960 Log: Add newsyslog capability to write RFC5424 compliant rotation message. This modification adds the capability to newsyslog to write the rotation message in a format that is compliant with RFC5424. This capability is enabled on a per-log file basis through a new value ("T") in the flags field in newsyslog.conf. This is useful on systems that use the RFC5424 format for log files so that the rotation message format matches that of the other log messages. There has been recent mention of adding an RFC5424 compliant mode to syslogd and at least one alternative system log daemon (rsyslogd) that already has the capability to use that format. Reviewed by: vangyzen, ngie Approved by: vangyzen (mentor) MFC after:2 months Relnotes: yes Sponsored by: Dell EMC Differential Revision:https://reviews.freebsd.org/D10253 Modified: head/usr.sbin/newsyslog/extern.h head/usr.sbin/newsyslog/newsyslog.8 head/usr.sbin/newsyslog/newsyslog.c head/usr.sbin/newsyslog/newsyslog.conf.5 head/usr.sbin/newsyslog/ptimes.c head/usr.sbin/newsyslog/tests/legacy_test.sh Modified: head/usr.sbin/newsyslog/extern.h == --- head/usr.sbin/newsyslog/extern.hFri May 26 16:29:55 2017 (r318959) +++ head/usr.sbin/newsyslog/extern.hFri May 26 16:36:30 2017 (r318960) @@ -60,6 +60,8 @@ intptime_free(struct ptime_data *_pti int ptime_relparse(struct ptime_data *_ptime, int _parseopts, time_t _basetime, const char *_str); const char *ptimeget_ctime(const struct ptime_data *_ptime); +char *ptimeget_ctime_rfc5424(const struct ptime_data *_ptime, + char *timebuf, size_t bufsize); double ptimeget_diff(const struct ptime_data *_minuend, const struct ptime_data *_subtrahend); time_t ptimeget_secs(const struct ptime_data *_ptime); Modified: head/usr.sbin/newsyslog/newsyslog.8 == --- head/usr.sbin/newsyslog/newsyslog.8 Fri May 26 16:29:55 2017 (r318959) +++ head/usr.sbin/newsyslog/newsyslog.8 Fri May 26 16:36:30 2017 (r318960) @@ -17,7 +17,7 @@ .\" the suitability of this software for any purpose. It is .\" provided "as is" without express or implied warranty. .\" -.Dd April 15, 2017 +.Dd May 19, 2017 .Dt NEWSYSLOG 8 .Os .Sh NAME @@ -125,7 +125,8 @@ reasons for either trimming that log or Cause .Nm not to trim the logs, but to print out what it would do if this option -were not specified. This option implies the +were not specified. +This option implies the .Fl r option. .It Fl r Modified: head/usr.sbin/newsyslog/newsyslog.c == --- head/usr.sbin/newsyslog/newsyslog.c Fri May 26 16:29:55 2017 (r318959) +++ head/usr.sbin/newsyslog/newsyslog.c Fri May 26 16:36:30 2017 (r318960) @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -132,6 +133,8 @@ __FBSDID("$FreeBSD$"); #defineCE_NODUMP 0x0200 /* Set 'nodump' on newly created log file. */ #defineCE_PID2CMD 0x0400 /* Replace PID file with a shell command.*/ +#defineCE_RFC5424 0x0800 /* Use RFC5424 format rotation message */ + #defineMIN_PID 5 /* Don't touch pids lower than this */ #defineMAX_PID 9 /* was lower, see /usr/include/sys/proc.h */ @@ -247,6 +250,15 @@ static struct ptime_data *timenow; /* Th #defineDAYTIME_LEN 16 static char daytime[DAYTIME_LEN];/* The current time in human readable form, * used for rotation-tracking messages. */ + +/* Another buffer to hold the current time in RFC5424 format. Fractional + * seconds are allowed by the RFC, but are not included in the + * rotation-tracking messages written by newsyslog and so are not accounted for + * in the length below. + */ +#defineDAYTIME_RFC5424_LEN sizeof("-MM-DDTHH:MM:SS+00:00") +static char daytime_rfc5424[DAYTIME_RFC5424_LEN]; + static char hostname[MAXHOSTNAMELEN]; /* hostname */ static const char *path_syslogpid = _PATH_SYSLOGPID; @@ -630,6 +642,7 @@ parse_args(int argc, char **argv) timenow = ptime_init(NULL); ptimeset_time(timenow, time(NULL)); strlcpy(daytime, ptimeget_ctime(timenow) + 4, DAYTIME_LEN); + ptimeget_ctime_rfc5424(timenow, daytime_rfc5424, DAYTIME_RFC5424_LEN); /* Let's get our hostname */ (void)gethostname(hostname, sizeof(hostname)); @@ -1296,11 +1309,14 @@ no_trimat: case 'r': working->flags |= CE_PID2CMD;
svn commit: r309019 - head/share/misc
Author: dab Date: Tue Nov 22 18:32:20 2016 New Revision: 309019 URL: https://svnweb.freebsd.org/changeset/base/309019 Log: Add myself (dab) as a src committer and vangyzen as my mentor. Approved by: vangyzen (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot == --- head/share/misc/committers-src.dot Tue Nov 22 18:31:43 2016 (r309018) +++ head/share/misc/committers-src.dot Tue Nov 22 18:32:20 2016 (r309019) @@ -15,7 +15,7 @@ digraph src { # foo [label="Foo Bar\n...@freebsd.org\n/??/??"] # # /??/?? is the date when the commit bit was obtained, usually the one you -# can find looking at svn logs for the svnadmin/access file. +# can find looking at svn logs for the svnadmin/conf/access file. # Use /MM/DD format. # # For returned commit bits, the node definition will follow this example: @@ -140,6 +140,7 @@ cognet [label="Olivier Houchard\ncognet@ cokane [label="Coleman Kane\ncok...@freebsd.org\n2000/06/19"] cperciva [label="Colin Percival\ncperc...@freebsd.org\n2004/01/20"] csjp [label="Christian S.J. Peron\nc...@freebsd.org\n2004/05/04"] +dab [label="David Bright\n...@freebsd.org\n2016/10/24"] das [label="David Schultz\n...@freebsd.org\n2003/02/21"] davide [label="Davide Italiano\ndav...@freebsd.org\n2012/01/27"] dchagin [label="Dmitry Chagin\ndcha...@freebsd.org\n2009/02/28"] @@ -783,6 +784,7 @@ ume -> suz ume -> tshiozak vangyzen -> badger +vangyzen -> dab wes -> scf ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"