Re: svn commit: r333175 - in head/sys: kern net netinet netinet6 sys: TRAP 12

2018-05-06 Thread O. Hartmann
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Am Sat, 5 May 2018 14:12:04 -0700
Matthew Macy  schrieb:

> it's in the same place as before but I'll attach just to be clear.
> Gzipped to keep gmail from inserting carriage returns.
> -M

Sorry, missed it.

oh

> 
> On Sat, May 5, 2018 at 1:54 PM, O. Hartmann  wrote:
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA512
> >
> > Am Sat, 5 May 2018 13:45:13 -0700
> > Matthew Macy  schrieb:
> >  
> >> actually can you try the updated patch please, it turns out I need to
> >> workaround this little shop of horrors:
> >>
> >>
> >> static void
> >> tcp_usr_detach(struct socket *so)
> >> {
> >> struct inpcb *inp;
> >> int rlock = 0;
> >>
> >> inp = sotoinpcb(so);
> >> KASSERT(inp != NULL, ("tcp_usr_detach: inp == NULL"));
> >> if (!INP_INFO_WLOCKED(&V_tcbinfo)) {
> >> INP_INFO_RLOCK(&V_tcbinfo);
> >> rlock = 1;
> >> }
> >> INP_WLOCK(inp);
> >> KASSERT(inp->inp_socket != NULL,
> >> ("tcp_usr_detach: inp_socket == NULL"));
> >> tcp_detach(so, inp);
> >> if (rlock)
> >> INP_INFO_RUNLOCK(&V_tcbinfo);
> >> }
> >>
> >> We're still acquiring a sleepable mutex out of order with a read lock
> >> held with the former version of the patch.
> >>  
> >
> > Well, I'd appreciate a patch file, if possible, please.
> >
> >  
> >>
> >> On Sat, May 5, 2018 at 1:31 PM, O. Hartmann  
> >> wrote:  
> >> > -BEGIN PGP SIGNED MESSAGE-
> >> > Hash: SHA512
> >> >
> >> > Am Sat, 5 May 2018 11:21:47 -0700
> >> > Matthew Macy  schrieb:
> >> >  
> >> >> pho@ and sbruno@ tested the patch before commit, I can't readily
> >> >> reproduce even though the detach path should be common enough. Please
> >> >> tell me if this helps:
> >> >>
> >> >> https://people.freebsd.org/~mmacy/inpcb.diff
> >> >>
> >> >>
> >> >> Thanks.
> >> >>  
> >> >
> >> >
> >> > The privided patch seemingly work so far (FreeBSD 12.0-CURRENT #4 
> >> > r333274M: Sat
> >> > May  5 22:19:04 CEST 2018 amd64). I just recompile world and kernel of 
> >> > revision
> >> > 333276 and try to push the box with ne traffic (NFS mostly).
> >> >
> >> > May I ask on what hardware the mentioned tests of yours has been 
> >> > performed? I can
> >> > tell, that ALL(!) boxes equipted with Intel's i350 NICs are suffering 
> >> > the very same
> >> > problem. I didn't dare to move on on the other systems with i210, i217 
> >> > or i219, but
> >> > with the patch provided working so far, I'll test.
> >> >
> >> > Thanks.
> >> >  
> >> >>
> >> >> On Sat, May 5, 2018 at 2:01 AM, O. Hartmann  
> >> >> wrote:  
> >> >> > -BEGIN PGP SIGNED MESSAGE-
> >> >> > Hash: SHA512
> >> >> >
> >> >> > Am Thu, 3 May 2018 22:23:52 +0200
> >> >> > "O. Hartmann"  schrieb:
> >> >> >
> >> >> >
> >> >> > I'm not familiar with kernel debugging, so there are some struggles.
> >> >> >
> >> >> > After compiling a debugging kernel on
> >> >> >
> >> >> > Version String: FreeBSD 12.0-CURRENT #2 r333269: Sat May  5 08:10:32 
> >> >> > CEST 2018
> >> >> >
> >> >> > Panic String: Lock tcp not exclusively locked
> >> >> > @ /usr/src/sys/netinet/in_pcb.c:1391
> >> >> >
> >> >> >
> >> >> > And this is what I can provide you with:
> >> >> >
> >> >> >
> >> >> > Reading symbols
> >> >> > from 
> >> >> > /usr/obj/usr/src/amd64.amd64/sys/WALHALL-DEBUG/kernel.full...done.
> >> >> >
> >> >> > Unread portion of the kernel message buffer:
> >> >> > panic: Lock tcp not exclusively locked @ 
> >> >> > /usr/src/sys/netinet/in_pcb.c:1391
> >> >> >
> >> >> > cpuid = 4
> >> >> > time = 1525510291
> >> >> > KDB: stack backtrace:
> >> >> > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 
> >> >> > 0xfe00e485e670
> >> >> > vpanic() at vpanic+0x1a3/frame 0xfe00e485e6d0
> >> >> > panic() at panic+0x43/frame 0xfe00e485e730
> >> >> > _rw_wunlock_cookie() at _rw_wunlock_cookie+0x137/frame 
> >> >> > 0xfe00e485e760
> >> >> > in_pcbfree() at in_pcbfree+0x51a/frame 0xfe00e485e7b0
> >> >> > tcp_usr_detach() at tcp_usr_detach+0x15e/frame 0xfe00e485e7f0
> >> >> > sofree() at sofree+0x2f4/frame 0xfe00e485e840
> >> >> > soclose() at soclose+0x387/frame 0xfe00e485e8b0
> >> >> > closef() at closef+0x1f5/frame 0xfe00e485e940
> >> >> > closefp() at closefp+0xa0/frame 0xfe00e485e980
> >> >> > amd64_syscall() at amd64_syscall+0x6d3/frame 0xfe00e485eab0
> >> >> > fast_syscall_common() at fast_syscall_common+0x101/frame 
> >> >> > 0xfe00e485eab0
> >> >> > - --- syscall (6, FreeBSD ELF64, sys_close), rip = 0x80111adda, rsp =
> >> >> > 0x7fffdf3f7228, rbp = 0x7fffdf3f7240 --- KDB: enter: panic
> >> >> >
> >> >> > __curthread () at ./machine/pcpu.h:231
> >> >> > 231 __asm("movq %%gs:%1,%0" : "=r" (td)
> >> >> > (kgdb) bt
> >> >> > (kgdb) bt
> >> >> > #0  __curthread () at ./machine/pcpu.h:231
> >> >> > #1  doadump (textdump=0) at /usr/src/sys/kern/kern_shutdown.c:365
> >> >> > #2  0x80597d5b in db_dump (dummy=, 
> >> >> > dummy2=,
> >> >> > dummy3=, dummy4=)

Re: svn commit: r333240 - in head/sys: powerpc/powerpc sys

2018-05-06 Thread Bruce Evans

On Sat, 5 May 2018, Mateusz Guzik wrote:


On Sat, May 5, 2018 at 2:00 PM, Alexey Dokuchaev  wrote:


On Sat, May 05, 2018 at 10:38:29AM +1000, Bruce Evans wrote:

...
Summary: this change wouldn't have passed my review.  I have used similar
changes for 15-20 years but never made them production quality since

there

are too many variations to consider and testing showed insignificant
improvements except for micro-benchmarks.


Perhaps Foundation could sponsor your work to make them production quality
Bruce.  :-)

Seriously though, I'm a bit worried to see these commits happening at the
same time correctness of the implementation is still under discussion and
disputes.  Shall I expect that after my next -CURRENT update things would
suddenly stop working? [1]

./danfe

[1] https://bugzilla.redhat.com/show_bug.cgi?id=638477


That was long.


Nothing of the sort was done here. They had a memcpy function which
internally behaved like memmove. They changed to behave like mere
memcpy (i.e. assume non-overlapping buffers). This caused buggy code
to run into trouble.


Especially since we are only changing the kernel now (but libc has even
sillier optimizations).


bcopy has memmove semantics and this change keeps that. The only
difference is that instead of always generating a call, the compiler is
allowed to perform the copy in place in certain cases. This is precisely
what happens almost everywhere and it was not happening in the
kernel because of a giant hammer -fno-builtin flag (added to reduce
changes the compiler will do stuff the kernel does not want to deal
with).


No, -fno-builtin is only used by NOTES to get different test coverage
there.  The hammer is -ffreestanding, which is added to avoid the
certainty that gcc-old will do things like strength-reducing printf(9)
into functions like puts(3) that don't exist in the kernel.  In
retrospect, -ffreestanding is not a hammer but is technically correct
and should have been used much earlier.  It is supported by gcc-2.95.4
(aka egcs?), but wasn't used in FreeBSD until gcc-3.  The hosted case
might also miscompile entry points like write() if the compiler
knows too much about POSIX.  The good name of functions like getenv()
was broken by renaming to names like kern_getenv() long after using
-ffreestanding made this unnecessary.  printf(9) remains with its good
name since the churn for renaming it should be too painful for anyone.

Apparently no one except me noticed or cared that -ffreestanding broke
the default of -fbuiltin.  Even NOTES was broken and remains unfixed.
Its -fno-builtin is supposed to reverse the default, but it now echoes
the default.

Bruce
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r333300 - head/crypto/openssh

2018-05-06 Thread Dag-Erling Smørgrav
Author: des
Date: Sun May  6 13:21:44 2018
New Revision: 00
URL: https://svnweb.freebsd.org/changeset/base/00

Log:
  Update the repository URLs.

Modified:
  head/crypto/openssh/FREEBSD-upgrade

Modified: head/crypto/openssh/FREEBSD-upgrade
==
--- head/crypto/openssh/FREEBSD-upgrade Sun May  6 12:27:15 2018
(r333299)
+++ head/crypto/openssh/FREEBSD-upgrade Sun May  6 13:21:44 2018
(r00)
@@ -17,7 +17,7 @@
 
 04) Copy to the vendor directory:
 
-$ svn co svn+ssh://svn.freebsd.org/base/vendor-crypto/openssh/dist
+$ svn co svn+ssh://repo.freebsd.org/base/vendor-crypto/openssh/dist
 $ rsync --archive --delete openssh-X.YpZ/ dist/
 
 05) Take care of added / deleted files:
@@ -32,13 +32,13 @@
 07) Tag:
 
 $ svn copy -m "Tag OpenSSH X.YpZ." \
-   svn+ssh://svn.freebsd.org/base/vendor-crypto/openssh/dist \
-   svn+ssh://svn.freebsd.org/base/vendor-crypto/openssh/X.YpZ
+   svn+ssh://repo.freebsd.org/base/vendor-crypto/openssh/dist \
+   svn+ssh://repo.freebsd.org/base/vendor-crypto/openssh/X.YpZ
 
 08) Check out head and run the pre-merge script, which strips our RCS
 tags from files that have them:
 
-$ svn co svn+ssh://svn.freebsd.org/base/head
+$ svn co svn+ssh://repo.freebsd.org/base/head
 $ cd head/crypto/openssh
 $ sh freebsd-pre-merge.sh
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r333304 - head/sys/netinet

2018-05-06 Thread Michael Tuexen
Author: tuexen
Date: Sun May  6 14:19:50 2018
New Revision: 04
URL: https://svnweb.freebsd.org/changeset/base/04

Log:
  Ensure we are not dereferencing a NULL pointer.
  
  This was found by Coverity scanning the usrsctp stack (CID 203808).
  
  MFC after:3 days

Modified:
  head/sys/netinet/sctp_indata.c

Modified: head/sys/netinet/sctp_indata.c
==
--- head/sys/netinet/sctp_indata.c  Sun May  6 13:59:56 2018
(r03)
+++ head/sys/netinet/sctp_indata.c  Sun May  6 14:19:50 2018
(r04)
@@ -3621,7 +3621,9 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, stru
SCTP_SO_NOT_LOCKED);
}
/* Make sure to flag we had a FR */
-   tp1->whoTo->net_ack++;
+   if (tp1->whoTo != NULL) {
+   tp1->whoTo->net_ack++;
+   }
continue;
}
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r333305 - head/sys/arm/ti/am335x

2018-05-06 Thread Emmanuel Vadot
Author: manu
Date: Sun May  6 14:37:11 2018
New Revision: 05
URL: https://svnweb.freebsd.org/changeset/base/05

Log:
  am335x_prcm: Delay the frequencies read check
  
  With Linux 4.17 dts the compatible for the prcm added 'simplebus' we mean
  that the simplebus driver will attach to it at the BUS_PASS_BUS pass.
  Change the pass for the prcm driver to be at BUS_PASS_BUS so we will win
  the attach.
  This introduce a problem as this driver needs the ti_scm one to be already
  attached. ti_scm also attach at BUS_PASS_BUS but after the prcm one as it is
  after in the dtb and the simplebus driver simpy walk the tree to attach it's
  children.
  Use the bus_new_pass method to defer the frequencies read at BUS_PASS_TIMER.
  This fixes booting on BeagleBone*
  
  Reported by:  many

Modified:
  head/sys/arm/ti/am335x/am335x_prcm.c

Modified: head/sys/arm/ti/am335x/am335x_prcm.c
==
--- head/sys/arm/ti/am335x/am335x_prcm.cSun May  6 14:19:50 2018
(r04)
+++ head/sys/arm/ti/am335x/am335x_prcm.cSun May  6 14:37:11 2018
(r05)
@@ -136,6 +136,7 @@ struct am335x_prcm_softc {
struct resource *   res[2];
bus_space_tag_t bst;
bus_space_handle_t  bsh;
+   int attach_done;
 };
 
 static struct resource_spec am335x_prcm_spec[] = {
@@ -424,7 +425,6 @@ static int
 am335x_prcm_attach(device_t dev)
 {
struct am335x_prcm_softc *sc = device_get_softc(dev);
-   unsigned int sysclk, fclk;
 
if (am335x_prcm_sc)
return (ENXIO);
@@ -440,6 +440,24 @@ am335x_prcm_attach(device_t dev)
am335x_prcm_sc = sc;
ti_cpu_reset = am335x_prcm_reset;
 
+   return (0);
+}
+
+static void
+am335x_prcm_new_pass(device_t dev)
+{
+   struct am335x_prcm_softc *sc = device_get_softc(dev);
+   unsigned int sysclk, fclk;
+
+   sc = device_get_softc(dev);
+   if (sc->attach_done ||
+   bus_current_pass < (BUS_PASS_TIMER + BUS_PASS_ORDER_EARLY)) {
+   bus_generic_new_pass(dev);
+   return;
+   }
+
+   sc->attach_done = 1;
+
if (am335x_clk_get_sysclk_freq(NULL, &sysclk) != 0)
sysclk = 0;
if (am335x_clk_get_arm_fclk_freq(NULL, &fclk) != 0)
@@ -447,15 +465,24 @@ am335x_prcm_attach(device_t dev)
if (sysclk && fclk)
device_printf(dev, "Clocks: System %u.%01u MHz, CPU %u MHz\n",
sysclk/100, (sysclk % 100)/10, fclk/100);
-   else
+   else {
device_printf(dev, "can't read frequencies yet (SCM device not 
ready?)\n");
+   goto fail;
+   }
 
-   return (0);
+   return;
+
+fail:
+   device_detach(dev);
+   return;
 }
 
 static device_method_t am335x_prcm_methods[] = {
DEVMETHOD(device_probe, am335x_prcm_probe),
DEVMETHOD(device_attach,am335x_prcm_attach),
+
+   /* Bus interface */
+   DEVMETHOD(bus_new_pass, am335x_prcm_new_pass),
{ 0, 0 }
 };
 
@@ -468,7 +495,7 @@ static driver_t am335x_prcm_driver = {
 static devclass_t am335x_prcm_devclass;
 
 EARLY_DRIVER_MODULE(am335x_prcm, simplebus, am335x_prcm_driver,
-   am335x_prcm_devclass, 0, 0, BUS_PASS_TIMER + BUS_PASS_ORDER_EARLY);
+   am335x_prcm_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE);
 MODULE_VERSION(am335x_prcm, 1);
 MODULE_DEPEND(am335x_prcm, ti_scm, 1, 1, 1);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r333306 - head/usr.bin/fetch

2018-05-06 Thread Benjamin Kaduk
Author: bjk (doc committer)
Date: Sun May  6 15:59:03 2018
New Revision: 06
URL: https://svnweb.freebsd.org/changeset/base/06

Log:
  Fix spelling of --output long option in fetch.1
  
  PR:   228017
  Reported by:  rff1...@yahoo.com

Modified:
  head/usr.bin/fetch/fetch.1

Modified: head/usr.bin/fetch/fetch.1
==
--- head/usr.bin/fetch/fetch.1  Sun May  6 14:37:11 2018(r05)
+++ head/usr.bin/fetch/fetch.1  Sun May  6 15:59:03 2018(r06)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 18, 2016
+.Dd May 6, 2018
 .Dt FETCH 1
 .Os
 .Sh NAME
@@ -241,7 +241,7 @@ certificate presented by the server.
 .It Fl -no-verify-peer
 [SSL]
 Do not verify the peer certificate against trusted CAs.
-.It Fl o Ar file , Fl output= Ns Ar file
+.It Fl o Ar file , Fl -output= Ns Ar file
 Set the output file name to
 .Ar file .
 By default, a ``pathname'' is extracted from the specified URI, and
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r333307 - head/cddl/contrib/opensolaris/lib/libzfs/common

2018-05-06 Thread Sean Bruno
Author: sbruno
Date: Sun May  6 16:22:02 2018
New Revision: 07
URL: https://svnweb.freebsd.org/changeset/base/07

Log:
  Cleanup sundry clang warnings for code that is not upstream in illumos.
  
https://github.com/illumos/illumos-gate/edit/master/usr/src/lib/libzfs/common/libzfs_sendrecv.c
  
  Patch our version of it to quiesce warnings until someone decides to sync
  up our code:
  
  libzfs_sendrecv.c:2555:30: warning: format specifies type 'unsigned long'
but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
  sprintf(guidname, "%lu", thisguid);
 ~~~   ^~~~
 %llu
  libzfs_sendrecv.c:2612:29: warning: format specifies type 'unsigned long'
but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
  sprintf(guidname, "%lu", parent_fromsnap_guid);
 ~~~   ^~~~
 %llu
  libzfs_sendrecv.c:2645:29: warning: format specifies type 'unsigned long'
but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
  sprintf(guidname, "%lu", parent_fromsnap_guid);
 ~~~   ^~~~
 %llu
  
  Reviewed by:  allanjude
  Differential Revision:https://reviews.freebsd.org/D15325

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c   Sun May 
 6 15:59:03 2018(r06)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c   Sun May 
 6 16:22:02 2018(r07)
@@ -2552,7 +2552,7 @@ again:
needagain = B_TRUE;
else
progress = B_TRUE;
-   sprintf(guidname, "%lu", thisguid);
+   sprintf(guidname, "%" PRIu64, thisguid);
nvlist_add_boolean(deleted, guidname);
continue;
}
@@ -2609,7 +2609,7 @@ again:
needagain = B_TRUE;
else
progress = B_TRUE;
-   sprintf(guidname, "%lu", parent_fromsnap_guid);
+   sprintf(guidname, "%" PRIu64, parent_fromsnap_guid);
nvlist_add_boolean(deleted, guidname);
continue;
}
@@ -2642,7 +2642,7 @@ again:
if (stream_parent_fromsnap_guid != 0 &&
 parent_fromsnap_guid != 0 &&
 stream_parent_fromsnap_guid != parent_fromsnap_guid) {
-   sprintf(guidname, "%lu", parent_fromsnap_guid);
+   sprintf(guidname, "%" PRIu64, parent_fromsnap_guid);
if (nvlist_exists(deleted, guidname)) {
progress = B_TRUE;
needagain = B_TRUE;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r333304 - head/sys/netinet

2018-05-06 Thread Conrad Meyer
FYI, Coverity can detect this kind of issue scanning the kernel (not
just usrsctp).  It was detected as CID 1385266 on FreeBSD's Coverity
Scan.

Best,
Conrad

On Sun, May 6, 2018 at 7:19 AM, Michael Tuexen  wrote:
> Author: tuexen
> Date: Sun May  6 14:19:50 2018
> New Revision: 04
> URL: https://svnweb.freebsd.org/changeset/base/04
>
> Log:
>   Ensure we are not dereferencing a NULL pointer.
>
>   This was found by Coverity scanning the usrsctp stack (CID 203808).
>
>   MFC after:3 days
>
> Modified:
>   head/sys/netinet/sctp_indata.c
>
> Modified: head/sys/netinet/sctp_indata.c
> ==
> --- head/sys/netinet/sctp_indata.c  Sun May  6 13:59:56 2018
> (r03)
> +++ head/sys/netinet/sctp_indata.c  Sun May  6 14:19:50 2018
> (r04)
> @@ -3621,7 +3621,9 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, stru
> SCTP_SO_NOT_LOCKED);
> }
> /* Make sure to flag we had a FR */
> -   tp1->whoTo->net_ack++;
> +   if (tp1->whoTo != NULL) {
> +   tp1->whoTo->net_ack++;
> +   }
> continue;
> }
> }
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r333304 - head/sys/netinet

2018-05-06 Thread Michael Tuexen
> On 6. May 2018, at 19:09, Conrad Meyer  wrote:
> 
> FYI, Coverity can detect this kind of issue scanning the kernel (not
> just usrsctp).  It was detected as CID 1385266 on FreeBSD's Coverity
> Scan.
That is correct. I just had problems in getting access to the FreeBSD
page, so I didn't know the number. This has now been resolved.

Best regards
Michael
> 
> Best,
> Conrad
> 
> On Sun, May 6, 2018 at 7:19 AM, Michael Tuexen  wrote:
>> Author: tuexen
>> Date: Sun May  6 14:19:50 2018
>> New Revision: 04
>> URL: https://svnweb.freebsd.org/changeset/base/04
>> 
>> Log:
>>  Ensure we are not dereferencing a NULL pointer.
>> 
>>  This was found by Coverity scanning the usrsctp stack (CID 203808).
>> 
>>  MFC after:3 days
>> 
>> Modified:
>>  head/sys/netinet/sctp_indata.c
>> 
>> Modified: head/sys/netinet/sctp_indata.c
>> ==
>> --- head/sys/netinet/sctp_indata.c  Sun May  6 13:59:56 2018
>> (r03)
>> +++ head/sys/netinet/sctp_indata.c  Sun May  6 14:19:50 2018
>> (r04)
>> @@ -3621,7 +3621,9 @@ sctp_strike_gap_ack_chunks(struct sctp_tcb *stcb, stru
>>SCTP_SO_NOT_LOCKED);
>>}
>>/* Make sure to flag we had a FR */
>> -   tp1->whoTo->net_ack++;
>> +   if (tp1->whoTo != NULL) {
>> +   tp1->whoTo->net_ack++;
>> +   }
>>continue;
>>}
>>}
>> 

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r333308 - head/sys/net

2018-05-06 Thread Matt Macy
Author: mmacy
Date: Sun May  6 20:32:47 2018
New Revision: 08
URL: https://svnweb.freebsd.org/changeset/base/08

Log:
  The ifnet pointer (ifp) in rt_newaddrmsg can be valid without ifp->if_addr 
being set if
  if the ifnet is still live by way of a reference but
  in line for deletion. Check ifp->if_addr before dereferencing.
  
  Approved by:  sbruno

Modified:
  head/sys/net/rtsock.c

Modified: head/sys/net/rtsock.c
==
--- head/sys/net/rtsock.c   Sun May  6 16:22:02 2018(r07)
+++ head/sys/net/rtsock.c   Sun May  6 20:32:47 2018(r08)
@@ -1411,7 +1411,10 @@ rt_newmaddrmsg(int cmd, struct ifmultiaddr *ifma)
 
bzero((caddr_t)&info, sizeof(info));
info.rti_info[RTAX_IFA] = ifma->ifma_addr;
-   info.rti_info[RTAX_IFP] = ifp ? ifp->if_addr->ifa_addr : NULL;
+   if (ifp && ifp->if_addr)
+   info.rti_info[RTAX_IFP] = ifp->if_addr->ifa_addr;
+   else
+   info.rti_info[RTAX_IFP] = NULL;
/*
 * If a link-layer address is present, present it as a ``gateway''
 * (similarly to how ARP entries, e.g., are presented).
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r333309 - in head/sys: net netinet netinet6

2018-05-06 Thread Matt Macy
Author: mmacy
Date: Sun May  6 20:34:13 2018
New Revision: 09
URL: https://svnweb.freebsd.org/changeset/base/09

Log:
  r333175 introduced deferred deletion of multicast addresses in order to 
permit the driver ioctl
  to sleep on commands to the NIC when updating multicast filters. More 
generally this permitted
  driver's to use an sx as a softc lock. Unfortunately this change introduced a 
race whereby a
  a multicast update would still be queued for deletion when ifconfig deleted 
the interface
  thus calling down in to _purgemaddrs and synchronously deleting _all_ of the 
multicast addresses
  on the interface.
  
  Synchronously remove all external references to a multicast address before 
enqueueing for delete.
  
  Reported by:  lwhsu
  Approved by:  sbruno

Modified:
  head/sys/net/if.c
  head/sys/net/if_var.h
  head/sys/netinet/igmp.c
  head/sys/netinet/in.c
  head/sys/netinet/in_mcast.c
  head/sys/netinet/in_var.h
  head/sys/netinet6/in6_ifattach.c
  head/sys/netinet6/in6_mcast.c
  head/sys/netinet6/in6_var.h
  head/sys/netinet6/mld6.c

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Sun May  6 20:32:47 2018(r08)
+++ head/sys/net/if.c   Sun May  6 20:34:13 2018(r09)
@@ -254,7 +254,6 @@ struct mbuf *(*tbr_dequeue_ptr)(struct ifaltq *, int) 
 static voidif_attachdomain(void *);
 static voidif_attachdomain1(struct ifnet *);
 static int ifconf(u_long, caddr_t);
-static voidif_freemulti(struct ifmultiaddr *);
 static voidif_grow(void);
 static voidif_input_default(struct ifnet *, struct mbuf *);
 static int if_requestencap_default(struct ifnet *, struct if_encap_req *);
@@ -3395,7 +3394,10 @@ if_allocmulti(struct ifnet *ifp, struct sockaddr *sa, 
  * counting, notifying the driver, handling routing messages, and releasing
  * any dependent link layer state.
  */
-static void
+#ifdef MCAST_VERBOSE
+extern void kdb_backtrace(void);
+#endif
+void
 if_freemulti(struct ifmultiaddr *ifma)
 {
 
@@ -3404,6 +3406,10 @@ if_freemulti(struct ifmultiaddr *ifma)
 
if (ifma->ifma_lladdr != NULL)
free(ifma->ifma_lladdr, M_IFMADDR);
+#ifdef MCAST_VERBOSE
+   kdb_backtrace();
+   printf("%s freeing ifma: %p\n", __func__, ifma);
+#endif
free(ifma->ifma_addr, M_IFMADDR);
free(ifma, M_IFMADDR);
 }
@@ -3610,6 +3616,12 @@ if_delallmulti(struct ifnet *ifp)
IF_ADDR_WUNLOCK(ifp);
 }
 
+void
+if_delmulti_ifma(struct ifmultiaddr *ifma)
+{
+   if_delmulti_ifma_flags(ifma, 0);
+}
+
 /*
  * Delete a multicast group membership by group membership pointer.
  * Network-layer protocol domains must use this routine.
@@ -3617,11 +3629,11 @@ if_delallmulti(struct ifnet *ifp)
  * It is safe to call this routine if the ifp disappeared.
  */
 void
-if_delmulti_ifma(struct ifmultiaddr *ifma)
+if_delmulti_ifma_flags(struct ifmultiaddr *ifma, int flags)
 {
struct ifnet *ifp;
int lastref;
-
+   MCDPRINTF("%s freeing ifma: %p\n", __func__, ifma);
 #ifdef INET
IN_MULTI_LIST_UNLOCK_ASSERT();
 #endif
@@ -3649,7 +3661,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifma)
if (ifp != NULL)
IF_ADDR_WLOCK(ifp);
 
-   lastref = if_delmulti_locked(ifp, ifma, 0);
+   lastref = if_delmulti_locked(ifp, ifma, flags);
 
if (ifp != NULL) {
/*
@@ -3683,6 +3695,7 @@ if_delmulti_locked(struct ifnet *ifp, struct ifmultiad
}
 
ifp = ifma->ifma_ifp;
+   MCDPRINTF("%s freeing %p from %s \n", __func__, ifma, ifp ? 
ifp->if_xname : "");
 
/*
 * If the ifnet is detaching, null out references to ifnet,
@@ -3708,6 +3721,9 @@ if_delmulti_locked(struct ifnet *ifp, struct ifmultiad
if (--ifma->ifma_refcount > 0)
return 0;
 
+   if (ifp != NULL && detaching == 0)
+   TAILQ_REMOVE(&ifp->if_multiaddrs, ifma, ifma_link);
+
/*
 * If this ifma is a network-layer ifma, a link-layer ifma may
 * have been associated with it. Release it first if so.
@@ -3726,11 +3742,15 @@ if_delmulti_locked(struct ifnet *ifp, struct ifmultiad
if_freemulti(ll_ifma);
}
}
-   if (ifp != NULL && detaching == 0)
-   TAILQ_REMOVE(&ifp->if_multiaddrs, ifma, ifma_link);
+#ifdef INVARIANTS
+   if (ifp) {
+   struct ifmultiaddr *ifmatmp;
 
+   TAILQ_FOREACH(ifmatmp, &ifp->if_multiaddrs, ifma_link)
+   MPASS(ifma != ifmatmp);
+   }
+#endif
if_freemulti(ifma);
-
/*
 * The last reference to this instance of struct ifmultiaddr
 * was released; the hardware should be notified of this change.

Modified: head/sys/net/if_var.h
==
--- head/sys/net/if_var.h   Sun May  6 20:32:47 2018(r08)
+++ head/sys/net/if_var

svn commit: r333310 - head/sys/sys

2018-05-06 Thread Poul-Henning Kamp
Author: phk
Date: Sun May  6 21:22:46 2018
New Revision: 10
URL: https://svnweb.freebsd.org/changeset/base/10

Log:
  With the fall-back hack for lint gone, I have no copyright claim on this file.

Modified:
  head/sys/sys/_stdarg.h

Modified: head/sys/sys/_stdarg.h
==
--- head/sys/sys/_stdarg.h  Sun May  6 20:34:13 2018(r09)
+++ head/sys/sys/_stdarg.h  Sun May  6 21:22:46 2018(r10)
@@ -2,7 +2,6 @@
  * SPDX-License-Identifier: BSD-3-Clause
  *
  * Copyright (c) 2002 David E. O'Brien.  All rights reserved.
- * Copyright (c) 2017 Poul-Henning Kamp. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r333311 - head/sys/fs/msdosfs

2018-05-06 Thread Pedro F. Giffuni
Author: pfg
Date: Sun May  6 21:29:29 2018
New Revision: 11
URL: https://svnweb.freebsd.org/changeset/base/11

Log:
  msdosfs: use vfs_timestamp() to generate timestamps instead of getnanotime().
  
  Most filesystems, with the notable exceptions of msdosfs and autofs use
  only vfs_timestamp() to read the current time. This has the benefit of
  configurable granularity (using the vfs.timestamp_precision sysctl).
  
  For convenience, use it on msdosfs too.
  
  Submitted by: Damjan Jovanovic
  Differential Revision:https://reviews.freebsd.org/D15297

Modified:
  head/sys/fs/msdosfs/msdosfs_denode.c
  head/sys/fs/msdosfs/msdosfs_vnops.c

Modified: head/sys/fs/msdosfs/msdosfs_denode.c
==
--- head/sys/fs/msdosfs/msdosfs_denode.cSun May  6 21:22:46 2018
(r10)
+++ head/sys/fs/msdosfs/msdosfs_denode.cSun May  6 21:29:29 2018
(r11)
@@ -297,7 +297,7 @@ deupdat(struct denode *dep, int waitfor)
DE_MODIFIED);
return (0);
}
-   getnanotime(&ts);
+   vfs_timestamp(&ts);
DETIMES(dep, &ts, &ts, &ts);
if ((dep->de_flag & DE_MODIFIED) == 0 && waitfor == 0)
return (0);

Modified: head/sys/fs/msdosfs/msdosfs_vnops.c
==
--- head/sys/fs/msdosfs/msdosfs_vnops.c Sun May  6 21:22:46 2018
(r10)
+++ head/sys/fs/msdosfs/msdosfs_vnops.c Sun May  6 21:29:29 2018
(r11)
@@ -178,7 +178,7 @@ msdosfs_create(struct vop_create_args *ap)
ndirent.de_FileSize = 0;
ndirent.de_pmp = pdep->de_pmp;
ndirent.de_flag = DE_ACCESS | DE_CREATE | DE_UPDATE;
-   getnanotime(&ts);
+   vfs_timestamp(&ts);
DETIMES(&ndirent, &ts, &ts, &ts);
error = createde(&ndirent, pdep, &dep, cnp);
if (error)
@@ -216,7 +216,7 @@ msdosfs_close(struct vop_close_args *ap)
 
VI_LOCK(vp);
if (vp->v_usecount > 1) {
-   getnanotime(&ts);
+   vfs_timestamp(&ts);
DETIMES(dep, &ts, &ts, &ts);
}
VI_UNLOCK(vp);
@@ -266,7 +266,7 @@ msdosfs_getattr(struct vop_getattr_args *ap)
u_long dirsperblk = pmp->pm_BytesPerSec / sizeof(struct direntry);
uint64_t fileid;
 
-   getnanotime(&ts);
+   vfs_timestamp(&ts);
DETIMES(dep, &ts, &ts, &ts);
vap->va_fsid = dev2udev(pmp->pm_dev);
/*
@@ -1330,7 +1330,7 @@ msdosfs_mkdir(struct vop_mkdir_args *ap)
memset(&ndirent, 0, sizeof(ndirent));
ndirent.de_pmp = pmp;
ndirent.de_flag = DE_ACCESS | DE_CREATE | DE_UPDATE;
-   getnanotime(&ts);
+   vfs_timestamp(&ts);
DETIMES(&ndirent, &ts, &ts, &ts);
 
/*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"