BUG/MINOR: quic: fix crash on PTO rearm if anti-amplification reset
There is a possible segfault when accessing qc->timer_task in quic_conn_io_cb() without testing it. It seems however very rare as it requires several condition to be encounter. * quic_conn must be in CLOSING state after having sent a CONNECTION_CLOSE which free the qc.timer_task * quic_conn handshake must still be in progress : in fact, qc.timer_task is accessed on this path because of the anti-amplification limit lifted. I was unable thus far to trigger it but benchmarking tests seems to have fire it with the following backtrace as a result : #0 _task_wakeup (f=4096, caller=0x5620ed004a40 <_.46868>, t=0x0) at include/haproxy/task.h:195 195 state = _HA_ATOMIC_OR_FETCH(&t->state, f); [Current thread is 1 (Thread 0x7fc714ff1700 (LWP 14305))] (gdb) bt #0 _task_wakeup (f=4096, caller=0x5620ed004a40 <_.46868>, t=0x0) at include/haproxy/task.h:195 #1 quic_conn_io_cb (t=0x7fc5d0e07060, context=0x7fc5d0df49c0, state=<optimized out>) at src/quic_conn.c:4393 #2 0x00005620ecedab6e in run_tasks_from_lists (budgets=<optimized out>) at src/task.c:596 #3 0x00005620ecedb63c in process_runnable_tasks () at src/task.c:861 #4 0x00005620ecea971a in run_poll_loop () at src/haproxy.c:2913 #5 0x00005620ecea9cf9 in run_thread_poll_loop (data=<optimized out>) at src/haproxy.c:3102 #6 0x00007fc773c3f609 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0 #7 0x00007fc77372d133 in clone () from /lib/x86_64-linux-gnu/libc.so.6 (gdb) up #1 quic_conn_io_cb (t=0x7fc5d0e07060, context=0x7fc5d0df49c0, state=<optimized out>) at src/quic_conn.c:4393 4393 task_wakeup(qc->timer_task, TASK_WOKEN_MSG); (gdb) p qc $1 = (struct quic_conn *) 0x7fc5d0df49c0 (gdb) p qc->timer_task $2 = (struct task *) 0x0 This fix should be backported up to 2.6.
This commit is contained in:
parent
16c9ca94ef
commit
5ac6b3b125
@ -4389,7 +4389,7 @@ struct task *quic_conn_io_cb(struct task *t, void *context, unsigned int state)
|
||||
* datagram parser was not executed by only one thread.
|
||||
*/
|
||||
qc_set_timer(qc);
|
||||
if (tick_isset(qc->timer) && tick_is_lt(qc->timer, now_ms))
|
||||
if (qc->timer_task && tick_isset(qc->timer) && tick_is_lt(qc->timer, now_ms))
|
||||
task_wakeup(qc->timer_task, TASK_WOKEN_MSG);
|
||||
}
|
||||
ssl_err = SSL_ERROR_NONE;
|
||||
|
Loading…
Reference in New Issue
Block a user