2000-04-03 16:48:47

by Jakub Jelinek

[permalink] [raw]
Subject: [PATCH] Avoid kernel memory leaks in signal handling


Attached is an updated version of the patch to avoid leaking kernel memory
into userspace with signals. This time it should support all architectures
currently in the 2.3 tree. At the same time it optimizes signal handling a
little bit and fixes siginfo_t conversion for sparc64(sparc), ia64(i386) and
in the future would help mips64 and ppc64 as well.
To copy siginfo_t in the kernel one uses

copy_siginfo(siginfo_t *to, siginfo_t *from)

instead of memcpy resp. direct assignment (this one can be implemented as
memcpy by the architecture but can be optimized),
to copy siginfo_t to userland kernel calls

copy_siginfo_to_user(siginfo_t *to, siginfo_t *from)

The latter has to make sure kernel does not leak any non-initialized
siginfo_t memory (ie. has to copy only the si_code, si_signo, si_errno and
the relevant union member entries).


siginfo-noleak.patch.gz (11.89 kB)