Oleg Nesterov
56ade33b1b
exec: load_script: don't blindly truncate shebang string
...
[ Upstream commit 8099b047ecc431518b9bb6bdbba3549bbecdc343 ]
load_script() simply truncates bprm->buf and this is very wrong if the
length of shebang string exceeds BINPRM_BUF_SIZE-2. This can silently
truncate i_arg or (worse) we can execute the wrong binary if buf[2:126]
happens to be the valid executable path.
Change load_script() to return ENOEXEC if it can't find '\n' or zero in
bprm->buf. Note that '\0' can come from either
prepare_binprm()->memset() or from kernel_read(), we do not care.
Link: http://lkml.kernel.org/r/20181112160931.GA28463@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Kees Cook <keescook@chromium.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Ben Woodard <woodard@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-02-12 19:46:10 +01:00
..
2018-12-01 09:42:50 +01:00
2017-11-02 11:10:55 +01:00
2018-05-30 07:51:47 +02:00
2018-07-08 15:30:51 +02:00
2018-09-19 22:43:48 +02:00
2017-11-02 11:10:55 +01:00
2018-12-01 09:42:51 +01:00
2019-01-31 08:13:48 +01:00
2018-12-17 09:28:53 +01:00
2019-01-13 10:01:06 +01:00
2019-02-12 19:46:08 +01:00
2017-11-24 08:37:05 +01:00
2018-11-21 09:24:15 +01:00
2018-11-13 11:15:12 -08:00
2018-08-03 07:50:32 +02:00
2018-07-17 11:39:26 +02:00
2019-02-12 19:45:57 +01:00
2018-06-21 04:02:42 +09:00
2017-11-02 11:10:55 +01:00
2018-11-27 16:10:47 +01:00
2018-12-17 09:28:50 +01:00
2018-12-05 19:41:25 +01:00
2019-01-16 22:07:13 +01:00
2019-02-12 19:46:08 +01:00
2018-11-04 14:52:47 +01:00
2018-12-17 09:28:53 +01:00
2018-12-21 14:13:05 +01:00
2019-02-06 17:31:35 +01:00
2018-12-17 09:28:54 +01:00
2018-12-17 09:28:54 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-04-19 08:56:21 +02:00
2018-10-03 17:00:57 -07:00
2018-11-13 11:15:05 -08:00
2019-01-26 09:37:02 +01:00
2018-08-09 12:16:39 +02:00
2018-12-08 13:03:35 +01:00
2019-01-13 10:01:06 +01:00
2017-11-02 11:10:55 +01:00
2018-03-28 18:24:43 +02:00
2019-02-12 19:46:07 +01:00
2018-02-03 17:39:08 +01:00
2019-02-12 19:46:00 +01:00
2018-05-30 07:51:47 +02:00
2017-11-02 11:10:55 +01:00
2019-02-06 17:31:37 +01:00
2017-11-02 11:10:55 +01:00
2019-02-12 19:46:09 +01:00
2017-11-02 11:10:55 +01:00
2018-06-26 08:06:33 +08:00
2018-11-21 09:24:17 +01:00
2018-12-29 13:39:11 +01:00
2019-01-26 09:37:02 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-01-26 09:37:05 +01:00
2017-09-06 17:27:26 -07:00
2018-11-27 16:10:46 +01:00
2017-11-02 11:10:55 +01:00
2018-09-05 09:26:32 +02:00
2018-09-05 09:26:41 +02:00
2018-12-17 09:28:48 +01:00
2018-12-29 13:39:11 +01:00
2019-02-12 19:46:03 +01:00
2018-05-30 07:51:47 +02:00
2018-12-05 19:41:16 +01:00
2018-12-21 14:13:04 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-09-04 19:05:15 -04:00
2017-09-14 18:13:32 -07:00
2018-09-26 08:38:09 +02:00
2017-11-02 11:10:55 +01:00
2018-06-26 08:06:33 +08:00
2019-02-12 19:46:10 +01:00
2019-01-23 08:09:50 +01:00
2017-11-30 08:40:45 +00:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-04-26 11:02:14 +02:00
2019-02-06 17:31:34 +01:00
2018-12-05 19:41:24 +01:00
2017-11-02 11:10:55 +01:00
2019-02-12 19:46:10 +01:00
2018-03-03 10:24:21 +01:00
2017-12-17 15:07:59 +01:00
2017-11-02 11:10:55 +01:00
2017-08-28 00:50:23 -04:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-05-16 10:10:25 +02:00
2018-07-17 11:39:27 +02:00
2017-09-13 09:11:44 -07:00
2018-11-10 07:48:33 -08:00
2018-10-03 17:00:53 -07:00
2018-10-03 17:00:53 -07:00
2017-11-02 11:10:55 +01:00
2018-02-22 15:42:25 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-12-01 09:42:59 +01:00
2018-11-21 09:24:14 +01:00
2017-11-02 11:10:55 +01:00
2017-09-05 12:53:12 +02:00
2018-02-16 20:23:05 +01:00
2017-11-02 11:10:55 +01:00
2018-11-10 07:48:33 -08:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-02-22 15:42:28 +01:00
2017-11-02 11:10:55 +01:00
2017-09-04 19:05:15 -04:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-05-30 07:51:47 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-12-21 14:13:04 +01:00
2017-11-02 11:10:55 +01:00
2018-10-10 08:54:27 +02:00