arm64: signal: Refactor sigcontext parsing in rt_sigreturn
authorDave Martin <Dave.Martin@arm.com>
Thu, 15 Jun 2017 14:03:39 +0000 (15:03 +0100)
committerWill Deacon <will.deacon@arm.com>
Tue, 20 Jun 2017 11:42:58 +0000 (12:42 +0100)
commit47ccb02868cead34578d953b5fe0cdd58394605e
tree0aa4f06e85f3f80b9fe8cd34d711e1e0ef750bbe
parent20987de3c2c45c314e0386f724aa85f55d984ef2
arm64: signal: Refactor sigcontext parsing in rt_sigreturn

Currently, rt_sigreturn does very limited checking on the
sigcontext coming from userspace.

Future additions to the sigcontext data will increase the potential
for surprises.  Also, it is not clear whether the sigcontext
extension records are supposed to occur in a particular order.

To allow the parsing code to be extended more easily, this patch
factors out the sigcontext parsing into a separate function, and
adds extra checks to validate the well-formedness of the sigcontext
structure.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/kernel/signal.c