glibc/hurd
Sergey Bugaev 8cbab3b729 hurd: Protect against servers returning bogus read/write lengths
There already was a branch checking for this case in _hurd_fd_read ()
when the data is returned out-of-line. Do the same for inline data, as
well as for _hurd_fd_write (). It's also not possible for the length to
be negative, since it's stored in an unsigned integer.

Not verifying the returned length can confuse the callers who assume
the returned length is always reasonable. This manifested as libzstd
test suite failing on writes to /dev/zero, even though the write () call
appeared to succeed. In fact, the zero store backing /dev/zero was
returning a larger written length than the size actually submitted to
it, which is a separate bug to be fixed on the Hurd side. With this
patch, EGRATUITOUS is now propagated to the caller.

Reported-by: Diego Nieto Cid <dnietoc@gmail.com>
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-ID: <20241204112915.540032-1-bugaevc@gmail.com>
2024-12-05 08:49:35 +01:00
..
hurd hurd: Stop mapping AT_NO_AUTOMOUNT to O_NOTRANS 2024-04-30 22:08:16 +02:00
alloc-fd.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
catch-exc.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
catch-signal.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
compat-20.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
ctty-input.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
ctty-output.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
Depend * Makefile (subdir-target-args): New variable. 2006-02-28 07:11:04 +00:00
dtable.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
exc2signal.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
faultexc.defs Sun May 12 11:16:58 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> 1996-05-12 16:38:08 +00:00
fchroot.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
fcntl-internal.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
fd-cleanup.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
fd-close.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
fd-read.c hurd: Protect against servers returning bogus read/write lengths 2024-12-05 08:49:35 +01:00
fd-write.c hurd: Protect against servers returning bogus read/write lengths 2024-12-05 08:49:35 +01:00
fopenport.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
get-host.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
getdport.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
geteuids.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
getumask.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurd-raise.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurd.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdauth.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdchdir.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdexec.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdfault.c x86_64 hurd: ensure we have a large enough buffer to receive exception_raise requests. 2024-07-30 16:59:12 +02:00
hurdfault.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdfchdir.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdhost.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdid.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdinit.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdioctl.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdkill.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdlock.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdlock.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdlookup.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdmalloc.c hurd: Fix static-PIE startup 2021-12-28 10:28:22 +01:00
hurdmalloc.h hurdmalloc: Run fork handler as late as possible [BZ #19431] 2016-09-22 01:45:48 +02:00
hurdmsg.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdpid.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdports.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdprio.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdrlimit.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdselect.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdsig.c hurd: Stop relying on VM_MAX_ADDRESS 2024-03-23 22:44:02 +01:00
hurdsock.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdsocket.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdstartup.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurdstartup.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
intern-fd.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
intr-msg.c hurd: Fix restoring message to be retried 2024-07-13 17:05:13 +02:00
intr-rpc.defs Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
intr-rpc.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
longjmp-ts.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
lookup-at.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
lookup-retry.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
Makefile hurd: Reformat Makefile. 2024-02-25 13:38:16 -05:00
msgportdemux.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
new-fd.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
Notes
openport.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
path-lookup.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
pid2task.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
port2fd.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
port-cleanup.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
ports-get.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
ports-set.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
preempt-sig.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
privports.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
report-wait.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
RPC_gsync_wait_intr.c hurd: Add __lll_abstimed_wait_intr 2020-12-16 01:58:33 +01:00
set-hooks.h Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
set-host.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
setauth.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
seteuids.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
siginfo.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
sigunwind.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
stack_chk_fail_local.c hurd: fix build with -fstack-protector-strong 2017-08-27 22:10:17 +02:00
task2pid.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
thread-cancel.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
thread-self.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
trampoline.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
Versions hurd: Fix using interposable hurd_thread_self 2023-05-19 20:45:51 +02:00
vpprintf.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
xattr.c hurd: Fix getxattr/listxattr returning ERANGE 2024-06-10 22:01:40 +02:00