Thread (110 messages) 110 messages, 6 authors, 2024-08-21

Re: [PATCH v10 23/40] arm64/signal: Set up and restore the GCS context for signal handlers

From: Catalin Marinas <catalin.marinas@arm.com>
Date: 2024-08-21 18:18:14
Also in: kvmarm, linux-arch, linux-arm-kernel, linux-fsdevel, linux-kselftest, linux-mm, linux-riscv, lkml

On Wed, Aug 21, 2024 at 07:03:13PM +0100, Mark Brown wrote:
On Wed, Aug 21, 2024 at 06:28:49PM +0100, Catalin Marinas wrote:
quoted
On Thu, Aug 01, 2024 at 01:06:50PM +0100, Mark Brown wrote:
quoted
+	/*
+	 * Push a cap and the GCS entry for the trampoline onto the GCS.
+	 */
+	put_user_gcs((unsigned long)sigtramp, gcspr_el0 - 2, &ret);
+	put_user_gcs(GCS_SIGNAL_CAP(gcspr_el0 - 1), gcspr_el0 - 1, &ret);
+	if (ret != 0)
+		return ret;
quoted
Doesn't the second put_user_gcs() override the previous ret?
No, we only set ret on error - if the first one faults it'll set ret
then the second one will either leave it unchanged or write the same
error code depending on if it fails.  This idiom is used quite a lot in
the signal code.
You are right, I missed that it's called 'err' in put_user_gcs(),
thought it's overridden.

-- 
Catalin
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help