Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp297306rdb; Thu, 1 Feb 2024 08:46:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IGbn9JkfM+jm1RG/77rLKUcR93N5uPE22fiTmOgzXGkRllYVnUKtnuvM7EMY7Oiv+3X/GsT X-Received: by 2002:a05:6a20:d90a:b0:19e:39d4:2839 with SMTP id jd10-20020a056a20d90a00b0019e39d42839mr5009296pzb.17.1706805979426; Thu, 01 Feb 2024 08:46:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706805979; cv=pass; d=google.com; s=arc-20160816; b=iQscfbBI1x6uACSUpIfrCrXipbLgzunltu+EwYb3XeeniMFMtGyPAxOeLBw7UKXqzu 2pwU4CCHBBEQzVg+69XwyE17Hp5OticHj2f3YwauDv5bN/O7DpFAbXeaI4hyMpKF/jV4 EUmd2fQDeC3mMKy2JbtVpR+ZfH0V3Zn2xfRHv8mowUpBmpaS/i6LzNOkGOE6aSw+xLZC zHmCQpPe8TuTLEQoaZz44HqnJBqum6Hd/NMd6Rka53jq4JyaqvSsmQkRGgVVsHgrQQWw HeEdHQUQPtTjenluiMyaNNq46m+dNuYTkWN1JhTmCVMegCoRY7AW3atYANmE6WfefmjQ Zg9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:autocrypt:references :in-reply-to:date:cc:to:from:subject:message-id:dkim-signature; bh=p64kf2y999rJ48Lqqzh1e4u0lBYwqg13FH7tss3VnQI=; fh=US8kiLREDy3kbNYt5f+jFVBnriSKlT5rr7JSFXMwmYg=; b=BWc0r0q5N0uyAU3RuhCa3WGNO4KAlJWH4ra80yuHLxvXIAKU5u43UKBz7bkv1HMnKY 0jQcqcNkv2dGmcpWovRcHaIkzqpGgzYq0iTnJvV8SMLAf7aIlBFdmMU2Rt5bkIN5oTXh cJqT9navjTFuvvwmS4rxuOql+yEjgnC3le7TSts5CP8nOwbLkih0dHJOPbFXaOShe8tz GoyEd+y+STVvalNFvYx8UcfyZF24kfDboepm0sfdb+iOKpxQlvqT6WszHugAJ4sJyKGh HrwQB4GjRvyecJDNMmMX2xKu+Phfe6aGAzc+LVPNIGl4bnxzDRiONiN+vugXAjBe/jUG pjzg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=JYoDOZUn; arc=pass (i=1 spf=pass spfdomain=xry111.site dkim=pass dkdomain=xry111.site dmarc=pass fromdomain=xry111.site); spf=pass (google.com: domain of linux-kernel+bounces-48539-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48539-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site X-Forwarded-Encrypted: i=1; AJvYcCXvOljm115GC/81M5LagthM7wdbrbNaxFegHnHlge9P3ElRiZ5h6LwpIAnjj7s+G3pVmToORlYFIYvW/jAAI6GhjG96Pu4hVOv4ja6m9Q== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l26-20020a63ba5a000000b005d509aa1476si12406466pgu.549.2024.02.01.08.46.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 08:46:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48539-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@xry111.site header.s=default header.b=JYoDOZUn; arc=pass (i=1 spf=pass spfdomain=xry111.site dkim=pass dkdomain=xry111.site dmarc=pass fromdomain=xry111.site); spf=pass (google.com: domain of linux-kernel+bounces-48539-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48539-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=xry111.site Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 435C9287EF6 for ; Thu, 1 Feb 2024 16:35:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C2064525B; Thu, 1 Feb 2024 16:35:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b="JYoDOZUn" Received: from xry111.site (xry111.site [89.208.246.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 732701FDB; Thu, 1 Feb 2024 16:35:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.208.246.23 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706805324; cv=none; b=EkNH8bjaatOQUiA+3/jiilXGi7ZmmbFyUaAUld4rR4CKzNH5M2iVZu1GRbBuYrqIdTY6G02+pu0UPFNklFuDDm91MtdvD1dU64r1T26B7jVtIvcknu5491bivtRKU/u6uY/M7qZbNUimJ27kPtZrbgALFVnxW+eGRUaGIvctdnc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706805324; c=relaxed/simple; bh=v7yRlc8JbVP7rQJskWuydHy/lSbUiMt1FoOZpCEGI8U=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=rIul/qem1xE9gWKnBiBTZPCVtkomdXXrxh7lrawSEnJEIhuezmqKsYJSQwsCoPX1Q99yAMGugP/OHN3yZBrcgJvHSyOCZUFb6SoBZK3uizdPVszfvMdwRQszGYzJYl0F93+bbQdCO8tSdKK3dKA/Sgrzi+XM1hSp9ZGK8uxw4T0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site; spf=pass smtp.mailfrom=xry111.site; dkim=pass (1024-bit key) header.d=xry111.site header.i=@xry111.site header.b=JYoDOZUn; arc=none smtp.client-ip=89.208.246.23 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1706805314; bh=v7yRlc8JbVP7rQJskWuydHy/lSbUiMt1FoOZpCEGI8U=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=JYoDOZUn8MgttQo2WLaIYWcNLO+qZHiVJvxm3Rm4lci1/VFs7m/TrprXoqL7q7DBv 9+nWGS9OcbqYLiZ1L2l1ZbwFkIYhg/ALGXbmXOuyMPcP9lroSSx3Xgffb6g4bKhvWs jq2oNQLazmxM1vjcP3757V8G8KHEKEF9pIvoILCs= Received: from [IPv6:240e:358:11d4:5700:dc73:854d:832e:4] (unknown [IPv6:240e:358:11d4:5700:dc73:854d:832e:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 0BB2866EF0; Thu, 1 Feb 2024 11:35:08 -0500 (EST) Message-ID: <9d1d51e69c3f96bf5992e9a988969515ba97f883.camel@xry111.site> Subject: Re: [PATCH 1/3] ptrace: Introduce exception_ip arch hook From: Xi Ruoyao To: Jiaxun Yang , Oleg Nesterov , Thomas Bogendoerfer , Andrew Morton , Ben Hutchings Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org Date: Fri, 02 Feb 2024 00:35:01 +0800 In-Reply-To: <20240201-exception_ip-v1-1-aa26ab3ee0b5@flygoat.com> References: <20240201-exception_ip-v1-0-aa26ab3ee0b5@flygoat.com> <20240201-exception_ip-v1-1-aa26ab3ee0b5@flygoat.com> Autocrypt: addr=xry111@xry111.site; prefer-encrypt=mutual; keydata=mDMEYnkdPhYJKwYBBAHaRw8BAQdAsY+HvJs3EVKpwIu2gN89cQT/pnrbQtlvd6Yfq7egugi0HlhpIFJ1b3lhbyA8eHJ5MTExQHhyeTExMS5zaXRlPoiTBBMWCgA7FiEEkdD1djAfkk197dzorKrSDhnnEOMFAmJ5HT4CGwMFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQrKrSDhnnEOPHFgD8D9vUToTd1MF5bng9uPJq5y3DfpcxDp+LD3joA3U2TmwA/jZtN9xLH7CGDHeClKZK/ZYELotWfJsqRcthOIGjsdAPuDgEYnkdPhIKKwYBBAGXVQEFAQEHQG+HnNiPZseiBkzYBHwq/nN638o0NPwgYwH70wlKMZhRAwEIB4h4BBgWCgAgFiEEkdD1djAfkk197dzorKrSDhnnEOMFAmJ5HT4CGwwACgkQrKrSDhnnEOPjXgD/euD64cxwqDIqckUaisT3VCst11RcnO5iRHm6meNIwj0BALLmWplyi7beKrOlqKfuZtCLbiAPywGfCNg8LOTt4iMD Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Thu, 2024-02-01 at 15:46 +0000, Jiaxun Yang wrote: > On architectures with delay slot, architecture level instruction > pointer (or program counter) in pt_regs may differ from where > exception was triggered. >=20 > Introduce exception_ip hook to invoke architecture code and determine > actual instruction pointer to the exception. >=20 > Link: > https://lore.kernel.org/lkml/00d1b813-c55f-4365-8d81-d70258e10b16@app.fas= tmail.com/ > Signed-off-by: Jiaxun Yang How about adding something like #ifndef arch_exception_ip #define exception_ip(regs) instruction_pointer(regs) #else #define exception_ip(regs) arch_exception_ip(regs) #endif into a generic header, instead of having to add exception_ip definition everywhere? > --- > =C2=A0arch/alpha/include/asm/ptrace.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 | 1 + > =C2=A0arch/arc/include/asm/ptrace.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 | 1 + > =C2=A0arch/arm/include/asm/ptrace.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 | 1 + > =C2=A0arch/csky/include/asm/ptrace.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | 1 + > =C2=A0arch/hexagon/include/uapi/asm/ptrace.h | 1 + > =C2=A0arch/loongarch/include/asm/ptrace.h=C2=A0=C2=A0=C2=A0 | 1 + > =C2=A0arch/m68k/include/asm/ptrace.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | 1 + > =C2=A0arch/microblaze/include/asm/ptrace.h=C2=A0=C2=A0 | 3 ++- > =C2=A0arch/mips/include/asm/ptrace.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | 1 + > =C2=A0arch/mips/kernel/ptrace.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 7 +++++++ > =C2=A0arch/nios2/include/asm/ptrace.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 | 3 ++- > =C2=A0arch/openrisc/include/asm/ptrace.h=C2=A0=C2=A0=C2=A0=C2=A0 | 1 + > =C2=A0arch/parisc/include/asm/ptrace.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 | 1 + > =C2=A0arch/s390/include/asm/ptrace.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 | 1 + > =C2=A0arch/sparc/include/asm/ptrace.h=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 | 2 ++ > =C2=A0arch/um/include/asm/ptrace-generic.h=C2=A0=C2=A0 | 1 + > =C2=A016 files changed, 25 insertions(+), 2 deletions(-) >=20 > diff --git a/arch/alpha/include/asm/ptrace.h > b/arch/alpha/include/asm/ptrace.h > index 3557ce64ed21..1ded3f2d09e9 100644 > --- a/arch/alpha/include/asm/ptrace.h > +++ b/arch/alpha/include/asm/ptrace.h > @@ -8,6 +8,7 @@ > =C2=A0#define arch_has_single_step() (1) > =C2=A0#define user_mode(regs) (((regs)->ps & 8) !=3D 0) > =C2=A0#define instruction_pointer(regs) ((regs)->pc) > +#define exception_ip(regs) instruction_pointer(regs) > =C2=A0#define profile_pc(regs) instruction_pointer(regs) > =C2=A0#define current_user_stack_pointer() rdusp() > =C2=A0 > diff --git a/arch/arc/include/asm/ptrace.h > b/arch/arc/include/asm/ptrace.h > index 00b9318e551e..94084f1048df 100644 > --- a/arch/arc/include/asm/ptrace.h > +++ b/arch/arc/include/asm/ptrace.h > @@ -105,6 +105,7 @@ struct callee_regs { > =C2=A0#endif > =C2=A0 > =C2=A0#define instruction_pointer(regs) ((regs)->ret) > +#define exception_ip(regs) instruction_pointer(regs) > =C2=A0#define profile_pc(regs) instruction_pointer(regs) > =C2=A0 > =C2=A0/* return 1 if user mode or 0 if kernel mode */ > diff --git a/arch/arm/include/asm/ptrace.h > b/arch/arm/include/asm/ptrace.h > index 7f44e88d1f25..fb4dc23eba78 100644 > --- a/arch/arm/include/asm/ptrace.h > +++ b/arch/arm/include/asm/ptrace.h > @@ -89,6 +89,7 @@ static inline long regs_return_value(struct pt_regs > *regs) > =C2=A0} > =C2=A0 > =C2=A0#define instruction_pointer(regs) (regs)->ARM_pc > +#define > exception_ip(regs) instruction_pointer(regs) > =C2=A0 > =C2=A0#ifdef CONFIG_THUMB2_KERNEL > =C2=A0#define frame_pointer(regs) (regs)->ARM_r7 > diff --git a/arch/csky/include/asm/ptrace.h > b/arch/csky/include/asm/ptrace.h > index 0634b7895d81..a738630e64b0 100644 > --- a/arch/csky/include/asm/ptrace.h > +++ b/arch/csky/include/asm/ptrace.h > @@ -22,6 +22,7 @@ > =C2=A0 > =C2=A0#define user_mode(regs) (!((regs)->sr & PS_S)) > =C2=A0#define instruction_pointer(regs) ((regs)->pc) > +#define exception_ip(regs) instruction_pointer(regs) > =C2=A0#define profile_pc(regs) instruction_pointer(regs) > =C2=A0#define trap_no(regs) ((regs->sr >> 16) & 0xff) > =C2=A0 > diff --git a/arch/hexagon/include/uapi/asm/ptrace.h > b/arch/hexagon/include/uapi/asm/ptrace.h > index 2a3ea14ad9b9..846471936237 100644 > --- a/arch/hexagon/include/uapi/asm/ptrace.h > +++ b/arch/hexagon/include/uapi/asm/ptrace.h > @@ -25,6 +25,7 @@ > =C2=A0#include > =C2=A0 > =C2=A0#define instruction_pointer(regs) pt_elr(regs) > +#define exception_ip(regs) instruction_pointer(regs) > =C2=A0#define user_stack_pointer(regs) ((regs)->r29) > =C2=A0 > =C2=A0#define profile_pc(regs) instruction_pointer(regs) > diff --git a/arch/loongarch/include/asm/ptrace.h > b/arch/loongarch/include/asm/ptrace.h > index f3ddaed9ef7f..a34327f0e69d 100644 > --- a/arch/loongarch/include/asm/ptrace.h > +++ b/arch/loongarch/include/asm/ptrace.h > @@ -160,6 +160,7 @@ static inline void regs_set_return_value(struct > pt_regs *regs, unsigned long val > =C2=A0} > =C2=A0 > =C2=A0#define instruction_pointer(regs) ((regs)->csr_era) > +#define exception_ip(regs) instruction_pointer(regs) > =C2=A0#define profile_pc(regs) instruction_pointer(regs) > =C2=A0 > =C2=A0extern void die(const char *str, struct pt_regs *regs); > diff --git a/arch/m68k/include/asm/ptrace.h > b/arch/m68k/include/asm/ptrace.h > index ea5a80ca1ab3..cb553e2ec73a 100644 > --- a/arch/m68k/include/asm/ptrace.h > +++ b/arch/m68k/include/asm/ptrace.h > @@ -13,6 +13,7 @@ > =C2=A0 > =C2=A0#define user_mode(regs) (!((regs)->sr & PS_S)) > =C2=A0#define instruction_pointer(regs) ((regs)->pc) > +#define exception_ip(regs) instruction_pointer(regs) > =C2=A0#define profile_pc(regs) instruction_pointer(regs) > =C2=A0#define current_pt_regs() \ > =C2=A0 (struct pt_regs *)((char *)current_thread_info() + > THREAD_SIZE) - 1 > diff --git a/arch/microblaze/include/asm/ptrace.h > b/arch/microblaze/include/asm/ptrace.h > index bfcb89df5e26..974c00fa7212 100644 > --- a/arch/microblaze/include/asm/ptrace.h > +++ b/arch/microblaze/include/asm/ptrace.h > @@ -12,7 +12,8 @@ > =C2=A0#define user_mode(regs) (!kernel_mode(regs)) > =C2=A0 > =C2=A0#define instruction_pointer(regs) ((regs)->pc) > -#define profile_pc(regs) instruction_pointer(regs) > +#define > exception_ip(regs) instruction_pointer(regs) > +#define > profile_pc(regs) instruction_pointer(regs) > =C2=A0#define user_stack_pointer(regs) ((regs)->r1) > =C2=A0 > =C2=A0static inline long regs_return_value(struct pt_regs *regs) > diff --git a/arch/mips/include/asm/ptrace.h > b/arch/mips/include/asm/ptrace.h > index daf3cf244ea9..97589731fd40 100644 > --- a/arch/mips/include/asm/ptrace.h > +++ b/arch/mips/include/asm/ptrace.h > @@ -154,6 +154,7 @@ static inline long regs_return_value(struct > pt_regs *regs) > =C2=A0} > =C2=A0 > =C2=A0#define instruction_pointer(regs) ((regs)->cp0_epc) > +extern unsigned long exception_ip(struct pt_regs *regs); > =C2=A0#define profile_pc(regs) instruction_pointer(regs) > =C2=A0 > =C2=A0extern asmlinkage long syscall_trace_enter(struct pt_regs *regs, lo= ng > syscall); > diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c > index d9df543f7e2c..59288c13b581 100644 > --- a/arch/mips/kernel/ptrace.c > +++ b/arch/mips/kernel/ptrace.c > @@ -31,6 +31,7 @@ > =C2=A0#include > =C2=A0#include > =C2=A0 > +#include > =C2=A0#include > =C2=A0#include > =C2=A0#include > @@ -48,6 +49,12 @@ > =C2=A0#define CREATE_TRACE_POINTS > =C2=A0#include > =C2=A0 > +unsigned long exception_ip(struct pt_regs *regs) > +{ > + return exception_epc(regs); > +} > +EXPORT_SYMBOL(exception_ip); > + > =C2=A0/* > =C2=A0 * Called by kernel/ptrace.c when detaching.. > =C2=A0 * > diff --git a/arch/nios2/include/asm/ptrace.h > b/arch/nios2/include/asm/ptrace.h > index 9da34c3022a2..136f5679ae79 100644 > --- a/arch/nios2/include/asm/ptrace.h > +++ b/arch/nios2/include/asm/ptrace.h > @@ -66,7 +66,8 @@ struct switch_stack { > =C2=A0#define user_mode(regs) (((regs)->estatus & ESTATUS_EU)) > =C2=A0 > =C2=A0#define instruction_pointer(regs) ((regs)->ra) > -#define profile_pc(regs) instruction_pointer(regs) > +#define > exception_ip(regs) instruction_pointer(regs) > +#define > profile_pc(regs) instruction_pointer(regs) > =C2=A0#define user_stack_pointer(regs) ((regs)->sp) > =C2=A0extern void show_regs(struct pt_regs *); > =C2=A0 > diff --git a/arch/openrisc/include/asm/ptrace.h > b/arch/openrisc/include/asm/ptrace.h > index 375147ff71fc..67c28484d17e 100644 > --- a/arch/openrisc/include/asm/ptrace.h > +++ b/arch/openrisc/include/asm/ptrace.h > @@ -67,6 +67,7 @@ struct pt_regs { > =C2=A0#define STACK_FRAME_OVERHEAD=C2=A0 128=C2=A0 /* size of minimum sta= ck frame */ > =C2=A0 > =C2=A0#define instruction_pointer(regs) ((regs)->pc) > +#define > exception_ip(regs) instruction_pointer(regs) > =C2=A0#define user_mode(regs) (((regs)->sr & > SPR_SR_SM) =3D=3D 0) > =C2=A0#define user_stack_pointer(regs) ((unsigned long)(regs)->sp) > =C2=A0#define profile_pc(regs) instruction_pointer(regs) > diff --git a/arch/parisc/include/asm/ptrace.h > b/arch/parisc/include/asm/ptrace.h > index eea3f3df0823..d7e8dcf26582 100644 > --- a/arch/parisc/include/asm/ptrace.h > +++ b/arch/parisc/include/asm/ptrace.h > @@ -17,6 +17,7 @@ > =C2=A0#define user_mode(regs) (((regs)->iaoq[0] & > 3) !=3D PRIV_KERNEL) > =C2=A0#define user_space(regs) ((regs)->iasq[1] !=3D > PRIV_KERNEL) > =C2=A0#define instruction_pointer(regs) ((regs)->iaoq[0] & ~3) > +#define > exception_ip(regs) instruction_pointer(regs) > =C2=A0#define user_stack_pointer(regs) ((regs)->gr[30]) > =C2=A0unsigned long profile_pc(struct pt_regs *); > =C2=A0 > diff --git a/arch/s390/include/asm/ptrace.h > b/arch/s390/include/asm/ptrace.h > index d28bf8fb2799..a5255b2337af 100644 > --- a/arch/s390/include/asm/ptrace.h > +++ b/arch/s390/include/asm/ptrace.h > @@ -211,6 +211,7 @@ static inline int > test_and_clear_pt_regs_flag(struct pt_regs *regs, int flag) > =C2=A0 > =C2=A0#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) !=3D = 0) > =C2=A0#define instruction_pointer(regs) ((regs)->psw.addr) > +#define exception_ip(regs) instruction_pointer(regs) > =C2=A0#define user_stack_pointer(regs)((regs)->gprs[15]) > =C2=A0#define profile_pc(regs) instruction_pointer(regs) > =C2=A0 > diff --git a/arch/sparc/include/asm/ptrace.h > b/arch/sparc/include/asm/ptrace.h > index d1419e669027..41ae186f2245 100644 > --- a/arch/sparc/include/asm/ptrace.h > +++ b/arch/sparc/include/asm/ptrace.h > @@ -63,6 +63,7 @@ extern union global_cpu_snapshot > global_cpu_snapshot[NR_CPUS]; > =C2=A0#define force_successful_syscall_return() set_thread_noerror(1) > =C2=A0#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV)) > =C2=A0#define instruction_pointer(regs) ((regs)->tpc) > +#define exception_ip(regs) instruction_pointer(regs) > =C2=A0#define instruction_pointer_set(regs, val) do { \ > =C2=A0 (regs)->tpc =3D (val); \ > =C2=A0 (regs)->tnpc =3D (val)+4; \ > @@ -142,6 +143,7 @@ static inline bool pt_regs_clear_syscall(struct > pt_regs *regs) > =C2=A0 > =C2=A0#define user_mode(regs) (!((regs)->psr & PSR_PS)) > =C2=A0#define instruction_pointer(regs) ((regs)->pc) > +#define exception_ip(regs) instruction_pointer(regs) > =C2=A0#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP]) > =C2=A0unsigned long profile_pc(struct pt_regs *); > =C2=A0#else /* (!__ASSEMBLY__) */ > diff --git a/arch/um/include/asm/ptrace-generic.h > b/arch/um/include/asm/ptrace-generic.h > index adf91ef553ae..f9ada287ca12 100644 > --- a/arch/um/include/asm/ptrace-generic.h > +++ b/arch/um/include/asm/ptrace-generic.h > @@ -26,6 +26,7 @@ struct pt_regs { > =C2=A0#define PT_REGS_SYSCALL_NR(r) UPT_SYSCALL_NR(&(r)->regs) > =C2=A0 > =C2=A0#define instruction_pointer(regs) PT_REGS_IP(regs) > +#define exception_ip(regs) instruction_pointer(regs) > =C2=A0 > =C2=A0#define PTRACE_OLDSETOPTIONS 21 > =C2=A0 >=20 --=20 Xi Ruoyao School of Aerospace Science and Technology, Xidian University