svn commit: r350495 - stable/12/sbin/swapon

2019-07-31 Thread Doug Moore
Author: dougm
Date: Thu Aug  1 05:30:31 2019
New Revision: 350495
URL: https://svnweb.freebsd.org/changeset/base/350495

Log:
  MFC r350183, r350359
  
  In trimming on startup, define swapon_trim() to invoke swapon before
  closing the fd used for trimming so that a geli device isn't detached
  before swapon is invoked.  Add comments to explain the reason for the
  ordering of events.
  
  Reviewed by: alc
  Approved by: markj (mentor, implicit)

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

Modified: stable/12/sbin/swapon/swapon.c
==
--- stable/12/sbin/swapon/swapon.c  Thu Aug  1 03:59:25 2019
(r350494)
+++ stable/12/sbin/swapon/swapon.c  Thu Aug  1 05:30:31 2019
(r350495)
@@ -739,16 +739,18 @@ run_cmd(int *ofd, const char *cmdline, ...)
return (WEXITSTATUS(status));
 }
 
-static void
-swap_trim(const char *name)
+static int
+swapon_trim(const char *name)
 {
struct stat sb;
off_t ioarg[2], sz;
-   int fd;
+   int error, fd;
 
+   /* Open a descriptor to create a consumer of the device. */
fd = open(name, O_WRONLY);
if (fd < 0)
errx(1, "Cannot open %s", name);
+   /* Find the device size. */
if (fstat(fd, ) < 0)
errx(1, "Cannot stat %s", name);
if (S_ISREG(sb.st_mode))
@@ -758,11 +760,24 @@ swap_trim(const char *name)
err(1, "ioctl(DIOCGMEDIASIZE)");
} else
errx(1, "%s has an invalid file type", name);
+   /* Trim the device. */
ioarg[0] = 0;
ioarg[1] = sz;
if (ioctl(fd, DIOCGDELETE, ioarg) != 0)
warn("ioctl(DIOCGDELETE)");
+
+   /* Start using the device for swapping, creating a second consumer. */
+   error = swapon(name);
+
+   /*
+* Do not close the device until the swap pager has attempted to create
+* another consumer.  For GELI devices created with the 'detach -l'
+* option, removing the last consumer causes the device to be detached
+* - that is, to disappear.  This ordering ensures that the device will
+* not be detached until swapoff is called.
+*/
close(fd);
+   return (error);
 }
 
 static const char *
@@ -770,11 +785,9 @@ swap_on_off_sfile(const char *name, int doingall)
 {
int error;
 
-   if (which_prog == SWAPON) {
-   if (Eflag)
-   swap_trim(name);
-   error = swapon(name);
-   } else /* SWAPOFF */
+   if (which_prog == SWAPON)
+   error = Eflag ? swapon_trim(name) : swapon(name);
+   else /* SWAPOFF */
error = swapoff(name);
 
if (error == -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: r350494 - head/sys/powerpc/powernv

2019-07-31 Thread Justin Hibbits
Author: jhibbits
Date: Thu Aug  1 03:59:25 2019
New Revision: 350494
URL: https://svnweb.freebsd.org/changeset/base/350494

Log:
  powerpc/powernv: Only clear EEH freeze for some errors
  
  Only clear an EEH freeze if an error occurs.  However, if an OPAL_HARDWARE
  error is returned, this indicates a hardware failure which cannot be
  unfrozen, and instead needs a hardware reset.  Attempting to unfreeze a
  broken PCH will result in console spam for each attempt.  To avoid the spam,
  just don't do it.

Modified:
  head/sys/powerpc/powernv/opal.h
  head/sys/powerpc/powernv/opal_pci.c

Modified: head/sys/powerpc/powernv/opal.h
==
--- head/sys/powerpc/powernv/opal.h Thu Aug  1 03:55:58 2019
(r350493)
+++ head/sys/powerpc/powernv/opal.h Thu Aug  1 03:59:25 2019
(r350494)
@@ -53,6 +53,7 @@ int opal_call(uint64_t token, ...);
 #defineOPAL_PCI_CONFIG_WRITE_BYTE  16
 #defineOPAL_PCI_CONFIG_WRITE_HALF_WORD 17
 #defineOPAL_PCI_CONFIG_WRITE_WORD  18
+#defineOPAL_PCI_EEH_FREEZE_STATUS  23
 #defineOPAL_PCI_EEH_FREEZE_CLEAR   26
 #defineOPAL_PCI_PHB_MMIO_ENABLE27
 #defineOPAL_PCI_SET_PHB_MEM_WINDOW 28

Modified: head/sys/powerpc/powernv/opal_pci.c
==
--- head/sys/powerpc/powernv/opal_pci.c Thu Aug  1 03:55:58 2019
(r350493)
+++ head/sys/powerpc/powernv/opal_pci.c Thu Aug  1 03:59:25 2019
(r350494)
@@ -117,6 +117,8 @@ static bus_dma_tag_t opalpci_get_dma_tag(device_t dev,
 #defineOPAL_EEH_ACTION_CLEAR_FREEZE_DMA2
 #defineOPAL_EEH_ACTION_CLEAR_FREEZE_ALL3
 
+#defineOPAL_EEH_STOPPED_NOT_FROZEN 0
+
 /*
  * Constants
  */
@@ -501,10 +503,11 @@ opalpci_read_config(device_t dev, u_int bus, u_int slo
 {
struct opalpci_softc *sc;
uint64_t config_addr;
-   uint8_t byte;
+   uint8_t byte, eeh_state;
uint16_t half;
uint32_t word;
int error;
+   uint16_t err_type;
 
sc = device_get_softc(dev);
 
@@ -536,11 +539,19 @@ opalpci_read_config(device_t dev, u_int bus, u_int slo
 *
 * XXX: Make this conditional on the existence of a freeze
 */
-   opal_call(OPAL_PCI_EEH_FREEZE_CLEAR, sc->phb_id, OPAL_PCI_DEFAULT_PE,
-   OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);

-   if (error != OPAL_SUCCESS)
+   if (error != OPAL_SUCCESS) {
+   if (error != OPAL_HARDWARE) {
+   opal_call(OPAL_PCI_EEH_FREEZE_STATUS, sc->phb_id,
+   OPAL_PCI_DEFAULT_PE, vtophys(_state),
+   vtophys(_type), NULL);
+   if (eeh_state != OPAL_EEH_STOPPED_NOT_FROZEN)
+   opal_call(OPAL_PCI_EEH_FREEZE_CLEAR,
+   sc->phb_id, OPAL_PCI_DEFAULT_PE,
+   OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
+   }
word = 0x;
+   }
 
return (word);
 }
@@ -552,6 +563,8 @@ opalpci_write_config(device_t dev, u_int bus, u_int sl
struct opalpci_softc *sc;
uint64_t config_addr;
int error = OPAL_SUCCESS;
+   uint16_t err_type;
+   uint8_t eeh_state;
 
sc = device_get_softc(dev);
 
@@ -577,8 +590,15 @@ opalpci_write_config(device_t dev, u_int bus, u_int sl
 * Poking config state for non-existant devices can make
 * the host bridge hang up. Clear any errors.
 */
-   opal_call(OPAL_PCI_EEH_FREEZE_CLEAR, sc->phb_id,
-   OPAL_PCI_DEFAULT_PE, OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
+   if (error != OPAL_HARDWARE) {
+   opal_call(OPAL_PCI_EEH_FREEZE_STATUS, sc->phb_id,
+   OPAL_PCI_DEFAULT_PE, vtophys(_state),
+   vtophys(_type), NULL);
+   if (eeh_state != OPAL_EEH_STOPPED_NOT_FROZEN)
+   opal_call(OPAL_PCI_EEH_FREEZE_CLEAR,
+   sc->phb_id, OPAL_PCI_DEFAULT_PE,
+   OPAL_EEH_ACTION_CLEAR_FREEZE_ALL);
+   }
}
 }
 
___
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: r350493 - in head/sys/powerpc: aim include

2019-07-31 Thread Justin Hibbits
Author: jhibbits
Date: Thu Aug  1 03:55:58 2019
New Revision: 350493
URL: https://svnweb.freebsd.org/changeset/base/350493

Log:
  powerpc64/mmu: Use a SLIST for the PVO delete list, instead of a RB_TREE
  
  Summary:
  Although it's convenient to reuse the pvo_plist for deletion, RB_TREE
  insertion and removal is not free, and can result in a lot of extra work
  to rebalance the tree.  Instead, use a SLIST as a LIFO delete queue,
  which gives us almost free insertion, deletion, and traversal.
  
  Reviewed by:  luporl
  Differential Revision: https://reviews.freebsd.org/D21061

Modified:
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/include/pmap.h

Modified: head/sys/powerpc/aim/mmu_oea64.c
==
--- head/sys/powerpc/aim/mmu_oea64.cThu Aug  1 02:16:48 2019
(r350492)
+++ head/sys/powerpc/aim/mmu_oea64.cThu Aug  1 03:55:58 2019
(r350493)
@@ -2364,9 +2364,9 @@ void
 moea64_remove_pages(mmu_t mmu, pmap_t pm)
 {
struct pvo_entry *pvo, *tpvo;
-   struct pvo_tree tofree;
+   struct pvo_dlist tofree;
 
-   RB_INIT();
+   SLIST_INIT();
 
PMAP_LOCK(pm);
RB_FOREACH_SAFE(pvo, pvo_tree, >pmap_pvo, tpvo) {
@@ -2379,13 +2379,14 @@ moea64_remove_pages(mmu_t mmu, pmap_t pm)
 * pass
 */
moea64_pvo_remove_from_pmap(mmu, pvo);
-   RB_INSERT(pvo_tree, , pvo);
+   SLIST_INSERT_HEAD(, pvo, pvo_dlink);
}
PMAP_UNLOCK(pm);
 
-   RB_FOREACH_SAFE(pvo, pvo_tree, , tpvo) {
+   while (!SLIST_EMPTY()) {
+   pvo = SLIST_FIRST();
+   SLIST_REMOVE_HEAD(, pvo_dlink);
moea64_pvo_remove_from_page(mmu, pvo);
-   RB_REMOVE(pvo_tree, , pvo);
free_pvo_entry(pvo);
}
 }
@@ -2397,7 +2398,7 @@ void
 moea64_remove(mmu_t mmu, pmap_t pm, vm_offset_t sva, vm_offset_t eva)
 {
struct  pvo_entry *pvo, *tpvo, key;
-   struct pvo_tree tofree;
+   struct pvo_dlist tofree;
 
/*
 * Perform an unsynchronized read.  This is, however, safe.
@@ -2407,7 +2408,7 @@ moea64_remove(mmu_t mmu, pmap_t pm, vm_offset_t sva, v
 
key.pvo_vaddr = sva;
 
-   RB_INIT();
+   SLIST_INIT();
 
PMAP_LOCK(pm);
for (pvo = RB_NFIND(pvo_tree, >pmap_pvo, );
@@ -2420,13 +2421,14 @@ moea64_remove(mmu_t mmu, pmap_t pm, vm_offset_t sva, v
 * pass
 */
moea64_pvo_remove_from_pmap(mmu, pvo);
-   RB_INSERT(pvo_tree, , pvo);
+   SLIST_INSERT_HEAD(, pvo, pvo_dlink);
}
PMAP_UNLOCK(pm);
 
-   RB_FOREACH_SAFE(pvo, pvo_tree, , tpvo) {
+   while (!SLIST_EMPTY()) {
+   pvo = SLIST_FIRST();
+   SLIST_REMOVE_HEAD(, pvo_dlink);
moea64_pvo_remove_from_page(mmu, pvo);
-   RB_REMOVE(pvo_tree, , pvo);
free_pvo_entry(pvo);
}
 }

Modified: head/sys/powerpc/include/pmap.h
==
--- head/sys/powerpc/include/pmap.h Thu Aug  1 02:16:48 2019
(r350492)
+++ head/sys/powerpc/include/pmap.h Thu Aug  1 03:55:58 2019
(r350493)
@@ -90,7 +90,10 @@ struct pvo_entry {
 #ifndef __powerpc64__
LIST_ENTRY(pvo_entry) pvo_olink;/* Link to overflow entry */
 #endif
-   RB_ENTRY(pvo_entry) pvo_plink;  /* Link to pmap entries */
+   union {
+   RB_ENTRY(pvo_entry) pvo_plink;  /* Link to pmap entries */
+   SLIST_ENTRY(pvo_entry) pvo_dlink; /* Link to delete enty */
+   };
struct {
 #ifndef __powerpc64__
/* 32-bit fields */
@@ -106,6 +109,7 @@ struct pvo_entry {
uint64_tpvo_vpn;/* Virtual page number */
 };
 LIST_HEAD(pvo_head, pvo_entry);
+SLIST_HEAD(pvo_dlist, pvo_entry);
 RB_HEAD(pvo_tree, pvo_entry);
 int pvo_vaddr_compare(struct pvo_entry *, struct pvo_entry *);
 RB_PROTOTYPE(pvo_tree, pvo_entry, pvo_plink, pvo_vaddr_compare);
___
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: r350492 - in head/sys/amd64: include vmm vmm/intel vmm/io

2019-07-31 Thread Ed Maste
Author: emaste
Date: Thu Aug  1 02:16:48 2019
New Revision: 350492
URL: https://svnweb.freebsd.org/changeset/base/350492

Log:
  vmx: use C99 bool, not boolean_t
  
  Bhyve's vmm is a self-contained modern component and thus a good
  candidate for use of C99 types.
  
  Reviewed by:  jhb, kib, markj, Patrick Mooney
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21036

Modified:
  head/sys/amd64/include/vmm.h
  head/sys/amd64/vmm/intel/vmx.c
  head/sys/amd64/vmm/intel/vmx_msr.c
  head/sys/amd64/vmm/io/ppt.c
  head/sys/amd64/vmm/io/ppt.h
  head/sys/amd64/vmm/vmm.c
  head/sys/amd64/vmm/vmm_lapic.c
  head/sys/amd64/vmm/vmm_lapic.h
  head/sys/amd64/vmm/vmm_util.c
  head/sys/amd64/vmm/vmm_util.h

Modified: head/sys/amd64/include/vmm.h
==
--- head/sys/amd64/include/vmm.hWed Jul 31 23:36:23 2019
(r350491)
+++ head/sys/amd64/include/vmm.hThu Aug  1 02:16:48 2019
(r350492)
@@ -319,12 +319,12 @@ vcpu_reqidle(struct vm_eventinfo *info)
 int vcpu_debugged(struct vm *vm, int vcpuid);
 
 /*
- * Return 1 if device indicated by bus/slot/func is supposed to be a
+ * Return true if device indicated by bus/slot/func is supposed to be a
  * pci passthrough device.
  *
- * Return 0 otherwise.
+ * Return false otherwise.
  */
-int vmm_is_pptdev(int bus, int slot, int func);
+bool vmm_is_pptdev(int bus, int slot, int func);
 
 void *vm_iommu_domain(struct vm *vm);
 

Modified: head/sys/amd64/vmm/intel/vmx.c
==
--- head/sys/amd64/vmm/intel/vmx.c  Wed Jul 31 23:36:23 2019
(r350491)
+++ head/sys/amd64/vmm/intel/vmx.c  Thu Aug  1 02:16:48 2019
(r350492)
@@ -1973,20 +1973,20 @@ ept_fault_type(uint64_t ept_qual)
return (fault_type);
 }
 
-static boolean_t
+static bool
 ept_emulation_fault(uint64_t ept_qual)
 {
int read, write;
 
/* EPT fault on an instruction fetch doesn't make sense here */
if (ept_qual & EPT_VIOLATION_INST_FETCH)
-   return (FALSE);
+   return (false);
 
/* EPT fault must be a read fault or a write fault */
read = ept_qual & EPT_VIOLATION_DATA_READ ? 1 : 0;
write = ept_qual & EPT_VIOLATION_DATA_WRITE ? 1 : 0;
if ((read | write) == 0)
-   return (FALSE);
+   return (false);
 
/*
 * The EPT violation must have been caused by accessing a
@@ -1995,10 +1995,10 @@ ept_emulation_fault(uint64_t ept_qual)
 */
if ((ept_qual & EPT_VIOLATION_GLA_VALID) == 0 ||
(ept_qual & EPT_VIOLATION_XLAT_VALID) == 0) {
-   return (FALSE);
+   return (false);
}
 
-   return (TRUE);
+   return (true);
 }
 
 static __inline int

Modified: head/sys/amd64/vmm/intel/vmx_msr.c
==
--- head/sys/amd64/vmm/intel/vmx_msr.c  Wed Jul 31 23:36:23 2019
(r350491)
+++ head/sys/amd64/vmm/intel/vmx_msr.c  Thu Aug  1 02:16:48 2019
(r350492)
@@ -45,24 +45,18 @@ __FBSDID("$FreeBSD$");
 #include "vmx.h"
 #include "vmx_msr.h"
 
-static boolean_t
+static bool
 vmx_ctl_allows_one_setting(uint64_t msr_val, int bitpos)
 {
 
-   if (msr_val & (1UL << (bitpos + 32)))
-   return (TRUE);
-   else
-   return (FALSE);
+   return ((msr_val & (1UL << (bitpos + 32))) != 0);
 }
 
-static boolean_t
+static bool
 vmx_ctl_allows_zero_setting(uint64_t msr_val, int bitpos)
 {
 
-   if ((msr_val & (1UL << bitpos)) == 0)
-   return (TRUE);
-   else
-   return (FALSE);
+   return ((msr_val & (1UL << bitpos)) == 0);
 }
 
 uint32_t
@@ -89,16 +83,13 @@ vmx_set_ctlreg(int ctl_reg, int true_ctl_reg, uint32_t
 {
int i;
uint64_t val, trueval;
-   boolean_t true_ctls_avail, one_allowed, zero_allowed;
+   bool true_ctls_avail, one_allowed, zero_allowed;
 
/* We cannot ask the same bit to be set to both '1' and '0' */
if ((ones_mask ^ zeros_mask) != (ones_mask | zeros_mask))
return (EINVAL);
 
-   if (rdmsr(MSR_VMX_BASIC) & (1UL << 55))
-   true_ctls_avail = TRUE;
-   else
-   true_ctls_avail = FALSE;
+   true_ctls_avail = (rdmsr(MSR_VMX_BASIC) & (1UL << 55)) != 0;
 
val = rdmsr(ctl_reg);
if (true_ctls_avail)

Modified: head/sys/amd64/vmm/io/ppt.c
==
--- head/sys/amd64/vmm/io/ppt.c Wed Jul 31 23:36:23 2019(r350491)
+++ head/sys/amd64/vmm/io/ppt.c Thu Aug  1 02:16:48 2019(r350492)
@@ -339,7 +339,7 @@ ppt_assigned_devices(struct vm *vm)
return (num);
 }
 
-boolean_t
+bool
 ppt_is_mmio(struct vm *vm, vm_paddr_t gpa)
 {
int i;
@@ -355,11 +355,11 @@ 

svn commit: r350491 - head

2019-07-31 Thread Rick Macklem
Author: rmacklem
Date: Wed Jul 31 23:36:23 2019
New Revision: 350491
URL: https://svnweb.freebsd.org/changeset/base/350491

Log:
  Add an entry for the copy_file_range(2) syscall.

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==
--- head/RELNOTES   Wed Jul 31 22:44:58 2019(r350490)
+++ head/RELNOTES   Wed Jul 31 23:36:23 2019(r350491)
@@ -14,6 +14,9 @@ r350471:
gnop(8) can now configure a delay to be applied to read and write
request delays.  See the -d, -q and -x parameters.
 
+r350315, r350316:
+   Adds a Linux compatible copy_file_range(2) syscall.
+
 r350307:
libcap_random(3) has been removed.  Applications can use native
APIs to get random data in capability mode.
___
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: r350490 - in head/sys/ufs: ffs ufs

2019-07-31 Thread Kirk McKusick
Author: mckusick
Date: Wed Jul 31 22:44:58 2019
New Revision: 350490
URL: https://svnweb.freebsd.org/changeset/base/350490

Log:
  When updating the user or group disk quotas for the return of inodes or
  disk blocks, set the FORCE flag in the call to chkiq() or chkdq() since
  the user is always allowed to return resources and hence there is no need
  to check the user's credential .
  
  Reported by:Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of 
Fraunhofer FKIE
  Reported as:FS-1-UFS-1: Denial Of Service in mount (prison_priv_check)
  Discussed with: kib
  MFC:1 week
  Sponsored by:   Netflix

Modified:
  head/sys/ufs/ffs/ffs_inode.c
  head/sys/ufs/ffs/ffs_softdep.c
  head/sys/ufs/ufs/ufs_quota.c
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/ufs/ffs/ffs_inode.c
==
--- head/sys/ufs/ffs/ffs_inode.cWed Jul 31 21:48:35 2019
(r350489)
+++ head/sys/ufs/ffs/ffs_inode.cWed Jul 31 22:44:58 2019
(r350490)
@@ -263,7 +263,7 @@ ffs_truncate(vp, length, flags, cred)
if ((error = ffs_syncvnode(vp, MNT_WAIT, 0)) != 0)
return (error);
 #ifdef QUOTA
-   (void) chkdq(ip, -extblocks, NOCRED, 0);
+   (void) chkdq(ip, -extblocks, NOCRED, FORCE);
 #endif
vinvalbuf(vp, V_ALT, 0, 0);
vn_pages_remove(vp,
@@ -621,7 +621,7 @@ done:
DIP_SET(ip, i_blocks, 0);
ip->i_flag |= IN_CHANGE;
 #ifdef QUOTA
-   (void) chkdq(ip, -blocksreleased, NOCRED, 0);
+   (void) chkdq(ip, -blocksreleased, NOCRED, FORCE);
 #endif
return (allerror);
 

Modified: head/sys/ufs/ffs/ffs_softdep.c
==
--- head/sys/ufs/ffs/ffs_softdep.c  Wed Jul 31 21:48:35 2019
(r350489)
+++ head/sys/ufs/ffs/ffs_softdep.c  Wed Jul 31 22:44:58 2019
(r350490)
@@ -6682,7 +6682,7 @@ softdep_journal_freeblocks(ip, cred, length, flags)
 #ifdef QUOTA
/* Reference the quotas in case the block count is wrong in the end. */
quotaref(vp, freeblks->fb_quota);
-   (void) chkdq(ip, -datablocks, NOCRED, 0);
+   (void) chkdq(ip, -datablocks, NOCRED, FORCE);
 #endif
freeblks->fb_chkcnt = -datablocks;
UFS_LOCK(ump);
@@ -6946,7 +6946,7 @@ softdep_setup_freeblocks(ip, length, flags)
 #ifdef QUOTA
/* Reference the quotas in case the block count is wrong in the end. */
quotaref(ITOV(ip), freeblks->fb_quota);
-   (void) chkdq(ip, -datablocks, NOCRED, 0);
+   (void) chkdq(ip, -datablocks, NOCRED, FORCE);
 #endif
freeblks->fb_chkcnt = -datablocks;
UFS_LOCK(ump);

Modified: head/sys/ufs/ufs/ufs_quota.c
==
--- head/sys/ufs/ufs/ufs_quota.cWed Jul 31 21:48:35 2019
(r350489)
+++ head/sys/ufs/ufs/ufs_quota.cWed Jul 31 22:44:58 2019
(r350490)
@@ -159,6 +159,7 @@ chkdq(struct inode *ip, ufs2_daddr_t change, struct uc
struct vnode *vp = ITOV(ip);
int i, error, warn, do_check;
 
+   MPASS(cred != NOCRED || (flags & FORCE) != 0);
/*
 * Disk quotas must be turned off for system files.  Currently
 * snapshot and quota files.
@@ -311,6 +312,7 @@ chkiq(struct inode *ip, int change, struct ucred *cred
struct dquot *dq;
int i, error, warn, do_check;
 
+   MPASS(cred != NOCRED || (flags & FORCE) != 0);
 #ifdef DIAGNOSTIC
if ((flags & CHOWN) == 0)
chkdquot(ip);

Modified: head/sys/ufs/ufs/ufs_vnops.c
==
--- head/sys/ufs/ufs/ufs_vnops.cWed Jul 31 21:48:35 2019
(r350489)
+++ head/sys/ufs/ufs/ufs_vnops.cWed Jul 31 22:44:58 2019
(r350490)
@@ -811,8 +811,8 @@ ufs_chown(vp, uid, gid, cred, td)
ip->i_dquot[GRPQUOTA] = NODQUOT;
}
change = DIP(ip, i_blocks);
-   (void) chkdq(ip, -change, cred, CHOWN);
-   (void) chkiq(ip, -1, cred, CHOWN);
+   (void) chkdq(ip, -change, cred, CHOWN|FORCE);
+   (void) chkiq(ip, -1, cred, CHOWN|FORCE);
for (i = 0; i < MAXQUOTAS; i++) {
dqrele(vp, ip->i_dquot[i]);
ip->i_dquot[i] = NODQUOT;
___
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: r350488 - head/sys/netinet

2019-07-31 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul 31 21:39:03 2019
New Revision: 350488
URL: https://svnweb.freebsd.org/changeset/base/350488

Log:
  Small cleanup, no functional change intended.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Wed Jul 31 21:29:17 2019
(r350487)
+++ head/sys/netinet/sctp_output.c  Wed Jul 31 21:39:03 2019
(r350488)
@@ -9089,7 +9089,6 @@ sctp_send_heartbeat_ack(struct sctp_tcb *stcb,
struct sctp_chunkhdr *chdr;
struct sctp_tmit_chunk *chk;
 
-
if (net == NULL)
/* must have a net pointer */
return;
@@ -9107,13 +9106,8 @@ sctp_send_heartbeat_ack(struct sctp_tcb *stcb,
chdr = mtod(outchain, struct sctp_chunkhdr *);
chdr->chunk_type = SCTP_HEARTBEAT_ACK;
chdr->chunk_flags = 0;
-   if (chk_length % 4) {
-   /* need pad */
-   uint32_t cpthis = 0;
-   int padlen;
-
-   padlen = 4 - (chk_length % 4);
-   m_copyback(outchain, chk_length, padlen, (caddr_t));
+   if (chk_length % 4 != 0) {
+   sctp_pad_lastmbuf(outchain, 4 - (chk_length % 4), NULL);
}
sctp_alloc_a_chunk(stcb, chk);
if (chk == NULL) {
___
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: r350487 - head/sys/netinet

2019-07-31 Thread Michael Tuexen
Author: tuexen
Date: Wed Jul 31 21:29:17 2019
New Revision: 350487
URL: https://svnweb.freebsd.org/changeset/base/350487

Log:
  Consistently cleanup mbufs in case of other memory errors.
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_output.c

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Wed Jul 31 21:21:34 2019
(r350486)
+++ head/sys/netinet/sctp_output.c  Wed Jul 31 21:29:17 2019
(r350487)
@@ -5586,8 +5586,7 @@ do_a_abort:
m = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_NOWAIT, 1, MT_DATA);
if (m == NULL) {
/* No memory, INIT timer will re-attempt. */
-   if (op_err)
-   sctp_m_freem(op_err);
+   sctp_m_freem(op_err);
return;
}
chunk_len = (uint16_t)sizeof(struct sctp_init_ack_chunk);
@@ -5776,8 +5775,11 @@ do_a_abort:
net->ro._s_addr = 
sctp_source_address_selection(inp,
stcb, (sctp_route_t *)>ro,
net, 0, vrf_id);
-   if (net->ro._s_addr == NULL)
+   if (net->ro._s_addr == NULL) {
+   sctp_m_freem(op_err);
+   sctp_m_freem(m);
return;
+   }
 
net->src_addr_selected = 1;
 
@@ -5806,8 +5808,11 @@ do_a_abort:
net->ro._s_addr = 
sctp_source_address_selection(inp,
stcb, (sctp_route_t *)>ro,
net, 0, vrf_id);
-   if (net->ro._s_addr == NULL)
+   if (net->ro._s_addr == NULL) {
+   sctp_m_freem(op_err);
+   sctp_m_freem(m);
return;
+   }
 
net->src_addr_selected = 1;
}
@@ -5878,6 +5883,7 @@ do_a_abort:
so = inp->sctp_socket;
if (so == NULL) {
/* memory problem */
+   sctp_m_freem(op_err);
sctp_m_freem(m);
return;
} 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: r350486 - head/cddl/contrib/opensolaris/cmd/zfs

2019-07-31 Thread Wolfram Schneider
Author: wosch
Date: Wed Jul 31 21:21:34 2019
New Revision: 350486
URL: https://svnweb.freebsd.org/changeset/base/350486

Log:
  add forgotten opening bracket "("
  
  PR:   237514
  Reviewed by:  allanjude
  MFC after:soon for 11.3 and 12 series
  Differential Revision:https://reviews.freebsd.org/D21009

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs.8

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Jul 31 20:31:36 2019
(r350485)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Jul 31 21:21:34 2019
(r350486)
@@ -1501,7 +1501,9 @@ command, or by changing the value of the
 .Sy refreservation
 property, or
 .Sy reservation
-property on pool version 8 or earlier
+property on pool 
+.Po
+version 8 or earlier
 .Pc
 after the volume has been created.
 A "sparse volume" is a volume where the value of
___
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: r350485 - head/stand/powerpc/ofw

2019-07-31 Thread Leandro Lupori
Author: luporl
Date: Wed Jul 31 20:31:36 2019
New Revision: 350485
URL: https://svnweb.freebsd.org/changeset/base/350485

Log:
  [PPC64] Implement CAS
  
  Guest PPC OSs running under a hypervisor may communicate the features they
  support, in order for the hypervisor to expose a virtualized machine in the 
way
  the client (guest OS) expects (see LoPAPR 1.1 - B.6.2.3).
  
  This is done by calling the "/ibm,client-architecture-support" (CAS) method,
  informing supported features in option vectors.  Until now, FreeBSD wasn't
  using CAS, but instead relied on hypervisor/QEMU's defaults.
  
  The problem is that, without CAS, it is very inconvenient to run POWER9 VMs on
  a POWER9 host running with radix enabled.  This happens because, in this case,
  the QEMU default is to present the guest OS a dual MMU (HPT/RPT), instead of
  presenting a regular HPT MMU, as FreeBSD expects, resulting in an early panic.
  The known workarounds required either changing the host to disable radix or
  passing a flag to QEMU to run in a POWER8 compatible mode.
  
  With CAS, FreeBSD is now able to communicate that it wants an HPT MMU,
  independent of the host setup, which now makes FreeBSD work on POWER9/pseries,
  with KVM enabled and without hugepages (support added in a previous commit).
  
  As CAS is invoked through OpenFirmware's call-method interface, it needs to be
  performed early, when OpenFirmware is still operational. Besides, now that FDT
  is the default way to inspect the device tree on PPC, OFW call-method feature
  will be unavailable by default, when control is passed to the kernel. Because
  of this, the call to CAS is being performed at the loader, instead of at the
  kernel.
  
  To avoid regressions with old platforms, this change uses CAS only on
  POWER8/POWER9.
  
  Reviewed by:  jhibbits
  Differential Revision:https://reviews.freebsd.org/D20827

Added:
  head/stand/powerpc/ofw/cas.c   (contents, props changed)
Modified:
  head/stand/powerpc/ofw/Makefile
  head/stand/powerpc/ofw/main.c

Modified: head/stand/powerpc/ofw/Makefile
==
--- head/stand/powerpc/ofw/Makefile Wed Jul 31 20:23:10 2019
(r350484)
+++ head/stand/powerpc/ofw/Makefile Wed Jul 31 20:31:36 2019
(r350485)
@@ -25,6 +25,11 @@ SRCS+=   ucmpdi2.c
 SRCS+= ofwfdt.c
 .endif
 
+.if ${MACHINE_ARCH} == "powerpc64"
+SRCS+= cas.c
+CFLAGS+=   -DCAS
+.endif
+
 HELP_FILES=${FDTSRC}/help.fdt
 
 # Always add MI sources
@@ -34,7 +39,7 @@ HELP_FILES=   ${FDTSRC}/help.fdt
 
 # load address. set in linker script
 RELOC?=0x1C0
-CFLAGS+=   -DRELOC=${RELOC}
+CFLAGS+=   -DRELOC=${RELOC} -g
 
 LDFLAGS=   -nostdlib -static -T ${.CURDIR}/ldscript.powerpc
 

Added: head/stand/powerpc/ofw/cas.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/stand/powerpc/ofw/cas.cWed Jul 31 20:31:36 2019
(r350485)
@@ -0,0 +1,225 @@
+/*-
+ * Copyright (c) 2019 Leandro Lupori
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+
+/* PVR */
+#define PVR_VER_P8E0x004b
+#define PVR_VER_P8NVL  0x004c
+#define PVR_VER_P8 0x004d
+#define PVR_VER_P9 0x004e
+#define PVR_VER_MASK   0x
+
+/* loader version of kernel's CPU_MAXSIZE */
+#define MAX_CPUS   ((uint32_t)256u)
+
+/* Option Vectors' settings */
+
+/* length of ignored OV */
+#define OV_IGN_LEN 0
+
+/* byte 1 (of any OV) */
+#define OV_IGN 

svn commit: r350484 - in head/sys: amd64/amd64 compat/freebsd32 compat/ia32 kern sys

2019-07-31 Thread Konstantin Belousov
Author: kib
Date: Wed Jul 31 20:23:10 2019
New Revision: 350484
URL: https://svnweb.freebsd.org/changeset/base/350484

Log:
  Make randomized stack gap between strings and pointers to argv/envs.
  
  This effectively makes the stack base on the csu _start entry
  randomized.
  
  The gap is enabled if ASLR is for the ABI is enabled, and then
  kern.elf{64,32}.aslr.stack_gap specify the max percentage of the
  initial stack size that can be wasted for gap.  Setting it to zero
  disables the gap, and max is capped at 50%.
  
  Only amd64 for now.
  
  Reviewed by:  cem, markj
  Discussed with:   emaste
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential revision:https://reviews.freebsd.org/D21081

Modified:
  head/sys/amd64/amd64/elf_machdep.c
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/compat/ia32/ia32_sysvec.c
  head/sys/kern/imgact_elf.c
  head/sys/kern/kern_exec.c
  head/sys/sys/imgact.h
  head/sys/sys/imgact_elf.h
  head/sys/sys/sysent.h

Modified: head/sys/amd64/amd64/elf_machdep.c
==
--- head/sys/amd64/amd64/elf_machdep.c  Wed Jul 31 20:04:39 2019
(r350483)
+++ head/sys/amd64/amd64/elf_machdep.c  Wed Jul 31 20:23:10 2019
(r350484)
@@ -82,6 +82,7 @@ struct sysentvec elf64_freebsd_sysvec = {
.sv_schedtail   = NULL,
.sv_thread_detach = NULL,
.sv_trap= NULL,
+   .sv_stackgap= elf64_stackgap,
 };
 INIT_SYSENTVEC(elf64_sysvec, _freebsd_sysvec);
 

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==
--- head/sys/compat/freebsd32/freebsd32_misc.c  Wed Jul 31 20:04:39 2019
(r350483)
+++ head/sys/compat/freebsd32/freebsd32_misc.c  Wed Jul 31 20:23:10 2019
(r350484)
@@ -3166,6 +3166,9 @@ freebsd32_copyout_strings(struct image_params *imgp)
destp = rounddown2(destp, sizeof(uint32_t));
 
vectp = (uint32_t *)destp;
+   if (imgp->sysent->sv_stackgap != NULL)
+   imgp->sysent->sv_stackgap(imgp, (u_long *));
+
if (imgp->auxargs) {
/*
 * Allocate room on the stack for the ELF auxargs

Modified: head/sys/compat/ia32/ia32_sysvec.c
==
--- head/sys/compat/ia32/ia32_sysvec.c  Wed Jul 31 20:04:39 2019
(r350483)
+++ head/sys/compat/ia32/ia32_sysvec.c  Wed Jul 31 20:23:10 2019
(r350484)
@@ -128,6 +128,7 @@ struct sysentvec ia32_freebsd_sysvec = {
.sv_schedtail   = NULL,
.sv_thread_detach = NULL,
.sv_trap= NULL,
+   .sv_stackgap= elf32_stackgap,
 };
 INIT_SYSENTVEC(elf_ia32_sysvec, _freebsd_sysvec);
 

Modified: head/sys/kern/imgact_elf.c
==
--- head/sys/kern/imgact_elf.c  Wed Jul 31 20:04:39 2019(r350483)
+++ head/sys/kern/imgact_elf.c  Wed Jul 31 20:23:10 2019(r350484)
@@ -156,6 +156,12 @@ SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, honor_sbrk, CTLFLA
 &__elfN(aslr_honor_sbrk), 0,
 __XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE)) ": assume sbrk is used");
 
+static int __elfN(aslr_stack_gap) = 3;
+SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, stack_gap, CTLFLAG_RW,
+&__elfN(aslr_stack_gap), 0,
+__XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE))
+": maximum percentage of main stack to waste on a random gap");
+
 static Elf_Brandinfo *elf_brand_list[MAX_BRANDS];
 
 #definealigned(a, t)   (rounddown2((u_long)(a), sizeof(t)) == 
(u_long)(a))
@@ -2719,4 +2725,25 @@ __elfN(untrans_prot)(vm_prot_t prot)
if (prot & VM_PROT_WRITE)
flags |= PF_W;
return (flags);
+}
+
+void
+__elfN(stackgap)(struct image_params *imgp, u_long *stack_base)
+{
+   u_long range, rbase, gap;
+   int pct;
+
+   if ((imgp->map_flags & MAP_ASLR) == 0)
+   return;
+   pct = __elfN(aslr_stack_gap);
+   if (pct == 0)
+   return;
+   if (pct > 50)
+   pct = 50;
+   range = imgp->eff_stack_sz * pct / 100;
+   range *= pct;
+   arc4rand(, sizeof(rbase), 0);
+   gap = rbase % range;
+   gap &= ~(sizeof(u_long) - 1);
+   *stack_base -= gap;
 }

Modified: head/sys/kern/kern_exec.c
==
--- head/sys/kern/kern_exec.c   Wed Jul 31 20:04:39 2019(r350483)
+++ head/sys/kern/kern_exec.c   Wed Jul 31 20:23:10 2019(r350484)
@@ -1128,6 +1128,7 @@ exec_new_vmspace(struct image_params *imgp, struct sys
} else {
ssiz = maxssiz;
}
+   imgp->eff_stack_sz = ssiz;
stack_addr = sv->sv_usrstack - ssiz;
error = vm_map_stack(map, stack_addr, (vm_size_t)ssiz,
obj != NULL && imgp->stack_prot != 0 ? imgp->stack_prot :
@@ -1615,6 +1616,9 @@ exec_copyout_strings(struct 

svn commit: r350483 - head/lib/libthr/thread

2019-07-31 Thread Konstantin Belousov
Author: kib
Date: Wed Jul 31 20:04:39 2019
New Revision: 350483
URL: https://svnweb.freebsd.org/changeset/base/350483

Log:
  Avoid conflicts with libc symbols in libthr jump table.
  
  In some corner cases of static linking and unexpected libraries order
  on the linker command line, libc symbol might preempt the same libthr
  symbol, in which case libthr jump table points back to libc causing
  either infinite recursion or loop.  Handle all of such symbols by
  using private libthr names for them, ensuring that the right pointers
  are installed into the table.
  
  In collaboration with: arichardson
  PR:   239475
  Tested by:pho
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential revision:https://reviews.freebsd.org/D21088

Modified:
  head/lib/libthr/thread/thr_private.h

Modified: head/lib/libthr/thread/thr_private.h
==
--- head/lib/libthr/thread/thr_private.hWed Jul 31 19:32:39 2019
(r350482)
+++ head/lib/libthr/thread/thr_private.hWed Jul 31 20:04:39 2019
(r350483)
@@ -1021,8 +1021,6 @@ void __thr_cleanup_push_imp(void (*)(void *), void *,
 void __thr_cleanup_pop_imp(int);
 void _thr_cleanup_push(void (*)(void *), void *);
 void _thr_cleanup_pop(int);
-void _thr_cancel_enter(struct pthread *);
-void _thr_cancel_leave(struct pthread *, int);
 void _Tthr_testcancel(void);
 int _thr_cancel(pthread_t);
 int _thr_atfork(void (*)(void), void (*)(void), void (*)(void));
___
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: r350005 - head/sys/kern

2019-07-31 Thread Bryan Drewery
On 7/31/19 12:42 PM, Konstantin Belousov wrote:
> On Wed, Jul 31, 2019 at 10:08:39AM -0700, Bryan Drewery wrote:
>> On 7/30/19 10:14 PM, Konstantin Belousov wrote:
>>> No, you should create a situation where the python process ends the endless
>>> loop, as reported.  Then, it should become killable by 9 with the first
>>> chunk only applied.
>>>
>>
>> I don't have an easy way to test that. kill -9 inside the loop didn't
>> work. Once the loop ended the process was done; it is very short lived
>> and the calling code is buried in Python I think.
> With only the umtxq_check_susp() chunk applied, you would wait for
> python to start looping, then verify that kill -9 works.
> 
> Anyway, I believe that the change is correct, and put the review at
> https://reviews.freebsd.org/D21124.  I will commit after it get some
> sanity checking by mentioned people.
> 

Right. I did that earlier and it did not work. I can try again shortly.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r350005 - head/sys/kern

2019-07-31 Thread Konstantin Belousov
On Wed, Jul 31, 2019 at 10:08:39AM -0700, Bryan Drewery wrote:
> On 7/30/19 10:14 PM, Konstantin Belousov wrote:
> > No, you should create a situation where the python process ends the endless
> > loop, as reported.  Then, it should become killable by 9 with the first
> > chunk only applied.
> > 
> 
> I don't have an easy way to test that. kill -9 inside the loop didn't
> work. Once the loop ended the process was done; it is very short lived
> and the calling code is buried in Python I think.
With only the umtxq_check_susp() chunk applied, you would wait for
python to start looping, then verify that kill -9 works.

Anyway, I believe that the change is correct, and put the review at
https://reviews.freebsd.org/D21124.  I will commit after it get some
sanity checking by mentioned people.
___
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: r350482 - head

2019-07-31 Thread Mariusz Zaborski
Author: oshogbo
Date: Wed Jul 31 19:32:39 2019
New Revision: 350482
URL: https://svnweb.freebsd.org/changeset/base/350482

Log:
  gnop: add note to the RELNOTES
  
  Submitted by: markj

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==
--- head/RELNOTES   Wed Jul 31 19:27:20 2019(r350481)
+++ head/RELNOTES   Wed Jul 31 19:32:39 2019(r350482)
@@ -10,6 +10,10 @@ newline.  Entries should be separated by a newline.
 
 Changes to this file should not be MFCed.
 
+r350471:
+   gnop(8) can now configure a delay to be applied to read and write
+   request delays.  See the -d, -q and -x parameters.
+
 r350307:
libcap_random(3) has been removed.  Applications can use native
APIs to get random data in capability mode.
___
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: r350481 - head/lib/libthr/thread

2019-07-31 Thread Konstantin Belousov
Author: kib
Date: Wed Jul 31 19:27:20 2019
New Revision: 350481
URL: https://svnweb.freebsd.org/changeset/base/350481

Log:
  Avoid conflicts with libc symbols in libthr jump table.
  
  In some corner cases of static linking and unexpected libraries order
  on the linker command line, libc symbol might preempt the same libthr
  symbol, in which case libthr jump table points back to libc causing
  either infinite recursion or loop.  Handle all of such symbols by
  using private libthr names for them, ensuring that the right pointers
  are installed into the table.
  
  In collaboration with: arichardson
  PR:   239475
  Tested by:pho
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential revision:https://reviews.freebsd.org/D21088

Modified:
  head/lib/libthr/thread/thr_attr.c
  head/lib/libthr/thread/thr_cancel.c
  head/lib/libthr/thread/thr_clean.c
  head/lib/libthr/thread/thr_cond.c
  head/lib/libthr/thread/thr_detach.c
  head/lib/libthr/thread/thr_equal.c
  head/lib/libthr/thread/thr_exit.c
  head/lib/libthr/thread/thr_fork.c
  head/lib/libthr/thread/thr_getthreadid_np.c
  head/lib/libthr/thread/thr_init.c
  head/lib/libthr/thread/thr_join.c
  head/lib/libthr/thread/thr_kill.c
  head/lib/libthr/thread/thr_main_np.c
  head/lib/libthr/thread/thr_mutex.c
  head/lib/libthr/thread/thr_mutexattr.c
  head/lib/libthr/thread/thr_once.c
  head/lib/libthr/thread/thr_private.h
  head/lib/libthr/thread/thr_rwlock.c
  head/lib/libthr/thread/thr_self.c
  head/lib/libthr/thread/thr_sig.c
  head/lib/libthr/thread/thr_spec.c

Modified: head/lib/libthr/thread/thr_attr.c
==
--- head/lib/libthr/thread/thr_attr.c   Wed Jul 31 19:20:39 2019
(r350480)
+++ head/lib/libthr/thread/thr_attr.c   Wed Jul 31 19:27:20 2019
(r350481)
@@ -109,10 +109,11 @@ __FBSDID("$FreeBSD$");
 
 static size_t  _get_kern_cpuset_size(void);
 
-__weak_reference(_pthread_attr_destroy, pthread_attr_destroy);
+__weak_reference(_thr_attr_destroy, _pthread_attr_destroy);
+__weak_reference(_thr_attr_destroy, pthread_attr_destroy);
 
 int
-_pthread_attr_destroy(pthread_attr_t *attr)
+_thr_attr_destroy(pthread_attr_t *attr)
 {
int ret;
 
@@ -136,10 +137,11 @@ _pthread_attr_destroy(pthread_attr_t *attr)
return(ret);
 }
 
-__weak_reference(_pthread_attr_get_np, pthread_attr_get_np);
+__weak_reference(_thr_attr_get_np, pthread_attr_get_np);
+__weak_reference(_thr_attr_get_np, _pthread_attr_get_np);
 
 int
-_pthread_attr_get_np(pthread_t pthread, pthread_attr_t *dstattr)
+_thr_attr_get_np(pthread_t pthread, pthread_attr_t *dstattr)
 {
struct pthread *curthread;
struct pthread_attr attr, *dst;
@@ -173,10 +175,11 @@ _pthread_attr_get_np(pthread_t pthread, pthread_attr_t
return (ret);
 }
 
-__weak_reference(_pthread_attr_getdetachstate, pthread_attr_getdetachstate);
+__weak_reference(_thr_attr_getdetachstate, pthread_attr_getdetachstate);
+__weak_reference(_thr_attr_getdetachstate, _pthread_attr_getdetachstate);
 
 int
-_pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
+_thr_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
 {
int ret;
 
@@ -196,10 +199,11 @@ _pthread_attr_getdetachstate(const pthread_attr_t *att
return(ret);
 }
 
-__weak_reference(_pthread_attr_getguardsize, pthread_attr_getguardsize);
+__weak_reference(_thr_attr_getguardsize, pthread_attr_getguardsize);
+__weak_reference(_thr_attr_getguardsize, _pthread_attr_getguardsize);
 
 int
-_pthread_attr_getguardsize(const pthread_attr_t * __restrict attr,
+_thr_attr_getguardsize(const pthread_attr_t * __restrict attr,
 size_t * __restrict guardsize)
 {
int ret;
@@ -215,10 +219,11 @@ _pthread_attr_getguardsize(const pthread_attr_t * __re
return(ret);
 }
 
-__weak_reference(_pthread_attr_getinheritsched, pthread_attr_getinheritsched);
+__weak_reference(_thr_attr_getinheritsched, pthread_attr_getinheritsched);
+__weak_reference(_thr_attr_getinheritsched, _pthread_attr_getinheritsched);
 
 int
-_pthread_attr_getinheritsched(const pthread_attr_t * __restrict attr,
+_thr_attr_getinheritsched(const pthread_attr_t * __restrict attr,
 int * __restrict sched_inherit)
 {
int ret = 0;
@@ -231,10 +236,11 @@ _pthread_attr_getinheritsched(const pthread_attr_t * _
return(ret);
 }
 
-__weak_reference(_pthread_attr_getschedparam, pthread_attr_getschedparam);
+__weak_reference(_thr_attr_getschedparam, pthread_attr_getschedparam);
+__weak_reference(_thr_attr_getschedparam, _pthread_attr_getschedparam);
 
 int
-_pthread_attr_getschedparam(const pthread_attr_t * __restrict attr,
+_thr_attr_getschedparam(const pthread_attr_t * __restrict attr,
 struct sched_param * __restrict param)
 {
int ret = 0;
@@ -247,10 +253,11 @@ _pthread_attr_getschedparam(const pthread_attr_t * __r
return(ret);
 }
 
-__weak_reference(_pthread_attr_getschedpolicy, 

svn commit: r350479 - head/sys/compat/freebsd32

2019-07-31 Thread Konstantin Belousov
Author: kib
Date: Wed Jul 31 19:20:05 2019
New Revision: 350479
URL: https://svnweb.freebsd.org/changeset/base/350479

Log:
  freebsd32 shims for copy_file_range(2).
  
  Reviewed by:  brooks, rmacklem (previous version)
  Sponsored by: The FreeBSD Foundation
  Differential revision:https://reviews.freebsd.org/D21092

Modified:
  head/sys/compat/freebsd32/syscalls.master

Modified: head/sys/compat/freebsd32/syscalls.master
==
--- head/sys/compat/freebsd32/syscalls.master   Wed Jul 31 19:16:49 2019
(r350478)
+++ head/sys/compat/freebsd32/syscalls.master   Wed Jul 31 19:20:05 2019
(r350479)
@@ -1147,5 +1147,8 @@
size_t bufsize); }
 568AUE_UNLINKATNOPROTO { int funlinkat(int dfd, const char *path, int 
fd, \
int flag); }
+569AUE_NULLNOPROTO { ssize_t copy_file_range(int infd, \
+   off_t *inoffp, int outfd, off_t *outoffp, \
+   size_t len, unsigned int flags); }
 
 ; vim: syntax=off
___
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: r350480 - head/sys/compat/freebsd32

2019-07-31 Thread Konstantin Belousov
Author: kib
Date: Wed Jul 31 19:20:39 2019
New Revision: 350480
URL: https://svnweb.freebsd.org/changeset/base/350480

Log:
  Regen.

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

Modified: head/sys/compat/freebsd32/freebsd32_syscall.h
==
--- head/sys/compat/freebsd32/freebsd32_syscall.h   Wed Jul 31 19:20:05 
2019(r350479)
+++ head/sys/compat/freebsd32/freebsd32_syscall.h   Wed Jul 31 19:20:39 
2019(r350480)
@@ -495,4 +495,5 @@
 #defineFREEBSD32_SYS_fhlinkat  566
 #defineFREEBSD32_SYS_fhreadlink567
 #defineFREEBSD32_SYS_funlinkat 568
-#defineFREEBSD32_SYS_MAXSYSCALL569
+#defineFREEBSD32_SYS_copy_file_range   569
+#defineFREEBSD32_SYS_MAXSYSCALL570

Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c
==
--- head/sys/compat/freebsd32/freebsd32_syscalls.c  Wed Jul 31 19:20:05 
2019(r350479)
+++ head/sys/compat/freebsd32/freebsd32_syscalls.c  Wed Jul 31 19:20:39 
2019(r350480)
@@ -605,4 +605,5 @@ const char *freebsd32_syscallnames[] = {
"fhlinkat", /* 566 = fhlinkat */
"fhreadlink",   /* 567 = fhreadlink */
"funlinkat",/* 568 = funlinkat */
+   "copy_file_range",  /* 569 = copy_file_range */
 };

Modified: head/sys/compat/freebsd32/freebsd32_sysent.c
==
--- head/sys/compat/freebsd32/freebsd32_sysent.cWed Jul 31 19:20:05 
2019(r350479)
+++ head/sys/compat/freebsd32/freebsd32_sysent.cWed Jul 31 19:20:39 
2019(r350480)
@@ -652,4 +652,5 @@ struct sysent freebsd32_sysent[] = {
{ AS(fhlinkat_args), (sy_call_t *)sys_fhlinkat, AUE_NULL, NULL, 0, 0, 
0, SY_THR_STATIC },   /* 566 = fhlinkat */
{ AS(fhreadlink_args), (sy_call_t *)sys_fhreadlink, AUE_NULL, NULL, 0, 
0, 0, SY_THR_STATIC },   /* 567 = fhreadlink */
{ AS(funlinkat_args), (sy_call_t *)sys_funlinkat, AUE_UNLINKAT, NULL, 
0, 0, SYF_CAPENABLED, SY_THR_STATIC },/* 568 = funlinkat */
+   { 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 */
 };

Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c
==
--- head/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Jul 31 19:20:05 
2019(r350479)
+++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Jul 31 19:20:39 
2019(r350480)
@@ -3320,6 +3320,18 @@ systrace_args(int sysnum, void *params, uint64_t *uarg
*n_args = 4;
break;
}
+   /* copy_file_range */
+   case 569: {
+   struct copy_file_range_args *p = params;
+   iarg[0] = p->infd; /* int */
+   uarg[1] = (intptr_t) p->inoffp; /* off_t * */
+   iarg[2] = p->outfd; /* int */
+   uarg[3] = (intptr_t) p->outoffp; /* off_t * */
+   uarg[4] = p->len; /* size_t */
+   uarg[5] = p->flags; /* unsigned int */
+   *n_args = 6;
+   break;
+   }
default:
*n_args = 0;
break;
@@ -8934,6 +8946,31 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d
break;
};
break;
+   /* copy_file_range */
+   case 569:
+   switch(ndx) {
+   case 0:
+   p = "int";
+   break;
+   case 1:
+   p = "userland off_t *";
+   break;
+   case 2:
+   p = "int";
+   break;
+   case 3:
+   p = "userland off_t *";
+   break;
+   case 4:
+   p = "size_t";
+   break;
+   case 5:
+   p = "unsigned int";
+   break;
+   default:
+   break;
+   };
+   break;
default:
break;
};
@@ -10807,6 +10844,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char *
case 568:
if (ndx == 0 || ndx == 1)
p = "int";
+   break;
+   /* copy_file_range */
+   case 569:
+   if (ndx == 0 || ndx == 1)
+   p = "ssize_t";
break;
default:
break;

svn commit: r350478 - head/sys/kern

2019-07-31 Thread Konstantin Belousov
Author: kib
Date: Wed Jul 31 19:16:49 2019
New Revision: 350478
URL: https://svnweb.freebsd.org/changeset/base/350478

Log:
  Fix handling of transient casueword(9) failures in do_sem_wait().
  
  In particular, restart should be only done when the failure is
  transient.  For this, recheck the count1 value after the operation.
  
  Note that do_sem_wait() is older usem interface.
  
  Reported and tested by:   bdrewery
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/kern_umtx.c

Modified: head/sys/kern/kern_umtx.c
==
--- head/sys/kern/kern_umtx.c   Wed Jul 31 18:44:20 2019(r350477)
+++ head/sys/kern/kern_umtx.c   Wed Jul 31 19:16:49 2019(r350478)
@@ -3229,7 +3229,8 @@ again:
rv = casueword32(>_has_waiters, 0, , 1);
if (rv == 0)
rv1 = fueword32(>_count, );
-   if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) || rv == 1) {
+   if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) ||
+   (rv == 1 && count1 == 0)) {
umtxq_lock(>uq_key);
umtxq_unbusy(>uq_key);
umtxq_remove(uq);
___
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: r350477 - head/sbin/nvmecontrol

2019-07-31 Thread Alexander Motin
Author: mav
Date: Wed Jul 31 18:44:20 2019
New Revision: 350477
URL: https://svnweb.freebsd.org/changeset/base/350477

Log:
  Feature-complete NVMe Namespace Management.
  
  This adds several previously missed but important subcommands to list
  namespaces and controllers.  It also fixes few previously added but
  just found with real testing to be broken subcommands.
  
  Also while there, add possibility to explicitly specify nsid for
  `nvmecontrol identify` subcommand.  It may be useful to specify nsids
  not having own devices, for example 0x, or just newly created
  ones.
  
  MFC after:2 weeks
  Relnotes: yes
  Sponsored by: iXsystems, Inc.

Modified:
  head/sbin/nvmecontrol/identify.c
  head/sbin/nvmecontrol/identify_ext.c
  head/sbin/nvmecontrol/ns.c
  head/sbin/nvmecontrol/nvmecontrol.8
  head/sbin/nvmecontrol/nvmecontrol.c
  head/sbin/nvmecontrol/nvmecontrol.h

Modified: head/sbin/nvmecontrol/identify.c
==
--- head/sbin/nvmecontrol/identify.cWed Jul 31 18:40:43 2019
(r350476)
+++ head/sbin/nvmecontrol/identify.cWed Jul 31 18:44:20 2019
(r350477)
@@ -48,13 +48,15 @@ static struct options {
boolhex;
boolverbose;
const char  *dev;
+   uint32_tnsid;
 } opt = {
.hex = false,
.verbose = false,
.dev = NULL,
+   .nsid = 0,
 };
 
-static void
+void
 print_namespace(struct nvme_namespace_data *nsdata)
 {
uint32_ti;
@@ -204,22 +206,24 @@ identify_ns(const struct cmd *f, int argc, char *argv[
int fd, hexlength;
uint32_tnsid;
 
-   /*
-* Check if the specified device node exists before continuing.
-*  This is a cleaner check for cases where the correct controller
-*  is specified, but an invalid namespace on that controller.
-*/
open_dev(opt.dev, , 1, 1);
-   close(fd);
-
-   /*
-* We send IDENTIFY commands to the controller, not the namespace,
-*  since it is an admin cmd.  The namespace ID will be specified in
-*  the IDENTIFY command itself.  So parse the namespace's device node
-*  string to get the controller substring and namespace ID.
-*/
-   parse_ns_str(opt.dev, path, );
-   open_dev(path, , 1, 1);
+   if (strstr(opt.dev, NVME_NS_PREFIX) != NULL) {
+   /*
+* Now we know that provided device name is valid, that is
+* good for error reporting if specified controller name is
+* valid, but namespace ID is not.  But we send IDENTIFY
+* commands to the controller, not the namespace, since it
+* is an admin cmd.  The namespace ID will be specified in
+* the IDENTIFY command itself.  So parse the namespace's
+* device node string to get the controller device substring
+* and namespace ID.
+*/
+   close(fd);
+   parse_ns_str(opt.dev, path, );
+   open_dev(path, , 1, 1);
+   } else {
+   nsid = opt.nsid;
+   }
read_namespace_data(fd, nsid, );
close(fd);
 
@@ -248,10 +252,10 @@ identify(const struct cmd *f, int argc, char *argv[])
arg_parse(argc, argv, f);
 
/*
-* If device node contains "ns", we consider it a namespace,
-*  otherwise, consider it a controller.
+* If device node contains "ns" or nsid is specified, we consider
+* it a namespace request, otherwise, consider it a controller.
 */
-   if (strstr(opt.dev, NVME_NS_PREFIX) == NULL)
+   if (strstr(opt.dev, NVME_NS_PREFIX) == NULL && opt.nsid == 0)
identify_ctrlr(f, argc, argv);
else
identify_ns(f, argc, argv);
@@ -263,6 +267,8 @@ static const struct opts identify_opts[] = {
"Print identiy information in hex"),
OPT("verbose", 'v', arg_none, opt, verbose,
"More verbosity: print entire identify table"),
+   OPT("nsid", 'n', arg_uint32, opt, nsid,
+   "Namespace ID to use if not in device name"),
{ NULL, 0, arg_none, NULL, NULL }
 };
 #undef OPT
@@ -275,7 +281,7 @@ static const struct args identify_args[] = {
 static struct cmd identify_cmd = {
.name = "identify",
.fn = identify,
-   .descr = "Print a human-readable summary of the IDENTIFY information",
+   .descr = "Print summary of the IDENTIFY information",
.ctx_size = sizeof(opt),
.opts = identify_opts,
.args = identify_args,

Modified: head/sbin/nvmecontrol/identify_ext.c
==
--- head/sbin/nvmecontrol/identify_ext.cWed Jul 31 18:40:43 2019
(r350476)
+++ head/sbin/nvmecontrol/identify_ext.c

svn commit: r350476 - stable/12/share/mk

2019-07-31 Thread Brooks Davis
Author: brooks
Date: Wed Jul 31 18:40:43 2019
New Revision: 350476
URL: https://svnweb.freebsd.org/changeset/base/350476

Log:
  MFC r350159:
  
  Make setting mips endian and ABI less verbose.
  
  Allow ABI to be over ridden to allow (with other changes) programs to be
  built targeting ABIs other than the default.  This is used in CheriBSD.
  
  Reviewed by:  imp
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D21001

Modified:
  stable/12/share/mk/bsd.cpu.mk
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/mk/bsd.cpu.mk
==
--- stable/12/share/mk/bsd.cpu.mk   Wed Jul 31 18:25:52 2019
(r350475)
+++ stable/12/share/mk/bsd.cpu.mk   Wed Jul 31 18:40:43 2019
(r350476)
@@ -312,27 +312,20 @@ MACHINE_CPU = v9 ultrasparc ultrasparc3
 
 .if ${MACHINE_CPUARCH} == "mips"
 CFLAGS += -G0
+AFLAGS+= -${MIPS_ENDIAN} -mabi=${MIPS_ABI}
+CFLAGS+= -${MIPS_ENDIAN} -mabi=${MIPS_ABI}
+LDFLAGS+= -${MIPS_ENDIAN} -mabi=${MIPS_ABI}
 . if ${MACHINE_ARCH:Mmips*el*} != ""
-AFLAGS += -EL
-CFLAGS += -EL
-LDFLAGS += -EL
+MIPS_ENDIAN=   EL
 . else
-AFLAGS += -EB
-CFLAGS += -EB
-LDFLAGS += -EB
+MIPS_ENDIAN=   EB
 . endif
 . if ${MACHINE_ARCH:Mmips64*} != ""
-AFLAGS+= -mabi=64
-CFLAGS+= -mabi=64
-LDFLAGS+= -mabi=64
+MIPS_ABI?= 64
 . elif ${MACHINE_ARCH:Mmipsn32*} != ""
-AFLAGS+= -mabi=n32
-CFLAGS+= -mabi=n32
-LDFLAGS+= -mabi=n32
+MIPS_ABI?= n32
 . else
-AFLAGS+= -mabi=32
-CFLAGS+= -mabi=32
-LDFLAGS+= -mabi=32
+MIPS_ABI?= 32
 . endif
 . if ${MACHINE_ARCH:Mmips*hf}
 CFLAGS += -mhard-float
___
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: r350475 - stable/12/lib/libproc

2019-07-31 Thread Brooks Davis
Author: brooks
Date: Wed Jul 31 18:25:52 2019
New Revision: 350475
URL: https://svnweb.freebsd.org/changeset/base/350475

Log:
  MFC r350158:
  
  Remove an unneeded temporary variable in two functions.
  
  There is no need to convert an intptr_t to a long just to cast it to a
  (void *).
  
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL

Modified:
  stable/12/lib/libproc/proc_bkpt.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libproc/proc_bkpt.c
==
--- stable/12/lib/libproc/proc_bkpt.c   Wed Jul 31 18:10:50 2019
(r350474)
+++ stable/12/lib/libproc/proc_bkpt.c   Wed Jul 31 18:25:52 2019
(r350475)
@@ -102,7 +102,6 @@ proc_bkptset(struct proc_handle *phdl, uintptr_t addre
 unsigned long *saved)
 {
struct ptrace_io_desc piod;
-   unsigned long caddr;
int ret = 0, stopped;
instr_t instr;
 
@@ -125,10 +124,9 @@ proc_bkptset(struct proc_handle *phdl, uintptr_t addre
/*
 * Read the original instruction.
 */
-   caddr = address;
instr = 0;
piod.piod_op = PIOD_READ_I;
-   piod.piod_offs = (void *)caddr;
+   piod.piod_offs = (void *)address;
piod.piod_addr = 
piod.piod_len  = BREAKPOINT_INSTR_SZ;
if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t), 0) < 0) {
@@ -141,10 +139,9 @@ proc_bkptset(struct proc_handle *phdl, uintptr_t addre
/*
 * Write a breakpoint instruction to that address.
 */
-   caddr = address;
instr = BREAKPOINT_INSTR;
piod.piod_op = PIOD_WRITE_I;
-   piod.piod_offs = (void *)caddr;
+   piod.piod_offs = (void *)address;
piod.piod_addr = 
piod.piod_len  = BREAKPOINT_INSTR_SZ;
if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t), 0) < 0) {
@@ -167,7 +164,6 @@ proc_bkptdel(struct proc_handle *phdl, uintptr_t addre
 unsigned long saved)
 {
struct ptrace_io_desc piod;
-   unsigned long caddr;
int ret = 0, stopped;
instr_t instr;
 
@@ -189,10 +185,9 @@ proc_bkptdel(struct proc_handle *phdl, uintptr_t addre
/*
 * Overwrite the breakpoint instruction that we setup previously.
 */
-   caddr = address;
instr = saved;
piod.piod_op = PIOD_WRITE_I;
-   piod.piod_offs = (void *)caddr;
+   piod.piod_offs = (void *)address;
piod.piod_addr = 
piod.piod_len  = BREAKPOINT_INSTR_SZ;
if (ptrace(PT_IO, proc_getpid(phdl), (caddr_t), 0) < 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: r350474 - stable/11/lib/libgssapi

2019-07-31 Thread Brooks Davis
Author: brooks
Date: Wed Jul 31 18:10:50 2019
New Revision: 350474
URL: https://svnweb.freebsd.org/changeset/base/350474

Log:
  MFC r350157:
  
  Use the __DECONST macro rather than hand rolling it.
  
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL

Modified:
  stable/11/lib/libgssapi/gss_accept_sec_context.c
  stable/11/lib/libgssapi/gss_names.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libgssapi/gss_accept_sec_context.c
==
--- stable/11/lib/libgssapi/gss_accept_sec_context.cWed Jul 31 17:56:07 
2019(r350473)
+++ stable/11/lib/libgssapi/gss_accept_sec_context.cWed Jul 31 18:10:50 
2019(r350474)
@@ -98,11 +98,11 @@ parse_header(const gss_buffer_t input_token, gss_OID m
 } 
 
 static gss_OID_desc krb5_mechanism =
-{9, (void *)(uintptr_t) "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02"};
+{9, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02")};
 static gss_OID_desc ntlm_mechanism =
-{10, (void *)(uintptr_t) "\x2b\x06\x01\x04\x01\x82\x37\x02\x02\x0a"};
+{10, __DECONST(void *, "\x2b\x06\x01\x04\x01\x82\x37\x02\x02\x0a")};
 static gss_OID_desc spnego_mechanism =
-{6, (void *)(uintptr_t) "\x2b\x06\x01\x05\x05\x02"};
+{6, __DECONST(void *, "\x2b\x06\x01\x05\x05\x02")};
 
 static OM_uint32
 choose_mech(const gss_buffer_t input, gss_OID mech_oid)

Modified: stable/11/lib/libgssapi/gss_names.c
==
--- stable/11/lib/libgssapi/gss_names.c Wed Jul 31 17:56:07 2019
(r350473)
+++ stable/11/lib/libgssapi/gss_names.c Wed Jul 31 18:10:50 2019
(r350474)
@@ -47,7 +47,7 @@
  * to that gss_OID_desc.
  */
 static gss_OID_desc GSS_C_NT_USER_NAME_storage =
-   {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x01"};
+   {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x01")};
 gss_OID GSS_C_NT_USER_NAME = _C_NT_USER_NAME_storage;
 
 /*
@@ -62,7 +62,7 @@ gss_OID GSS_C_NT_USER_NAME = _C_NT_USER_NAME_stora
  * initialized to point to that gss_OID_desc.
  */
 static gss_OID_desc GSS_C_NT_MACHINE_UID_NAME_storage =
-   {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x02"};
+   {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x02")};
 gss_OID GSS_C_NT_MACHINE_UID_NAME = _C_NT_MACHINE_UID_NAME_storage;
 
 /*
@@ -77,7 +77,7 @@ gss_OID GSS_C_NT_MACHINE_UID_NAME = _C_NT_MACHINE_
  * initialized to point to that gss_OID_desc.
  */
 static gss_OID_desc GSS_C_NT_STRING_UID_NAME_storage =
-   {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x03"};
+   {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x03")};
 gss_OID GSS_C_NT_STRING_UID_NAME = _C_NT_STRING_UID_NAME_storage;
 
 /*
@@ -98,7 +98,7 @@ gss_OID GSS_C_NT_STRING_UID_NAME = _C_NT_STRING_UI
  * implementations
  */
 static gss_OID_desc GSS_C_NT_HOSTBASED_SERVICE_X_storage =
-   {6, (void *)(uintptr_t)"\x2b\x06\x01\x05\x06\x02"};
+   {6, __DECONST(void *, "\x2b\x06\x01\x05\x06\x02")};
 gss_OID GSS_C_NT_HOSTBASED_SERVICE_X = _C_NT_HOSTBASED_SERVICE_X_storage;
 
 /*
@@ -113,7 +113,7 @@ gss_OID GSS_C_NT_HOSTBASED_SERVICE_X = _C_NT_HOSTB
  * to point to that gss_OID_desc.
  */
 static gss_OID_desc GSS_C_NT_HOSTBASED_SERVICE_storage =
-   {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04"};
+   {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04")};
 gss_OID GSS_C_NT_HOSTBASED_SERVICE = _C_NT_HOSTBASED_SERVICE_storage;
 
 /*
@@ -127,7 +127,7 @@ gss_OID GSS_C_NT_HOSTBASED_SERVICE = _C_NT_HOSTBAS
  * to that gss_OID_desc.
  */
 static gss_OID_desc GSS_C_NT_ANONYMOUS_storage =
-   {6, (void *)(uintptr_t)"\x2b\x06\01\x05\x06\x03"};
+   {6, __DECONST(void *, "\x2b\x06\01\x05\x06\x03")};
 gss_OID GSS_C_NT_ANONYMOUS = _C_NT_ANONYMOUS_storage;
 
 /*
@@ -141,7 +141,7 @@ gss_OID GSS_C_NT_ANONYMOUS = _C_NT_ANONYMOUS_stora
  * to that gss_OID_desc.
  */
 static gss_OID_desc GSS_C_NT_EXPORT_NAME_storage =
-   {6, (void *)(uintptr_t)"\x2b\x06\x01\x05\x06\x04"};
+   {6, __DECONST(void *, "\x2b\x06\x01\x05\x06\x04")};
 gss_OID GSS_C_NT_EXPORT_NAME = _C_NT_EXPORT_NAME_storage;
 
 /*
@@ -151,7 +151,7 @@ gss_OID GSS_C_NT_EXPORT_NAME = _C_NT_EXPORT_NAME_s
  *   is "GSS_KRB5_NT_PRINCIPAL_NAME".
  */
 static gss_OID_desc GSS_KRB5_NT_PRINCIPAL_NAME_storage =
-{10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01"};
+{10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01")};
 gss_OID GSS_KRB5_NT_PRINCIPAL_NAME = _KRB5_NT_PRINCIPAL_NAME_storage;
 
 /*
___
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: r350473 - stable/12/lib/libgssapi

2019-07-31 Thread Brooks Davis
Author: brooks
Date: Wed Jul 31 17:56:07 2019
New Revision: 350473
URL: https://svnweb.freebsd.org/changeset/base/350473

Log:
  MFC r350157:
  
  Use the __DECONST macro rather than hand rolling it.
  
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL

Modified:
  stable/12/lib/libgssapi/gss_accept_sec_context.c
  stable/12/lib/libgssapi/gss_names.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libgssapi/gss_accept_sec_context.c
==
--- stable/12/lib/libgssapi/gss_accept_sec_context.cWed Jul 31 17:51:06 
2019(r350472)
+++ stable/12/lib/libgssapi/gss_accept_sec_context.cWed Jul 31 17:56:07 
2019(r350473)
@@ -100,11 +100,11 @@ parse_header(const gss_buffer_t input_token, gss_OID m
 } 
 
 static gss_OID_desc krb5_mechanism =
-{9, (void *)(uintptr_t) "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02"};
+{9, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02")};
 static gss_OID_desc ntlm_mechanism =
-{10, (void *)(uintptr_t) "\x2b\x06\x01\x04\x01\x82\x37\x02\x02\x0a"};
+{10, __DECONST(void *, "\x2b\x06\x01\x04\x01\x82\x37\x02\x02\x0a")};
 static gss_OID_desc spnego_mechanism =
-{6, (void *)(uintptr_t) "\x2b\x06\x01\x05\x05\x02"};
+{6, __DECONST(void *, "\x2b\x06\x01\x05\x05\x02")};
 
 static OM_uint32
 choose_mech(const gss_buffer_t input, gss_OID mech_oid)

Modified: stable/12/lib/libgssapi/gss_names.c
==
--- stable/12/lib/libgssapi/gss_names.c Wed Jul 31 17:51:06 2019
(r350472)
+++ stable/12/lib/libgssapi/gss_names.c Wed Jul 31 17:56:07 2019
(r350473)
@@ -49,7 +49,7 @@
  * to that gss_OID_desc.
  */
 static gss_OID_desc GSS_C_NT_USER_NAME_storage =
-   {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x01"};
+   {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x01")};
 gss_OID GSS_C_NT_USER_NAME = _C_NT_USER_NAME_storage;
 
 /*
@@ -64,7 +64,7 @@ gss_OID GSS_C_NT_USER_NAME = _C_NT_USER_NAME_stora
  * initialized to point to that gss_OID_desc.
  */
 static gss_OID_desc GSS_C_NT_MACHINE_UID_NAME_storage =
-   {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x02"};
+   {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x02")};
 gss_OID GSS_C_NT_MACHINE_UID_NAME = _C_NT_MACHINE_UID_NAME_storage;
 
 /*
@@ -79,7 +79,7 @@ gss_OID GSS_C_NT_MACHINE_UID_NAME = _C_NT_MACHINE_
  * initialized to point to that gss_OID_desc.
  */
 static gss_OID_desc GSS_C_NT_STRING_UID_NAME_storage =
-   {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x03"};
+   {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x03")};
 gss_OID GSS_C_NT_STRING_UID_NAME = _C_NT_STRING_UID_NAME_storage;
 
 /*
@@ -100,7 +100,7 @@ gss_OID GSS_C_NT_STRING_UID_NAME = _C_NT_STRING_UI
  * implementations
  */
 static gss_OID_desc GSS_C_NT_HOSTBASED_SERVICE_X_storage =
-   {6, (void *)(uintptr_t)"\x2b\x06\x01\x05\x06\x02"};
+   {6, __DECONST(void *, "\x2b\x06\x01\x05\x06\x02")};
 gss_OID GSS_C_NT_HOSTBASED_SERVICE_X = _C_NT_HOSTBASED_SERVICE_X_storage;
 
 /*
@@ -115,7 +115,7 @@ gss_OID GSS_C_NT_HOSTBASED_SERVICE_X = _C_NT_HOSTB
  * to point to that gss_OID_desc.
  */
 static gss_OID_desc GSS_C_NT_HOSTBASED_SERVICE_storage =
-   {10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04"};
+   {10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04")};
 gss_OID GSS_C_NT_HOSTBASED_SERVICE = _C_NT_HOSTBASED_SERVICE_storage;
 
 /*
@@ -129,7 +129,7 @@ gss_OID GSS_C_NT_HOSTBASED_SERVICE = _C_NT_HOSTBAS
  * to that gss_OID_desc.
  */
 static gss_OID_desc GSS_C_NT_ANONYMOUS_storage =
-   {6, (void *)(uintptr_t)"\x2b\x06\01\x05\x06\x03"};
+   {6, __DECONST(void *, "\x2b\x06\01\x05\x06\x03")};
 gss_OID GSS_C_NT_ANONYMOUS = _C_NT_ANONYMOUS_storage;
 
 /*
@@ -143,7 +143,7 @@ gss_OID GSS_C_NT_ANONYMOUS = _C_NT_ANONYMOUS_stora
  * to that gss_OID_desc.
  */
 static gss_OID_desc GSS_C_NT_EXPORT_NAME_storage =
-   {6, (void *)(uintptr_t)"\x2b\x06\x01\x05\x06\x04"};
+   {6, __DECONST(void *, "\x2b\x06\x01\x05\x06\x04")};
 gss_OID GSS_C_NT_EXPORT_NAME = _C_NT_EXPORT_NAME_storage;
 
 /*
@@ -153,7 +153,7 @@ gss_OID GSS_C_NT_EXPORT_NAME = _C_NT_EXPORT_NAME_s
  *   is "GSS_KRB5_NT_PRINCIPAL_NAME".
  */
 static gss_OID_desc GSS_KRB5_NT_PRINCIPAL_NAME_storage =
-{10, (void *)(uintptr_t)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01"};
+{10, __DECONST(void *, "\x2a\x86\x48\x86\xf7\x12\x01\x02\x02\x01")};
 gss_OID GSS_KRB5_NT_PRINCIPAL_NAME = _KRB5_NT_PRINCIPAL_NAME_storage;
 
 /*
___
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: r350472 - head/sys/geom/nop

2019-07-31 Thread Mariusz Zaborski
Author: oshogbo
Date: Wed Jul 31 17:51:06 2019
New Revision: 350472
URL: https://svnweb.freebsd.org/changeset/base/350472

Log:
  gnop: style nits

Modified:
  head/sys/geom/nop/g_nop.c

Modified: head/sys/geom/nop/g_nop.c
==
--- head/sys/geom/nop/g_nop.c   Wed Jul 31 17:47:12 2019(r350471)
+++ head/sys/geom/nop/g_nop.c   Wed Jul 31 17:51:06 2019(r350472)
@@ -116,6 +116,7 @@ static int
 g_nop_dumper(void *priv, void *virtual, vm_offset_t physical, off_t offset,
 size_t length)
 {
+
return (0);
 }
 
@@ -213,7 +214,7 @@ g_nop_start(struct bio *bp)
break;
case BIO_GETATTR:
sc->sc_getattrs++;
-   if (sc->sc_physpath && 
+   if (sc->sc_physpath &&
g_handleattr_str(bp, "GEOM::physpath", sc->sc_physpath))
;
else if (strcmp(bp->bio_attribute, "GEOM::kerneldump") == 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: r350471 - in head: lib/geom/nop sys/geom/nop

2019-07-31 Thread Mariusz Zaborski
Author: oshogbo
Date: Wed Jul 31 17:47:12 2019
New Revision: 350471
URL: https://svnweb.freebsd.org/changeset/base/350471

Log:
  gnop: Introduce requests delay.
  
  This allows to simulated disk that is responding slowly to the IO requests.
  
  Reviewed by:  markj, bcr, pjd (previous version)
  Differential Revision:https://reviews.freebsd.org/D21052

Modified:
  head/lib/geom/nop/geom_nop.c
  head/lib/geom/nop/gnop.8
  head/sys/geom/nop/g_nop.c
  head/sys/geom/nop/g_nop.h

Modified: head/lib/geom/nop/geom_nop.c
==
--- head/lib/geom/nop/geom_nop.cWed Jul 31 17:29:14 2019
(r350470)
+++ head/lib/geom/nop/geom_nop.cWed Jul 31 17:47:12 2019
(r350471)
@@ -43,29 +43,36 @@ uint32_t version = G_NOP_VERSION;
 struct g_command class_commands[] = {
{ "create", G_FLAG_VERBOSE | G_FLAG_LOADKLD, NULL,
{
+   { 'd', "delaymsec", "-1", G_TYPE_NUMBER },
{ 'e', "error", "-1", G_TYPE_NUMBER },
{ 'o', "offset", "0", G_TYPE_NUMBER },
{ 'p', "stripesize", "0", G_TYPE_NUMBER },
{ 'P', "stripeoffset", "0", G_TYPE_NUMBER },
+   { 'q', "rdelayprob", "-1", G_TYPE_NUMBER },
{ 'r', "rfailprob", "-1", G_TYPE_NUMBER },
{ 's', "size", "0", G_TYPE_NUMBER },
{ 'S', "secsize", "0", G_TYPE_NUMBER },
{ 'w', "wfailprob", "-1", G_TYPE_NUMBER },
+   { 'x', "wdelayprob", "1", G_TYPE_NUMBER },
{ 'z', "physpath", G_NOP_PHYSPATH_PASSTHROUGH, G_TYPE_STRING },
G_OPT_SENTINEL
},
-   "[-v] [-e error] [-o offset] [-p stripesize] [-P stripeoffset] "
-   "[-r rfailprob] [-s size] [-S secsize] [-w wfailprob] "
-   "[-z physpath] dev ..."
+   "[-v] [-d delaymsec] [-e error] [-o offset] [-p stripesize] "
+   "[-P stripeoffset] [-q rdelayprob] [-r rfailprob] [-s size] "
+   "[-S secsize] [-w wfailprob] [-x wdelayprob] [-z physpath] dev ..."
},
{ "configure", G_FLAG_VERBOSE, NULL,
{
+   { 'd', "delaymsec", "-1", G_TYPE_NUMBER },
{ 'e', "error", "-1", G_TYPE_NUMBER },
+   { 'q', "rdelayprob", "-1", G_TYPE_NUMBER },
{ 'r', "rfailprob", "-1", G_TYPE_NUMBER },
{ 'w', "wfailprob", "-1", G_TYPE_NUMBER },
+   { 'x', "wdelayprob", "1", G_TYPE_NUMBER },
G_OPT_SENTINEL
},
-   "[-v] [-e error] [-r rfailprob] [-w wfailprob] prov ..."
+   "[-v] [-d delaymsec] [-e error] [-q rdelayprob] [-r rfailprob] "
+   "[-w wfailprob] [-x wdelayprob] prov ..."
},
{ "destroy", G_FLAG_VERBOSE, NULL,
{

Modified: head/lib/geom/nop/gnop.8
==
--- head/lib/geom/nop/gnop.8Wed Jul 31 17:29:14 2019(r350470)
+++ head/lib/geom/nop/gnop.8Wed Jul 31 17:47:12 2019(r350471)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 17, 2018
+.Dd July 31, 2019
 .Dt GNOP 8
 .Os
 .Sh NAME
@@ -34,22 +34,28 @@
 .Nm
 .Cm create
 .Op Fl v
+.Op Fl d Ar delaymsec
 .Op Fl e Ar error
 .Op Fl o Ar offset
 .Op Fl p Ar stripesize
 .Op Fl P Ar stripeoffset
+.Op Fl q Ar rdelayprob
 .Op Fl r Ar rfailprob
 .Op Fl s Ar size
 .Op Fl S Ar secsize
 .Op Fl w Ar wfailprob
+.Op Fl x Ar wdelayprob
 .Op Fl z Ar physpath
 .Ar dev ...
 .Nm
 .Cm configure
 .Op Fl v
+.Op Fl d Ar delaymsec
 .Op Fl e Ar error
+.Op Fl q Ar rdelayprob
 .Op Fl r Ar rfailprob
 .Op Fl w Ar wfailprob
+.Op Fl x Ar wdelayprob
 .Ar prov ...
 .Nm
 .Cm destroy
@@ -113,6 +119,9 @@ See
 .Pp
 Additional options:
 .Bl -tag -width ".Fl r Ar rfailprob"
+.It Fl d Ar delaymsec
+Specifies the delay of the requests in milliseconds.
+Note that requests will be delayed before they are sent to the backing device.
 .It Fl e Ar error
 Specifies the error number to return on failure.
 .It Fl f
@@ -123,6 +132,8 @@ Where to begin on the original provider.
 Value of the stripesize property of the transparent provider.
 .It Fl P Ar stripeoffset
 Value of the stripeoffset property of the transparent provider.
+.It Fl q Ar rdelayprob
+Specifies read delay probability in percent.
 .It Fl r Ar rfailprob
 Specifies read failure probability in percent.
 .It Fl s Ar size
@@ -133,6 +144,8 @@ Sector size of the transparent provider.
 Specifies write failure probability in percent.
 .It Fl v
 Be more verbose.
+.It Fl x Ar wdelayprob
+Specifies write delay probability in percent.
 .It Fl z Ar physpath
 Physical path of the transparent provider.
 .El

Modified: head/sys/geom/nop/g_nop.c
==
--- head/sys/geom/nop/g_nop.c   Wed Jul 31 17:29:14 2019(r350470)
+++ head/sys/geom/nop/g_nop.c   Wed Jul 31 17:47:12 2019(r350471)
@@ -74,6 

svn commit: r350470 - in stable/11/libexec/bootpd: . tools

2019-07-31 Thread Brooks Davis
Author: brooks
Date: Wed Jul 31 17:29:14 2019
New Revision: 350470
URL: https://svnweb.freebsd.org/changeset/base/350470

Log:
  MFC r350143, r350148
  
  r350143:
  Chain Makefile.inc's so default are inherited as expected.
  
  Remove unneeded or duplicate variables.
  
  No functional change.
  
  r350148:
  Restore WARNS?=1 here.  I missed that libexec/bootpd/bootpgw existed.
  
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL

Modified:
  stable/11/libexec/bootpd/Makefile.inc
  stable/11/libexec/bootpd/tools/Makefile.inc
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/libexec/bootpd/Makefile.inc
==
--- stable/11/libexec/bootpd/Makefile.inc   Wed Jul 31 17:01:23 2019
(r350469)
+++ stable/11/libexec/bootpd/Makefile.inc   Wed Jul 31 17:29:14 2019
(r350470)
@@ -1,5 +1,5 @@
 # $FreeBSD$
 
-BINDIR?=   /usr/libexec
-
 WARNS?=1
+
+.include "../Makefile.inc"

Modified: stable/11/libexec/bootpd/tools/Makefile.inc
==
--- stable/11/libexec/bootpd/tools/Makefile.inc Wed Jul 31 17:01:23 2019
(r350469)
+++ stable/11/libexec/bootpd/tools/Makefile.inc Wed Jul 31 17:29:14 2019
(r350470)
@@ -4,3 +4,5 @@
 BINDIR=/usr/sbin
 
 WARNS?=1
+
+.include "../Makefile.inc"
___
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: r350005 - head/sys/kern

2019-07-31 Thread Bryan Drewery
On 7/30/19 10:14 PM, Konstantin Belousov wrote:
> On Tue, Jul 30, 2019 at 08:40:28PM -0700, Bryan Drewery wrote:
>> This 2nd change alone (&& count1 == 0) was sufficient to fix the endless
>> loop problem.
> Good, thank you.
> 
>>
>> I am not sure how to test the umtxq_check_susp() change. Do I just need
>> to ptrace the process?
> 
> No, you should create a situation where the python process ends the endless
> loop, as reported.  Then, it should become killable by 9 with the first
> chunk only applied.
> 

I don't have an easy way to test that. kill -9 inside the loop didn't
work. Once the loop ended the process was done; it is very short lived
and the calling code is buried in Python I think.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r350469 - in stable/12/libexec/bootpd: . tools

2019-07-31 Thread Brooks Davis
Author: brooks
Date: Wed Jul 31 17:01:23 2019
New Revision: 350469
URL: https://svnweb.freebsd.org/changeset/base/350469

Log:
  MFC r350143, r350148
  
  r350143:
  Chain Makefile.inc's so default are inherited as expected.
  
  Remove unneeded or duplicate variables.
  
  No functional change.
  
  r350148:
  Restore WARNS?=1 here.  I missed that libexec/bootpd/bootpgw existed.
  
  Obtained from:CheriBSD
  Sponsored by: DARPA, AFRL

Modified:
  stable/12/libexec/bootpd/Makefile.inc
  stable/12/libexec/bootpd/tools/Makefile.inc
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/libexec/bootpd/Makefile.inc
==
--- stable/12/libexec/bootpd/Makefile.inc   Wed Jul 31 16:58:09 2019
(r350468)
+++ stable/12/libexec/bootpd/Makefile.inc   Wed Jul 31 17:01:23 2019
(r350469)
@@ -1,5 +1,5 @@
 # $FreeBSD$
 
-BINDIR?=   /usr/libexec
-
 WARNS?=1
+
+.include "../Makefile.inc"

Modified: stable/12/libexec/bootpd/tools/Makefile.inc
==
--- stable/12/libexec/bootpd/tools/Makefile.inc Wed Jul 31 16:58:09 2019
(r350468)
+++ stable/12/libexec/bootpd/tools/Makefile.inc Wed Jul 31 17:01:23 2019
(r350469)
@@ -4,3 +4,5 @@
 BINDIR=/usr/sbin
 
 WARNS?=1
+
+.include "../Makefile.inc"
___
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: r350468 - head/sys/netpfil/pf

2019-07-31 Thread Ed Maste
Author: emaste
Date: Wed Jul 31 16:58:09 2019
New Revision: 350468
URL: https://svnweb.freebsd.org/changeset/base/350468

Log:
  pf: zero (another) output buffer in pfioctl
  
  Avoid potential structure padding leak.  r350294 identified a leak via
  static analysis; although there's no report of a leak with the
  DIOCGETSRCNODES ioctl it's a good practice to zero the memory.
  
  Suggested by: kp
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/netpfil/pf/pf_ioctl.c

Modified: head/sys/netpfil/pf/pf_ioctl.c
==
--- head/sys/netpfil/pf/pf_ioctl.c  Wed Jul 31 16:22:05 2019
(r350467)
+++ head/sys/netpfil/pf/pf_ioctl.c  Wed Jul 31 16:58:09 2019
(r350468)
@@ -3752,7 +3752,7 @@ DIOCCHANGEADDR_error:
 
nr = 0;
 
-   p = pstore = malloc(psn->psn_len, M_TEMP, M_WAITOK);
+   p = pstore = malloc(psn->psn_len, M_TEMP, M_WAITOK | M_ZERO);
for (i = 0, sh = V_pf_srchash; i <= pf_srchashmask;
i++, sh++) {
PF_HASHROW_LOCK(sh);
___
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: r350467 - head/contrib/llvm/tools/lld/ELF

2019-07-31 Thread Leandro Lupori
Author: luporl
Date: Wed Jul 31 16:22:05 2019
New Revision: 350467
URL: https://svnweb.freebsd.org/changeset/base/350467

Log:
  [PPC64] Backport fix for missing IRELATIVE relocations
  
  This is a backport of LLVM commit 8331f61a51a7a0a1efbf5ed398e181593023d151,
  llvm-svn: 353981:
  
  ELF: Allow GOT relocs pointing to non-preemptable ifunc to resolve to an
  IRELATIVE where possible.
  
  This is needed in order to make ifuncs work correctly on PPC64.
  
  It fixes an issue with lld, in which it would skip emitting necessary 
IRELATIVE
  relocations.  Without this change, indirect calls to ifuncs would result in a
  segmentation fault, in static binaries or when defined in the main binary
  (outside shared libraries).
  
  This change also reverts the local
  "Preserve relocations against ifuncs when -zifunc-noplt" commit and
  replaces it by its upstream version, as part of the merge.
  
  Reviewed by:  markj
  Differential Revision:https://reviews.freebsd.org/D21102

Modified:
  head/contrib/llvm/tools/lld/ELF/Config.h
  head/contrib/llvm/tools/lld/ELF/Driver.cpp
  head/contrib/llvm/tools/lld/ELF/InputSection.cpp
  head/contrib/llvm/tools/lld/ELF/Relocations.cpp
  head/contrib/llvm/tools/lld/ELF/Relocations.h
  head/contrib/llvm/tools/lld/ELF/Symbols.cpp
  head/contrib/llvm/tools/lld/ELF/Symbols.h
  head/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp
  head/contrib/llvm/tools/lld/ELF/Writer.cpp

Modified: head/contrib/llvm/tools/lld/ELF/Config.h
==
--- head/contrib/llvm/tools/lld/ELF/Config.hWed Jul 31 16:07:16 2019
(r350466)
+++ head/contrib/llvm/tools/lld/ELF/Config.hWed Jul 31 16:22:05 2019
(r350467)
@@ -191,7 +191,7 @@ struct Configuration {
   bool ZExecstack;
   bool ZGlobal;
   bool ZHazardplt;
-  bool ZIfuncnoplt;
+  bool ZIfuncNoplt;
   bool ZInitfirst;
   bool ZInterpose;
   bool ZKeepTextSectionPrefix;

Modified: head/contrib/llvm/tools/lld/ELF/Driver.cpp
==
--- head/contrib/llvm/tools/lld/ELF/Driver.cpp  Wed Jul 31 16:07:16 2019
(r350466)
+++ head/contrib/llvm/tools/lld/ELF/Driver.cpp  Wed Jul 31 16:22:05 2019
(r350467)
@@ -299,6 +299,9 @@ static void checkOptions() {
   if (!Config->Relocatable && !Config->DefineCommon)
 error("-no-define-common not supported in non relocatable output");
 
+  if (Config->ZText && Config->ZIfuncNoplt)
+error("-z text and -z ifunc-noplt may not be used together");
+
   if (Config->Relocatable) {
 if (Config->Shared)
   error("-r and -shared may not be used together");
@@ -348,8 +351,7 @@ static bool getZFlag(opt::InputArgList , StringRe
 static bool isKnownZFlag(StringRef S) {
   return S == "combreloc" || S == "copyreloc" || S == "defs" ||
  S == "execstack" || S == "global" || S == "hazardplt" ||
- S == "ifunc-noplt" ||
- S == "initfirst" || S == "interpose" ||
+ S == "ifunc-noplt" || S == "initfirst" || S == "interpose" ||
  S == "keep-text-section-prefix" || S == "lazy" || S == "muldefs" ||
  S == "nocombreloc" || S == "nocopyreloc" || S == "nodefaultlib" ||
  S == "nodelete" || S == "nodlopen" || S == "noexecstack" ||
@@ -875,7 +877,7 @@ void LinkerDriver::readConfigs(opt::InputArgList 
   Config->ZExecstack = getZFlag(Args, "execstack", "noexecstack", false);
   Config->ZGlobal = hasZOption(Args, "global");
   Config->ZHazardplt = hasZOption(Args, "hazardplt");
-  Config->ZIfuncnoplt = hasZOption(Args, "ifunc-noplt");
+  Config->ZIfuncNoplt = hasZOption(Args, "ifunc-noplt");
   Config->ZInitfirst = hasZOption(Args, "initfirst");
   Config->ZInterpose = hasZOption(Args, "interpose");
   Config->ZKeepTextSectionPrefix = getZFlag(

Modified: head/contrib/llvm/tools/lld/ELF/InputSection.cpp
==
--- head/contrib/llvm/tools/lld/ELF/InputSection.cppWed Jul 31 16:07:16 
2019(r350466)
+++ head/contrib/llvm/tools/lld/ELF/InputSection.cppWed Jul 31 16:22:05 
2019(r350467)
@@ -610,7 +610,6 @@ static uint64_t getRelocTargetVA(const InputFile *File
   case R_ARM_SBREL:
 return Sym.getVA(A) - getARMStaticBase(Sym);
   case R_GOT:
-  case R_GOT_PLT:
   case R_RELAX_TLS_GD_TO_IE_ABS:
 return Sym.getGotVA() + A;
   case R_GOTONLY_PC:
@@ -629,7 +628,6 @@ static uint64_t getRelocTargetVA(const InputFile *File
   case R_RELAX_TLS_GD_TO_IE_GOT_OFF:
 return Sym.getGotOffset() + A;
   case R_AARCH64_GOT_PAGE_PC:
-  case R_AARCH64_GOT_PAGE_PC_PLT:
   case R_AARCH64_RELAX_TLS_GD_TO_IE_PAGE_PC:
 return getAArch64Page(Sym.getGotVA() + A) - getAArch64Page(P);
   case R_GOT_PC:
@@ -677,10 +675,6 @@ static uint64_t getRelocTargetVA(const InputFile *File
In.MipsGot->getGp(File);
   case R_AARCH64_PAGE_PC: {
 uint64_t Val = Sym.isUndefWeak() ? P + A : Sym.getVA(A);
-return 

svn commit: r350465 - in stable: 11/sys/net 12/sys/net

2019-07-31 Thread Kyle Evans
Author: kevans
Date: Wed Jul 31 15:56:40 2019
New Revision: 350465
URL: https://svnweb.freebsd.org/changeset/base/350465

Log:
  MFC r350336: if_tun(4): Add TUNGIFNAME
  
  This is effectively a direct commit to stable branches as tun/tap have been
  merged in head. The code here is identical, just in a slightly different
  context.

Modified:
  stable/11/sys/net/if_tun.c
  stable/11/sys/net/if_tun.h
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/net/if_tun.c
  stable/12/sys/net/if_tun.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/net/if_tun.c
==
--- stable/11/sys/net/if_tun.c  Wed Jul 31 15:16:51 2019(r350464)
+++ stable/11/sys/net/if_tun.c  Wed Jul 31 15:56:40 2019(r350465)
@@ -735,12 +735,16 @@ staticint
 tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag,
 struct thread *td)
 {
-   struct ifreq ifr;
+   struct ifreq ifr, *ifrp;
struct tun_softc *tp = dev->si_drv1;
struct tuninfo *tunp;
int error;
 
switch (cmd) {
+   case TUNGIFNAME:
+   ifrp = (struct ifreq *)data;
+   strlcpy(ifrp->ifr_name, TUN2IFP(tp)->if_xname, IFNAMSIZ);
+   break;
case TUNSIFINFO:
tunp = (struct tuninfo *)data;
if (TUN2IFP(tp)->if_type != tunp->type)

Modified: stable/11/sys/net/if_tun.h
==
--- stable/11/sys/net/if_tun.h  Wed Jul 31 15:16:51 2019(r350464)
+++ stable/11/sys/net/if_tun.h  Wed Jul 31 15:56:40 2019(r350465)
@@ -40,6 +40,7 @@ struct tuninfo {
 #defineTUNSIFINFO  _IOW('t', 91, struct tuninfo)
 #defineTUNGIFINFO  _IOR('t', 92, struct tuninfo)
 #defineTUNSLMODE   _IOW('t', 93, int)
+#defineTUNGIFNAME  _IOR('t', 93, struct ifreq)
 #defineTUNSIFMODE  _IOW('t', 94, int)
 #defineTUNSIFPID   _IO('t', 95)
 #defineTUNSIFHEAD  _IOW('t', 96, int)
___
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: r350465 - in stable: 11/sys/net 12/sys/net

2019-07-31 Thread Kyle Evans
Author: kevans
Date: Wed Jul 31 15:56:40 2019
New Revision: 350465
URL: https://svnweb.freebsd.org/changeset/base/350465

Log:
  MFC r350336: if_tun(4): Add TUNGIFNAME
  
  This is effectively a direct commit to stable branches as tun/tap have been
  merged in head. The code here is identical, just in a slightly different
  context.

Modified:
  stable/12/sys/net/if_tun.c
  stable/12/sys/net/if_tun.h
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/net/if_tun.c
  stable/11/sys/net/if_tun.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/net/if_tun.c
==
--- stable/12/sys/net/if_tun.c  Wed Jul 31 15:16:51 2019(r350464)
+++ stable/12/sys/net/if_tun.c  Wed Jul 31 15:56:40 2019(r350465)
@@ -735,12 +735,16 @@ staticint
 tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag,
 struct thread *td)
 {
-   struct ifreq ifr;
+   struct ifreq ifr, *ifrp;
struct tun_softc *tp = dev->si_drv1;
struct tuninfo *tunp;
int error;
 
switch (cmd) {
+   case TUNGIFNAME:
+   ifrp = (struct ifreq *)data;
+   strlcpy(ifrp->ifr_name, TUN2IFP(tp)->if_xname, IFNAMSIZ);
+   break;
case TUNSIFINFO:
tunp = (struct tuninfo *)data;
if (TUN2IFP(tp)->if_type != tunp->type)

Modified: stable/12/sys/net/if_tun.h
==
--- stable/12/sys/net/if_tun.h  Wed Jul 31 15:16:51 2019(r350464)
+++ stable/12/sys/net/if_tun.h  Wed Jul 31 15:56:40 2019(r350465)
@@ -40,6 +40,7 @@ struct tuninfo {
 #defineTUNSIFINFO  _IOW('t', 91, struct tuninfo)
 #defineTUNGIFINFO  _IOR('t', 92, struct tuninfo)
 #defineTUNSLMODE   _IOW('t', 93, int)
+#defineTUNGIFNAME  _IOR('t', 93, struct ifreq)
 #defineTUNSIFMODE  _IOW('t', 94, int)
 #defineTUNSIFPID   _IO('t', 95)
 #defineTUNSIFHEAD  _IOW('t', 96, int)
___
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: r350464 - in head/sys: compat/cloudabi kern

2019-07-31 Thread Kyle Evans
Author: kevans
Date: Wed Jul 31 15:16:51 2019
New Revision: 350464
URL: https://svnweb.freebsd.org/changeset/base/350464

Log:
  kern_shm_open: push O_CLOEXEC into caller control
  
  The motivation for this change is to allow wrappers around shm to be written
  that don't set CLOEXEC. kern_shm_open currently accepts O_CLOEXEC but sets
  it unconditionally. kern_shm_open is used by the shm_open(2) syscall, which
  is mandated by POSIX to set CLOEXEC, and CloudABI's sys_fd_create1().
  Presumably O_CLOEXEC is intended in the latter caller, but it's unclear from
  the context.
  
  sys_shm_open() now unconditionally sets O_CLOEXEC to meet POSIX
  requirements, and a comment has been dropped in to kern_fd_open() to explain
  the situation and add a pointer to where O_CLOEXEC setting is maintained for
  shm_open(2) correctness. CloudABI's sys_fd_create1() also unconditionally
  sets O_CLOEXEC to match previous behavior.
  
  This also has the side-effect of making flags correctly reflect the
  O_CLOEXEC status on this fd for the rest of kern_shm_open(), but a
  glance-over leads me to believe that it didn't really matter.
  
  Reviewed by:  kib, markj
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D21119

Modified:
  head/sys/compat/cloudabi/cloudabi_fd.c
  head/sys/kern/uipc_shm.c

Modified: head/sys/compat/cloudabi/cloudabi_fd.c
==
--- head/sys/compat/cloudabi/cloudabi_fd.c  Wed Jul 31 05:38:39 2019
(r350463)
+++ head/sys/compat/cloudabi/cloudabi_fd.c  Wed Jul 31 15:16:51 2019
(r350464)
@@ -94,7 +94,8 @@ cloudabi_sys_fd_create1(struct thread *td,
case CLOUDABI_FILETYPE_SHARED_MEMORY:
cap_rights_init(_rights, CAP_FSTAT, CAP_FTRUNCATE,
CAP_MMAP_RWX);
-   return (kern_shm_open(td, SHM_ANON, O_RDWR, 0, ));
+   return (kern_shm_open(td, SHM_ANON, O_RDWR | O_CLOEXEC, 0,
+   ));
default:
return (EINVAL);
}

Modified: head/sys/kern/uipc_shm.c
==
--- head/sys/kern/uipc_shm.cWed Jul 31 05:38:39 2019(r350463)
+++ head/sys/kern/uipc_shm.cWed Jul 31 15:16:51 2019(r350464)
@@ -729,7 +729,14 @@ kern_shm_open(struct thread *td, const char *userpath,
fdp = td->td_proc->p_fd;
cmode = (mode & ~fdp->fd_cmask) & ACCESSPERMS;
 
-   error = falloc_caps(td, , , O_CLOEXEC, fcaps);
+   /*
+* shm_open(2) created shm should always have O_CLOEXEC set, as mandated
+* by POSIX.  We allow it to be unset here so that an in-kernel
+* interface may be written as a thin layer around shm, optionally not
+* setting CLOEXEC.  For shm_open(2), O_CLOEXEC is set unconditionally
+* in sys_shm_open() to keep this implementation compliant.
+*/
+   error = falloc_caps(td, , , flags & O_CLOEXEC, fcaps);
if (error)
return (error);
 
@@ -844,7 +851,8 @@ int
 sys_shm_open(struct thread *td, struct shm_open_args *uap)
 {
 
-   return (kern_shm_open(td, uap->path, uap->flags, uap->mode, NULL));
+   return (kern_shm_open(td, uap->path, uap->flags | O_CLOEXEC, uap->mode,
+   NULL));
 }
 
 int
___
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"