Hello Ahmed, That explains the original implementation. Given the wording of the task description, your interpretation was understandable. :)
The task description could perhaps be updated to reflect the single bounded RPC approach and avoid similar misunderstandings in the future. I look forward to reviewing the fd-read patch — hopefully only once. :) Best regards, Alperen Erkan On Sat, Nov 28, 2026 at 8:28 PM Ahmed Khider <[email protected]> wrote: > Hello Alperen > > when I saw this task on the small hack entries (1) > > It was say : > > Fix _hurd_fd_read and _hurd_fd_write (and possibly other such RPCs) for > sizes beyond 2GB on 64b systems: mach_msg_type_number_t cannot express > such a large value; they need to perform a loop. > > I misunderstood the loop part, so I thought I should implement it. > > Also, I may send duplicate patches accidentally when I send the fd-read > patch :) > > 1 : https://hurd.ion.nu/contributing.html > > On Sat, Nov 28, 2026 at 8:04 PM Alperen Erkan <[email protected]> > wrote: > >> Hello Ahmed, >> >> Quite a bit of work has gone into this! :) >> >> The concerns I raised in my previous reviews have been addressed. The >> single bounded RPC >> approach, the use of INT32_MAX, and the updated sanity check are all >> consistent with our earlier discussions. >> >> I have no further objections from a static review perspective. >> >> LGTM. >> >> Please note that I have neither compiled nor runtime-tested the patch. >> >> I will leave any further comments to the other reviewers. >> >> Best regards, >> Alperen Erkan >> >> On Sat, Nov 28, 2026 at 7:32 PM Ahmed Khider <[email protected]> >> wrote: >> >>> --- >>> hurd/fd-write.c | 11 +++++++++-- >>> 1 file changed, 9 insertions(+), 2 deletions(-) >>> >>> diff --git a/hurd/fd-write.c b/hurd/fd-write.c >>> index 2dc2eedf..7d138c2c 100644 >>> --- a/hurd/fd-write.c >>> +++ b/hurd/fd-write.c >>> @@ -16,6 +16,7 @@ >>> License along with the GNU C Library; if not, see >>> <https://www.gnu.org/licenses/>. */ >>> >>> +#include <stdint.h> >>> #include <errno.h> >>> #include <unistd.h> >>> #include <hurd.h> >>> @@ -27,17 +28,23 @@ _hurd_fd_write (struct hurd_fd *fd, >>> { >>> error_t err; >>> vm_size_t wrote; >>> + size_t wbytes; >>> >>> + if (*nbytes > INT32_MAX) >>> + wbytes = INT32_MAX; >>> + else >>> + wbytes = *nbytes; >>> >>> error_t writefd (io_t port) >>> { >>> - return __io_write (port, buf, *nbytes, offset, &wrote); >>> + return __io_write (port, buf, wbytes, offset, &wrote); >>> } >>> >>> err = HURD_FD_PORT_USE_CANCEL (fd, _hurd_ctty_output (port, ctty, >>> writefd)); >>> if (err) >>> return err; >>> >>> - if (__glibc_unlikely (wrote > *nbytes)) /* Sanity check for >>> bogus server. */ >>> + if (__glibc_unlikely (wrote > wbytes)) /* Sanity check for >>> bogus server. */ >>> return EGRATUITOUS; >>> >>> *nbytes = wrote; >>> -- >>> 2.47.3 >>> >>> >>>
