NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/40661: kernel: page fault trap by IPV6_PKTINFO



>Number:         40661
>Category:       kern
>Synopsis:       kernel: page fault trap by IPV6_PKTINFO
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 16 10:55:00 +0000 2009
>Originator:     Tanaka Akira
>Release:        NetBSD 4.0.1
>Organization:
AIST
>Environment:
NetBSD netbsd.tky.aist.go.jp 4.0.1 NetBSD 4.0.1 (GENERIC) #0: Tue Oct  7 
21:00:39 PDT 2008  
builds@wb28:/home/builds/ab/netbsd-4-0-1-RELEASE/amd64/200810080053Z-obj/home/builds/ab/netbsd-4-0-1-RELEASE/src/sys/arch/amd64/compile/GENERIC
 amd64

>Description:
IPV6_PKTINFO causes "kernel: page fault trap".

uvm_fault(0xffffffff80aef340, 0xffff800085250000, 1) -> e
kernel: page fault trap, code=0
Stopped in pid 179.1 (a.out) at netbsd:ip6_setpktopts+0xe6:    movl    
0(%r13),%r12d
db>

Note that IPV6_PKTINFO is described in RFC 3542.

>How-To-Repeat:
% cat tst.c 
#include <stdlib.h>
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>

int main(int argc, char **argv)
{
  int s1, s2;
  int on = 1;
  struct sockaddr_in6 addr = { sizeof(addr), AF_INET6, 9999, 0, 
IN6ADDR_LOOPBACK_INIT, 0 };
  char buf[4096], cbuf[4096];
  struct sockaddr_storage ss;
  struct iovec iov;
  struct msghdr msg;
  int ret;

  s1 = socket(PF_INET6, SOCK_DGRAM, 0);
  if (s1 == -1) { perror("socket"); exit(1); }

  ret = setsockopt(s1, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on));
  if (ret == -1) { perror("setsockopt"); exit(1); }

  ret = bind(s1, (struct sockaddr *)&addr, sizeof(addr));
  if (ret == -1) { perror("bind"); exit(1); }

  s2 = socket(PF_INET6, SOCK_DGRAM, 0);
  if (s2 == -1) { perror("socket"); exit(1); }

  ret = sendto(s2, "a", 1, 0, (struct sockaddr *)&addr, sizeof(addr));
  if (ret == -1) { perror("sendto"); exit(1); }

  iov.iov_base = buf;
  iov.iov_len = sizeof(buf);

  msg.msg_name = (void *)&ss;
  msg.msg_namelen = sizeof(ss);
  msg.msg_iov = &iov;
  msg.msg_iovlen = 1;
  msg.msg_control = cbuf;
  msg.msg_controllen = sizeof(cbuf);
  msg.msg_flags = 0;

  ret = recvmsg(s1, &msg, 0);
  if (ret == -1) { perror("recvmsg"); exit(1); }

  msg.msg_iov->iov_len = ret;
  msg.msg_controllen = ((struct cmsghdr *)&cbuf)->cmsg_len;

  ret = sendmsg(s1, &msg, 0);
  if (ret == -1) { perror("sendmsg"); exit(1); }

  return 0;
}
% gcc -Wall tst.c 
% ./a.out 

>Fix:



Home | Main Index | Thread Index | Old Index