On Fri, Feb 17, 2017 at 11:06:21AM -0800, hiren panchasara wrote: h> On 03/19/15 at 11:08P, hiren panchasara wrote: h> > On 03/16/15 at 06:06P, hiren panchasara wrote: h> > > On 03/16/15 at 03:39P, Gleb Smirnoff wrote: h> > > > On Wed, Mar 11, 2015 at 02:36:07PM -0700, hiren panchasara wrote: h> > > > h> On 02/13/15 at 11:19P, Simon J. Gerraty wrote: h> > > > h> > Author: sjg h> > > > h> > Date: Fri Feb 13 23:19:35 2015 h> > > > h> > New Revision: 278729 h> > > > h> > URL: https://svnweb.freebsd.org/changeset/base/278729 h> > > > h> > h> > > > h> > Log: h> > > > h> > sbspace: size of bleft, mleft must match sockbuf fields to avoid h> > > > h> > overflow on amd64 h> > > > h> > h> > > > h> > Submitted by: anshu...@juniper.net h> > > > h> > Obtained from: Juniper Networks h> > > > h> h> > > > h> Talking to sjg on -arch to MFC this. If he cannot get around doing that, h> > > > h> I'll do it tomorrow. h> > > > h> h> > > > h> Letting people know here to see if there are any objections. h> > > > h> > > > Would that fix the bug we've been discussing? h> > > h> > > Unsure as I am not sure what caused the issue I saw. h> > > h> > > For those who do not know the details, we recently saw a userland h> > > process stuck spinning at 100% around sbcut_internal(). Inside h> > > sbflush_internal(), the sb_cc was grown to be about 4G. And before h> > > passing it to sbcut_internal(), we cast it from uint to int which h> > > would make that valud -ve. h> > > h> > > Gleb pointed out to me that sbspace() is supposed to check/stop sb_cc h> > > from growing that large. h> > > h> > > Now, I am not sure if we'd ever run into this situation again but h> > > current fix is a great catch anyways. h> > > h> > > I still have 2 questions around what we saw. It'd be great if someone can h> > > clarify them for my understanding: h> > > h> > > 1) Even if we get into such a scenario that we were in, following would h> > > help by not looping endlessly. h> > > h> > > --- uipc_sockbuf.c.0 2015-03-11 15:49:52.000000000 -0700 h> > > +++ uipc_sockbuf.c 2015-03-11 15:51:48.000000000 -0700 h> > > @@ -877,6 +877,9 @@ h> > > { h> > > struct mbuf *m, *n, *next, *mfree; h> > > h> > > + if (len < 0) h> > > + panic("%s: len is %d and it is supposed to be +ve", h> > > + __func__, len); h> > > + h> > > next = (m = sb->sb_mb) ? m->m_nextpkt : 0; h> > > mfree = NULL h> > > h> > > 2) We need 1) because we are casting a uint to int which _may_ rander a h> > > value -ve. Is there a way we can avoid the casting? h> > h> > It'd be useful if someone with knowledge in this area can weigh in. h> h> Ran into this again today. While the real question of how sb_ccc grew h> this large is still unsolved, any objection to adding this patch to h> avoid a hang and panic instead?
I am all for adding KASSERT now and then fixing the bug. -- Totus tuus, Glebius. _______________________________________________ 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"