|
From: | Pádraig Brady |
Subject: | bug#49209: coreutils: stack out-of-bounds write in tail --follow |
Date: | Tue, 29 Jun 2021 00:10:42 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 |
On 27/06/2021 02:47, Paul Eggert wrote:
On 6/24/21 8:50 AM, Paul Eggert wrote:inotify_init can return 1025 even if called first thing, so we also need to dup2 the result of early inotify_init down to 3 (or whatever), or at least to check that it's less than 1024. Choosing 3 is a tricky business, since it's not clear what fds the C library actually needs.When looking into this I decided it was cleaner to fix coreutils by using 'poll' instead of 'select', as Kamil suggested. I installed the attached patches to do that. The last patch fixes the bug.
Yes using poll() with the inotify descriptor is cleaner. That's limited to Linux also, so should work fine. For my reference, with the change from select() to poll() in check_output_alive(), we'll need to be more carefully test tests/tail-2/pipe-f.sh on various platforms, especially those where we implement missing poll (mingw, MSVC 14, HP NonStop). If poll() didn't work here for these platforms (and we moved back to using select), we might considering removing poll as a dependency as it would be redundant. thanks for the fix! Pádraig
[Prev in Thread] | Current Thread | [Next in Thread] |