]> git.baikalelectronics.ru Git - kernel.git/commit
um: Do not set unsecure permission for temporary file
authorMickaël Salaün <mic@digikod.net>
Tue, 22 Dec 2015 21:15:09 +0000 (22:15 +0100)
committerRichard Weinberger <richard@nod.at>
Sun, 10 Jan 2016 20:49:50 +0000 (21:49 +0100)
commit2e96db91d0aa8c528508fef03c65dd696912e7a1
treec8752e1d750c1bc378894dbe9ff84c817087101e
parent6465741ec1a0b3d00793596747a7c599771052b8
um: Do not set unsecure permission for temporary file

Remove the insecure 0777 mode for temporary file to prohibit other users
to change the executable mapped code.

An attacker could gain access to the mapped file descriptor from the
temporary file (before it is unlinked) in a read-only mode but it should
not be accessible in write mode to avoid arbitrary code execution.

To not change the hostfs behavior, the temporary file creation
permission now depends on the current umask(2) and the implementation of
mkstemp(3).

Signed-off-by: Mickaël Salaün <mic@digikod.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Acked-by: Tristan Schmelcher <tschmelcher@google.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
arch/um/os-Linux/mem.c