Introduce pte_get_hash_gslot()() which returns the slot number of the
HPTE in the global hash table.
This function will come in handy as we work towards re-arranging the
PTE bits in the later patches.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/book3s/64/hash.h |3 +++
arch/powerpc/
Introduce pte_set_hash_slot().It sets the (H_PAGE_F_SECOND|H_PAGE_F_GIX)
bits at the appropriate location in the PTE of 4K PTE. For
64K PTE, it sets the bits in the second part of the PTE. Though
the implementation for the former just needs the slot parameter, it does
tak
Rearrange 64K PTE bits to free up bits 3, 4, 5 and 6,
in the 4K backed HPTE pages.These bits continue to be used
for 64K backed HPTE pages in this patch, but will be freed
up in the next patch. The bit numbers are big-endian as
defined in the ISA3.0
The patch does the following change to t
The H_PAGE_F_SECOND,H_PAGE_F_GIX are not in the 64K main-PTE.
capture these changes in the dump pte report.
Signed-off-by: Ram Pai
---
arch/powerpc/mm/dump_linuxpagetables.c |3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/mm/dump_linuxpagetables.c
b/arch/
replace redundant code in __hash_page_huge() with helper
functions pte_get_hash_gslot() and pte_set_hash_slot()
Signed-off-by: Ram Pai
---
arch/powerpc/mm/hugetlbpage-hash64.c | 24
1 files changed, 4 insertions(+), 20 deletions(-)
diff --git a/arch/powerpc/mm/hugetlb
replace redundant code in __hash_page_4K() with helper
functions pte_get_hash_gslot() and pte_set_hash_slot()
Signed-off-by: Ram Pai
---
arch/powerpc/mm/hash64_64k.c | 34 +-
1 files changed, 9 insertions(+), 25 deletions(-)
diff --git a/arch/powerpc/mm/hash64_
replace redundant code in __hash_page_64K() with helper
functions pte_get_hash_gslot() and pte_set_hash_slot()
Signed-off-by: Ram Pai
---
arch/powerpc/mm/hash64_64k.c | 24
1 files changed, 4 insertions(+), 20 deletions(-)
diff --git a/arch/powerpc/mm/hash64_64k.c b/a
Currently only 4bits are allocated in the vma flags to hold 16
keys. This is sufficient for x86. PowerPC supports 32 keys,
which needs 5bits. This patch allocates an additional bit.
Signed-off-by: Ram Pai
---
fs/proc/task_mmu.c |6 --
include/linux/mm.h | 20 ++--
2
replace redundant code with helper functions
pte_get_hash_gslot() and pte_set_hash_slot()
Signed-off-by: Ram Pai
---
arch/powerpc/mm/hash64_4k.c | 14 ++
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/mm/hash64_4k.c b/arch/powerpc/mm/hash64_4k.c
index 6
replace redundant code in flush_hash_page() with helper function
pte_get_hash_gslot().
Signed-off-by: Ram Pai
---
arch/powerpc/mm/hash_utils_64.c | 13 -
1 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
Implements helper functions to read and write the key related
registers; AMR, IAMR, UAMOR.
AMR register tracks the read,write permission of a key
IAMR register tracks the execute permission of a key
UAMOR register enables and disables a key
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/bo
Introduce helper functions that can initialize the bits in the AMR,
IAMR and UMOR register; the bits that correspond to the given pkey.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/pkeys.h |1 +
arch/powerpc/mm/pkeys.c | 44 ++
2 files ch
Total 32 keys are supported on powerpc. However pkey 0,1
and 31 are reserved. So effectively we have 29 pkeys.
This patch keeps track of reserved keys, allocated keys
and keys that are currently free.
Also it adds skeletal functions and macros, that the
architecture-independent code expects
Finally this patch provides the ability for a process to
allocate and free a protection key.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/systbl.h |2 ++
arch/powerpc/include/asm/unistd.h |4 +---
arch/powerpc/include/uapi/asm/unistd.h |2 ++
3 files changed, 5 inser
cleanup the bits corresponding to a key in the AMR, and IAMR
register, when the key is newly allocated/activated or is freed.
We dont want some residual bits cause the hardware enforce
unintended behavior when the key is activated or freed.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/pke
Store and restore the AMR, IAMR and UMOR register state of the task
before scheduling out and after scheduling in, respectively.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/processor.h |5 +
arch/powerpc/kernel/process.c| 18 ++
2 files changed, 23 inser
This patch provides the implementation of execute-only pkey.
The architecture-independent expects the ability to create
and manage a special key which has execute-only permission.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/book3s/64/mmu.h |1 +
arch/powerpc/include/asm/pkeys.h
powerpc has hardware support to disable execute on a pkey.
This patch enables the ability to create execute-disabled
keys.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/pkeys.h | 12
arch/powerpc/mm/pkeys.c | 10 ++
2 files changed, 22 insertions(+), 0 del
This patch provides the detailed implementation for
a user to allocate a key and enable it in the hardware.
It provides the plumbing, but it cannot be used till
the system call is implemented. The next patch will
do so.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/pkeys.h | 10 +++
map the pkey bits in the pte from the key protection
bits of the vma.
The pte bits used for pkey are 3,4,5,6 and 57. The first
four bits are the same four bits that were freed up initially
in this patch series. remember? :-) Without those four bits
this patch would'nt be possible.
Signed-off-by:
helper function that checks if the read/write/execute is allowed
on the pte.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/book3s/64/pgtable.h |4 +++
arch/powerpc/include/asm/pkeys.h | 12 +
arch/powerpc/mm/pkeys.c | 33
Patch provides the ability for a process to
associate a pkey with a address range.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/systbl.h |1 +
arch/powerpc/include/asm/unistd.h |4 +---
arch/powerpc/include/uapi/asm/unistd.h |1 +
3 files changed, 3 insertions(+), 3
Map the PTE protection key bits to the HPTE key protection bits,
while creating HPTE entries.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/book3s/64/mmu-hash.h |5 +
arch/powerpc/include/asm/pkeys.h | 12
arch/powerpc/mm/hash_utils_64.c |
Make sure that the kernel does not access user pages without
checking their key-protection.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/book3s/64/pgtable.h | 14 ++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h
This patch provides the implementation for
arch_vma_access_permitted(). Returns true if the
requested access is allowed by pkey associated with the
vma.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/mmu_context.h |5 +++-
arch/powerpc/mm/pkeys.c| 43 ++
capture AMR register contents, and save it in paca
whenever a pkey violation is detected.
This value will be needed to deliver pkey-violation
signal to the task.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/paca.h |3 +++
arch/powerpc/kernel/asm-offsets.c |5 +
arch/powerpc
Replace the magic number used to check for DSI exception
with a meaningful value.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/reg.h |7 ++-
arch/powerpc/kernel/exceptions-64s.S |2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/as
arch_pkeys_enabled() returns true if the cpu
supports protection key, and the kernel has it
enabled.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/pkeys.h |5 +
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/include/asm/pkeys.h b/arch/powerpc/include/as
Capture the protection key that got violated in paca.
This value will be later used to inform the signal
handler.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/paca.h |1 +
arch/powerpc/kernel/asm-offsets.c |1 +
arch/powerpc/mm/fault.c |8
3 files changed,
get_pte_pkey() helper returns the pkey associated with
a address corresponding to a given mm_struct.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/book3s/64/mmu-hash.h |5 +
arch/powerpc/mm/hash_utils_64.c | 25 +
2 files changed, 30 insertio
Currently the architecture specific code is expected to
display the protection keys in smap for a given vma.
This can lead to redundant code and possibly to divergent
formats in which the key gets displayed.
This patch changes the implementation. It displays the
pkey only if the architecture suppo
The value of the AMR register at the time of exception
is made available in gp_regs[PT_AMR] of the siginfo.
The value of the pkey, whose protection got violated,
is made available in si_pkey field of the siginfo structure.
Signed-off-by: Ram Pai
---
arch/powerpc/include/uapi/asm/ptrace.h |1
arch_show_smap() function is not needed anymore.
Delete it.
Signed-off-by: Ram Pai
---
arch/x86/kernel/setup.c |8
1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index f818236..5efe4c3 100644
--- a/arch/x86/kernel/set
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/Makefile |1 +
tools/testing/selftests/vm/pkey-helpers.h | 219
tools/testing/selftests/vm/protection_keys.c | 1395 +
tools/testing/selftests/x86/Makefile |2 +-
tools/testing/self
Moved all the generic definition and helper functions to the
header file
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/pkey-helpers.h| 62 +++--
tools/testing/selftests/vm/protection_keys.c | 54 --
2 files changed, 57 insertions(+), 59 del
some pkru references are named to pkey_reg
and some prku references are renamed to pkey
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/pkey-helpers.h| 85 +-
tools/testing/selftests/vm/protection_keys.c | 227 ++
2 files changed, 164 insertions(+), 1
This is in preparation to accomadate a differing size register
across architectures.
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/pkey-helpers.h| 27 +-
tools/testing/selftests/vm/protection_keys.c | 75 ++
2 files changed, 54 insertions(+), 48 de
helper functions to handler shadow pkey register
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/pkey-helpers.h| 27
tools/testing/selftests/vm/protection_keys.c | 34 -
2 files changed, 49 insertions(+), 12 deletions(-)
diff --git a/to
open_hugepage_file() <- opens the huge page file
get_start_key() <-- provides the first non-reserved key.
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/pkey-helpers.h| 11 +++
tools/testing/selftests/vm/protection_keys.c |6 +++---
2 files changed, 14 insertions(+), 3
If the flag is 0, no bits will be set. Hence we cant expect
the resulting bitmap to have a higher value than what it
was earlier.
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/protection_keys.c |2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/testing/selfte
instead of clearing the bits, pkey_disable_clear() was setting
the bits. Fixed it.
Also fixed a wrong assertion in that function. When bits are
cleared, the resulting bit value will be less than the original.
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/protection_keys.c |4 ++--
1
When a key is freed, the key is no more effective.
Clear the bits corresponding to the pkey in the shadow
register. Otherwise it will carry some spurious bits
which can trigger false-positive asserts.
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/protection_keys.c |3 +++
1 fi
alloc_random_pkey() was allocating the same pkey every time.
Not all pkeys were geting tested. fixed it.
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/protection_keys.c | 10 +++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/vm/protection
detect access-violation on a page to which access-disabled
key is associated much after the page is mapped.
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/protection_keys.c | 19 +++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/tools/testing/selftests/
expected_pkey_fault() is comparing the contents of pkey
register with 0. This may not be true all the time. There
could be bits set by default by the architecture
which can never be changed. Hence compare the value against
shadow pkey register, which is supposed to track the bits
accurately all thr
cleanup the code to satisfy coding styles.
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/protection_keys.c | 81 ++
1 files changed, 43 insertions(+), 38 deletions(-)
diff --git a/tools/testing/selftests/vm/protection_keys.c
b/tools/testing/selftests/vm/protec
detect write-violation on a page to which write-disabled
key is associated much after the page is mapped.
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/protection_keys.c | 12
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/tools/testing/selftests/vm/protec
a access-denied key should not trigger any key violation
after the key has been freed.
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/protection_keys.c | 25 +
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/tools/testing/selftests/vm/protection_k
a write-denied key should not trigger any key violation
after the key has been freed.
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/protection_keys.c | 18 ++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/tools/testing/selftests/vm/protection_keys.c
b
detect write-violation on a page to which access-disabled
key is associated much after the page is mapped.
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/protection_keys.c | 13 +
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/tools/testing/selftests/vm/prot
introduce a new allocator that allocates 4k hardware-pages to back
64k linux-page. This allocator is only applicable on powerpc.
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/protection_keys.c | 29 ++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --gi
Add documentation updates that capture PowerPC specific changes.
Signed-off-by: Ram Pai
---
Documentation/vm/protection-keys.txt | 90 -
1 files changed, 65 insertions(+), 25 deletions(-)
diff --git a/Documentation/vm/protection-keys.txt
b/Documentation/vm/pro
Since PowerPC and Intel both support memory protection keys, moving
the documenation to arch-neutral directory.
Signed-off-by: Ram Pai
---
Documentation/vm/protection-keys.txt | 85 +
Documentation/x86/protection-keys.txt | 85
Introduce powerpc implementation for the various
abstactions.
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/pkey-helpers.h| 97 +++--
tools/testing/selftests/vm/protection_keys.c | 33 +
2 files changed, 107 insertions(+), 23 deletions(-)
diff --git a
The maximum number of keys that can be allocated has to
take into consideration that some keys are reserved by
the architecture of specific purpose and cannot be allocated.
Fix the assertion in test_pkey_alloc_exhaust()
Signed-off-by: Ram Pai
---
tools/testing/selftests/vm/protection_keys.c |
arch_pkeys_enabled() returns true if the cpu
supports X86_FEATURE_OSPKE.
Signed-off-by: Ram Pai
---
arch/x86/include/asm/pkeys.h |1 +
arch/x86/kernel/fpu/xstate.c |5 +
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/arch/x86/include/asm/pkeys.h b/arch/x86/include/asm
Only the architecture knows if it supports protection keys.
Hence introducing arch_pkeys_enabled().
This function is needed by arch neutral code.
One use case is -- to determine if the
protection key needs to be displayed in smaps.
Signed-off-by: Ram Pai
---
include/linux/pkeys.h |
arch-independent code expects the arch to map
a pkey into the vma's protection bit setting.
The patch provides that ability.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/mman.h |8 +++-
arch/powerpc/include/asm/pkeys.h | 18 +++---
2 files changed, 22 insertions(
arch independent code calls arch_override_mprotect_pkey()
to return a pkey that best matches the requested protection.
This patch provides the implementation.
Signed-off-by: Ram Pai
---
arch/powerpc/include/asm/mmu_context.h |5 +++
arch/powerpc/include/asm/pkeys.h | 14 -
a
Handle Data and Instruction exceptions caused by memory
protection-key.
The CPU will detect the key fault if the HPTE is already
programmed with the key.
However if the HPTE is not hashed, a key fault will not
be detected by the hardware. The software will detect
pkey violation in such a cas
Memory protection keys enable applications to protect its
address space from inadvertent access or corruption from
itself.
The overall idea:
-
A process allocates a key and associates it with
an address range withinits address space.
The process then can dynamic
Rearrange 64K PTE bits to free up bits 3, 4, 5 and 6
in the 64K backed HPTE pages. This along with the earlier
patch will entirely free up the four bits from 64K PTE.
The bit numbers are big-endian as defined in the ISA3.0
This patch does the following change to 64K PTE backed
by 64K H
basic setup to initialize the pkey system. Only 64K kernel in HPT
mode, enables the pkey system.
Signed-off-by: Ram Pai
---
arch/powerpc/Kconfig | 16 ++
arch/powerpc/include/asm/mmu_context.h |5 +++
arch/powerpc/include/asm/pkeys.h | 51 +
Solving Sphinx dependencies can be painful. Add a script to
check if everything is ok.
Tested on:
- Fedora 25 and 26;
- Ubuntu 17.04;
- OpenSuse Tumbleweed;
- Arch Linux.
Signed-off-by: Mauro Carvalho Chehab
---
v7: added support for OpenSuse and Arch Linux. Re-t
Em Sat, 15 Jul 2017 09:55:09 -0300
Mauro Carvalho Chehab escreveu:
> Em Sat, 15 Jul 2017 09:49:40 -0300
> Mauro Carvalho Chehab escreveu:
>
> > I guess it could also use kpsewhich to check if the needed
> > texlive packages are installed. However, the problem with such
> > approach is that texl
Here's a request to consider as an end-of-window pull. Mauro has gone
through and fixed up a lot of top-level documentation files to make them
conform to the RST format, but without moving or renaming them in any
way. This will help when we incorporate the ones we want to keep into the
Sphinx doc
Solving Sphinx dependencies can be painful. Add a script to
check if everything is ok.
Signed-off-by: Mauro Carvalho Chehab
---
v6: add logic to detect texlive packages
v5: minor fix to return error if virtualenv and Sphinx is not installed
v4: changed default to use virtualenv for Sphinx and ad
Em Sat, 15 Jul 2017 09:49:40 -0300
Mauro Carvalho Chehab escreveu:
> I guess it could also use kpsewhich to check if the needed
> texlive packages are installed. However, the problem with such
> approach is that texlive-kpathsea-bin package should be installed
> first, in order to provide such co
Em Sat, 15 Jul 2017 11:51:45 +0200
Markus Heiser escreveu:
> > Am 15.07.2017 um 04:21 schrieb Mauro Carvalho Chehab
> > :
> >
> > Em Fri, 14 Jul 2017 19:35:59 +0200
> > Markus Heiser escreveu:
> >
> >>> Am 14.07.2017 um 18:49 schrieb Mauro Carvalho Chehab
> >>> :
> >>>
> >>> Solving Sphin
Solving Sphinx dependencies can be painful. Add a script to
check if everything is ok.
Signed-off-by: Mauro Carvalho Chehab
---
v5: minor fix to return error if virtualenv and Sphinx is not installed
v4: changed default to use virtualenv for Sphinx and add switches to
change its behavior to
Solving Sphinx dependencies can be painful. Add a script to
check if everything is ok.
Signed-off-by: Mauro Carvalho Chehab
---
v4: changed default to use virtualenv for Sphinx and add switches to
change its behavior to disable PDF and virtualenv.
v3: check for DeJavu fonts on Ubuntu and a
> Am 15.07.2017 um 04:21 schrieb Mauro Carvalho Chehab
> :
>
> Em Fri, 14 Jul 2017 19:35:59 +0200
> Markus Heiser escreveu:
>
>>> Am 14.07.2017 um 18:49 schrieb Mauro Carvalho Chehab
>>> :
>>>
>>> Solving Sphinx dependencies can be painful. Add a script to
>>> check if everything is ok.
>>
On Tue, Jul 04, 2017 at 01:24:13PM -0600, Jonathan Corbet wrote:
> On Mon, 3 Jul 2017 21:32:33 -0700
> Linus Torvalds wrote:
>
> > Eg things like
> >
> > Error: Cannot open file ./kernel/rcu/srcu.c
> > Error: Cannot open file ./kernel/rcu/srcu.c
> >
> > happen simply because that file no lo
73 matches
Mail list logo