Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-17 Thread Khalid Aziz
On 01/16/2017 09:47 PM, David Miller wrote: From: Dave Hansen Date: Wed, 11 Jan 2017 10:13:54 -0800 For memory shared by two different processes, do they have to agree on what the tags are, or can they differ? Whoever allocates the memory (does the mmap()+mprotect() or whatever), decides on

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-16 Thread David Miller
From: Dave Hansen Date: Wed, 11 Jan 2017 08:33:30 -0800 > Is there a cost in the hardware associated with doing this "ADI > checking"? For instance, instead of having this new mprotect() > interface, why not just always set TTE.mcd on all PTEs? If we did this then for every page mapped into use

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-16 Thread David Miller
From: Dave Hansen Date: Wed, 11 Jan 2017 10:13:54 -0800 > For memory shared by two different processes, do they have to agree on > what the tags are, or can they differ? Whoever allocates the memory (does the mmap()+mprotect() or whatever), decides on the tag. They set it, and this determines w

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-13 Thread Rob Gardner
On 01/13/2017 09:08 AM, Dave Hansen wrote: On 01/13/2017 07:29 AM, Rob Gardner wrote: so perhaps ADI should simply be disallowed for memory mapped to files, and this particular complication can be avoided. Thoughts? What's a "file" from your perspective? In Linux, shared memory is a file. hug

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-13 Thread Dave Hansen
On 01/13/2017 07:29 AM, Rob Gardner wrote: > so perhaps ADI should simply be disallowed for memory mapped to > files, and this particular complication can be avoided. Thoughts? What's a "file" from your perspective? In Linux, shared memory is a file. hugetlbfs is done with files. Many databases

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-13 Thread Khalid Aziz
On 01/13/2017 08:29 AM, Rob Gardner wrote: On 01/13/2017 07:48 AM, Khalid Aziz wrote: On 01/12/2017 06:31 PM, Rob Gardner wrote: On 01/12/2017 05:22 PM, Khalid Aziz wrote: On 01/12/2017 10:53 AM, Dave Hansen wrote: On 01/12/2017 08:50 AM, Khalid Aziz wrote: 2. Any shared page that has ADI pr

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-13 Thread Rob Gardner
On 01/13/2017 07:48 AM, Khalid Aziz wrote: On 01/12/2017 06:31 PM, Rob Gardner wrote: On 01/12/2017 05:22 PM, Khalid Aziz wrote: On 01/12/2017 10:53 AM, Dave Hansen wrote: On 01/12/2017 08:50 AM, Khalid Aziz wrote: 2. Any shared page that has ADI protection enabled on it, must stay ADI prote

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-13 Thread Khalid Aziz
On 01/12/2017 06:31 PM, Rob Gardner wrote: On 01/12/2017 05:22 PM, Khalid Aziz wrote: On 01/12/2017 10:53 AM, Dave Hansen wrote: On 01/12/2017 08:50 AM, Khalid Aziz wrote: 2. Any shared page that has ADI protection enabled on it, must stay ADI protected across all processes sharing it. Is th

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-12 Thread Rob Gardner
On 01/12/2017 05:22 PM, Khalid Aziz wrote: On 01/12/2017 10:53 AM, Dave Hansen wrote: On 01/12/2017 08:50 AM, Khalid Aziz wrote: 2. Any shared page that has ADI protection enabled on it, must stay ADI protected across all processes sharing it. Is that true? What happens if a page with ADI ta

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-12 Thread Khalid Aziz
On 01/12/2017 10:53 AM, Dave Hansen wrote: On 01/12/2017 08:50 AM, Khalid Aziz wrote: 2. Any shared page that has ADI protection enabled on it, must stay ADI protected across all processes sharing it. Is that true? What happens if a page with ADI tags set is accessed via a PTE without the ADI

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-12 Thread Dave Hansen
On 01/12/2017 08:50 AM, Khalid Aziz wrote: > 2. Any shared page that has ADI protection enabled on it, must stay ADI > protected across all processes sharing it. Is that true? What happens if a page with ADI tags set is accessed via a PTE without the ADI enablement bit set? > COW creates an inte

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-12 Thread Khalid Aziz
On 01/11/2017 05:49 PM, Dave Hansen wrote: On 01/11/2017 04:22 PM, Khalid Aziz wrote: ... All of the tag coordination can happen in userspace. Once a process sets a tag on a physical page mapped in its address space, another process that has mapped the same physical page in its address space can

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-11 Thread Dave Hansen
On 01/11/2017 04:22 PM, Khalid Aziz wrote: ... > All of the tag coordination can happen in userspace. Once a process sets > a tag on a physical page mapped in its address space, another process > that has mapped the same physical page in its address space can only set > the tag to exact same value.

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-11 Thread Khalid Aziz
On 01/11/2017 12:11 PM, Dave Hansen wrote: On 01/11/2017 10:50 AM, Khalid Aziz wrote: On 01/11/2017 11:13 AM, Dave Hansen wrote: On 01/11/2017 08:56 AM, Khalid Aziz wrote: For memory shared by two different processes, do they have to agree on what the tags are, or can they differ? The two pro

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-11 Thread Dave Hansen
On 01/11/2017 10:50 AM, Khalid Aziz wrote: > On 01/11/2017 11:13 AM, Dave Hansen wrote: >> On 01/11/2017 08:56 AM, Khalid Aziz wrote: >> For memory shared by two different processes, do they have to agree on >> what the tags are, or can they differ? > > The two processes have to agree on the tag.

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-11 Thread Khalid Aziz
On 01/11/2017 11:13 AM, Dave Hansen wrote: On 01/11/2017 08:56 AM, Khalid Aziz wrote: On 01/11/2017 09:33 AM, Dave Hansen wrote: On 01/11/2017 08:12 AM, Khalid Aziz wrote: A userspace task enables ADI through mprotect(). This patch series adds a page protection bit PROT_ADI and a corresponding

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-11 Thread Dave Hansen
On 01/11/2017 08:56 AM, Khalid Aziz wrote: > On 01/11/2017 09:33 AM, Dave Hansen wrote: >> On 01/11/2017 08:12 AM, Khalid Aziz wrote: >>> A userspace task enables ADI through mprotect(). This patch series adds >>> a page protection bit PROT_ADI and a corresponding VMA flag >>> VM_SPARC_ADI. VM_SPAR

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-11 Thread Khalid Aziz
On 01/11/2017 09:33 AM, Dave Hansen wrote: On 01/11/2017 08:12 AM, Khalid Aziz wrote: A userspace task enables ADI through mprotect(). This patch series adds a page protection bit PROT_ADI and a corresponding VMA flag VM_SPARC_ADI. VM_SPARC_ADI is used to trigger setting TTE.mcd bit in the sparc

Re: [PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-11 Thread Dave Hansen
On 01/11/2017 08:12 AM, Khalid Aziz wrote: > A userspace task enables ADI through mprotect(). This patch series adds > a page protection bit PROT_ADI and a corresponding VMA flag > VM_SPARC_ADI. VM_SPARC_ADI is used to trigger setting TTE.mcd bit in the > sparc pte that enables ADI checking on the

[PATCH v4 0/4] Application Data Integrity feature introduced by SPARC M7

2017-01-11 Thread Khalid Aziz
SPARC M7 processor adds additional metadata for memory address space that can be used to secure access to regions of memory. This additional metadata is implemented as a 4-bit tag attached to each cacheline size block of memory. A task can set a tag on any number of such blocks. Access to such bloc