]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: poller: drop FD's tgid when masks don't match
authorWilly Tarreau <w@1wt.eu>
Mon, 25 Jul 2022 13:39:21 +0000 (15:39 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 Jul 2022 13:47:15 +0000 (15:47 +0200)
A bug was introduced in 2.7-dev2 by commit 1f947cb39 ("MAJOR: poller:
only touch/inspect the update_mask under tgid protection"): once the
FD's tgid is held, we would forget to drop it in case the update mask
doesn't match, resulting in random watchdog panics of older processes
on successive reloads.

This should fix issue #1798. Thanks to Christian for the report and
to Christopher for the reproducer.

No backport is needed.

src/ev_epoll.c
src/ev_evports.c
src/ev_kqueue.c

index f35e1c29be6f03017742b16f9bdcf3f79325f2b8..970c0fe70564b33c18ed7e1442ed526a440c0a72 100644 (file)
@@ -204,8 +204,10 @@ static void _do_poll(struct poller *p, int exp, int wake)
                        continue;
                }
 
-               if (!(fdtab[fd].update_mask & ti->ltid_bit))
+               if (!(fdtab[fd].update_mask & ti->ltid_bit)) {
+                       fd_drop_tgid(fd);
                        continue;
+               }
 
                done_update_polling(fd);
 
index 19d572c66375eace89d648696573ba7fd03555bb..2530b39c046d25bef28f89975c5bfc35b03b5a6a 100644 (file)
@@ -160,8 +160,10 @@ static void _do_poll(struct poller *p, int exp, int wake)
                        continue;
                }
 
-               if (!(fdtab[fd].update_mask & ti->ltid_bit))
+               if (!(fdtab[fd].update_mask & ti->ltid_bit)) {
+                       fd_drop_tgid(fd);
                        continue;
+               }
 
                done_update_polling(fd);
 
index 3d555ec7ef8ae2899733f0a10536dcc495ba603b..3c8787ffd780adea59a01914c2ebf5668f412f3b 100644 (file)
@@ -134,8 +134,10 @@ static void _do_poll(struct poller *p, int exp, int wake)
                        continue;
                }
 
-               if (!(fdtab[fd].update_mask & ti->ltid_bit))
+               if (!(fdtab[fd].update_mask & ti->ltid_bit)) {
+                       fd_drop_tgid(fd);
                        continue;
+               }
 
                done_update_polling(fd);