[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.11.1509222157050.5606@nanos>
Date: Tue, 22 Sep 2015 22:03:08 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Dave Hansen <dave@...1.net>
cc: x86@...nel.org, linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH 10/26] x86, pkeys: notify userspace about protection key
faults
On Wed, 16 Sep 2015, Dave Hansen wrote:
>
> +static inline u16 vma_pkey(struct vm_area_struct *vma)
> +{
> + u16 pkey = 0;
> +#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
> + unsigned long f = vma->vm_flags;
> + pkey |= (!!(f & VM_HIGH_ARCH_0)) << 0;
> + pkey |= (!!(f & VM_HIGH_ARCH_1)) << 1;
> + pkey |= (!!(f & VM_HIGH_ARCH_2)) << 2;
> + pkey |= (!!(f & VM_HIGH_ARCH_3)) << 3;
Eew. What's wrong with:
pkey = (vma->vm_flags & VM_PKEY_MASK) >> VM_PKEY_SHIFT;
???
> +static u16 fetch_pkey(unsigned long address, struct task_struct *tsk)
So here we get a u16 and assign it to si_pkey
> + if (boot_cpu_has(X86_FEATURE_OSPKE) && si_code == SEGV_PKUERR)
> + info.si_pkey = fetch_pkey(address, tsk);
which is int.
> + int _pkey; /* FIXME: protection key value??
Inconsistent at least.
Thanks,
tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists