Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752315AbdHSTKO (ORCPT ); Sat, 19 Aug 2017 15:10:14 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:40597 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751171AbdHSTKM (ORCPT ); Sat, 19 Aug 2017 15:10:12 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Ram Pai Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, khandual@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, bsingharora@gmail.com, dave.hansen@intel.com, hbabu@us.ibm.com, arnd@arndb.de, akpm@linux-foundation.org, corbet@lwn.net, mingo@redhat.com, mhocko@kernel.org References: <1500177424-13695-1-git-send-email-linuxram@us.ibm.com> <1500177424-13695-36-git-send-email-linuxram@us.ibm.com> Date: Sat, 19 Aug 2017 14:09:58 -0500 In-Reply-To: <1500177424-13695-36-git-send-email-linuxram@us.ibm.com> (Ram Pai's message of "Sat, 15 Jul 2017 20:56:37 -0700") Message-ID: <87d17rnzll.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1dj98K-0002EV-Pt;;;mid=<87d17rnzll.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=67.3.200.44;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1/WQOWLeCARc+HYUKhNHQ2jyX0lotuLcyA= X-SA-Exim-Connect-IP: 67.3.200.44 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4770] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Ram Pai X-Spam-Relay-Country: X-Spam-Timing: total 408 ms - load_scoreonly_sql: 0.04 (0.0%), signal_user_changed: 2.7 (0.7%), b_tie_ro: 1.88 (0.5%), parse: 0.84 (0.2%), extract_message_metadata: 2.6 (0.6%), get_uri_detail_list: 1.03 (0.3%), tests_pri_-1000: 3.9 (1.0%), tests_pri_-950: 1.25 (0.3%), tests_pri_-900: 1.07 (0.3%), tests_pri_-400: 23 (5.7%), check_bayes: 22 (5.5%), b_tokenize: 7 (1.8%), b_tok_get_all: 7 (1.8%), b_comp_prob: 1.91 (0.5%), b_tok_touch_all: 3.9 (1.0%), b_finish: 0.65 (0.2%), tests_pri_0: 358 (87.9%), check_dkim_signature: 0.46 (0.1%), check_dkim_adsp: 2.6 (0.6%), tests_pri_500: 5 (1.3%), rewrite_mail: 0.00 (0.0%) Subject: Re: [RFC v6 35/62] powerpc: Deliver SEGV signal on pkey violation X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1512 Lines: 48 Ram Pai writes: > diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c > index d4e545d..fe1e7c7 100644 > --- a/arch/powerpc/kernel/traps.c > +++ b/arch/powerpc/kernel/traps.c > @@ -20,6 +20,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -247,6 +248,15 @@ void user_single_step_siginfo(struct task_struct *tsk, > info->si_addr = (void __user *)regs->nip; > } > > +#ifdef CONFIG_PPC64_MEMORY_PROTECTION_KEYS > +static void fill_sig_info_pkey(int si_code, siginfo_t *info, unsigned long addr) > +{ > + if (si_code != SEGV_PKUERR) > + return; Given that SEGV_PKUERR is a signal specific si_code this test is insufficient to detect an pkey error. You also need to check that signr == SIGSEGV > + info->si_pkey = get_paca()->paca_pkey; > +} > +#endif /* CONFIG_PPC64_MEMORY_PROTECTION_KEYS */ > + > void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr) > { > siginfo_t info; > @@ -274,6 +284,11 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr) > info.si_signo = signr; > info.si_code = code; > info.si_addr = (void __user *) addr; > + > +#ifdef CONFIG_PPC64_MEMORY_PROTECTION_KEYS > + fill_sig_info_pkey(code, &info, addr); > +#endif /* CONFIG_PPC64_MEMORY_PROTECTION_KEYS */ > + > force_sig_info(signr, &info, current); > } Eric