Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4781234ioa; Wed, 27 Apr 2022 10:59:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypAoVtBWwAH6PPxXygX3XDziHeEguCYN6Na7phaUdyC7lTqE5EeSGyKpc7mcZnkTU6XKJQ X-Received: by 2002:a17:90a:634b:b0:1ca:6c7e:7952 with SMTP id v11-20020a17090a634b00b001ca6c7e7952mr44904639pjs.54.1651082353647; Wed, 27 Apr 2022 10:59:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651082353; cv=none; d=google.com; s=arc-20160816; b=CKBlMA5tGq21bo6w10OOXI4Rq7trLf0oJNBX9v5INmZPJDkfuwJFIzfXCUQtPZw/Zi Dc4JGpw7gEec9FTFDvAe6/It9aaNsrg66MdCQkA0F6/7DyF3WAd+dHR/QJmGlQ0eOYEy uqRAcLT5Kn3E/CmmVeVuCxODNn3j5DdIzWt6zJ6dvbkUDgDxZbzqzu9FlPQ8mrYYIfwa Dpz3gAv2jsmV0GDlHAM4zILQVFmiifHqCWv8ihxbHAhqfH5PfyqlaFLBM9EZW6he3TCj 6EYDucOOuO9Y9ultEwUBuaSf+LTIVnuk8Vc4nEqaXcEm2Gm1+5UYbzS6PvShrXLp0j+9 2q1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=HTz0KzRVkjj+LRHzvQ4nu3mlrscLpTaY44klLZodsKY=; b=ZKp/jyalf/Vp9TtL/7GfCZo676JniI+DQ1/0GTJKC7pBXoG7vdKVfr8G5gxlWAWQuA RocVjg9WGrnECRi1BCrRm7Q7BKNG3VvqFLFftxSv+ZQ//UCtSq0utfqBAK2YeNRxkGmo K0rebBcp1KkCdycFid5lxWFl6FPZKHbtupD7i3nvar5tyj0fwJ9xUKVYwXLKw6ePTiWO SWIZND3YRdQdECwIa2QxmU2feJ/NKNJfCWK9BwZUV56Q1CCk35AED6Dyy5MlDzGAnx7f OolR9vhuoou3o1cRugkdtohA7JHb6NMoYHPYalIbq0ls1dSP7umx4UykJ5pRRamr+uaU /YsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id f18-20020a056a0022d200b004fa3a8e004csi2193129pfj.259.2022.04.27.10.59.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 10:59:13 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6CFA82A18AD; Wed, 27 Apr 2022 10:32:49 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244454AbiD0Rfz (ORCPT + 99 others); Wed, 27 Apr 2022 13:35:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244359AbiD0RfW (ORCPT ); Wed, 27 Apr 2022 13:35:22 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 999C3240669 for ; Wed, 27 Apr 2022 10:31:59 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7F854ED1; Wed, 27 Apr 2022 10:31:59 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 426D33F73B; Wed, 27 Apr 2022 10:31:58 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: akpm@linux-foundation.org, alex.popov@linux.com, catalin.marinas@arm.com, keescook@chromium.org, linux-kernel@vger.kernel.org, luto@kernel.org, mark.rutland@arm.com, will@kernel.org Subject: [PATCH v2 13/13] arm64: entry: use stackleak_erase_on_task_stack() Date: Wed, 27 Apr 2022 18:31:28 +0100 Message-Id: <20220427173128.2603085-14-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220427173128.2603085-1-mark.rutland@arm.com> References: <20220427173128.2603085-1-mark.rutland@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On arm64 we always call stackleak_erase() on a task stack, and never call it on another stack. We can avoid some redundant work by using stackleak_erase_on_task_stack(), telling the stackleak code that it's being called on a task stack. Signed-off-by: Mark Rutland Cc: Alexander Popov Cc: Andrew Morton Cc: Andy Lutomirski Cc: Catalin Marinas Cc: Kees Cook Cc: Will Deacon --- arch/arm64/kernel/entry.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index ede028dee81b0..5b82b92924005 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -596,7 +596,7 @@ SYM_CODE_START_LOCAL(ret_to_user) ldr x19, [tsk, #TSK_TI_FLAGS] // re-check for single-step enable_step_tsk x19, x2 #ifdef CONFIG_GCC_PLUGIN_STACKLEAK - bl stackleak_erase + bl stackleak_erase_on_task_stack #endif kernel_exit 0 SYM_CODE_END(ret_to_user) -- 2.30.2