From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FC2D1F03D5 for ; Tue, 7 Jan 2025 09:41:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736242922; cv=none; b=SXV7E8pr4atAxT3JQWvOYGERX/KD+dLRn7/AwDhS3j6U1wSTz68uu6YWNK2TROZhVBzpYfnXWqdUCrEnlLRPUH6j6oTR1dctHgjqWFXmcNVGB70DMvPMD4z9HQKMVG9nHh8aUhe4zBLKX08KFRwwYssDzs9nLKX1z9lKX4dJEsA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736242922; c=relaxed/simple; bh=DJeoxcjUCLEaiS4XtVLddJSWYzijcBqz2zmYIomw+2Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=G97Dms7oihuJNhF0qGp6TUR0I8DlaQbqCoS7kDGhd631KfGs2U1Fjmb58/35rapo8xBe8YJYsrF/G/pPGhq+MTx7V+s6/F76D7SLBnB1cZvjC2Q9BHSwIE+Hrapbj8BU+b4B6GFF1LhIXGyf1K29FXIkKqiuVPmm6LK5uFzLECA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=iKbmfS+K; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="iKbmfS+K" Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-aabfb33aff8so2739368966b.0 for ; Tue, 07 Jan 2025 01:41:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736242914; x=1736847714; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=k9gWcnGbM9p5D0ak7vJHUxszZShK1nQ9isvrX6RkWiI=; b=iKbmfS+KhEfSffVJjt9825gg2ETUqAE+YERa5/bP/eBNGcFVJhYiBr1zS6Yb8yn06I vSvIMQrM59ttZ4EAmhQCv0AASNuK0/Hi4kexpgV4R2p/vWuB/H8wEyi0qYEXzsbGwr6Z xFHTorqA69bfj67rcGgn/gNptwoe9jUr78+ZQwr5wF9zy+fvfFMAG7OchyM8jHEYgcjz FLPxcsBsNFYdaMvI2KuvyZzM4acfVoc6WPpF30nZnakXbbbT8T+NWda0jDN/ZMr5xqxE eHCKrunV9D3b1Q+V6R7Z91mqh4wORVRO5TrrN999mE3+f4YNRfHYl5884MRSWn8Uf52U yJGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736242914; x=1736847714; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k9gWcnGbM9p5D0ak7vJHUxszZShK1nQ9isvrX6RkWiI=; b=QOb2bGe97pFZdww2gIOOFRjlnxxdxgAksD9jMQbEOBTQ5nQTKBD8grbS1qhBLIOazf Yko+ul/1WCPMc4nw7Fx/pTlD6BbHg0SHJxTuBubQmDyU+vyjnQIXFtiPS4oIJRYyhpoI yKdxPj4zSz0PqGme9Cp7Rs+QW0QuERGQD6vlHeIwnx4UfAXEYcvPzD0OzS///zm0zy5T hzRODlTJ4aC5+yx5TvDMLS14geV7jKWyFpNE26WFhBwHvOc3enan08l/GgLLqfDbzGG+ UzwvX+j36lQRCYH0i3lyv0VXZ+AWmxs5ItDAaIz0GkRiQdL5JhnUeKdeI9CQTcAastVb l1xQ== X-Forwarded-Encrypted: i=1; AJvYcCXlEhjq28U3KGoKCsf1VGPLV8pSG4I+VrlZJXeRv+G44kZRl83dIOE4P9T6vWYL1SwTLpBmXakQcP3zk9U=@vger.kernel.org X-Gm-Message-State: AOJu0Yy0agnCQp4T5ytIJvClKHHeddgPq+6zUWEOium/dLrYRyreaSvX AIAaj48bCrz7a1F/JfPEeDQdvOlj7MssmK6XGTvvtjMTyQGL1YnfSgClM7EJLxQ= X-Gm-Gg: ASbGncuyD0p9t+LLw46gSx8GZT4m2hRjma9qjRdZciqGyOCe5ovrB3rWSEYNU1aTJEt NdsTZaGVNAbWRJCw0kdLNsmdJrb8T8tGTIFZwogX2j9sevDYDO9cyXtz7lPlX9TzqrT7J5GTJ21 g9kSp0IsJjEivncODOIDK+PzULuyMe3k58bee1aWnXcnltAQWgZVsOBENESAcjG7xPFHTRWkee6 xUW0bUsdN+DLYZh0ffSUwqpegcSuCmPIy0gikNu62GMInmsp+OolToYBR8NokqO1Jk= X-Google-Smtp-Source: AGHT+IEHxw4mJqEFIqYXG/sglqgavssOFXM+rzspDasKvBGAFEnARnh+FvuNyCDWBSoQ/jKx1bXiCw== X-Received: by 2002:a17:907:1b05:b0:a9a:6c41:50a8 with SMTP id a640c23a62f3a-ab2910990f2mr261206866b.17.1736242914486; Tue, 07 Jan 2025 01:41:54 -0800 (PST) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aac0f012229sm2356901166b.133.2025.01.07.01.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 01:41:54 -0800 (PST) From: Linus Walleij Date: Tue, 07 Jan 2025 10:41:37 +0100 Subject: [PATCH RFC v3 21/30] ARM: entry: Do not double-call exit functions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20250107-arm-generic-entry-v3-21-4e5f3c15db2d@linaro.org> References: <20250107-arm-generic-entry-v3-0-4e5f3c15db2d@linaro.org> In-Reply-To: <20250107-arm-generic-entry-v3-0-4e5f3c15db2d@linaro.org> To: Dmitry Vyukov , Oleg Nesterov , Russell King , Kees Cook , Andy Lutomirski , Will Drewry , Frederic Weisbecker , "Paul E. McKenney" , Jinjie Ruan , Arnd Bergmann , Ard Biesheuvel , Al Viro Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.14.2 This is a semantic change to ret_fast_syscall: if there is no work pending the function used to jump to ret_to_user, instead we proceed to return from the syscall. If we jump to ret_to_user, IRQs are enabled and we call syscall_exit_to_user_mode a second time; at this point a this just means a second call to rseq_syscall(), but it seems wrong and we want syscall_exit_to_user_mode to be called exactly once. Apparently the ARM kernel has under some circumstances called rseq_syscall() twice on the exit to userspace without side effects. ret_to_user also checks for pending work a second time under ret_to_user_from_irq, but this isn't even needed any more on the fast return path: this was needed because the syscall invocation enabled interrupts when doing syscall tracing, and all tracing invocation has been moved over to C in earlier patches. Signed-off-by: Linus Walleij --- arch/arm/kernel/entry-common.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index ece9215717143427de7572a18a6dbe620a9193e9..33bc9e7c5b32f62474724f1d47f97af24dba53bf 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S @@ -49,7 +49,7 @@ ret_fast_syscall: tst r1, #_TIF_SYSCALL_WORK beq 1f - b ret_to_user + b 2f 1: mov r0, sp @ 'regs' bl do_work_pending -- 2.47.1