Daniel Hartmeier | 5 Jun 2012 11:05
Favicon

m_copym() panics possibly due to pfil hook?

Does someone still experience infrequent m_copym panics, like PR #41588?

This might be related to the pfil hooks and mbufs that don't start with
a contiguous IP header.

If so, see http://marc.info/?l=freebsd-net&m=133888532814565 for an
explanation and simple patch to try.

Kind regards,
Daniel

Darren Reed | 5 Jun 2012 19:33
Picon

Re: m_copym() panics possibly due to pfil hook?

On 5/06/2012 7:05 PM, Daniel Hartmeier wrote:
> Does someone still experience infrequent m_copym panics, like PR #41588?
> 
> This might be related to the pfil hooks and mbufs that don't start with
> a contiguous IP header.
> 
> If so, see http://marc.info/?l=freebsd-net&m=133888532814565 for an
> explanation and simple patch to try.
> 
> Kind regards,
> Daniel

As much as I dislike the patch you created, I can't see any other way
to elegantly solve the problem. The reason that I don't like the change
is that it seems silly to have to put the packet in two different mbufs
after having put it all in one. I'll file this as a workaround for the
code in m_pulldown() being buggy.

The patch below should work for NetBSD.

The greater problem that I see here is what if someone else were to use
m_pulldown in their home-brew code that uses pfil ... from that angle,
there should be a responsibility to make the interfaces more robust but
perhaps that can be achieved with documentation updates.

Darren

*** ip_fil_netbsd.c.orig     26 Jan 2012 06:03:43 -0000      2.55.2.71
--- ip_fil_netbsd.c     5 Jun 2012 12:14:47 -0000
***************
(Continue reading)

Darren Reed | 5 Jun 2012 20:08
Picon

Re: m_copym() panics possibly due to pfil hook?

Scratch that prior patch, it doesn't fix the problem for IPv6.

Darren

*** ip_fil_netbsd.c.orig     26 Jan 2012 06:03:43 -0000      2.55.2.71
--- ip_fil_netbsd.c     5 Jun 2012 18:02:12 -0000
***************
*** 170,175 ****
--- 170,176 ----
  struct ifnet *ifp;
  int dir;
  {
+       struct mbuf *m;
        struct ip *ip;
        int rv, hlen;

***************
*** 220,230 ****
        NTOHS(ip->ip_off);

        rv = fr_check(ip, hlen, ifp, (dir == PFIL_OUT), mp);
!
!       if (rv == 0 && *mp != NULL) {
!               ip = mtod(*mp, struct ip *);
!               HTONS(ip->ip_len);
!               HTONS(ip->ip_off);
        }

        return (rv);
--- 221,236 ----
(Continue reading)


Gmane