From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752777AbdLNOVm (ORCPT ); Thu, 14 Dec 2017 09:21:42 -0500 Received: from mx2.suse.de ([195.135.220.15]:45636 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751480AbdLNOVl (ORCPT ); Thu, 14 Dec 2017 09:21:41 -0500 Subject: Re: [PATCH 1/2] x86: consider effective protection attributes in W+X check To: Jan Beulich Cc: mingo@elte.hu, Thomas Gleixner , xen-devel , Boris Ostrovsky , sds@tycho.nsa.gov, linux-kernel@vger.kernel.org, hpa@zytor.com References: <5A2FBC570200007800196B3E@prv-mh.provo.novell.com> <5A2FBE0A0200007800196B4F@suse.com> <5A32959902000078001975D6@prv-mh.provo.novell.com> From: Juergen Gross Message-ID: <27f41ad1-1ad4-dfb7-a1b4-7b405ffadd78@suse.com> Date: Thu, 14 Dec 2017 15:21:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <5A32959902000078001975D6@prv-mh.provo.novell.com> Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/12/17 15:15, Jan Beulich wrote: >>>> On 14.12.17 at 15:04, wrote: >> On 12/12/17 11:31, Jan Beulich wrote: >>> @@ -335,42 +346,45 @@ static inline bool kasan_page_table(stru >>> >>> #if PTRS_PER_PMD > 1 >>> >>> -static void walk_pmd_level(struct seq_file *m, struct pg_state *st, pud_t addr, unsigned long P) >>> +static void walk_pmd_level(struct seq_file *m, struct pg_state *st, pud_t addr, >>> + pgprotval_t eff_in, unsigned long P) >>> { >>> int i; >>> pmd_t *start, *pmd_start; >>> - pgprotval_t prot; >>> + pgprotval_t prot, eff; >>> >>> pmd_start = start = (pmd_t *)pud_page_vaddr(addr); >>> for (i = 0; i < PTRS_PER_PMD; i++) { >>> st->current_address = normalize_addr(P + i * PMD_LEVEL_MULT); >>> if (!pmd_none(*start)) { >>> + prot = pmd_flags(*start); >>> + eff = effective_prot(eff_in, prot); >>> if (pmd_large(*start) || !pmd_present(*start)) { >>> - prot = pmd_flags(*start); >>> - note_page(m, st, __pgprot(prot), 4); >>> + note_page(m, st, __pgprot(prot), eff, 4); >>> } else if (!kasan_page_table(m, st, pmd_start)) { >>> - walk_pte_level(m, st, *start, >>> + walk_pte_level(m, st, *start, eff, >>> P + i * PMD_LEVEL_MULT); >>> } >> >> You can drop the braces for both cases. Applies to similar >> constructs below, too. > > I did consider that, but decided against to allow the patch to show > more clearly what it is that is actually being changed. > >> With that fixed you can add my: >> >> Reviewed-by: Juergen Gross > > Thanks. I'd like to wait for the x86 maintainer's opinion, and hence > won't add your R-b unless you tell me that's fine either way, or > unless they too would prefer resulting code cleanliness over patch > readability. I'm fine with the braces kept, too. Juergen