All of
 help / color / mirror / Atom feed
* [PATCH -next] prctl: Fix false positive in validate_prctl_map
@ 2019-04-08 14:35 Cyrill Gorcunov
  0 siblings, 0 replies; only message in thread
From: Cyrill Gorcunov @ 2019-04-08 14:35 UTC (permalink / raw)
  To: LKML; +Cc: Andrey Vagin, Dmitry Safonov, Pavel Emelyanov, Andrew Morton

While validating new map we require the @start_data to be strictly less
than @end_data, which is fine for regular applications (this is why this
nit didn't trigger for that long). These members are set from executable
loaders such as elf halders, still it is pretty valid to have a loadable
data section with zero size in file, in such case the start_data is equal
to end_data once kernel loader finishes.

In result when we'are trying to restore such program the procedure fails
and kernel returns -EINVAL. From the image dump of a program:

 | "mm_start_code": "0x400000",
 | "mm_end_code": "0x8f5fb4",
 | "mm_start_data": "0xf1bfb0",
 | "mm_end_data": "0xf1bfb0",

Thus we need to change validate_prctl_map from strictly less to less or
equal operator use.

Fixes: f606b77f1a9e362451aca8f81d8f36a3a112139e
Signed-off-by: Cyrill Gorcunov <>
CC: Andrey Vagin <>
CC: Dmitry Safonov <>
CC: Pavel Emelyanov <>
CC: Andrew Morton <>
I don't consider this issue as a critical one, since it triggered first
time for in more than 4 years period (and report came from a proprietary

 kernel/sys.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-next.git/kernel/sys.c
--- linux-next.git.orig/kernel/sys.c
+++ linux-next.git/kernel/sys.c
@@ -1924,7 +1924,7 @@ static int validate_prctl_map(struct prc
 	((unsigned long)prctl_map->__m1 __op				\
 	 (unsigned long)prctl_map->__m2) ? 0 : -EINVAL
 	error  = __prctl_check_order(start_code, <, end_code);
-	error |= __prctl_check_order(start_data, <, end_data);
+	error |= __prctl_check_order(start_data,<=, end_data);
 	error |= __prctl_check_order(start_brk, <=, brk);
 	error |= __prctl_check_order(arg_start, <=, arg_end);
 	error |= __prctl_check_order(env_start, <=, env_end);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-04-08 14:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-08 14:35 [PATCH -next] prctl: Fix false positive in validate_prctl_map Cyrill Gorcunov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.