FreeBSD Bugzilla – Attachment 145446 Details for
Bug 192426
[bpf] [panic] [patch]: Kernel panic when using BPF
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Minimal test case to reproduce the kernel panic
panic.c (text/plain), 792 bytes, created by
Robert Clipsham
on 2014-08-07 13:01:57 UTC
(
hide
)
Description:
Minimal test case to reproduce the kernel panic
Filename:
MIME Type:
Creator:
Robert Clipsham
Created:
2014-08-07 13:01:57 UTC
Size:
792 bytes
patch
obsolete
>#include <fcntl.h> >#include <string.h> >#include <sys/types.h> >#include <sys/time.h> >#include <sys/ioctl.h> >#include <net/bpf.h> >#include <sys/socket.h> >#include <net/if.h> >#include <unistd.h> > >#define BUFLEN 64 > >int main(int argc, const char *argv[]) >{ > unsigned char buffer[BUFLEN]; > u_int buflen = BUFLEN; > u_int one = 1; > struct ifreq iface; > int fd; > > memset(buffer, 0, BUFLEN); > > memset(&iface, 0, sizeof iface); > memcpy(&iface, "lo0", 3); > > fd = open("/dev/bpf", O_RDWR, 0); > ioctl(fd, BIOCSBLEN, &buflen); > ioctl(fd, BIOCSETIF, &iface); > > // Commenting either of the following two lines > // prevents the panic > ioctl(fd, BIOCFEEDBACK, &one); > *(u_long*)buffer = 2; // buffer[0..3] = AF_INET > > write(fd, buffer, BUFLEN); > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 192426
:
145415
| 145446 |
145448