Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp740539pxb; Tue, 14 Sep 2021 07:47:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2wwgQ11unvfeYTx+cPSerbjgIKwpDGaUZkSJ/24hvUy4RqUCbbAgsSJdbfpTNLq4xpDPV X-Received: by 2002:a05:6402:5188:: with SMTP id q8mr19123787edd.138.1631630835446; Tue, 14 Sep 2021 07:47:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631630835; cv=none; d=google.com; s=arc-20160816; b=c37tOmq3y3gAgC1Wtru6DPjeEnHlqPhNFu12+M42LnkOk9C/cuIB0Q+nQmE3AycIkN Tk6d7AWwZI9R+7qUuV7JpZzcKJUQTxVG3nichiZ+tQE7GTDhJhcohqYVh70lqvq7RyKv iPdjYHtezMgy7Ih3ilt3zq79gH/XW0fy6tztiy/BLHv+aTi+GI+E387ZqjP6eHQMQN/Z fwMs9LWA1bR/I/DK4egNJ25sjdli0iSbKnmi6Cv/K7Q8Bl3rw0HHxL7/9/WiruoLL2zT jOGpZb0d74VRI2hbWD3ar+X+fJ9nGBTBfLIPl2usMauXXSzsrbILViiNwqjRtxwhaOAT N4Fw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uskfpA5qdrkiYQKe0tHCLGMZfn0CyOl2YHdE4x9HpV8=; b=EnBaJc1k3bxkoCY4I96Wi4atu+mB4VW7AyrTn79IlMWT73DCZskzECEswuFTY8Dyi8 WxJFSlq8MjrlLAbCUOei0WSBG40WKT7NbGHyb4xKJmOA/MYKIqaD3A6KjysbiaVu7GAr t+61qjV4frBs4kI07SdYa7P+o4K8KSj5ckoXic9L0q9zLdqhtx34BWMSvQV8n8//ZeVD Bj2u4xJ+LjznCjXcNdT4wnJeLojNe8WGs7cl8no0uFzAxswWhaoEASCwpI8nurjPl/WD tRQPAsYD3wXBECsc36rAtrmOZgaQifchIG8aNoQN2vBIMcAFaXK6BQ9z4A7du+KXNUNc 6FZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jlCaPgcJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e20si10945139ejl.254.2021.09.14.07.46.51; Tue, 14 Sep 2021 07:47:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jlCaPgcJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234308AbhINOoG (ORCPT + 99 others); Tue, 14 Sep 2021 10:44:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:37424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234353AbhINOnY (ORCPT ); Tue, 14 Sep 2021 10:43:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6C74D610E6; Tue, 14 Sep 2021 14:42:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631630527; bh=jM/E5qbkTRhtXvBgC/DCoql0xzq9kLErr23TZymhaCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jlCaPgcJhWUO+i9/EysWC59P/e3Mf+EtfSanbyZejo32D+FMKaBZnJSHVZ6hKfABp WEgh66BhjEFoshS/x9skRs8MxeczHQ9dTxInEG1kbVEIMr+QCUb6XcvTEIYNW6dIGC qmbRAo7UKGEAQQbmdREJQjcykU0qVe8s+/cjJ9zcpsaY5lViLl+E6+JJAsWuTl8l8l GW8J53lrRtxgpoKVQZCYRd7DbOYLfmVap7kfXSZVXNvq+qouDHc7CgkFvmIvIO8TAI eLKG80VAOUyugEdxYtbQCn8kzgFXVrBzFVgMNIqHJIT0hqiqJvY+UCedT2HcifvWJV KKdOjXNl29AvA== From: Masami Hiramatsu To: Steven Rostedt , Josh Poimboeuf , Ingo Molnar Cc: X86 ML , Masami Hiramatsu , Daniel Xu , linux-kernel@vger.kernel.org, bpf@vger.kernel.org, kuba@kernel.org, mingo@redhat.com, ast@kernel.org, Thomas Gleixner , Borislav Petkov , Peter Zijlstra , kernel-team@fb.com, yhs@fb.com, linux-ia64@vger.kernel.org, Abhishek Sagar , Andrii Nakryiko , Paul McKenney Subject: [PATCH -tip v11 22/27] arm: kprobes: Make space for instruction pointer on stack Date: Tue, 14 Sep 2021 23:42:02 +0900 Message-Id: <163163052262.489837.10327621053231461255.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <163163030719.489837.2236069935502195491.stgit@devnote2> References: <163163030719.489837.2236069935502195491.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since arm's __kretprobe_trampoline() saves partial 'pt_regs' on the stack, 'regs->ARM_pc' (instruction pointer) is not accessible from the kretprobe handler. This means if instruction_pointer_set() is used from kretprobe handler, it will break the data on the stack. Make space for instruction pointer (ARM_pc) on the stack in the __kretprobe_trampoline() for fixing this problem. Signed-off-by: Masami Hiramatsu --- Changes in v9: - Update changelog. --- arch/arm/probes/kprobes/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/probes/kprobes/core.c b/arch/arm/probes/kprobes/core.c index 67ce7eb8f285..95f23b47ba27 100644 --- a/arch/arm/probes/kprobes/core.c +++ b/arch/arm/probes/kprobes/core.c @@ -376,11 +376,13 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self, void __naked __kprobes __kretprobe_trampoline(void) { __asm__ __volatile__ ( + "sub sp, sp, #16 \n\t" "stmdb sp!, {r0 - r11} \n\t" "mov r0, sp \n\t" "bl trampoline_handler \n\t" "mov lr, r0 \n\t" "ldmia sp!, {r0 - r11} \n\t" + "add sp, sp, #16 \n\t" #ifdef CONFIG_THUMB2_KERNEL "bx lr \n\t" #else