Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp239633pxa; Tue, 4 Aug 2020 04:32:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHkbc2H0flMRJzmrdQoHG6nsg+YKXGiDN9cyxTESaQKkbo0bkaxjRvHlhPq/751mbmSG3r X-Received: by 2002:a17:906:82d5:: with SMTP id a21mr20636741ejy.213.1596540775673; Tue, 04 Aug 2020 04:32:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596540775; cv=none; d=google.com; s=arc-20160816; b=0lkBGQUiO1+hrY/UyA1aPbFdfwhh+QbSztI+lXdSJS4NzUVxOsrBCSwpiBWcu0BlDe dLNLhCzcB0CsQTvQnoA6jCYb1jKACDozLzFdLmGW7rm4eGD7zouUWR+max+PbYEfDdn0 zxA6TrjDezm3D8Jy64N/eMjWOZ2yLQvVdGzGxrxc3QFV7Zu7bLuhfvS5JD/RPFYbqfuj W93CYmHYYOHy+wBl37cDVLDOFoVOhQZjBoGbggQ2ni6zMul0j9hEObgVJh9UIwGrn+F4 Wo5gFUjm+9kJG8QE6XXAQJdJjN0F3pUQ9WdAbIbllsC159DDMBmIWq6VnzfTX/0Fxf5D pUsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=l87wDaYHWXtQSty3IMd46hLnbAORaqJGvqcZvl1gCvo=; b=v8isp1JdrTV/DMEQQcBchVHZ3G69+zY7H4IiVlyIMzAVEFw1cArjhAIE/kbdfmlnfv lorqXYaQD9wbdX76lwjG/I02cqo0qZWc0+BC1pre78cuiiJnAZ51py8ZkCdAhZe8TE3P cQRhs3ZqXbtlESIXEmBmVk2+vyD+DYoAi1AwJ+eTmVppD2HgLS+I0sbO9c48HvxHiRQm eqPP7/J3aqZuBwc40LbfmjcFAXfmruCRoh515gXNCIVVVUSI6YdwV7hc7nbYGHIHAEdF YQyzNJBm/j9WKDCtiPSBQ0UxahT/2i1RS/Mh+eDM3mmsB4Fg/97i9xRybcfd2e/nT47h ctpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ERmQBgFV; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mh23si10111007ejb.493.2020.08.04.04.32.20; Tue, 04 Aug 2020 04:32:55 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ERmQBgFV; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728763AbgHDLcE (ORCPT + 99 others); Tue, 4 Aug 2020 07:32:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727792AbgHDLcE (ORCPT ); Tue, 4 Aug 2020 07:32:04 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C09DC06174A for ; Tue, 4 Aug 2020 04:31:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=l87wDaYHWXtQSty3IMd46hLnbAORaqJGvqcZvl1gCvo=; b=ERmQBgFV4BKw53A9yaAmGT3E91 roKpvnLCUScSdq43eHannjc+NhwolysOHIq2FXAijiXWW5UiwwYv4XnREq36SFN8voMQY7Dd8Dw5P X0Mq7VkWyOdFWRyfUrksIELXt0REXJjlhzSQqv43Dxmv4yFTqZnvPqwDSQrTyZ3gzDQR7kEl1C+pl s7GXSbnS8WACYLNj398O3OPvj+XTkwe+QWUpT9aTJDvXJSaVh+x/YEAiR0oKZKD6e/r8LskIyTkB+ 9jwokNtnMm8MdFw/80RvGAvtAVzA3CwJ7ZcFjrYSd59muZ5ALCDZQC6CQDmPpLXZCt+9Jp4/n2ioR IEmp87lA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2vAL-0006L3-NT; Tue, 04 Aug 2020 11:31:34 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 441D9301A66; Tue, 4 Aug 2020 13:31:30 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id DBB2E2BDB8C9C; Tue, 4 Aug 2020 13:31:30 +0200 (CEST) Date: Tue, 4 Aug 2020 13:31:30 +0200 From: peterz@infradead.org To: Jin Yao Cc: mingo@redhat.com, oleg@redhat.com, acme@kernel.org, jolsa@kernel.org, Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com, alexander.shishkin@linux.intel.com, mark.rutland@arm.com, rth@twiddle.net, ink@jurassic.park.msu.ru, mattst88@gmail.com, nickhu@andestech.com, green.hu@gmail.com, chris@zankel.net, jcmvbkbc@gmail.com Subject: Re: [PATCH v1 1/2] Missing instruction_pointer_set() instances Message-ID: <20200804113130.GH2657@hirez.programming.kicks-ass.net> References: <20200731025617.16243-1-yao.jin@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200731025617.16243-1-yao.jin@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 31, 2020 at 10:56:16AM +0800, Jin Yao wrote: > There is a potential security issue that perf kernel samples > may be leaked even though kernel sampling is disabled. For fixing > the potential leakage, the idea is to use instruction_pointer_set > to set invalid ip address in leaked perf samples in some cases. > > But instruction_pointer_set is missing on some architectures. > Define instruction_pointer_set for these architectures. > > Signed-off-by: Jin Yao > --- > arch/alpha/include/asm/ptrace.h | 6 ++++++ > arch/arc/include/asm/ptrace.h | 6 ++++++ > arch/nds32/include/asm/ptrace.h | 7 +++++++ > arch/xtensa/include/asm/ptrace.h | 6 ++++++ > 4 files changed, 25 insertions(+) AFAICT you forgot to actually Cc the maintainers for all that. > diff --git a/arch/alpha/include/asm/ptrace.h b/arch/alpha/include/asm/ptrace.h > index df5f317ab3fc..c464d525c110 100644 > --- a/arch/alpha/include/asm/ptrace.h > +++ b/arch/alpha/include/asm/ptrace.h > @@ -25,4 +25,10 @@ static inline unsigned long regs_return_value(struct pt_regs *regs) > return regs->r0; > } > > +static inline void instruction_pointer_set(struct pt_regs *regs, > + unsigned long val) > +{ > + regs->pc = val; > +} > + > #endif > diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h > index 2fdb87addadc..8869a6c0fe8c 100644 > --- a/arch/arc/include/asm/ptrace.h > +++ b/arch/arc/include/asm/ptrace.h > @@ -154,6 +154,12 @@ static inline long regs_return_value(struct pt_regs *regs) > return (long)regs->r0; > } > > +static inline void instruction_pointer_set(struct pt_regs *regs, > + unsigned long val) > +{ > + regs->ret = val; > +} > + > #endif /* !__ASSEMBLY__ */ > > #endif /* __ASM_PTRACE_H */ > diff --git a/arch/nds32/include/asm/ptrace.h b/arch/nds32/include/asm/ptrace.h > index 919ee223620c..19a916bef7f5 100644 > --- a/arch/nds32/include/asm/ptrace.h > +++ b/arch/nds32/include/asm/ptrace.h > @@ -62,6 +62,13 @@ static inline unsigned long regs_return_value(struct pt_regs *regs) > { > return regs->uregs[0]; > } > + > +static inline void instruction_pointer_set(struct pt_regs *regs, > + unsigned long val) > +{ > + regs->ipc = val; > +} > + > extern void show_regs(struct pt_regs *); > /* Avoid circular header include via sched.h */ > struct task_struct; > diff --git a/arch/xtensa/include/asm/ptrace.h b/arch/xtensa/include/asm/ptrace.h > index b109416dc07e..82ab1ba99259 100644 > --- a/arch/xtensa/include/asm/ptrace.h > +++ b/arch/xtensa/include/asm/ptrace.h > @@ -90,6 +90,12 @@ struct pt_regs { > # define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \ > (regs)->areg[1])) > > +static inline void instruction_pointer_set(struct pt_regs *regs, > + unsigned long val) > +{ > + regs->pc = val; > +} > + > # ifndef CONFIG_SMP > # define profile_pc(regs) instruction_pointer(regs) > # else > -- > 2.17.1 >