Re: [PATCH 0/5] Bring the BusLogic host bus adapter driver up to Y2021

2021-04-19 Thread Khalid Aziz
On 4/19/21 10:01 AM, Maciej W. Rozycki wrote: > On Mon, 19 Apr 2021, Khalid Aziz wrote: > >> On 4/18/21 2:21 PM, Ondrej Zary wrote: >>> >>> Found the 3000763 document here: >>> https://doc.lagout.org/science/0_Computer Science/0_Comp

Re: [PATCH 0/5] Bring the BusLogic host bus adapter driver up to Y2021

2021-04-19 Thread Khalid Aziz
On 4/18/21 2:21 PM, Ondrej Zary wrote: > On Friday 16 April 2021 23:25:18 Maciej W. Rozycki wrote: >> On Fri, 16 Apr 2021, Khalid Aziz wrote: >> >>>> Sadly I didn't get to these resources while they were still there, and >>>> neither did archive

Re: [PATCH 1/5] scsi: BusLogic: Fix missing `pr_cont' use

2021-04-16 Thread Khalid Aziz
On 4/15/21 8:08 PM, Joe Perches wrote: > And while it's a lot more code, I'd prefer a solution that looks more > like the other commonly used kernel logging extension mechanisms > where adapter is placed before the format, ... in the argument list. Hi Joe, I don't mind making these changes. It is

Re: [PATCH 2/5] scsi: BusLogic: Avoid unbounded `vsprintf' use

2021-04-16 Thread Khalid Aziz
As Maciej explained in other email that snprintf() does null-terminate the string, I think this change is fine. Acked-by: Khalid Aziz

Re: [PATCH 0/5] Bring the BusLogic host bus adapter driver up to Y2021

2021-04-16 Thread Khalid Aziz
On 4/14/21 4:38 PM, Maciej W. Rozycki wrote: > Hi, > > First of all, does anyone have a copy of: "MultiMaster UltraSCSI Host > Adapters for PCI Systems: Technical Reference Manual" (pub. 3002493-E)? > It used to live in the "Mylex Manuals and Documentation Archives" section > of the Mylex web

Re: [PATCH 1/5] scsi: BusLogic: Fix missing `pr_cont' use

2021-04-16 Thread Khalid Aziz
st_no, buf); > } else > - printk("%s", buf); > + pr_cont("%s", buf); > } else { > if (begin) { > if (adapter != NULL && adapter->adapter_initd) > @@ -3611,7 +3611,7 @@ static void blogic_msg(enum blogic_msgle > else > printk("%s%s", blogic_msglevelmap[msglevel], > buf); > } else > - printk("%s", buf); > + pr_cont("%s", buf); > } > begin = (buf[len - 1] == '\n'); > } > Looks good. Acked-by: Khalid Aziz

Re: [PATCH 4/8] scsi: FlashPoint: Remove unused variable 'TID' from 'FlashPoint_AbortCCB()'

2021-03-17 Thread Khalid Aziz
On 3/17/21 3:11 AM, Lee Jones wrote: > Fixes the following W=1 kernel build warning(s): > > drivers/scsi/FlashPoint.c: In function ‘FlashPoint_AbortCCB’: > drivers/scsi/FlashPoint.c:1618:16: warning: variable ‘TID’ set but not used > [-Wunused-but-set-variable] > >

Re: [PATCH 1/8] scsi: BusLogic: Supply __printf(x, y) formatting for blogic_msg()

2021-03-17 Thread Khalid Aziz
> candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format] > > Cc: Khalid Aziz > Cc: "James E.J. Bottomley" > Cc: "Martin K. Petersen" > Cc: "Leonard N. Zubkoff" > Cc: linux-s...@vger.kernel.org > Signed-off-by: Lee Jones > --

Re: [PATCH] scsi: FlashPoint: Fix typo issue

2021-03-04 Thread Khalid Aziz
p > * > - * Description: Load the Automation RAM with the defualt map values. > + * Description: Load the Automation RAM with the default map values. > * > *-----*/ > static void FPT_autoLoadDefaultMap(u32 p_port

Re: [PATCH V3] mm/compaction: correct deferral logic for proactive compaction

2021-01-19 Thread Khalid Aziz
score_zone_weighted(zone); } return score; Looks good. Reviewed-by: Khalid Aziz

Re: [PATCH] sparc64: Use arch_validate_flags() to validate ADI flag

2020-11-24 Thread Khalid Aziz
On 11/20/20 11:01 AM, Catalin Marinas wrote: Hi Khalid, On Fri, Oct 23, 2020 at 11:56:11AM -0600, Khalid Aziz wrote: diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h index f94532f25db1..274217e7ed70 100644 --- a/arch/sparc/include/asm/mman.h +++ b/arch/sparc/include

[PATCH] sparc64: Use arch_validate_flags() to validate ADI flag

2020-10-23 Thread Khalid Aziz
Christoph Hellwig Suggested-by: Catalin Marinas Signed-off-by: Khalid Aziz --- arch/sparc/include/asm/mman.h | 54 +++ 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/arch/sparc/include/asm/mman.h b/arch/sparc/include/asm/mman.h index f9

Re: [PATCH 1/2] mm/mprotect: Call arch_validate_prot under mmap_lock and with length

2020-10-15 Thread Khalid Aziz
On 10/15/20 3:05 AM, Catalin Marinas wrote: > On Wed, Oct 14, 2020 at 03:21:16PM -0600, Khalid Aziz wrote: >> What FreeBSD does seems like a reasonable thing to do. Any way first >> thing to do is to update sparc to use arch_validate_flags() and update >> sparc_validate_prot()

Re: [PATCH 1/2] mm/mprotect: Call arch_validate_prot under mmap_lock and with length

2020-10-14 Thread Khalid Aziz
On 10/13/20 3:16 AM, Catalin Marinas wrote: > On Mon, Oct 12, 2020 at 01:14:50PM -0600, Khalid Aziz wrote: >> On 10/12/20 11:22 AM, Catalin Marinas wrote: >>> On Mon, Oct 12, 2020 at 11:03:33AM -0600, Khalid Aziz wrote: >>>> On 10/10/20 5:09 AM, Catalin Marinas wrote:

Re: [PATCH 1/2] mm/mprotect: Call arch_validate_prot under mmap_lock and with length

2020-10-12 Thread Khalid Aziz
On 10/12/20 11:22 AM, Catalin Marinas wrote: > On Mon, Oct 12, 2020 at 11:03:33AM -0600, Khalid Aziz wrote: >> On 10/10/20 5:09 AM, Catalin Marinas wrote: >>> On Wed, Oct 07, 2020 at 02:14:09PM -0600, Khalid Aziz wrote: >>>> On 10/7/20 1:39 AM, Jann Horn wrote: >&g

Re: [PATCH 1/2] mm/mprotect: Call arch_validate_prot under mmap_lock and with length

2020-10-12 Thread Khalid Aziz
On 10/10/20 5:09 AM, Catalin Marinas wrote: > Hi Khalid, > > On Wed, Oct 07, 2020 at 02:14:09PM -0600, Khalid Aziz wrote: >> On 10/7/20 1:39 AM, Jann Horn wrote: >>> arch_validate_prot() is a hook that can validate whether a given set of >>> protection flags is

Re: [PATCH 2/2] sparc: Check VMA range in sparc_validate_prot()

2020-10-07 Thread Khalid Aziz
(Application Data > Integrity)") > Signed-off-by: Jann Horn > --- > compile-tested only, I don't have a Sparc ADI setup - might be nice if some > Sparc person could test this? > > arch/sparc/include/asm/mman.h | 50 +------ > 1 file changed, 30 ins

Re: [PATCH 1/2] mm/mprotect: Call arch_validate_prot under mmap_lock and with length

2020-10-07 Thread Khalid Aziz
> arch_validate_prot() call in mm/mprotect.c down into the locked region. > > Cc: sta...@vger.kernel.org > Fixes: 9035cf9a97e4 ("mm: Add address parameter to arch_validate_prot()") > Suggested-by: Khalid Aziz > Suggested-by: Christoph Hellwig > Signed-off-by: Jann Horn

Re: SPARC version of arch_validate_prot() looks broken (UAF read)

2020-09-29 Thread Khalid Aziz
On 9/28/20 6:14 AM, Jann Horn wrote: > From what I can tell from looking at the code: > > SPARC's arch_validate_prot() looks up the VMA and peeks at it; that's > not permitted though. do_mprotect_pkey() calls arch_validate_prot() > before taking the mmap lock, so we can hit use-after-free reads if

Re: [RFC PATCH 1/1] usb: ehci: Remove erroneous return of EPROTO upon detection of stall

2020-09-04 Thread Khalid Aziz
On 9/4/20 9:19 AM, Greg KH wrote: > On Mon, Aug 31, 2020 at 10:08:43AM -0600, Khalid Aziz wrote: >> With the USB 3.0/3.1 controller on MSI B450-A Pro Max motherboard, >> full speed and low speed devices see constant resets making >> keyboards and mouse unreliable and unusa

Re: [RFC RESEND PATCH 0/1] USB EHCI: repeated resets on full and low speed devices

2020-09-01 Thread Khalid Aziz
On 9/1/20 1:51 PM, Alan Stern wrote: > On Tue, Sep 01, 2020 at 11:00:16AM -0600, Khalid Aziz wrote: >> On 9/1/20 10:36 AM, Alan Stern wrote: >>> On Tue, Sep 01, 2020 at 09:15:46AM -0700, Khalid Aziz wrote: >>>> On 8/31/20 8:31 PM, Alan Stern wrote: >>>>&

Re: [RFC RESEND PATCH 0/1] USB EHCI: repeated resets on full and low speed devices

2020-09-01 Thread Khalid Aziz
On 9/1/20 10:36 AM, Alan Stern wrote: > On Tue, Sep 01, 2020 at 09:15:46AM -0700, Khalid Aziz wrote: >> On 8/31/20 8:31 PM, Alan Stern wrote: >>> Can you collect a usbmon trace showing an example of this problem? >>> >> >> I have attached usbmon traces fo

Re: [RFC RESEND PATCH 0/1] USB EHCI: repeated resets on full and low speed devices

2020-09-01 Thread Khalid Aziz
On 8/31/20 8:31 PM, Alan Stern wrote: > On Mon, Aug 31, 2020 at 10:23:30AM -0600, Khalid Aziz wrote: >> [Resending since I screwed up linux-usb mailing list address in >> cut-n-paste in original email] >> >> >> I recently replaced the motherboard on my desk

[RFC PATCH 1/1] usb: ehci: Remove erroneous return of EPROTO upon detection of stall

2020-08-31 Thread Khalid Aziz
hub being cleared. Hubs do not seem to repsond well to this and seem to hang which causes further USB transactions to time out. A reset finally clears the issue until we repeat the cycle all over again. Signed-off-by: Khalid Aziz Cc: Khalid Aziz --- drivers/usb/host/ehci-q.c | 4 1 file

[RFC PATCH 0/1] USB EHCI: repeated resets on full and low speed devices

2020-08-31 Thread Khalid Aziz
p sending isochronous packets)". That may be what is happening. Removing the code that returns EPROTO for such case solves the problem on my machine (as in the RFC patch) but that probably is not the right solution. I do not understand USB protocol well enough to propose a better solution. Do

Re: [PATCH v6] mm: Proactive compaction

2020-06-09 Thread Khalid Aziz
hugepage allocations. > > Changelog v2 vs v1: > - Introduce per-node and per-zone "proactive compaction score". This > score is compared against watermarks which are set according to >user provided proactiveness value. > - Separate code-paths for proactive compa

Re: [PATCH v5] mm: Proactive compaction

2020-05-28 Thread Khalid Aziz
This looks good to me. I like the idea overall of controlling aggressiveness of compaction with a single tunable for the whole system. I wonder how an end user could arrive at what a reasonable value would be for this based upon their workload. More comments below. On Mon, 2020-05-18 at 11:14 -070

Re: [PATCH] pcdp: Replace zero-length array with flexible-array

2020-05-08 Thread Khalid Aziz
creator_id[4]; > u32 creator_rev; > u32 num_uarts; > - struct pcdp_uartuart[0];/* actual size is num_uarts */ > + struct pcdp_uartuart[]; /* actual size is num_uarts */ > /* remainder of table is pcdp_device structures */ > } __attribute__((packed)); > Loks good to me. Acked-by: Khalid Aziz

Re: [RFC] mm: Proactive compaction

2019-09-24 Thread Khalid Aziz
On 9/24/19 7:39 AM, Vlastimil Babka wrote: > On 9/20/19 1:37 AM, Nitin Gupta wrote: >> On Tue, 2019-08-20 at 10:46 +0200, Vlastimil Babka wrote: >>> >>> That's a lot of control knobs - how is an admin supposed to tune them to >>> their >>> needs? >> >> >> Yes, it's difficult for an admin to get so

Re: [RFC PATCH 0/2] Add predictive memory reclamation and compaction

2019-09-03 Thread Khalid Aziz
On 9/2/19 2:02 AM, Michal Hocko wrote: > On Fri 30-08-19 15:35:06, Khalid Aziz wrote: > [...] >> - Kernel is not self-tuning and is dependent upon a userspace tool to >> perform well in a fundamental area of memory management. > > You keep bringing this up without an ac

Re: [RFC PATCH 0/2] Add predictive memory reclamation and compaction

2019-08-30 Thread Khalid Aziz
On 8/27/19 12:16 AM, Michal Hocko wrote: > On Tue 27-08-19 02:14:20, Bharath Vedartham wrote: >> Hi Michal, >> >> Here are some of my thoughts, >> On Wed, Aug 21, 2019 at 04:06:32PM +0200, Michal Hocko wrote: >>> On Thu 15-08-19 14:51:04, Khalid Aziz wrote: >

Re: [RFC] mm: Proactive compaction

2019-08-24 Thread Khalid Aziz
On 8/20/19 2:46 AM, Vlastimil Babka wrote: > +CC Khalid Aziz who proposed a different approach: > https://lore.kernel.org/linux-mm/20190813014012.30232-1-khalid.a...@oracle.com/T/#u > > On 8/16/19 11:43 PM, Nitin Gupta wrote: >> The patch has plenty of rough edges but posting

Re: [RFC PATCH 0/2] Add predictive memory reclamation and compaction

2019-08-15 Thread Khalid Aziz
On 8/15/19 11:02 AM, Michal Hocko wrote: > On Thu 15-08-19 10:27:26, Khalid Aziz wrote: >> On 8/14/19 2:58 AM, Michal Hocko wrote: >>> On Tue 13-08-19 09:20:51, Khalid Aziz wrote: >>>> On 8/13/19 8:05 AM, Michal Hocko wrote: >>>>>

Re: [RFC PATCH 0/2] Add predictive memory reclamation and compaction

2019-08-15 Thread Khalid Aziz
On 8/14/19 2:58 AM, Michal Hocko wrote: > On Tue 13-08-19 09:20:51, Khalid Aziz wrote: >> On 8/13/19 8:05 AM, Michal Hocko wrote: >>> On Mon 12-08-19 19:40:10, Khalid Aziz wrote: >>> [...] >>>> Patch 1 adds code to maintain a sliding lookback window of (

Re: [RFC PATCH 0/2] Add predictive memory reclamation and compaction

2019-08-13 Thread Khalid Aziz
On 8/13/19 8:05 AM, Michal Hocko wrote: > On Mon 12-08-19 19:40:10, Khalid Aziz wrote: > [...] >> Patch 1 adds code to maintain a sliding lookback window of (time, number >> of free pages) points which can be updated continuously and adds code to >> compute best fit line

[RFC PATCH 2/2] mm/vmscan: Add fragmentation and page starvation prediction to kswapd

2019-08-12 Thread Khalid Aziz
-by: Khalid Aziz Signed-off-by: Bharath Vedartham Tested-by: Vandana BN --- include/linux/mmzone.h | 38 ++ mm/page_alloc.c| 27 -- mm/vmscan.c| 116 ++--- 3 files changed, 148 insertions(+), 33 deletions(-) diff --git

[RFC PATCH 0/2] Add predictive memory reclamation and compaction

2019-08-12 Thread Khalid Aziz
improvements. It attempts to address potential stalls proactively before they happen and will make use of any improvements made to the reclamation/compaction code. Any feedback on this proposal and associated implementation will be greatly appreciated. This is work in progress. Khalid Aziz (2): mm: Add

[RFC PATCH 1/2] mm: Add trend based prediction algorithm for memory usage

2019-08-12 Thread Khalid Aziz
least squares. it can then compute if system will run out of memory if the current trend continues. Historical data is held in a new data structure lsq_struct for each zone and each order within the zone. Size of the window for historical data is given by LSQ_LOOKBACK. Signed-off-by: Khalid Aziz

Re: [PATCH 09/16] sparc64: use the generic get_user_pages_fast code

2019-07-26 Thread Khalid Aziz
>> Signed-off-by: Christoph Hellwig >> Reviewed-by: Khalid Aziz >> --- >> arch/sparc/Kconfig | 1 + >> arch/sparc/include/asm/pgtable_64.h | 18 ++ >> arch/sparc/mm/Makefile | 2 +- >> arch/sparc/mm/gup.c

Re: [PATCH 01/16] mm: use untagged_addr() for get_user_pages_fast addresses

2019-06-21 Thread Khalid Aziz
On 6/21/19 7:39 AM, Jason Gunthorpe wrote: > On Tue, Jun 11, 2019 at 04:40:47PM +0200, Christoph Hellwig wrote: >> This will allow sparc64 to override its ADI tags for >> get_user_pages and get_user_pages_fast. >> >> Signed-off-by: Christoph Hellwig >> mm/gup.c | 4 ++-- >> 1 file changed, 2 inse

Re: [PATCH v17 04/15] mm, arm64: untag user pointers passed to memory syscalls

2019-06-19 Thread Khalid Aziz
On 6/19/19 9:55 AM, Khalid Aziz wrote: > On 6/12/19 5:43 AM, Andrey Konovalov wrote: >> This patch is a part of a series that extends arm64 kernel ABI to allow to >> pass tagged user pointers (with the top byte set to something else other >> than 0x00) as syscall arguments. &g

Re: [PATCH 09/16] sparc64: use the generic get_user_pages_fast code

2019-06-11 Thread Khalid Aziz
1 + > arch/sparc/include/asm/pgtable_64.h | 18 ++ > arch/sparc/mm/Makefile | 2 +- > arch/sparc/mm/gup.c | 340 > 4 files changed, 20 insertions(+), 341 deletions(-) > delete mode 100644 arch/sparc/mm/gup.c > Reviewed-by: Khalid Aziz

Re: [PATCH 10/16] mm: rename CONFIG_HAVE_GENERIC_GUP to CONFIG_HAVE_FAST_GUP

2019-06-11 Thread Khalid Aziz
| 2 +- > mm/gup.c | 4 ++-- > 10 files changed, 11 insertions(+), 18 deletions(-) > Looks good. Reviewed-by: Khalid Aziz

Re: [PATCH 08/16] sparc64: define untagged_addr()

2019-06-11 Thread Khalid Aziz
insertions(+) Looks good to me. Reviewed-by: Khalid Aziz > > diff --git a/arch/sparc/include/asm/pgtable_64.h > b/arch/sparc/include/asm/pgtable_64.h > index f0dcf991d27f..1904782dcd39 100644 > --- a/arch/sparc/include/asm/pgtable_64.h > +++ b/arch/sparc/include/asm/pgtab

Re: [PATCH 01/16] mm: use untagged_addr() for get_user_pages_fast addresses

2019-06-11 Thread Khalid Aziz
tagging to use this. So I would suggest rewording the commit log. Other than that: Reviewed-by: Khalid Aziz > mm/gup.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/gup.c b/mm/gup.c > index ddde097cf9e4..6bb521db67ec 100644 > --- a/mm/gu

Re: [PATCH 01/16] uaccess: add untagged_addr definition for other arches

2019-06-03 Thread Khalid Aziz
On 6/1/19 1:49 AM, Christoph Hellwig wrote: > From: Andrey Konovalov > > To allow arm64 syscalls to accept tagged pointers from userspace, we must > untag them when they are passed to the kernel. Since untagging is done in > generic parts of the kernel, the untagged_addr macro needs to be defined

Re: [PATCH v15 01/17] uaccess: add untagged_addr definition for other arches

2019-05-29 Thread Khalid Aziz
ris started, there is a generic need to untag addresses in kernel and this patch gets us ready for that. Reviewed-by: Khalid Aziz > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 6b10c21630f5..44041df804a6 100644 > --- a/include/linux/mm.h > +++ b/include/lin

Re: [PATCH 4/6] mm: add a gup_fixup_start_addr hook

2019-05-28 Thread Khalid Aziz
On 5/25/19 11:05 AM, Linus Torvalds wrote: > [ Adding Khalid, who added the sparc64 code ] > > On Sat, May 25, 2019 at 6:32 AM Christoph Hellwig wrote: >> >> This will allow sparc64 to override its ADI tags for >> get_user_pages and get_user_pages_fast. I have no idea why this >> is not required

Re: [PATCH] mm: remove unused variable

2019-03-12 Thread Khalid Aziz
On 3/12/19 7:28 AM, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > The mm variable is set but unused. Remove it. It is used. Look further down for calls to set_pte_at(). -- Khalid > > Signed-off-by: Bartosz Golaszewski > --- > mm/mprotect.c | 1 - > 1 file changed, 1 deletion(-)

Re: [RFC PATCH v8 08/14] arm64/mm: disable section/contiguous mappings if XPFO is enabled

2019-02-15 Thread Khalid Aziz
On 2/15/19 6:09 AM, Mark Rutland wrote: > Hi, > > On Wed, Feb 13, 2019 at 05:01:31PM -0700, Khalid Aziz wrote: >> From: Tycho Andersen >> >> XPFO doesn't support section/contiguous mappings yet, so let's disable it >> if XPFO is turned on. >> >

Re: [RFC PATCH v8 03/14] mm, x86: Add support for eXclusive Page Frame Ownership (XPFO)

2019-02-14 Thread Khalid Aziz
On 2/14/19 12:08 PM, Peter Zijlstra wrote: > On Thu, Feb 14, 2019 at 10:13:54AM -0700, Khalid Aziz wrote: > >> Patch 11 ("xpfo, mm: remove dependency on CONFIG_PAGE_EXTENSION") cleans >> all this up. If the original authors of these two patches, Juerg >> Haef

Re: [RFC PATCH v8 13/14] xpfo, mm: Defer TLB flushes for non-current CPUs (x86 only)

2019-02-14 Thread Khalid Aziz
On 2/14/19 10:42 AM, Dave Hansen wrote: >> #endif >> + >> +/* If there is a pending TLB flush for this CPU due to XPFO >> + * flush, do it now. >> + */ > > Don't forget CodingStyle in all this, please. Of course. I will fix that. > >> +if (cpumask_test_and_clear_cpu(cpu, &pendi

Re: [RFC PATCH v8 04/14] swiotlb: Map the buffer if it was unmapped by XPFO

2019-02-14 Thread Khalid Aziz
On 2/14/19 10:44 AM, Christoph Hellwig wrote: > On Thu, Feb 14, 2019 at 09:56:24AM -0700, Khalid Aziz wrote: >> On 2/14/19 12:47 AM, Christoph Hellwig wrote: >>> On Wed, Feb 13, 2019 at 05:01:27PM -0700, Khalid Aziz wrote: >>>> +++ b/kernel/dma/swiotlb.c >&g

Re: [RFC PATCH v8 07/14] arm64/mm, xpfo: temporarily map dcache regions

2019-02-14 Thread Khalid Aziz
On 2/14/19 8:54 AM, Tycho Andersen wrote: > Hi, > > On Wed, Feb 13, 2019 at 05:01:30PM -0700, Khalid Aziz wrote: >> From: Juerg Haefliger >> >> If the page is unmapped by XPFO, a data cache flush results in a fatal >> page fault, so let's temporarily map

Re: [RFC PATCH v8 03/14] mm, x86: Add support for eXclusive Page Frame Ownership (XPFO)

2019-02-14 Thread Khalid Aziz
On 2/14/19 9:15 AM, Borislav Petkov wrote: > On Thu, Feb 14, 2019 at 11:56:31AM +0100, Peter Zijlstra wrote: >>> +EXPORT_SYMBOL(xpfo_kunmap); >> >> And these here things are most definitely not IRQ-safe. > > Should also be EXPORT_SYMBOL_GPL. > Agreed. On the other hand, is there even a need to e

Re: [RFC PATCH v8 03/14] mm, x86: Add support for eXclusive Page Frame Ownership (XPFO)

2019-02-14 Thread Khalid Aziz
On 2/14/19 3:56 AM, Peter Zijlstra wrote: > On Wed, Feb 13, 2019 at 05:01:26PM -0700, Khalid Aziz wrote: >> static inline void *kmap_atomic(struct page *page) >> { >> +void *kaddr; >> + >> preempt_disable(); >> pagefault_disab

Re: [RFC PATCH v8 04/14] swiotlb: Map the buffer if it was unmapped by XPFO

2019-02-14 Thread Khalid Aziz
On 2/14/19 12:47 AM, Christoph Hellwig wrote: > On Wed, Feb 13, 2019 at 05:01:27PM -0700, Khalid Aziz wrote: >> +++ b/kernel/dma/swiotlb.c >> @@ -396,8 +396,9 @@ static void swiotlb_bounce(phys_addr_t orig_addr, >> phys_addr_t tlb_addr, >> { >> unsig

[RFC PATCH v8 01/14] mm: add MAP_HUGETLB support to vm_mmap

2019-02-13 Thread Khalid Aziz
From: Tycho Andersen vm_mmap is exported, which means kernel modules can use it. In particular, for testing XPFO support, we want to use it with the MAP_HUGETLB flag, so let's support it via vm_mmap. Signed-off-by: Tycho Andersen Tested-by: Marco Benatto Tested-by: Khalid Aziz --- in

[RFC PATCH v8 03/14] mm, x86: Add support for eXclusive Page Frame Ownership (XPFO)

2019-02-13 Thread Khalid Aziz
by: Julian Stecklina Reviewed-by: Khalid Aziz --- .../admin-guide/kernel-parameters.txt | 2 + arch/x86/Kconfig | 1 + arch/x86/include/asm/pgtable.h| 26 ++ arch/x86/mm/Makefile | 2 + ar

[RFC PATCH v8 11/14] xpfo, mm: remove dependency on CONFIG_PAGE_EXTENSION

2019-02-13 Thread Khalid Aziz
configurable for maximum performance. Signed-off-by: Julian Stecklina Cc: x...@kernel.org Cc: kernel-harden...@lists.openwall.com Cc: Vasileios P. Kemerlis Cc: Juerg Haefliger Cc: Tycho Andersen Cc: Marco Benatto Cc: David Woodhouse Reviewed-by: Khalid Aziz --- include/linux/mm_types.h

[RFC PATCH v8 14/14] xpfo, mm: Optimize XPFO TLB flushes by batching them together

2019-02-13 Thread Khalid Aziz
803.989s1.32x 4.20+XPFO+Deferred flush+Batch update 795.728s1.31x Signed-off-by: Khalid Aziz Signed-off-by: Tycho Andersen --- arch/x86/mm/xpfo.c | 5 + include/linux/page-flags.h | 5 - include/linux/xpfo.h | 8 mm/page_alloc.c| 4

[RFC PATCH v8 12/14] xpfo, mm: optimize spinlock usage in xpfo_kunmap

2019-02-13 Thread Khalid Aziz
table. Model-checked with up to 4 concurrent callers with Spin. Signed-off-by: Julian Stecklina Signed-off-by: Khalid Aziz Cc: x...@kernel.org Cc: kernel-harden...@lists.openwall.com Cc: Vasileios P. Kemerlis Cc: Juerg Haefliger Cc: Tycho Andersen Cc: Marco Benatto Cc: David Woodhouse

[RFC PATCH v8 02/14] x86: always set IF before oopsing from page fault

2019-02-13 Thread Khalid Aziz
en a fault is in kernel space which has been triggered by XPFO. Signed-off-by: Tycho Andersen CC: x...@kernel.org Tested-by: Khalid Aziz --- arch/x86/mm/fault.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 71d4b9d4d43f..ba51652fbd33 10

[RFC PATCH v8 04/14] swiotlb: Map the buffer if it was unmapped by XPFO

2019-02-13 Thread Khalid Aziz
From: Juerg Haefliger v6: * guard against lookup_xpfo() returning NULL CC: Konrad Rzeszutek Wilk Signed-off-by: Juerg Haefliger Signed-off-by: Tycho Andersen Reviewed-by: Khalid Aziz Reviewed-by: Konrad Rzeszutek Wilk --- include/linux/xpfo.h | 4 kernel/dma/swiotlb.c | 3 ++- mm

[RFC PATCH v8 08/14] arm64/mm: disable section/contiguous mappings if XPFO is enabled

2019-02-13 Thread Khalid Aziz
ned-off-by: Tycho Andersen Reviewed-by: Khalid Aziz --- arch/arm64/mm/mmu.c | 2 +- include/linux/xpfo.h | 4 mm/xpfo.c| 6 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index d1d6601b385d..f4dd27073006 100644 --- a/

[RFC PATCH v8 06/14] xpfo: add primitives for mapping underlying memory

2019-02-13 Thread Khalid Aziz
: Khalid Aziz --- include/linux/xpfo.h | 22 ++ mm/xpfo.c| 30 ++ 2 files changed, 52 insertions(+) diff --git a/include/linux/xpfo.h b/include/linux/xpfo.h index cba37ffb09b1..1ae05756344d 100644 --- a/include/linux/xpfo.h +++ b/include

[RFC PATCH v8 10/14] lkdtm: Add test for XPFO

2019-02-13 Thread Khalid Aziz
;t be used accidentally by other CPUs. Signed-off-by: Juerg Haefliger Signed-off-by: Tycho Andersen Tested-by: Marco Benatto [jstec...@amazon.de: rebased from v4.13 to v4.19] Signed-off-by: Julian Stecklina Tested-by: Khalid Aziz --- drivers/misc/lkdtm/Makefile | 1 + drivers/misc/lk

[RFC PATCH v8 09/14] mm: add a user_virt_to_phys symbol

2019-02-13 Thread Khalid Aziz
Signed-off-by: Tycho Andersen Tested-by: Marco Benatto Signed-off-by: Khalid Aziz --- v6: * add a definition of user_virt_to_phys in the !CONFIG_XPFO case v7: * make user_virt_to_phys a GPL symbol arch/x86/mm/xpfo.c | 57 include/linux/xpfo.h | 8

[RFC PATCH v8 05/14] arm64/mm: Add support for XPFO

2019-02-13 Thread Khalid Aziz
Andersen Signed-off-by: Khalid Aziz --- v6: - use flush_tlb_kernel_range() instead of __flush_tlb_one() v8: - Add check for NULL pte in set_kpte() arch/arm64/Kconfig | 1 + arch/arm64/mm/Makefile | 2 ++ arch/arm64/mm/xpfo.c | 64

[RFC PATCH v8 13/14] xpfo, mm: Defer TLB flushes for non-current CPUs (x86 only)

2019-02-13 Thread Khalid Aziz
Signed-off-by: Khalid Aziz --- arch/x86/include/asm/tlbflush.h | 1 + arch/x86/mm/tlb.c | 38 + arch/x86/mm/xpfo.c | 2 +- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/i

[RFC PATCH v8 00/14] Add support for eXclusive Page Frame Ownership

2019-02-13 Thread Khalid Aziz
Add test for XPFO Julian Stecklina (2): xpfo, mm: remove dependency on CONFIG_PAGE_EXTENSION xpfo, mm: optimize spinlock usage in xpfo_kunmap Khalid Aziz (2): xpfo, mm: Defer TLB flushes for non-current CPUs (x86 only) xpfo, mm: Optimize XPFO TLB flushes by batching them together Tycho

[RFC PATCH v8 07/14] arm64/mm, xpfo: temporarily map dcache regions

2019-02-13 Thread Khalid Aziz
From: Juerg Haefliger If the page is unmapped by XPFO, a data cache flush results in a fatal page fault, so let's temporarily map the region, flush the cache, and then unmap it. v6: actually flush in the face of xpfo, and temporarily map the underlying memory so it can be flushed correctly

Re: [RFC PATCH v7 05/16] arm64/mm: Add support for XPFO

2019-02-12 Thread Khalid Aziz
On 2/12/19 1:01 PM, Laura Abbott wrote: > On 2/12/19 7:52 AM, Khalid Aziz wrote: >> On 1/23/19 7:24 AM, Konrad Rzeszutek Wilk wrote: >>> On Thu, Jan 10, 2019 at 02:09:37PM -0700, Khalid Aziz wrote: >>>> From: Juerg Haefliger >>>> >>>> Enable

Re: [RFC PATCH v7 05/16] arm64/mm: Add support for XPFO

2019-02-12 Thread Khalid Aziz
On 1/23/19 7:24 AM, Konrad Rzeszutek Wilk wrote: > On Thu, Jan 10, 2019 at 02:09:37PM -0700, Khalid Aziz wrote: >> From: Juerg Haefliger >> >> Enable support for eXclusive Page Frame Ownership (XPFO) for arm64 and >> provide a hook for updating a single kernel

Re: [RFC PATCH v7 05/16] arm64/mm: Add support for XPFO

2019-02-12 Thread Khalid Aziz
On 1/23/19 7:20 AM, Konrad Rzeszutek Wilk wrote: > On Thu, Jan 10, 2019 at 02:09:37PM -0700, Khalid Aziz wrote: >> From: Juerg Haefliger >> >> Enable support for eXclusive Page Frame Ownership (XPFO) for arm64 and >> provide a hook for updating a single kernel

Re: [RFC PATCH v7 14/16] EXPERIMENTAL: xpfo, mm: optimize spin lock usage in xpfo_kmap

2019-01-17 Thread Khalid Aziz
On 1/16/19 5:18 PM, Laura Abbott wrote: > On 1/10/19 1:09 PM, Khalid Aziz wrote: >> From: Julian Stecklina >> >> We can reduce spin lock usage in xpfo_kmap to the 0->1 transition of >> the mapcount. This means that xpfo_kmap() can now race and that we >> get

Re: [RFC PATCH v7 00/16] Add support for eXclusive Page Frame Ownership

2019-01-16 Thread Khalid Aziz
On 1/16/19 7:56 AM, Julian Stecklina wrote: > Khalid Aziz writes: > >> I am continuing to build on the work Juerg, Tycho and Julian have done >> on XPFO. > > Awesome! > >> A rogue process can launch a ret2dir attack only from a CPU that has >> dual mapp

Re: [RFC PATCH v7 00/16] Add support for eXclusive Page Frame Ownership

2019-01-11 Thread Khalid Aziz
On 1/11/19 2:06 PM, Andy Lutomirski wrote: > On Fri, Jan 11, 2019 at 12:42 PM Dave Hansen wrote: >> The second process could easily have the page's old TLB entry. It could abuse that entry as long as that CPU doesn't context switch (switch_mm_irqs_off()) or otherwise flush the TLB

Re: [RFC PATCH v7 00/16] Add support for eXclusive Page Frame Ownership

2019-01-11 Thread Khalid Aziz
On 1/11/19 1:42 PM, Dave Hansen wrote: >>> The second process could easily have the page's old TLB entry. It could >>> abuse that entry as long as that CPU doesn't context switch >>> (switch_mm_irqs_off()) or otherwise flush the TLB entry. >> >> That is an interesting scenario. Working through thi

Re: [RFC PATCH v7 00/16] Add support for eXclusive Page Frame Ownership

2019-01-11 Thread Khalid Aziz
On 1/10/19 5:44 PM, Andy Lutomirski wrote: > On Thu, Jan 10, 2019 at 3:07 PM Kees Cook wrote: >> >> On Thu, Jan 10, 2019 at 1:10 PM Khalid Aziz wrote: >>> I implemented a solution to reduce performance penalty and >>> that has had large impact. When XPFO code

Re: [RFC PATCH v7 07/16] arm64/mm, xpfo: temporarily map dcache regions

2019-01-11 Thread Khalid Aziz
On 1/11/19 7:54 AM, Tycho Andersen wrote: > On Thu, Jan 10, 2019 at 02:09:39PM -0700, Khalid Aziz wrote: >> From: Juerg Haefliger >> >> If the page is unmapped by XPFO, a data cache flush results in a fatal >> page fault, so let's temporarily map the region, flush

Re: [RFC PATCH v7 00/16] Add support for eXclusive Page Frame Ownership

2019-01-11 Thread Khalid Aziz
Hi Dave, Thanks for looking at this and providing feedback. On 1/10/19 4:40 PM, Dave Hansen wrote: > First of all, thanks for picking this back up. It looks to be going in > a very positive direction! > > On 1/10/19 1:09 PM, Khalid Aziz wrote: >> I implemented a solution to

Re: [RFC PATCH v7 00/16] Add support for eXclusive Page Frame Ownership

2019-01-10 Thread Khalid Aziz
Thanks for looking this over. On 1/10/19 4:07 PM, Kees Cook wrote: > On Thu, Jan 10, 2019 at 1:10 PM Khalid Aziz wrote: >> I implemented a solution to reduce performance penalty and >> that has had large impact. When XPFO code flushes stale TLB entries, >> it does so for a

[RFC PATCH v7 10/16] lkdtm: Add test for XPFO

2019-01-10 Thread Khalid Aziz
;t be used accidentally by other CPUs. Signed-off-by: Juerg Haefliger Signed-off-by: Tycho Andersen Tested-by: Marco Benatto [jstec...@amazon.de: rebased from v4.13 to v4.19] Signed-off-by: Julian Stecklina Signed-off-by: Khalid Aziz --- drivers/misc/lkdtm/Makefile | 1 + drivers/misc/lk

[RFC PATCH v7 13/16] xpfo, mm: optimize spinlock usage in xpfo_kunmap

2019-01-10 Thread Khalid Aziz
table. Model-checked with up to 4 concurrent callers with Spin. Signed-off-by: Julian Stecklina Cc: x...@kernel.org Cc: kernel-harden...@lists.openwall.com Cc: Vasileios P. Kemerlis Cc: Juerg Haefliger Cc: Tycho Andersen Cc: Marco Benatto Cc: David Woodhouse Signed-off-by: Khalid Aziz

[RFC PATCH v7 07/16] arm64/mm, xpfo: temporarily map dcache regions

2019-01-10 Thread Khalid Aziz
ectly CC: linux-arm-ker...@lists.infradead.org Signed-off-by: Juerg Haefliger Signed-off-by: Tycho Andersen Signed-off-by: Khalid Aziz --- arch/arm64/mm/flush.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index 30695a868107..f12f26b

[RFC PATCH v7 11/16] mm, x86: omit TLB flushing by default for XPFO page table modifications

2019-01-10 Thread Khalid Aziz
c: Juerg Haefliger Cc: Tycho Andersen Cc: Marco Benatto Cc: David Woodhouse Signed-off-by: Khalid Aziz --- mm/xpfo.c | 37 + 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/mm/xpfo.c b/mm/xpfo.c index 25fba05d01bd..e80374b0c78e 100644 --- a/mm/xpfo

[RFC PATCH v7 12/16] xpfo, mm: remove dependency on CONFIG_PAGE_EXTENSION

2019-01-10 Thread Khalid Aziz
configurable for maximum performance. Signed-off-by: Julian Stecklina Cc: x...@kernel.org Cc: kernel-harden...@lists.openwall.com Cc: Vasileios P. Kemerlis Cc: Juerg Haefliger Cc: Tycho Andersen Cc: Marco Benatto Cc: David Woodhouse Signed-off-by: Khalid Aziz --- include/linux/mm_types.h

[RFC PATCH v7 15/16] xpfo, mm: Fix hang when booting with "xpfotlbflush"

2019-01-10 Thread Khalid Aziz
Kernel hangs when booted up with "xpfotlbflush" option. This is caused by xpfo_kunmap() fliushing TLB while holding xpfo lock starving other tasks waiting for the lock. This patch moves tlb flush outside of the code holding xpfo lock. Signed-off-by: Khalid Aziz --- mm/xpfo.c | 7 +

[RFC PATCH v7 08/16] arm64/mm: disable section/contiguous mappings if XPFO is enabled

2019-01-10 Thread Khalid Aziz
ned-off-by: Tycho Andersen Signed-off-by: Khalid Aziz --- arch/arm64/mm/mmu.c | 2 +- include/linux/xpfo.h | 4 mm/xpfo.c| 6 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index d1d6601b385d..f4dd27073006 100644 --- a/

[RFC PATCH v7 05/16] arm64/mm: Add support for XPFO

2019-01-10 Thread Khalid Aziz
...@lists.infradead.org Signed-off-by: Juerg Haefliger Signed-off-by: Tycho Andersen Signed-off-by: Khalid Aziz --- arch/arm64/Kconfig | 1 + arch/arm64/mm/Makefile | 2 ++ arch/arm64/mm/xpfo.c | 58 ++ 3 files changed, 61 insertions(+) create mode 100644 arch

[RFC PATCH v7 16/16] xpfo, mm: Defer TLB flushes for non-current CPUs (x86 only)

2019-01-10 Thread Khalid Aziz
elp reduce these cases. This same code should be implemented for other architectures as well once finalized. Signed-off-by: Khalid Aziz --- arch/x86/include/asm/tlbflush.h | 1 + arch/x86/mm/tlb.c | 27 +++ arch/x86/mm/xpfo.c | 2 +- include/lin

[RFC PATCH v7 01/16] mm: add MAP_HUGETLB support to vm_mmap

2019-01-10 Thread Khalid Aziz
From: Tycho Andersen vm_mmap is exported, which means kernel modules can use it. In particular, for testing XPFO support, we want to use it with the MAP_HUGETLB flag, so let's support it via vm_mmap. Signed-off-by: Tycho Andersen Tested-by: Marco Benatto Signed-off-by: Khalid

[RFC PATCH v7 14/16] EXPERIMENTAL: xpfo, mm: optimize spin lock usage in xpfo_kmap

2019-01-10 Thread Khalid Aziz
Cc: David Woodhouse Signed-off-by: Khalid Aziz --- arch/x86/mm/fault.c | 4 include/linux/xpfo.h | 4 mm/xpfo.c| 50 +--- 3 files changed, 51 insertions(+), 7 deletions(-) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c in

[RFC PATCH v7 04/16] swiotlb: Map the buffer if it was unmapped by XPFO

2019-01-10 Thread Khalid Aziz
From: Juerg Haefliger v6: * guard against lookup_xpfo() returning NULL CC: Konrad Rzeszutek Wilk Signed-off-by: Juerg Haefliger Signed-off-by: Tycho Andersen Signed-off-by: Khalid Aziz --- include/linux/xpfo.h | 4 kernel/dma/swiotlb.c | 3 ++- mm/xpfo.c| 15

[RFC PATCH v7 06/16] xpfo: add primitives for mapping underlying memory

2019-01-10 Thread Khalid Aziz
-by: Khalid Aziz --- include/linux/xpfo.h | 22 ++ mm/xpfo.c| 30 ++ 2 files changed, 52 insertions(+) diff --git a/include/linux/xpfo.h b/include/linux/xpfo.h index e38b823f44e3..2682a00ebbcb 100644 --- a/include/linux/xpfo.h +++ b

[RFC PATCH v7 00/16] Add support for eXclusive Page Frame Ownership

2019-01-10 Thread Khalid Aziz
t for XPFO Julian Stecklina (4): mm, x86: omit TLB flushing by default for XPFO page table modifications xpfo, mm: remove dependency on CONFIG_PAGE_EXTENSION xpfo, mm: optimize spinlock usage in xpfo_kunmap EXPERIMENTAL: xpfo, mm: optimize spin lock usage in xpfo_kmap Khalid Aziz (2):

[RFC PATCH v7 03/16] mm, x86: Add support for eXclusive Page Frame Ownership (XPFO)

2019-01-10 Thread Khalid Aziz
by: Julian Stecklina Signed-off-by: Khalid Aziz --- .../admin-guide/kernel-parameters.txt | 2 + arch/x86/Kconfig | 1 + arch/x86/include/asm/pgtable.h| 26 ++ arch/x86/mm/Makefile | 2 + ar

[RFC PATCH v7 09/16] mm: add a user_virt_to_phys symbol

2019-01-10 Thread Khalid Aziz
O case CC: linux-arm-ker...@lists.infradead.org CC: x...@kernel.org Signed-off-by: Tycho Andersen Tested-by: Marco Benatto Signed-off-by: Khalid Aziz --- arch/x86/mm/xpfo.c | 57 include/linux/xpfo.h | 8 +++ 2 files changed, 65 insertions(+)

[RFC PATCH v7 02/16] x86: always set IF before oopsing from page fault

2019-01-10 Thread Khalid Aziz
en a fault is in kernel space which has been triggered by XPFO. Signed-off-by: Tycho Andersen CC: x...@kernel.org Signed-off-by: Khalid Aziz --- arch/x86/mm/fault.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 71d4b9d4d43f..ba51652fb

  1   2   3   4   5   >