To test, I've been placing a webserver with the kernel in production, and monitoring performance and behaviours. With the new kernel, we'll see segfaults somewhat regularly, although it's hard to predict how quickly they happen; sometimes it's within minutes, sometimes it takes a half hour:
- Code: Select all
Oct 7 13:20:32 webtest kernel: [66581.193615] grsec: From 192.168.0.10: Segmentation fault occurred at (nil) in /usr/sbin/nginx[nginx:8166] uid/euid:33/33 gid/egid:33/33, parent /usr/sbin/nginx[nginx:8164] uid/euid:0/0 gid/egid:0/0
Since we use Lua, nginx is already exempt from mprotect. To try to figure out what might be causing it, I've exempted it from all things PAX; its flags are now "mprxs". This didn't help, and the segmentation faults are continuing.
Taking a quick look at a core dump:
- Code: Select all
Reading symbols from /usr/sbin/nginx...done.
[New LWP 8166]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `nginx: worker process '.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 ngx_ssl_new_session (ssl_conn=0x2ea1f00, sess=0x2d779e0) at src/event/ngx_event_openssl.c:2309
2309 cache = shm_zone->data;
(gdb) bt
#0 ngx_ssl_new_session (ssl_conn=0x2ea1f00, sess=0x2d779e0) at src/event/ngx_event_openssl.c:2309
#1 0x00006de9a1d33790 in ?? () from /lib/x86_64-linux-gnu/libssl.so.1.0.0
#2 0x00006de9a1d12908 in ?? () from /lib/x86_64-linux-gnu/libssl.so.1.0.0
#3 0x00000000004284f1 in ngx_ssl_handshake (c=c@entry=0x6de99b5f31d0) at src/event/ngx_event_openssl.c:1093
#4 0x0000000000428738 in ngx_ssl_handshake_handler (ev=<optimized out>) at src/event/ngx_event_openssl.c:1245
#5 0x000000000041ea58 in ngx_event_process_posted (cycle=cycle@entry=0x872ea0, posted=0x6b54f0 <ngx_posted_events>) at src/event/ngx_event_posted.c:33
#6 0x000000000041e645 in ngx_process_events_and_timers (cycle=cycle@entry=0x872ea0) at src/event/ngx_event.c:265
#7 0x00000000004240cc in ngx_worker_process_cycle (cycle=0x872ea0, data=<optimized out>) at src/os/unix/ngx_process_cycle.c:767
#8 0x0000000000422b46 in ngx_spawn_process (cycle=cycle@entry=0x872ea0, proc=proc@entry=0x423ffb <ngx_worker_process_cycle>, data=data@entry=0x1, name=name@entry=0x481386 "worker process", respawn=respawn@entry=-3) at src/os/unix/ngx_process.c:198
#9 0x0000000000424225 in ngx_start_worker_processes (cycle=cycle@entry=0x872ea0, n=2, type=type@entry=-3) at src/os/unix/ngx_process_cycle.c:357
#10 0x0000000000424a81 in ngx_master_process_cycle (cycle=cycle@entry=0x872ea0) at src/os/unix/ngx_process_cycle.c:129
#11 0x00000000004081c6 in main (argc=<optimized out>, argv=<optimized out>) at src/core/nginx.c:419
(gdb)
Note that I've only looked at the one core, and I haven't really done any further investigation.
Is there something that's changed in recent versions of grsecurity that might cause this?