[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/2] x86: consider effective protection attributes in W+X check



On 14/12/17 15:15, Jan Beulich wrote:
>>>> On 14.12.17 at 15:04, <jgross@xxxxxxxx> 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 <jgross@xxxxxxxx>
> 
> 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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.