svn commit: r366262 - stable/12/sbin/nvmecontrol

2020-09-29 Thread David Bright
Author: dab
Date: Tue Sep 29 17:09:43 2020
New Revision: 366262
URL: https://svnweb.freebsd.org/changeset/base/366262

Log:
  MFC r365967:
  
  Whitespace fix after r365948
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/sbin/nvmecontrol/firmware.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/nvmecontrol/firmware.c
==
--- stable/12/sbin/nvmecontrol/firmware.c   Tue Sep 29 16:38:56 2020
(r366261)
+++ stable/12/sbin/nvmecontrol/firmware.c   Tue Sep 29 17:09:43 2020
(r366262)
@@ -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, _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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366261 - stable/12/sbin/nvmecontrol

2020-09-29 Thread David Bright
Author: dab
Date: Tue Sep 29 16:38:56 2020
New Revision: 366261
URL: https://svnweb.freebsd.org/changeset/base/366261

Log:
  MFC r365948:
  
  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
  identify-controller response to set the max transfer size.
- 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.
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/sbin/nvmecontrol/firmware.c
  stable/12/sbin/nvmecontrol/identify_ext.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/nvmecontrol/firmware.c
==
--- stable/12/sbin/nvmecontrol/firmware.c   Tue Sep 29 16:29:50 2020
(r366260)
+++ stable/12/sbin/nvmecontrol/firmware.c   Tue Sep 29 16:38:56 2020
(r366261)
@@ -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, _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(, 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: stable/12/sbin/nvmecontrol/identify_ext.c
==
--- stable/12/sbin/nvmecontrol/identify_ext.c   Tue Sep 29 16:29:50 2020
(r366260)
+++ stable/12/sbin/nvmecontrol/identify_ext.c   Tue Sep 29 16:38:56 2020
(r366261)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r366255 - stable/12/sys/dev/nvme

2020-09-29 Thread David Bright
Author: dab
Date: Tue Sep 29 14:59:41 2020
New Revision: 366255
URL: https://svnweb.freebsd.org/changeset/base/366255

Log:
  MFC r365946:
  
  Add an ioctl to get an NVMe device's maximum transfer size
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/sys/dev/nvme/nvme.h
  stable/12/sys/dev/nvme/nvme_ctrlr.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/nvme/nvme.h
==
--- stable/12/sys/dev/nvme/nvme.h   Tue Sep 29 14:02:42 2020
(r366254)
+++ stable/12/sys/dev/nvme/nvme.h   Tue Sep 29 14:59:41 2020
(r366255)
@@ -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: stable/12/sys/dev/nvme/nvme_ctrlr.c
==
--- stable/12/sys/dev/nvme/nvme_ctrlr.c Tue Sep 29 14:02:42 2020
(r366254)
+++ stable/12/sys/dev/nvme/nvme_ctrlr.c Tue Sep 29 14:59:41 2020
(r366255)
@@ -1309,6 +1309,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365967 - head/sbin/nvmecontrol

2020-09-21 Thread David Bright
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, _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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365948 - head/sbin/nvmecontrol

2020-09-21 Thread David Bright
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, _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(, 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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r365946 - head/sys/dev/nvme

2020-09-21 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r363231 - stable/12/lib/libutil

2020-07-15 Thread David Bright
Author: dab
Date: Wed Jul 15 17:34:08 2020
New Revision: 363231
URL: https://svnweb.freebsd.org/changeset/base/363231

Log:
  MFC r362634:
  
  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.
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/lib/libutil/pidfile.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libutil/pidfile.c
==
--- stable/12/lib/libutil/pidfile.c Wed Jul 15 17:24:39 2020
(r363230)
+++ stable/12/lib/libutil/pidfile.c Wed Jul 15 17:34:08 2020
(r363231)
@@ -196,7 +196,7 @@ pidfile_open(const char *pathp, mode_t mode, pid_t *pi
}
 
if (cap_rights_limit(fd, cap_rights_init(, CAP_PWRITE,
-   CAP_FSTAT, CAP_FTRUNCATE)) < 0 &&
+   CAP_FSTAT, CAP_FTRUNCATE, CAP_EVENT)) < 0 &&
errno != ENOSYS) {
goto failed;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r362634 - head/lib/libutil

2020-06-25 Thread David Bright
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(, CAP_PWRITE,
-   CAP_FSTAT, CAP_FTRUNCATE)) < 0 &&
+   CAP_FSTAT, CAP_FTRUNCATE, CAP_EVENT)) < 0 &&
errno != ENOSYS) {
goto failed;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r361030 - stable/12/sys/dev/nvme

2020-05-14 Thread David Bright
Author: dab
Date: Thu May 14 12:52:08 2020
New Revision: 361030
URL: https://svnweb.freebsd.org/changeset/base/361030

Log:
  MFC r360568:
  
  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
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/sys/dev/nvme/nvme.c
  stable/12/sys/dev/nvme/nvme_ctrlr.c
  stable/12/sys/dev/nvme/nvme_ns.c
  stable/12/sys/dev/nvme/nvme_pci.c
  stable/12/sys/dev/nvme/nvme_qpair.c
  stable/12/sys/dev/nvme/nvme_sysctl.c
  stable/12/sys/dev/nvme/nvme_test.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/nvme/nvme.c
==
--- stable/12/sys/dev/nvme/nvme.c   Thu May 14 09:55:41 2020
(r361029)
+++ stable/12/sys/dev/nvme/nvme.c   Thu May 14 12:52:08 2020
(r361030)
@@ -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(>config_hook);
+   if (config_intrhook_establish(>config_hook) != 0)
+   return (ENOMEM);
 
return (0);
 }

Modified: stable/12/sys/dev/nvme/nvme_ctrlr.c
==
--- stable/12/sys/dev/nvme/nvme_ctrlr.c Thu May 14 09:55:41 2020
(r361029)
+++ stable/12/sys/dev/nvme/nvme_ctrlr.c Thu May 14 12:52:08 2020
(r361030)
@@ -1299,6 +1299,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;
}
@@ -1583,12 +1584,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(>is_resetting, 1, 0);
+   (void)atomic_cmpset_32(>is_resetting, 1, 0);
 
return (0);
 fail:
@@ -1599,6 +1600,6 @@ fail:
 */
nvme_printf(ctrlr, "Failed to reset on resume, failing.\n");
nvme_ctrlr_fail(ctrlr);
-   atomic_cmpset_32(>is_resetting, 1, 0);
+   (void)atomic_cmpset_32(>is_resetting, 1, 0);
return (0);
 }

Modified: stable/12/sys/dev/nvme/nvme_ns.c
==
--- stable/12/sys/dev/nvme/nvme_ns.cThu May 14 09:55:41 2020
(r361029)
+++ stable/12/sys/dev/nvme/nvme_ns.cThu May 14 12:52:08 2020
(r361030)
@@ -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: stable/12/sys/dev/nvme/nvme_pci.c
==
--- stable/12/sys/dev/nvme/nvme_pci.c   Thu May 14 09:55:41 2020
(r361029)
+++ stable/12/sys/dev/nvme/nvme_pci.c   Thu May 14 12:52:08 2020
(r361030)
@@ -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, >tag);
-
-   if (ctrlr->tag == NULL) {
+   ctrlr, >tag) != 0) {
nvme_printf(ctrlr, "unable to setup intx handler\n");
return (ENOMEM);
}

Modified: stable/12/sys/dev/nvme/nvme_qpair.c
==
--- stable/12/sys/dev/nvme/nvme_qpair.c Thu May 14 09:55:41 2020
(r361029)
+++ stable/12/sys/dev/nvme/nvme_qpair.c Thu May 14 12:52:08 2020
(r361030)
@@ -671,9 +671,12 @@ nvme_qpair_construct(struct nvme_qpair *qpair,
 
qpair->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ,
>rid, RF_ACTIVE);
-   bus_setup_intr(ctrlr->dev, qpair->res,
+   if (bus_setup_intr(ctrlr->dev, qpair->res,
INTR_TYPE_MISC | INTR_MPSAFE, NULL,
- 

svn commit: r360568 - head/sys/dev/nvme

2020-05-02 Thread David Bright
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(>config_hook);
+   if (config_intrhook_establish(>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(>is_resetting, 1, 0);
+   (void)atomic_cmpset_32(>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(>is_resetting, 1, 0);
+   (void)atomic_cmpset_32(>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, >tag);
-
-   if (ctrlr->tag == NULL) {
+   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,
>rid, RF_ACTIVE);
-   bus_setup_intr(ctrlr->dev, qpair->res,
+   if (bus_setup_intr(ctrlr->dev, qpair->res,
INTR_TYPE_MISC | INTR_MPSAFE, NULL,
-   nvme_qpair_msix_handler, 

svn commit: r359838 - in stable/12: etc/mtree sbin/nvmecontrol sbin/nvmecontrol/tests

2020-04-12 Thread David Bright
Author: dab
Date: Sun Apr 12 22:11:29 2020
New Revision: 359838
URL: https://svnweb.freebsd.org/changeset/base/359838

Log:
  MFC r359717:
  
  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.
  
  Sponsored by: Dell EMC Isilon

Added:
  stable/12/sbin/nvmecontrol/tests/
 - copied from r359717, head/sbin/nvmecontrol/tests/
Modified:
  stable/12/etc/mtree/BSD.tests.dist
  stable/12/sbin/nvmecontrol/Makefile
  stable/12/sbin/nvmecontrol/devlist.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/etc/mtree/BSD.tests.dist
==
--- stable/12/etc/mtree/BSD.tests.dist  Sun Apr 12 21:23:51 2020
(r359837)
+++ stable/12/etc/mtree/BSD.tests.dist  Sun Apr 12 22:11:29 2020
(r359838)
@@ -432,6 +432,8 @@
 ..
 mdconfig
 ..
+nvmecontrol
+..
 pfctl
 files
 ..

Modified: stable/12/sbin/nvmecontrol/Makefile
==
--- stable/12/sbin/nvmecontrol/Makefile Sun Apr 12 21:23:51 2020
(r359837)
+++ stable/12/sbin/nvmecontrol/Makefile Sun Apr 12 22:11:29 2020
(r359838)
@@ -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: stable/12/sbin/nvmecontrol/devlist.c
==
--- stable/12/sbin/nvmecontrol/devlist.cSun Apr 12 21:23:51 2020
(r359837)
+++ stable/12/sbin/nvmecontrol/devlist.cSun Apr 12 22:11:29 2020
(r359838)
@@ -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);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359751 - in stable/12/sbin/nvmecontrol: . modules/wdc

2020-04-09 Thread David Bright
Author: dab
Date: Thu Apr  9 18:17:07 2020
New Revision: 359751
URL: https://svnweb.freebsd.org/changeset/base/359751

Log:
  MFC r359562:
  
  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.
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/sbin/nvmecontrol/firmware.c
  stable/12/sbin/nvmecontrol/identify.c
  stable/12/sbin/nvmecontrol/logpage.c
  stable/12/sbin/nvmecontrol/modules/wdc/wdc.c
  stable/12/sbin/nvmecontrol/nsid.c
  stable/12/sbin/nvmecontrol/passthru.c
  stable/12/sbin/nvmecontrol/power.c
  stable/12/sbin/nvmecontrol/reset.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/nvmecontrol/firmware.c
==
--- stable/12/sbin/nvmecontrol/firmware.c   Thu Apr  9 16:24:57 2020
(r359750)
+++ stable/12/sbin/nvmecontrol/firmware.c   Thu Apr  9 18:17:07 2020
(r359751)
@@ -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: stable/12/sbin/nvmecontrol/identify.c
==
--- stable/12/sbin/nvmecontrol/identify.c   Thu Apr  9 16:24:57 2020
(r359750)
+++ stable/12/sbin/nvmecontrol/identify.c   Thu Apr  9 18:17:07 2020
(r359751)
@@ -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, , 1, 1);
get_nsid(fd, , );

Modified: stable/12/sbin/nvmecontrol/logpage.c
==
--- stable/12/sbin/nvmecontrol/logpage.cThu Apr  9 16:24:57 2020
(r359750)
+++ stable/12/sbin/nvmecontrol/logpage.cThu Apr  9 18:17:07 2020
(r359751)
@@ -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: stable/12/sbin/nvmecontrol/modules/wdc/wdc.c
==
--- stable/12/sbin/nvmecontrol/modules/wdc/wdc.cThu Apr  9 16:24:57 
2020(r359750)
+++ stable/12/sbin/nvmecontrol/modules/wdc/wdc.cThu Apr  9 18:17:07 
2020(r359751)
@@ -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: stable/12/sbin/nvmecontrol/nsid.c
==
--- stable/12/sbin/nvmecontrol/nsid.c   Thu Apr  9 16:24:57 2020
(r359750)
+++ stable/12/sbin/nvmecontrol/nsid.c   Thu Apr  9 18:17:07 2020
(r359751)
@@ -70,7 +70,8 @@ gnsid(const struct cmd *f, int argc, 

svn commit: r359717 - in head: etc/mtree sbin/nvmecontrol sbin/nvmecontrol/tests

2020-04-07 Thread David Bright
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 

svn commit: r359562 - in head/sbin/nvmecontrol: . modules/wdc

2020-04-02 Thread David Bright
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, , 1, 1);
get_nsid(fd, , );

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: r359237 - stable/11/sys/cam/nvme

2020-03-23 Thread David Bright
Author: dab
Date: Mon Mar 23 12:39:18 2020
New Revision: 359237
URL: https://svnweb.freebsd.org/changeset/base/359237

Log:
  MFC r359129:
  
  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.
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/11/sys/cam/nvme/nvme_da.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/nvme/nvme_da.c
==
--- stable/11/sys/cam/nvme/nvme_da.cMon Mar 23 12:38:44 2020
(r359236)
+++ stable/11/sys/cam/nvme/nvme_da.cMon Mar 23 12:39:18 2020
(r359237)
@@ -774,9 +774,9 @@ ndaregister(struct cam_periph *periph, void *arg)
 *  the serial or model number strings.
 */
nvme_strvis(disk->d_descr, cd->mn,
-   sizeof(disk->d_descr), NVME_MODEL_NUMBER_LENGTH);
+   NVME_MODEL_NUMBER_LENGTH, sizeof(disk->d_descr));
nvme_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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359236 - stable/12/sys/cam/nvme

2020-03-23 Thread David Bright
Author: dab
Date: Mon Mar 23 12:38:44 2020
New Revision: 359236
URL: https://svnweb.freebsd.org/changeset/base/359236

Log:
  MFC r359129:
  
  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.
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/sys/cam/nvme/nvme_da.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/nvme/nvme_da.c
==
--- stable/12/sys/cam/nvme/nvme_da.cMon Mar 23 12:21:32 2020
(r359235)
+++ stable/12/sys/cam/nvme/nvme_da.cMon Mar 23 12:38:44 2020
(r359236)
@@ -798,9 +798,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r359129 - head/sys/cam/nvme

2020-03-19 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354854 - head/sys/sys

2019-11-19 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-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

2019-11-18 Thread David Bright
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

2019-09-26 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r352751 - in head/sys: compat/freebsd32 kern sys

2019-09-26 Thread David Bright
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

2019-09-26 Thread David Bright
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 

svn commit: r345507 - stable/11/sys/dev/pms/RefTisa/tisa/sassata/sas/ini

2019-03-25 Thread David Bright
Author: dab
Date: Mon Mar 25 17:04:14 2019
New Revision: 345507
URL: https://svnweb.freebsd.org/changeset/base/345507

Log:
  MFC r345009:
  
  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
  Sponsored by:   Dell EMC Isilon

Modified:
  stable/11/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c
==
--- stable/11/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c  Mon Mar 25 
17:03:39 2019(r345506)
+++ stable/11/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c  Mon Mar 25 
17:04:14 2019(r345507)
@@ -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,

   );
 if(status != AGSA_RC_SUCCESS)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r345508 - stable/10/sys/dev/pms/RefTisa/tisa/sassata/sas/ini

2019-03-25 Thread David Bright
Author: dab
Date: Mon Mar 25 17:04:33 2019
New Revision: 345508
URL: https://svnweb.freebsd.org/changeset/base/345508

Log:
  MFC r345009:
  
  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
  Sponsored by:   Dell EMC Isilon

Modified:
  stable/10/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c
==
--- stable/10/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c  Mon Mar 25 
17:04:14 2019(r345507)
+++ stable/10/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c  Mon Mar 25 
17:04:33 2019(r345508)
@@ -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,

   );
 if(status != AGSA_RC_SUCCESS)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r345506 - stable/12/sys/dev/pms/RefTisa/tisa/sassata/sas/ini

2019-03-25 Thread David Bright
Author: dab
Date: Mon Mar 25 17:03:39 2019
New Revision: 345506
URL: https://svnweb.freebsd.org/changeset/base/345506

Log:
  MFC r345009:
  
  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
  Sponsored by:   Dell EMC Isilon

Modified:
  stable/12/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c
==
--- stable/12/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c  Mon Mar 25 
16:40:54 2019(r345505)
+++ stable/12/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c  Mon Mar 25 
17:03:39 2019(r345506)
@@ -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,

   );
 if(status != AGSA_RC_SUCCESS)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r345009 - head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini

2019-03-11 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r345009 - head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini

2019-03-11 Thread David Bright
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,

   );
 if(status != AGSA_RC_SUCCESS)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344889 - stable/11/sys/dev/asmc

2019-03-07 Thread David Bright
Author: dab
Date: Thu Mar  7 15:31:32 2019
New Revision: 344889
URL: https://svnweb.freebsd.org/changeset/base/344889

Log:
  MFC r344553:
  
  asmc: Add support for Mac mini 2,1
  
  PR: 235798
  Submitted by:   Trev 
  Reported by:Trev 

Modified:
  stable/11/sys/dev/asmc/asmc.c
  stable/11/sys/dev/asmc/asmcvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/asmc/asmc.c
==
--- stable/11/sys/dev/asmc/asmc.c   Thu Mar  7 15:30:48 2019
(r344888)
+++ stable/11/sys/dev/asmc/asmc.c   Thu Mar  7 15:31:32 2019
(r344889)
@@ -262,6 +262,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: stable/11/sys/dev/asmc/asmcvar.h
==
--- stable/11/sys/dev/asmc/asmcvar.hThu Mar  7 15:30:48 2019
(r344888)
+++ stable/11/sys/dev/asmc/asmcvar.hThu Mar  7 15:31:32 2019
(r344889)
@@ -339,6 +339,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344888 - stable/12/sys/dev/asmc

2019-03-07 Thread David Bright
Author: dab
Date: Thu Mar  7 15:30:48 2019
New Revision: 344888
URL: https://svnweb.freebsd.org/changeset/base/344888

Log:
  MFC r344553:
  
  asmc: Add support for Mac mini 2,1
  
  PR:   235798
  Submitted by: Trev 
  Reported by:  Trev 

Modified:
  stable/12/sys/dev/asmc/asmc.c
  stable/12/sys/dev/asmc/asmcvar.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/asmc/asmc.c
==
--- stable/12/sys/dev/asmc/asmc.c   Thu Mar  7 13:53:59 2019
(r344887)
+++ stable/12/sys/dev/asmc/asmc.c   Thu Mar  7 15:30:48 2019
(r344888)
@@ -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: stable/12/sys/dev/asmc/asmcvar.h
==
--- stable/12/sys/dev/asmc/asmcvar.hThu Mar  7 13:53:59 2019
(r344887)
+++ stable/12/sys/dev/asmc/asmcvar.hThu Mar  7 15:30:48 2019
(r344888)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344882 - stable/10/usr.sbin/newsyslog

2019-03-07 Thread David Bright
Author: dab
Date: Thu Mar  7 13:11:00 2019
New Revision: 344882
URL: https://svnweb.freebsd.org/changeset/base/344882

Log:
  MFC r344470:
  
  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)
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/10/usr.sbin/newsyslog/newsyslog.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/newsyslog/newsyslog.c
==
--- stable/10/usr.sbin/newsyslog/newsyslog.cThu Mar  7 13:10:48 2019
(r344881)
+++ stable/10/usr.sbin/newsyslog/newsyslog.cThu Mar  7 13:11:00 2019
(r344882)
@@ -259,7 +259,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);
@@ -850,7 +850,7 @@ get_worklist(char **files)
 
if (verbose)
printf("Processing %s\n", inc->file);
-   parse_file(f, filelist, globlist, defconf, );
+   parse_file(f, filelist, globlist, , );
(void) fclose(f);
}
 
@@ -867,7 +867,6 @@ get_worklist(char **files)
if (defconf != NULL)
free_entry(defconf);
return (filelist);
-   /* NOTREACHED */
}
 
/*
@@ -924,7 +923,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);
@@ -1055,7 +1054,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;
@@ -1146,12 +1145,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);
@@ -1369,7 +1368,8 @@ no_trimat:
q = NULL;
else {
q = parse = sob(parse + 1); /* Optional field */
-   *(parse = son(parse)) = '\0';
+   parse = son(parse);
+   *parse = '\0';
}
 

svn commit: r344880 - stable/12/usr.sbin/newsyslog

2019-03-07 Thread David Bright
Author: dab
Date: Thu Mar  7 13:10:34 2019
New Revision: 344880
URL: https://svnweb.freebsd.org/changeset/base/344880

Log:
  MFC r344470:
  
  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)
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/usr.sbin/newsyslog/newsyslog.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/newsyslog/newsyslog.c
==
--- stable/12/usr.sbin/newsyslog/newsyslog.cThu Mar  7 13:07:10 2019
(r344879)
+++ stable/12/usr.sbin/newsyslog/newsyslog.cThu Mar  7 13:10:34 2019
(r344880)
@@ -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, );
+   parse_file(f, filelist, globlist, , );
(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';
}
 

svn commit: r344881 - stable/11/usr.sbin/newsyslog

2019-03-07 Thread David Bright
Author: dab
Date: Thu Mar  7 13:10:48 2019
New Revision: 344881
URL: https://svnweb.freebsd.org/changeset/base/344881

Log:
  MFC r344470:
  
  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)
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/11/usr.sbin/newsyslog/newsyslog.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/newsyslog/newsyslog.c
==
--- stable/11/usr.sbin/newsyslog/newsyslog.cThu Mar  7 13:10:34 2019
(r344880)
+++ stable/11/usr.sbin/newsyslog/newsyslog.cThu Mar  7 13:10:48 2019
(r344881)
@@ -260,7 +260,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);
@@ -848,7 +848,7 @@ get_worklist(char **files)
 
if (verbose)
printf("Processing %s\n", inc->file);
-   parse_file(f, filelist, globlist, defconf, );
+   parse_file(f, filelist, globlist, , );
(void) fclose(f);
}
 
@@ -865,7 +865,6 @@ get_worklist(char **files)
if (defconf != NULL)
free_entry(defconf);
return (filelist);
-   /* NOTREACHED */
}
 
/*
@@ -922,7 +921,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);
@@ -1053,7 +1052,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;
@@ -1144,12 +1143,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);
@@ -1355,7 +1354,8 @@ no_trimat:
q = NULL;
else {
q = parse = sob(parse + 1); /* Optional field */
-   *(parse = son(parse)) = '\0';
+   parse = son(parse);
+   *parse = '\0';
}
 

svn commit: r344646 - stable/10/sys/dev/pms/RefTisa/tisa/sassata/sas/ini

2019-02-27 Thread David Bright
Author: dab
Date: Wed Feb 27 22:29:37 2019
New Revision: 344646
URL: https://svnweb.freebsd.org/changeset/base/344646

Log:
  MFC r344473:
  
  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.
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/10/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c
==
--- stable/10/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c  Wed Feb 27 
22:29:26 2019(r344645)
+++ stable/10/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c  Wed Feb 27 
22:29:37 2019(r344646)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344645 - stable/11/sys/dev/pms/RefTisa/tisa/sassata/sas/ini

2019-02-27 Thread David Bright
Author: dab
Date: Wed Feb 27 22:29:26 2019
New Revision: 344645
URL: https://svnweb.freebsd.org/changeset/base/344645

Log:
  MFC r344473:
  
  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.
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/11/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c
==
--- stable/11/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c  Wed Feb 27 
22:29:12 2019(r344644)
+++ stable/11/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c  Wed Feb 27 
22:29:26 2019(r344645)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344644 - stable/12/sys/dev/pms/RefTisa/tisa/sassata/sas/ini

2019-02-27 Thread David Bright
Author: dab
Date: Wed Feb 27 22:29:12 2019
New Revision: 344644
URL: https://svnweb.freebsd.org/changeset/base/344644

Log:
  MFC r344473:
  
  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.
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c
==
--- stable/12/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c  Wed Feb 27 
22:26:18 2019(r344643)
+++ stable/12/sys/dev/pms/RefTisa/tisa/sassata/sas/ini/itdio.c  Wed Feb 27 
22:29:12 2019(r344644)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344553 - head/sys/dev/asmc

2019-02-25 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344473 - head/sys/dev/pms/RefTisa/tisa/sassata/sas/ini

2019-02-22 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344470 - head/usr.sbin/newsyslog

2019-02-22 Thread David Bright
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, );
+   parse_file(f, filelist, globlist, , );
(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

2019-02-22 Thread David Bright
[… 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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344468 - head/usr.sbin/newsyslog

2019-02-22 Thread David Bright
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, , );
+   parse_file(f, filelist, globlist, defconf, );
(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: r344393 - stable/11/sys/cam/scsi

2019-02-20 Thread David Bright
Author: dab
Date: Wed Feb 20 22:48:55 2019
New Revision: 344393
URL: https://svnweb.freebsd.org/changeset/base/344393

Log:
  MFC r344024:
  
  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.
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/11/sys/cam/scsi/scsi_xpt.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/scsi/scsi_xpt.c
==
--- stable/11/sys/cam/scsi/scsi_xpt.c   Wed Feb 20 22:48:38 2019
(r344392)
+++ stable/11/sys/cam/scsi/scsi_xpt.c   Wed Feb 20 22:48:55 2019
(r344393)
@@ -1379,6 +1379,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 = >device->inq_data;
if (path->device->flags & CAM_DEV_INQUIRY_DATA_VALID &&
(SID_QUAL(inq_buf) == SID_QUAL_LU_CONNECTED ||
@@ -1391,9 +1397,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344392 - stable/12/sys/cam/scsi

2019-02-20 Thread David Bright
Author: dab
Date: Wed Feb 20 22:48:38 2019
New Revision: 344392
URL: https://svnweb.freebsd.org/changeset/base/344392

Log:
  MFC r344024:
  
  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.
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/sys/cam/scsi/scsi_xpt.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/scsi/scsi_xpt.c
==
--- stable/12/sys/cam/scsi/scsi_xpt.c   Wed Feb 20 22:41:14 2019
(r344391)
+++ stable/12/sys/cam/scsi/scsi_xpt.c   Wed Feb 20 22:48:38 2019
(r344392)
@@ -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 = >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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344394 - stable/10/sys/cam/scsi

2019-02-20 Thread David Bright
Author: dab
Date: Wed Feb 20 22:49:09 2019
New Revision: 344394
URL: https://svnweb.freebsd.org/changeset/base/344394

Log:
  MFC r344024:
  
  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.
  
  Sponsored by: Dell EMC Isilon

Modified:
  stable/10/sys/cam/scsi/scsi_xpt.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_xpt.c
==
--- stable/10/sys/cam/scsi/scsi_xpt.c   Wed Feb 20 22:48:55 2019
(r344393)
+++ stable/10/sys/cam/scsi/scsi_xpt.c   Wed Feb 20 22:49:09 2019
(r344394)
@@ -1351,6 +1351,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 = >device->inq_data;
if (path->device->flags & CAM_DEV_INQUIRY_DATA_VALID &&
(SID_QUAL(inq_buf) == SID_QUAL_LU_CONNECTED ||
@@ -1363,9 +1369,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344389 - head/usr.sbin/newsyslog

2019-02-20 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r344024 - head/sys/cam/scsi

2019-02-11 Thread David Bright
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 = >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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r343906 - head/usr.sbin/newsyslog

2019-02-08 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r343906 - head/usr.sbin/newsyslog

2019-02-08 Thread David Bright
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, );
+   parse_file(f, filelist, globlist, , );
(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 +1358,8 @@ no_trimat:
 

svn commit: r343151 - stable/11/sys/dev/asmc

2019-01-18 Thread David Bright
Author: dab
Date: Fri Jan 18 16:04:36 2019
New Revision: 343151
URL: https://svnweb.freebsd.org/changeset/base/343151

Log:
  MFC r342822:
  
  asmc: Add support for Mac mini 4,1 (Mid-2010)

Modified:
  stable/11/sys/dev/asmc/asmc.c
  stable/11/sys/dev/asmc/asmcvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/asmc/asmc.c
==
--- stable/11/sys/dev/asmc/asmc.c   Fri Jan 18 16:03:59 2019
(r343150)
+++ stable/11/sys/dev/asmc/asmc.c   Fri Jan 18 16:04:36 2019
(r343151)
@@ -154,6 +154,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",
@@ -267,6 +269,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: stable/11/sys/dev/asmc/asmcvar.h
==
--- stable/11/sys/dev/asmc/asmcvar.hFri Jan 18 16:03:59 2019
(r343150)
+++ stable/11/sys/dev/asmc/asmcvar.hFri Jan 18 16:04:36 2019
(r343151)
@@ -358,6 +358,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r343150 - stable/12/sys/dev/asmc

2019-01-18 Thread David Bright
Author: dab
Date: Fri Jan 18 16:03:59 2019
New Revision: 343150
URL: https://svnweb.freebsd.org/changeset/base/343150

Log:
  MFC r342822:
  
  asmc: Add support for Mac mini 4,1 (Mid-2010)

Modified:
  stable/12/sys/dev/asmc/asmc.c
  stable/12/sys/dev/asmc/asmcvar.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/asmc/asmc.c
==
--- stable/12/sys/dev/asmc/asmc.c   Fri Jan 18 15:59:49 2019
(r343149)
+++ stable/12/sys/dev/asmc/asmc.c   Fri Jan 18 16:03:59 2019
(r343150)
@@ -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: stable/12/sys/dev/asmc/asmcvar.h
==
--- stable/12/sys/dev/asmc/asmcvar.hFri Jan 18 15:59:49 2019
(r343149)
+++ stable/12/sys/dev/asmc/asmcvar.hFri Jan 18 16:03:59 2019
(r343150)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r343149 - stable/11/sys/dev/asmc

2019-01-18 Thread David Bright
Author: dab
Date: Fri Jan 18 15:59:49 2019
New Revision: 343149
URL: https://svnweb.freebsd.org/changeset/base/343149

Log:
  MFC r342770:
  
  asmc: Patch to add MacBook Pro 9,2 support
  
  PR:  211513
  Submitted by:  William Theesfeld Jr 
  Reported by:   William Theesfeld Jr 

Modified:
  stable/11/sys/dev/asmc/asmc.c
  stable/11/sys/dev/asmc/asmcvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/asmc/asmc.c
==
--- stable/11/sys/dev/asmc/asmc.c   Fri Jan 18 15:58:32 2019
(r343148)
+++ stable/11/sys/dev/asmc/asmc.c   Fri Jan 18 15:59:49 2019
(r343149)
@@ -234,6 +234,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: stable/11/sys/dev/asmc/asmcvar.h
==
--- stable/11/sys/dev/asmc/asmcvar.hFri Jan 18 15:58:32 2019
(r343148)
+++ stable/11/sys/dev/asmc/asmcvar.hFri Jan 18 15:59:49 2019
(r343149)
@@ -255,6 +255,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r343148 - stable/12/sys/dev/asmc

2019-01-18 Thread David Bright
Author: dab
Date: Fri Jan 18 15:58:32 2019
New Revision: 343148
URL: https://svnweb.freebsd.org/changeset/base/343148

Log:
  MFC r342770:
  
  asmc: Patch to add MacBook Pro 9,2 support
  
  PR:   211513
  Submitted by: William Theesfeld Jr 
  Reported by:  William Theesfeld Jr 

Modified:
  stable/12/sys/dev/asmc/asmc.c
  stable/12/sys/dev/asmc/asmcvar.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/asmc/asmc.c
==
--- stable/12/sys/dev/asmc/asmc.c   Fri Jan 18 13:43:11 2019
(r343147)
+++ stable/12/sys/dev/asmc/asmc.c   Fri Jan 18 15:58:32 2019
(r343148)
@@ -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: stable/12/sys/dev/asmc/asmcvar.h
==
--- stable/12/sys/dev/asmc/asmcvar.hFri Jan 18 13:43:11 2019
(r343147)
+++ stable/12/sys/dev/asmc/asmcvar.hFri Jan 18 15:58:32 2019
(r343148)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342822 - head/sys/dev/asmc

2019-01-06 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342770 - head/sys/dev/asmc

2019-01-04 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342756 - stable/12/sys/dev/asmc

2019-01-03 Thread David Bright
Author: dab
Date: Fri Jan  4 02:50:55 2019
New Revision: 342756
URL: https://svnweb.freebsd.org/changeset/base/342756

Log:
  MFC r342218:
  
  asmc: Add support for MacPro1,1
  
  PR:   203431
  Submitted by: j...@alisa.org & holin...@saunalahti.fi
  Reported by:  j...@alisa.org

Modified:
  stable/12/sys/dev/asmc/asmc.c
  stable/12/sys/dev/asmc/asmcvar.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/asmc/asmc.c
==
--- stable/12/sys/dev/asmc/asmc.c   Fri Jan  4 02:50:18 2019
(r342755)
+++ stable/12/sys/dev/asmc/asmc.c   Fri Jan  4 02:50:55 2019
(r342756)
@@ -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: stable/12/sys/dev/asmc/asmcvar.h
==
--- stable/12/sys/dev/asmc/asmcvar.hFri Jan  4 02:50:18 2019
(r342755)
+++ stable/12/sys/dev/asmc/asmcvar.hFri Jan  4 02:50:55 2019
(r342756)
@@ -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", \
+ 

svn commit: r342755 - stable/11/sys/dev/asmc

2019-01-03 Thread David Bright
Author: dab
Date: Fri Jan  4 02:50:18 2019
New Revision: 342755
URL: https://svnweb.freebsd.org/changeset/base/342755

Log:
  MFC r342218:
  
  asmc: Add support for MacPro1,1
  
  PR:   203431
  Submitted by: j...@alisa.org & holin...@saunalahti.fi
  Reported by:  j...@alisa.org

Modified:
  stable/11/sys/dev/asmc/asmc.c
  stable/11/sys/dev/asmc/asmcvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/asmc/asmc.c
==
--- stable/11/sys/dev/asmc/asmc.c   Fri Jan  4 02:48:43 2019
(r342754)
+++ stable/11/sys/dev/asmc/asmc.c   Fri Jan  4 02:50:18 2019
(r342755)
@@ -272,13 +272,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: stable/11/sys/dev/asmc/asmcvar.h
==
--- stable/11/sys/dev/asmc/asmcvar.hFri Jan  4 02:48:43 2019
(r342754)
+++ stable/11/sys/dev/asmc/asmcvar.hFri Jan  4 02:50:18 2019
(r342755)
@@ -372,7 +372,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", \
+ 

svn commit: r342753 - stable/12/sys/dev/asmc

2019-01-03 Thread David Bright
Author: dab
Date: Fri Jan  4 02:21:00 2019
New Revision: 342753
URL: https://svnweb.freebsd.org/changeset/base/342753

Log:
  MFC r342171:
  
  asmc: Add support for mid-2011 Macmini 5,2
  
  PR:   225911
  Submitted by: trev 
  Reported by:  trev 

Modified:
  stable/12/sys/dev/asmc/asmc.c
  stable/12/sys/dev/asmc/asmcvar.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/asmc/asmc.c
==
--- stable/12/sys/dev/asmc/asmc.c   Fri Jan  4 02:20:34 2019
(r342752)
+++ stable/12/sys/dev/asmc/asmc.c   Fri Jan  4 02:21:00 2019
(r342753)
@@ -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: stable/12/sys/dev/asmc/asmcvar.h
==
--- stable/12/sys/dev/asmc/asmcvar.hFri Jan  4 02:20:34 2019
(r342752)
+++ stable/12/sys/dev/asmc/asmcvar.hFri Jan  4 02:21:00 2019
(r342753)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342752 - stable/11/sys/dev/asmc

2019-01-03 Thread David Bright
Author: dab
Date: Fri Jan  4 02:20:34 2019
New Revision: 342752
URL: https://svnweb.freebsd.org/changeset/base/342752

Log:
  MFC r342171:
  
  asmc: Add support for mid-2011 Macmini 5,2
  
  PR:   225911
  Submitted by: trev 
  Reported by:  trev 

Modified:
  stable/11/sys/dev/asmc/asmc.c
  stable/11/sys/dev/asmc/asmcvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/asmc/asmc.c
==
--- stable/11/sys/dev/asmc/asmc.c   Fri Jan  4 01:19:23 2019
(r342751)
+++ stable/11/sys/dev/asmc/asmc.c   Fri Jan  4 02:20:34 2019
(r342752)
@@ -263,6 +263,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: stable/11/sys/dev/asmc/asmcvar.h
==
--- stable/11/sys/dev/asmc/asmcvar.hFri Jan  4 01:19:23 2019
(r342751)
+++ stable/11/sys/dev/asmc/asmcvar.hFri Jan  4 02:20:34 2019
(r342752)
@@ -337,6 +337,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342269 - stable/11/sys/dev/asmc

2018-12-19 Thread David Bright
Author: dab
Date: Thu Dec 20 00:58:16 2018
New Revision: 342269
URL: https://svnweb.freebsd.org/changeset/base/342269

Log:
  MFC r341988
  
  asmc: Add Support for Macbook Pro 8,1
  
  PR:   217505
  Submitted by: John O. Brickley , updated by Maciej 
Pasternacki 
  Reported by:  John O. Brickley 

Modified:
  stable/11/sys/dev/asmc/asmc.c
  stable/11/sys/dev/asmc/asmcvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/asmc/asmc.c
==
--- stable/11/sys/dev/asmc/asmc.c   Thu Dec 20 00:57:23 2018
(r342268)
+++ stable/11/sys/dev/asmc/asmc.c   Thu Dec 20 00:58:16 2018
(r342269)
@@ -222,9 +222,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: stable/11/sys/dev/asmc/asmcvar.h
==
--- stable/11/sys/dev/asmc/asmcvar.hThu Dec 20 00:57:23 2018
(r342268)
+++ stable/11/sys/dev/asmc/asmcvar.hThu Dec 20 00:58:16 2018
(r342269)
@@ -216,21 +216,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342268 - stable/12/sys/dev/asmc

2018-12-19 Thread David Bright
Author: dab
Date: Thu Dec 20 00:57:23 2018
New Revision: 342268
URL: https://svnweb.freebsd.org/changeset/base/342268

Log:
  MFC r341988
  
  asmc: Add Support for Macbook Pro 8,1
  
  PR:   217505
  Submitted by: John O. Brickley , updated by Maciej 
Pasternacki 
  Reported by:  John O. Brickley 

Modified:
  stable/12/sys/dev/asmc/asmc.c
  stable/12/sys/dev/asmc/asmcvar.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/asmc/asmc.c
==
--- stable/12/sys/dev/asmc/asmc.c   Wed Dec 19 23:29:44 2018
(r342267)
+++ stable/12/sys/dev/asmc/asmc.c   Thu Dec 20 00:57:23 2018
(r342268)
@@ -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: stable/12/sys/dev/asmc/asmcvar.h
==
--- stable/12/sys/dev/asmc/asmcvar.hWed Dec 19 23:29:44 2018
(r342267)
+++ stable/12/sys/dev/asmc/asmcvar.hThu Dec 20 00:57:23 2018
(r342268)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342254 - stable/11/share/vt/keymaps

2018-12-19 Thread David Bright
Author: dab
Date: Wed Dec 19 22:48:27 2018
New Revision: 342254
URL: https://svnweb.freebsd.org/changeset/base/342254

Log:
  MFC r341806:
  
  Add uk.macbook.kbd keymap (vt)
  
  PR:   215185
  Submitted by: James Wright 
  Reported by:  James Wright 

Added:
  stable/11/share/vt/keymaps/uk.macbook.kbd
 - copied unchanged from r341806, head/share/vt/keymaps/uk.macbook.kbd
Modified:
  stable/11/share/vt/keymaps/INDEX.keymaps
  stable/11/share/vt/keymaps/Makefile
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/vt/keymaps/INDEX.keymaps
==
--- stable/11/share/vt/keymaps/INDEX.keymapsWed Dec 19 22:47:37 2018
(r342253)
+++ stable/11/share/vt/keymaps/INDEX.keymapsWed Dec 19 22:48:27 2018
(r342254)
@@ -534,6 +534,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: stable/11/share/vt/keymaps/Makefile
==
--- stable/11/share/vt/keymaps/Makefile Wed Dec 19 22:47:37 2018
(r342253)
+++ stable/11/share/vt/keymaps/Makefile Wed Dec 19 22:48:27 2018
(r342254)
@@ -76,6 +76,7 @@ FILES=INDEX.keymaps \
uk.capsctrl.kbd \
uk.dvorak.kbd \
uk.kbd \
+   uk.macbook.kbd \
us.acc.kbd \
us.ctrl.kbd \
us.dvorak.kbd \

Copied: stable/11/share/vt/keymaps/uk.macbook.kbd (from r341806, 
head/share/vt/keymaps/uk.macbook.kbd)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/11/share/vt/keymaps/uk.macbook.kbd   Wed Dec 19 22:48:27 2018
(r342254, copy of r341806, head/share/vt/keymaps/uk.macbook.kbd)
@@ -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'  

svn commit: r342252 - stable/12/share/vt/keymaps

2018-12-19 Thread David Bright
Author: dab
Date: Wed Dec 19 22:46:03 2018
New Revision: 342252
URL: https://svnweb.freebsd.org/changeset/base/342252

Log:
  MFC r341806:
  
  Add uk.macbook.kbd keymap (vt)
  
  PR:   215185
  Submitted by: James Wright 
  Reported by:  James Wright 

Added:
  stable/12/share/vt/keymaps/uk.macbook.kbd
 - copied unchanged from r341806, head/share/vt/keymaps/uk.macbook.kbd
Modified:
  stable/12/share/vt/keymaps/INDEX.keymaps
  stable/12/share/vt/keymaps/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/vt/keymaps/INDEX.keymaps
==
--- stable/12/share/vt/keymaps/INDEX.keymapsWed Dec 19 22:43:10 2018
(r342251)
+++ stable/12/share/vt/keymaps/INDEX.keymapsWed Dec 19 22:46:03 2018
(r342252)
@@ -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: stable/12/share/vt/keymaps/Makefile
==
--- stable/12/share/vt/keymaps/Makefile Wed Dec 19 22:43:10 2018
(r342251)
+++ stable/12/share/vt/keymaps/Makefile Wed Dec 19 22:46:03 2018
(r342252)
@@ -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 \

Copied: stable/12/share/vt/keymaps/uk.macbook.kbd (from r341806, 
head/share/vt/keymaps/uk.macbook.kbd)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/share/vt/keymaps/uk.macbook.kbd   Wed Dec 19 22:46:03 2018
(r342252, copy of r341806, head/share/vt/keymaps/uk.macbook.kbd)
@@ -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'  

svn commit: r342246 - stable/11/sys/dev/asmc

2018-12-19 Thread David Bright
Author: dab
Date: Wed Dec 19 22:17:24 2018
New Revision: 342246
URL: https://svnweb.freebsd.org/changeset/base/342246

Log:
  MFC r341820:
  
  asmc: Add Support for MacBookAir 7,1 and 7,2
  
  PR:   226172
  Submitted by: James Wright 
  Reported by:  James Wright 

Modified:
  stable/11/sys/dev/asmc/asmc.c
  stable/11/sys/dev/asmc/asmcvar.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/asmc/asmc.c
==
--- stable/11/sys/dev/asmc/asmc.c   Wed Dec 19 22:08:51 2018
(r342245)
+++ stable/11/sys/dev/asmc/asmc.c   Wed Dec 19 22:17:24 2018
(r342246)
@@ -303,6 +303,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: stable/11/sys/dev/asmc/asmcvar.h
==
--- stable/11/sys/dev/asmc/asmcvar.hWed Dec 19 22:08:51 2018
(r342245)
+++ stable/11/sys/dev/asmc/asmcvar.hWed Dec 19 22:17:24 2018
(r342246)
@@ -426,3 +426,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342241 - stable/12/sys/dev/asmc

2018-12-19 Thread David Bright
Author: dab
Date: Wed Dec 19 21:28:11 2018
New Revision: 342241
URL: https://svnweb.freebsd.org/changeset/base/342241

Log:
  MFC r341820:
  
  asmc: Add Support for MacBookAir 7,1 and 7,2
  
  PR:   226172
  Submitted by: James Wright 
  Reported by:  James Wright 

Modified:
  stable/12/sys/dev/asmc/asmc.c
  stable/12/sys/dev/asmc/asmcvar.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/asmc/asmc.c
==
--- stable/12/sys/dev/asmc/asmc.c   Wed Dec 19 21:25:43 2018
(r342240)
+++ stable/12/sys/dev/asmc/asmc.c   Wed Dec 19 21:28:11 2018
(r342241)
@@ -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: stable/12/sys/dev/asmc/asmcvar.h
==
--- stable/12/sys/dev/asmc/asmcvar.hWed Dec 19 21:25:43 2018
(r342240)
+++ stable/12/sys/dev/asmc/asmcvar.hWed Dec 19 21:28:11 2018
(r342241)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r342218 - head/sys/dev/asmc

2018-12-19 Thread David Bright
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

2018-12-17 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r341988 - head/sys/dev/asmc

2018-12-12 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r341820 - head/sys/dev/asmc

2018-12-11 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r341806 - head/share/vt/keymaps

2018-12-10 Thread David Bright
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'

svn commit: r341275 - in stable/11: sys/dev/netmap tests/sys/kqueue/libkqueue

2018-11-29 Thread David Bright
Author: dab
Date: Fri Nov 30 02:06:30 2018
New Revision: 341275
URL: https://svnweb.freebsd.org/changeset/base/341275

Log:
  MFC r337812,r337814,r337820,r341068:
  
  Fix several memory leaks (r337812 & r337814).
  
  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.
  
  r337812 also fixed a bug in the netmap kevent code. The inclusion of
  that fix was an oversight that I didn't notice until this
  MFC. Reference the code review and PR here in the MFC for
  completeness.
  
  r337820 & r341068 were white-space only changes as a follow-up to
  r337812 & r337814:
  
  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.
  
  PR:  206053
  Differential Revision:https://reviews.freebsd.org/D16531
  Sponsored by: Dell EMC Isilon

Modified:
  stable/11/sys/dev/netmap/netmap_freebsd.c
  stable/11/tests/sys/kqueue/libkqueue/common.h
  stable/11/tests/sys/kqueue/libkqueue/main.c
  stable/11/tests/sys/kqueue/libkqueue/proc.c
  stable/11/tests/sys/kqueue/libkqueue/signal.c
  stable/11/tests/sys/kqueue/libkqueue/timer.c
  stable/11/tests/sys/kqueue/libkqueue/user.c
  stable/11/tests/sys/kqueue/libkqueue/vnode.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/netmap/netmap_freebsd.c
==
--- stable/11/sys/dev/netmap/netmap_freebsd.c   Fri Nov 30 01:45:54 2018
(r341274)
+++ stable/11/sys/dev/netmap/netmap_freebsd.c   Fri Nov 30 02:06:30 2018
(r341275)
@@ -778,7 +778,7 @@ netmap_kqfilter(struct cdev *dev, struct knote *kn)
kn->kn_fop = (ev == EVFILT_WRITE) ?
_wfiltops : _rfiltops;
kn->kn_hook = priv;
-   knlist_add(>si.si_note, kn, 1);
+   knlist_add(>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: stable/11/tests/sys/kqueue/libkqueue/common.h
==
--- stable/11/tests/sys/kqueue/libkqueue/common.h   Fri Nov 30 01:45:54 
2018(r341274)
+++ stable/11/tests/sys/kqueue/libkqueue/common.h   Fri Nov 30 02:06:30 
2018(r341275)
@@ -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: stable/11/tests/sys/kqueue/libkqueue/main.c
==
--- stable/11/tests/sys/kqueue/libkqueue/main.c Fri Nov 30 01:45:54 2018
(r341274)
+++ stable/11/tests/sys/kqueue/libkqueue/main.c Fri Nov 30 02:06:30 2018
(r341275)
@@ -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(, 0, sizeof(timeo));
 nfds = kevent(kqfd, NULL, 0, , 1, );
 if (nfds != 0) {
 puts("\nUnexpected event:");
-puts(kevent_to_str());
+kev_str = kevent_to_str();
+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(, 0, sizeof(timeo));
 nfds = kevent(kqfd, NULL, 0, , 1, );
 if (nfds != 0) {
 puts("\nUnexpected event:");
-puts(kevent_to_str());
+kev_str = kevent_to_str();
+puts(kev_str);
+free(kev_str);
 errx(1, "%d event(s) pending, but none expected:", nfds);
 }
 }
@@ -79,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)
@@ -97,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, );
 if (nfds < 0) {
@@ -117,10 +123,10 @@ kevent_fflags_dump(struct kevent *kev)
 
 #define KEVFFL_DUMP(attrib) \
 if (kev->fflags & 

svn commit: r341274 - stable/12/tests/sys/kqueue/libkqueue

2018-11-29 Thread David Bright
Author: dab
Date: Fri Nov 30 01:45:54 2018
New Revision: 341274
URL: https://svnweb.freebsd.org/changeset/base/341274

Log:
  MFC r341068:
  
  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@
  Sponsored by: Dell EMC Isilon

Modified:
  stable/12/tests/sys/kqueue/libkqueue/main.c
  stable/12/tests/sys/kqueue/libkqueue/proc.c
  stable/12/tests/sys/kqueue/libkqueue/signal.c
  stable/12/tests/sys/kqueue/libkqueue/timer.c
  stable/12/tests/sys/kqueue/libkqueue/user.c
  stable/12/tests/sys/kqueue/libkqueue/vnode.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/tests/sys/kqueue/libkqueue/main.c
==
--- stable/12/tests/sys/kqueue/libkqueue/main.c Fri Nov 30 00:47:36 2018
(r341273)
+++ stable/12/tests/sys/kqueue/libkqueue/main.c Fri Nov 30 01:45:54 2018
(r341274)
@@ -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, );
 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([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: stable/12/tests/sys/kqueue/libkqueue/proc.c

svn commit: r341068 - head/tests/sys/kqueue/libkqueue

2018-11-27 Thread David Bright
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, );
 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([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 Nov 27 

svn commit: r337820 - head/tests/sys/kqueue/libkqueue

2018-08-14 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r337814 - head/tests/sys/kqueue/libkqueue

2018-08-14 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r337812 - in head: sys/dev/netmap tests/sys/kqueue/libkqueue

2018-08-14 Thread David Bright
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) ?
_wfiltops : _rfiltops;
kn->kn_hook = priv;
-   knlist_add(>si.si_note, kn, 1);
+   knlist_add(>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(, 0, sizeof(timeo));
 nfds = kevent(kqfd, NULL, 0, , 1, );
 if (nfds != 0) {
 puts("\nUnexpected event:");
-puts(kevent_to_str());
+kev_str = kevent_to_str();
+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(, 0, sizeof(timeo));
 nfds = kevent(kqfd, NULL, 0, , 1, );
 if (nfds != 0) {
 puts("\nUnexpected event:");
-puts(kevent_to_str());
+kev_str = kevent_to_str();
+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([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: %s\n", kevent_to_str(kevp));
+kev_str = 

svn commit: r337418 - in stable/11: lib/libc/sys sys/kern tests/sys/kqueue/libkqueue

2018-08-07 Thread David Bright
Author: dab
Date: Tue Aug  7 14:39:00 2018
New Revision: 337418
URL: https://svnweb.freebsd.org/changeset/base/337418

Log:
  MFC r336761 & r336781:
  
  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
  Relnotes: yes
  Sponsored by: Dell EMC

Modified:
  stable/11/lib/libc/sys/kqueue.2
  stable/11/sys/kern/kern_event.c
  stable/11/tests/sys/kqueue/libkqueue/common.h
  stable/11/tests/sys/kqueue/libkqueue/main.c
  stable/11/tests/sys/kqueue/libkqueue/timer.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/sys/kqueue.2
==
--- stable/11/lib/libc/sys/kqueue.2 Tue Aug  7 14:09:29 2018
(r337417)
+++ stable/11/lib/libc/sys/kqueue.2 Tue Aug  7 14:39:00 2018
(r337418)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 22, 2017
+.Dd July 27, 2018
 .Dt KQUEUE 2
 .Os
 .Sh NAME
@@ -339,8 +339,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 .
@@ -485,7 +485,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
@@ -530,6 +530,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
@@ -576,9 +583,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,

Modified: stable/11/sys/kern/kern_event.c
==
--- stable/11/sys/kern/kern_event.c Tue Aug  7 14:09:29 2018
(r337417)
+++ stable/11/sys/kern/kern_event.c Tue Aug  7 14:39:00 2018
(r337418)
@@ -151,6 +151,10 @@ static int filt_fileattach(struct knote *kn);
 static voidfilt_timerexpire(void *knx);
 static int filt_timerattach(struct knote *kn);
 static voidfilt_timerdetach(struct knote *kn);
+static voidfilt_timerstart(struct knote *kn, sbintime_t to);
+static voidfilt_timertouch(struct knote *kn, struct kevent *kev,
+   u_long type);
+static int 

svn commit: r336905 - head/tests/sys/kqueue/libkqueue

2018-07-30 Thread David Bright
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(, 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, , 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(, 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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r336802 - head/tests/sys/kqueue/libkqueue

2018-07-27 Thread David Bright
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(, 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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r336781 - head/tests/sys/kqueue/libkqueue

2018-07-27 Thread David Bright
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(, 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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r336761 - in head: lib/libc/sys sys/kern tests/sys/kqueue/libkqueue

2018-07-27 Thread David Bright
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
==
--- 

svn commit: r336647 - stable/10/sys/sys

2018-07-23 Thread David Bright
Author: dab
Date: Mon Jul 23 18:47:04 2018
New Revision: 336647
URL: https://svnweb.freebsd.org/changeset/base/336647

Log:
  MFC r336457:
  
  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.
  
  Sponsored by: Dell EMC

Modified:
  stable/10/sys/sys/event.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/sys/event.h
==
--- stable/10/sys/sys/event.h   Mon Jul 23 18:35:58 2018(r336646)
+++ stable/10/sys/sys/event.h   Mon Jul 23 18:47:04 2018(r336647)
@@ -73,9 +73,9 @@
 struct kevent {
uintptr_t   ident;  /* identifier for this event */
short   filter; /* filter for event */
-   u_short flags;
-   u_int   fflags;
-   intptr_tdata;
+   u_short flags;  /* action flags for kqueue */
+   u_int   fflags; /* filter flag value */
+   intptr_tdata;   /* filter data value */
void*udata; /* opaque user data identifier */
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r336646 - stable/11/sys/sys

2018-07-23 Thread David Bright
Author: dab
Date: Mon Jul 23 18:35:58 2018
New Revision: 336646
URL: https://svnweb.freebsd.org/changeset/base/336646

Log:
  MFC r336457:
  
  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.
  
  Sponsored by: Dell EMC

Modified:
  stable/11/sys/sys/event.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/sys/event.h
==
--- stable/11/sys/sys/event.h   Mon Jul 23 18:08:56 2018(r336645)
+++ stable/11/sys/sys/event.h   Mon Jul 23 18:35:58 2018(r336646)
@@ -74,9 +74,9 @@
 struct kevent {
uintptr_t   ident;  /* identifier for this event */
short   filter; /* filter for event */
-   u_short flags;
-   u_int   fflags;
-   intptr_tdata;
+   u_short flags;  /* action flags for kqueue */
+   u_int   fflags; /* filter flag value */
+   intptr_tdata;   /* filter data value */
void*udata; /* opaque user data identifier */
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r336457 - head/sys/sys

2018-07-18 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r336200 - stable/10/sys/sys

2018-07-11 Thread David Bright
Author: dab
Date: Wed Jul 11 14:56:38 2018
New Revision: 336200
URL: https://svnweb.freebsd.org/changeset/base/336200

Log:
  MFC r335765, r335776, r336186:
  
  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 
  Sponsored by: Dell EMC

Modified:
  stable/10/sys/sys/event.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/sys/event.h
==
--- stable/10/sys/sys/event.h   Wed Jul 11 14:54:56 2018(r336199)
+++ stable/10/sys/sys/event.h   Wed Jul 11 14:56:38 2018(r336200)
@@ -44,6 +44,21 @@
 #define EVFILT_USER(-11)   /* User events */
 #define EVFILT_SYSCOUNT11
 
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#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),   \
+   };  \
+} 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);\
@@ -53,6 +68,7 @@
(kevp)->data = (e); \
(kevp)->udata = (f);\
 } while(0)
+#endif
 
 struct kevent {
uintptr_t   ident;  /* identifier for this event */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r336198 - stable/11/sys/sys

2018-07-11 Thread David Bright
Author: dab
Date: Wed Jul 11 14:50:06 2018
New Revision: 336198
URL: https://svnweb.freebsd.org/changeset/base/336198

Log:
  MFC r335765, r335776, r336186:
  
  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 
  Sponsored by: Dell EMC

Modified:
  stable/11/sys/sys/event.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/sys/event.h
==
--- stable/11/sys/sys/event.h   Wed Jul 11 13:53:44 2018(r336197)
+++ stable/11/sys/sys/event.h   Wed Jul 11 14:50:06 2018(r336198)
@@ -45,6 +45,21 @@
 #define EVFILT_SENDFILE(-12)   /* attached to sendfile 
requests */
 #define EVFILT_SYSCOUNT12
 
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#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),   \
+   };  \
+} 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);\
@@ -54,6 +69,7 @@
(kevp)->data = (e); \
(kevp)->udata = (f);\
 } while(0)
+#endif
 
 struct kevent {
uintptr_t   ident;  /* identifier for this event */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r336186 - head/sys/sys

2018-07-10 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335776 - head/sys/sys

2018-06-28 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335765 - head/sys/sys

2018-06-28 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r331217 - stable/10/etc/rc.d

2018-03-19 Thread David Bright
Author: dab
Date: Mon Mar 19 17:38:35 2018
New Revision: 331217
URL: https://svnweb.freebsd.org/changeset/base/331217

Log:
  MFC r331015:
  
  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
  Sponsored by:   Dell EMC

Modified:
  stable/10/etc/rc.d/fsck
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/rc.d/fsck
==
--- stable/10/etc/rc.d/fsck Mon Mar 19 17:37:51 2018(r331216)
+++ stable/10/etc/rc.d/fsck Mon Mar 19 17:38:35 2018(r331217)
@@ -42,7 +42,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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r331216 - stable/11/etc/rc.d

2018-03-19 Thread David Bright
Author: dab
Date: Mon Mar 19 17:37:51 2018
New Revision: 331216
URL: https://svnweb.freebsd.org/changeset/base/331216

Log:
  MFC r331015:
  
  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
  Sponsored by:   Dell EMC

Modified:
  stable/11/etc/rc.d/fsck
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/etc/rc.d/fsck
==
--- stable/11/etc/rc.d/fsck Mon Mar 19 17:14:56 2018(r331215)
+++ stable/11/etc/rc.d/fsck Mon Mar 19 17:37:51 2018(r331216)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r331015 - head/etc/rc.d

2018-03-15 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r328013 - head/sbin/fsck_ffs

2018-03-10 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r330695 - in stable/10/usr.sbin/pw: . tests

2018-03-09 Thread David Bright
Author: dab
Date: Fri Mar  9 14:45:47 2018
New Revision: 330695
URL: https://svnweb.freebsd.org/changeset/base/330695

Log:
  MFC r330245:
  
  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 
  Sponsored by:   Dell EMC

Modified:
  stable/10/usr.sbin/pw/pw_user.c
  stable/10/usr.sbin/pw/tests/pw_useradd_test.sh
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/pw/pw_user.c
==
--- stable/10/usr.sbin/pw/pw_user.c Fri Mar  9 14:45:17 2018
(r330694)
+++ stable/10/usr.sbin/pw/pw_user.c Fri Mar  9 14:45:47 2018
(r330695)
@@ -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: stable/10/usr.sbin/pw/tests/pw_useradd_test.sh
==
--- stable/10/usr.sbin/pw/tests/pw_useradd_test.sh  Fri Mar  9 14:45:17 
2018(r330694)
+++ stable/10/usr.sbin/pw/tests/pw_useradd_test.sh  Fri Mar  9 14:45:47 
2018(r330695)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r330694 - in stable/11/usr.sbin/pw: . tests

2018-03-09 Thread David Bright
Author: dab
Date: Fri Mar  9 14:45:17 2018
New Revision: 330694
URL: https://svnweb.freebsd.org/changeset/base/330694

Log:
  MFC r330245:
  
  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 
  Sponsored by: Dell EMC

Modified:
  stable/11/usr.sbin/pw/pw_user.c
  stable/11/usr.sbin/pw/tests/pw_useradd_test.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/pw/pw_user.c
==
--- stable/11/usr.sbin/pw/pw_user.c Fri Mar  9 14:39:28 2018
(r330693)
+++ stable/11/usr.sbin/pw/pw_user.c Fri Mar  9 14:45:17 2018
(r330694)
@@ -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: stable/11/usr.sbin/pw/tests/pw_useradd_test.sh
==
--- stable/11/usr.sbin/pw/tests/pw_useradd_test.sh  Fri Mar  9 14:39:28 
2018(r330693)
+++ stable/11/usr.sbin/pw/tests/pw_useradd_test.sh  Fri Mar  9 14:45:17 
2018(r330694)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r330693 - stable/10/sbin/dhclient

2018-03-09 Thread David Bright
Author: dab
Date: Fri Mar  9 14:39:28 2018
New Revision: 330693
URL: https://svnweb.freebsd.org/changeset/base/330693

Log:
  MFC r330085:
  
  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 
  Sponsored by:   Dell EMC

Modified:
  stable/10/sbin/dhclient/dhclient.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/dhclient/dhclient.c
==
--- stable/10/sbin/dhclient/dhclient.c  Fri Mar  9 14:38:46 2018
(r330692)
+++ stable/10/sbin/dhclient/dhclient.c  Fri Mar  9 14:39:28 2018
(r330693)
@@ -1460,7 +1460,8 @@ cancel:
memcpy(_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(, ip->client->active->address.iabuf,
sizeof(from));
else
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r330692 - stable/11/sbin/dhclient

2018-03-09 Thread David Bright
Author: dab
Date: Fri Mar  9 14:38:46 2018
New Revision: 330692
URL: https://svnweb.freebsd.org/changeset/base/330692

Log:
  MFC r330085:
  
  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 
  Sponsored by:   Dell EMC

Modified:
  stable/11/sbin/dhclient/dhclient.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/dhclient/dhclient.c
==
--- stable/11/sbin/dhclient/dhclient.c  Fri Mar  9 14:34:42 2018
(r330691)
+++ stable/11/sbin/dhclient/dhclient.c  Fri Mar  9 14:38:46 2018
(r330692)
@@ -1478,7 +1478,8 @@ cancel:
memcpy(_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(, ip->client->active->address.iabuf,
sizeof(from));
else
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r330664 - stable/10/usr.sbin/syslogd

2018-03-08 Thread David Bright
Author: dab
Date: Thu Mar  8 17:14:16 2018
New Revision: 330664
URL: https://svnweb.freebsd.org/changeset/base/330664

Log:
  MFC r330034
  
  Fix a memory leak 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.
  
  PR:   198385
  Submitted by: Sreeram 
  Reported by:  Sreeram 
  Sponsored by: Dell EMC

Modified:
  stable/10/usr.sbin/syslogd/syslogd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/syslogd/syslogd.c
==
--- stable/10/usr.sbin/syslogd/syslogd.cThu Mar  8 17:04:36 2018
(r330663)
+++ stable/10/usr.sbin/syslogd/syslogd.cThu Mar  8 17:14:16 2018
(r330664)
@@ -161,7 +161,7 @@ STAILQ_HEAD(, funix) funixes =  { _default,
  * 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 {
@@ -353,10 +353,16 @@ close_filed(struct filed *f)
return;
 
switch (f->f_type) {
+   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:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r330661 - stable/11/usr.sbin/syslogd

2018-03-08 Thread David Bright
Author: dab
Date: Thu Mar  8 16:26:49 2018
New Revision: 330661
URL: https://svnweb.freebsd.org/changeset/base/330661

Log:
  MFC r330034
  
  Fix a memory leak 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.
  
  PR:   198385
  Submitted by: Sreeram 
  Reported by:  Sreeram 
  Sponsored by: Dell EMC

Modified:
  stable/11/usr.sbin/syslogd/syslogd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/syslogd/syslogd.c
==
--- stable/11/usr.sbin/syslogd/syslogd.cThu Mar  8 16:19:01 2018
(r330660)
+++ stable/11/usr.sbin/syslogd/syslogd.cThu Mar  8 16:26:49 2018
(r330661)
@@ -170,7 +170,7 @@ STAILQ_HEAD(, funix) funixes =  { _default,
  * 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 {
@@ -363,10 +363,16 @@ close_filed(struct filed *f)
return;
 
switch (f->f_type) {
+   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:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r330512 - stable/10/sys/libkern

2018-03-05 Thread David Bright
Author: dab
Date: Mon Mar  5 16:00:05 2018
New Revision: 330512
URL: https://svnweb.freebsd.org/changeset/base/330512

Log:
  MFC r330027
  
  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, , 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 
  Sponsored by: Dell EMC

Modified:
  stable/10/sys/libkern/iconv.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/libkern/iconv.c
==
--- stable/10/sys/libkern/iconv.c   Mon Mar  5 15:12:35 2018
(r330511)
+++ stable/10/sys/libkern/iconv.c   Mon Mar  5 16:00:05 2018
(r330512)
@@ -411,11 +411,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, ) != 0)
return EINVAL;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r330505 - stable/11/sys/libkern

2018-03-05 Thread David Bright
Author: dab
Date: Mon Mar  5 13:58:03 2018
New Revision: 330505
URL: https://svnweb.freebsd.org/changeset/base/330505

Log:
  MFC r330027
  
  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, , 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 
  Sponsored by: Dell EMC

Modified:
  stable/11/sys/libkern/iconv.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/libkern/iconv.c
==
--- stable/11/sys/libkern/iconv.c   Mon Mar  5 13:57:37 2018
(r330504)
+++ stable/11/sys/libkern/iconv.c   Mon Mar  5 13:58:03 2018
(r330505)
@@ -411,11 +411,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, ) != 0)
return EINVAL;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r330245 - in head/usr.sbin/pw: . tests

2018-03-01 Thread David Bright
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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


  1   2   >