]> git.baikalelectronics.ru Git - kernel.git/commit
ima: avoid appraise error for hash calc interrupt
authorPatrick Callaghan <patrickc@linux.ibm.com>
Mon, 11 Nov 2019 19:23:48 +0000 (14:23 -0500)
committerMimi Zohar <zohar@linux.ibm.com>
Thu, 12 Dec 2019 13:52:05 +0000 (08:52 -0500)
commitf371bedcab66061806f3619983cb84bfec70f51f
tree295e290ddea43c07a7da9806fe65df87adf0269b
parent7855fcc07be326322b44982a21760fd9bd8e2b92
ima: avoid appraise error for hash calc interrupt

The integrity_kernel_read() call in ima_calc_file_hash_tfm() can return
a value of 0 before all bytes of the file are read. A value of 0 would
normally indicate an EOF. This has been observed if a user process is
causing a file appraisal and is terminated with a SIGTERM signal. The
most common occurrence of seeing the problem is if a shutdown or systemd
reload is initiated while files are being appraised.

The problem is similar to commit <c50d20d8293a> (ima: always return
negative code for error) that fixed the problem in
ima_calc_file_hash_atfm().

Suggested-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Patrick Callaghan <patrickc@linux.ibm.com>
Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
security/integrity/ima/ima_crypto.c