From: Christopher Faulet Date: Thu, 23 Mar 2023 16:30:29 +0000 (+0100) Subject: MINOR: stconn/applet: Add BUG_ON_HOT() to be sure SE_FL_EOS is never set alone X-Git-Tag: v2.8-dev7~68 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8019f78326993a50458a69534c5b29e1266cbb05;p=thirdparty%2Fhaproxy.git MINOR: stconn/applet: Add BUG_ON_HOT() to be sure SE_FL_EOS is never set alone SE_FL_EOS flag must never be set on the SE descriptor without SE_FL_EOI or SE_FL_ERROR. When a mux or an applet report an end of stream, it must be able to state if it is the end of input too or if it is an error. Because all this part was recently refactored, especially the applet part, it is a bit sensitive. Thus a BUG_ON_HOT() is used and not a BUG_ON(). --- diff --git a/src/applet.c b/src/applet.c index b9bb9928b2..41f1b08035 100644 --- a/src/applet.c +++ b/src/applet.c @@ -477,6 +477,8 @@ struct task *task_run_applet(struct task *t, void *context, unsigned int state) stream_dump_and_crash(&app->obj_type, read_freq_ctr(&app->call_rate)); } + BUG_ON_HOT((sc_ep_get(sc) & (SE_FL_EOI|SE_FL_EOS|SE_FL_ERROR)) == SE_FL_EOS); + sc->app_ops->wake(sc); channel_release_buffer(sc_ic(sc), &app->buffer_wait); TRACE_LEAVE(APPLET_EV_PROCESS, app); diff --git a/src/stconn.c b/src/stconn.c index 061a003b81..b1d02d95f9 100644 --- a/src/stconn.c +++ b/src/stconn.c @@ -1502,6 +1502,8 @@ static int sc_conn_recv(struct stconn *sc) se_have_more_data(sc->sedesc); ret = 1; } + + BUG_ON_HOT((sc_ep_get(sc) & (SE_FL_EOI|SE_FL_EOS|SE_FL_ERROR)) == SE_FL_EOS); return ret; }