]> 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)
commita82396b717a6d031a9a3c0055fa8e1484b5dfdcd
treec8752e1d750c1bc378894dbe9ff84c817087101e
parentaba9b480da5587290f2c07e0fb2ccbde6b04f88d
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