[PATCH 08/11] perf intel-pt: Allow for a guest kernel address filter

2021-02-18 Thread Adrian Hunter
Handling TIP.PGD for an address filter for a guest kernel is the same as a host kernel, but user space decoding, and hence address filters, are not supported. Signed-off-by: Adrian Hunter --- tools/perf/util/intel-pt.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/to

[PATCH 5.4 06/32] arm64: Fix kernel address detection of __is_lm_address()

2021-02-05 Thread Greg Kroah-Hartman
invalid virtual addresses (e.g. 0x0). Fix the detection checking that it's actually a kernel address starting at PAGE_OFFSET. Fixes: 68dd8ef32162 ("arm64: memory: Fix virt_addr_valid() using __is_lm_address()") Cc: # 5.4.x Cc: Will Deacon Suggested-by: Catalin Marinas Reviewed-by:

[PATCH 5.10 13/57] arm64: Fix kernel address detection of __is_lm_address()

2021-02-05 Thread Greg Kroah-Hartman
invalid virtual addresses (e.g. 0x0). Fix the detection checking that it's actually a kernel address starting at PAGE_OFFSET. Fixes: 68dd8ef32162 ("arm64: memory: Fix virt_addr_valid() using __is_lm_address()") Cc: # 5.4.x Cc: Will Deacon Suggested-by: Catalin Marinas Reviewed-by:

Re: [PATCH] arm64: Fix kernel address detection of __is_lm_address()

2021-01-27 Thread Catalin Marinas
alid virtual addresses (e.g. 0x0). > > Fix the detection checking that it's actually a kernel address starting > at PAGE_OFFSET. Applied to arm64 (for-next/fixes), thanks! [1/1] arm64: Fix kernel address detection of __is_lm_address() https://git.kernel.org/arm64/c/519ea6f1c82f -- Catalin

Re: [PATCH] arm64: Fix kernel address detection of __is_lm_address()

2021-01-26 Thread Vincenzo Frascino
as a side effect that virt_addr_valid() returns true even for >> invalid virtual addresses (e.g. 0x0). >> >> Fix the detection checking that it's actually a kernel address starting >> at PAGE_OFFSET. >> >> Fixes: f4693c2716b35 ("arm64: mm: extend linear regi

Re: [PATCH] arm64: Fix kernel address detection of __is_lm_address()

2021-01-26 Thread Catalin Marinas
alid virtual addresses (e.g. 0x0). > > Fix the detection checking that it's actually a kernel address starting > at PAGE_OFFSET. > > Fixes: f4693c2716b35 ("arm64: mm: extend linear region for 52-bit VA > configurations") > Cc: # 5.4.x Not sure what happened w

[PATCH] arm64: Fix kernel address detection of __is_lm_address()

2021-01-26 Thread Vincenzo Frascino
lly a kernel address starting at PAGE_OFFSET. Fixes: f4693c2716b35 ("arm64: mm: extend linear region for 52-bit VA configurations") Cc: # 5.4.x Cc: Catalin Marinas Cc: Will Deacon Suggested-by: Catalin Marinas Reviewed-by: Catalin Marinas Acked-by: Mark Rutland Signed-off-by: Vi

Re: [PATCH v4 1/3] arm64: Improve kernel address detection of __is_lm_address()

2021-01-26 Thread Vincenzo Frascino
ently, the __is_lm_address() check just masks out the top 12 bits >>>>>>>> of the address, but if they are 0, it still yields a true result. >>>>>>>> This has as a side effect that virt_addr_valid() returns true even for >>>>>>>&g

Re: [PATCH v4 1/3] arm64: Improve kernel address detection of __is_lm_address()

2021-01-26 Thread Catalin Marinas
;>>>>> of the address, but if they are 0, it still yields a true result. > >>>>>> This has as a side effect that virt_addr_valid() returns true even for > >>>>>> invalid virtual addresses (e.g. 0x0). > >>>>>> >

Re: [PATCH v4 1/3] arm64: Improve kernel address detection of __is_lm_address()

2021-01-26 Thread Vincenzo Frascino
;>>> This has as a side effect that virt_addr_valid() returns true even for >>>>>> invalid virtual addresses (e.g. 0x0). >>>>>> >>>>>> Improve the detection checking that it's actually a kernel address >>>>>> sta

Re: [PATCH v4 1/3] arm64: Improve kernel address detection of __is_lm_address()

2021-01-25 Thread Mark Rutland
even for > invalid virtual addresses (e.g. 0x0). > > Improve the detection checking that it's actually a kernel address > starting at PAGE_OFFSET. > > Cc: Catalin Marinas > Cc: Will Deacon > Suggested-by: Catalin Marinas > Reviewed-by: Catalin Marinas > Signed-of

Re: [PATCH v4 1/3] arm64: Improve kernel address detection of __is_lm_address()

2021-01-25 Thread Catalin Marinas
even for > >>>> invalid virtual addresses (e.g. 0x0). > >>>> > >>>> Improve the detection checking that it's actually a kernel address > >>>> starting at PAGE_OFFSET. > >>>> > >>>> Cc: Catalin Marinas > &

Re: [PATCH v4 1/3] arm64: Improve kernel address detection of __is_lm_address()

2021-01-25 Thread Mark Rutland
On Mon, Jan 25, 2021 at 02:59:12PM +, Catalin Marinas wrote: > On Mon, Jan 25, 2021 at 02:36:34PM +, Vincenzo Frascino wrote: > > On 1/25/21 1:02 PM, Mark Rutland wrote: > > > On Fri, Jan 22, 2021 at 03:56:40PM +, Vincenzo Frascino wrote: > > > This patch itself looks fine, but it's not

Re: [PATCH v4 1/3] arm64: Improve kernel address detection of __is_lm_address()

2021-01-25 Thread Vincenzo Frascino
heck just masks out the top 12 bits >>>> of the address, but if they are 0, it still yields a true result. >>>> This has as a side effect that virt_addr_valid() returns true even for >>>> invalid virtual addresses (e.g. 0x0). >>>> >>&g

Re: [PATCH v4 1/3] arm64: Improve kernel address detection of __is_lm_address()

2021-01-25 Thread Catalin Marinas
ress, but if they are 0, it still yields a true result. > >> This has as a side effect that virt_addr_valid() returns true even for > >> invalid virtual addresses (e.g. 0x0). > >> > >> Improve the detection checking that it's actually a kernel address > &

Re: [PATCH v4 1/3] arm64: Improve kernel address detection of __is_lm_address()

2021-01-25 Thread Vincenzo Frascino
ult. >> This has as a side effect that virt_addr_valid() returns true even for >> invalid virtual addresses (e.g. 0x0). >> >> Improve the detection checking that it's actually a kernel address >> starting at PAGE_OFFSET. >> >> Cc: Catalin Marinas

[PATCH v4 1/3] arm64: Improve kernel address detection of __is_lm_address()

2021-01-22 Thread Vincenzo Frascino
lly a kernel address starting at PAGE_OFFSET. Cc: Catalin Marinas Cc: Will Deacon Suggested-by: Catalin Marinas Reviewed-by: Catalin Marinas Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/memory.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/

Re: [PATCH v3 1/2] arm64: Improve kernel address detection of __is_lm_address()

2021-01-22 Thread Catalin Marinas
alid virtual addresses (e.g. 0x0). > > Improve the detection checking that it's actually a kernel address > starting at PAGE_OFFSET. > > Cc: Catalin Marinas > Cc: Will Deacon > Suggested-by: Catalin Marinas > Signed-off-by: Vincenzo Frascino Reviewed-by: Catalin M

[PATCH v3 1/2] arm64: Improve kernel address detection of __is_lm_address()

2021-01-22 Thread Vincenzo Frascino
lly a kernel address starting at PAGE_OFFSET. Cc: Catalin Marinas Cc: Will Deacon Suggested-by: Catalin Marinas Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/memory.h | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/memory.h b/arch/

Re: [PATCH v2 1/2] arm64: Fix kernel address detection of __is_lm_address()

2021-01-21 Thread Vincenzo Frascino
On 1/21/21 4:02 PM, Vincenzo Frascino wrote: >> I think it'd be worth checking, if we're going to use this in common >> code. >> > Ok, I will run some tests and let you know. > I checked on x86_64 and ppc64 (they both have KASAN implementation): I added the following: printk("%s: %d\n", __fun

Re: [PATCH v2 1/2] arm64: Fix kernel address detection of __is_lm_address()

2021-01-21 Thread Mark Rutland
e kernel VA range, instead. > > I have no strong opinion either way even if personally I feel that modifying > __is_lm_address() is more clear. Feel free to propose something. Sure; I'm happy for it to live within __is_lm_address() if that's simpler overall, given it doesn

Re: [PATCH v2 1/2] arm64: Fix kernel address detection of __is_lm_address()

2021-01-21 Thread Vincenzo Frascino
I think it'd be worth checking, if we're going to use this in common > code. > Ok, I will run some tests and let you know. >>> I wonder if it's worth virt_addr_valid() having an explicit check for >>> the kernel VA range, instead. >> >> I have no

Re: [PATCH v2 1/2] arm64: Fix kernel address detection of __is_lm_address()

2021-01-21 Thread Vincenzo Frascino
explicit check for > the kernel VA range, instead. > I have no strong opinion either way even if personally I feel that modifying __is_lm_address() is more clear. Feel free to propose something. >> Fix the detection checking that it's actually a kernel address starting >> at P

Re: [PATCH v2 1/2] arm64: Fix kernel address detection of __is_lm_address()

2021-01-21 Thread Mark Rutland
h virt_addr_valid() having an explicit check for the kernel VA range, instead. > Fix the detection checking that it's actually a kernel address starting > at PAGE_OFFSET. > > Fixes: f4693c2716b35 ("arm64: mm: extend linear region for 52-bit VA > configurations") > Cc:

[PATCH v2 1/2] arm64: Fix kernel address detection of __is_lm_address()

2021-01-21 Thread Vincenzo Frascino
lly a kernel address starting at PAGE_OFFSET. Fixes: f4693c2716b35 ("arm64: mm: extend linear region for 52-bit VA configurations") Cc: Catalin Marinas Cc: Will Deacon Suggested-by: Catalin Marinas Signed-off-by: Vincenzo Frascino --- arch/arm64/include/asm/memory.h | 2 +- 1 file chang

[PATCH] perf: Turn kernel address filters into linear address filters

2020-09-09 Thread Alexander Shishkin
One thing that the address filters can't do at the moment is cover anonymous mappings. Apparently, there is code out there that generates executable code in anonymous mappings and executes it in place. And at the moment we only allow file-based address filters for userspace. The easiest way to do

Re: Kernel panic : Unable to handle kernel paging request at virtual address - dead address between user and kernel address ranges

2020-08-30 Thread Viresh Kumar
On 28-08-20, 14:23, Ulf Hansson wrote: > Anders, Naresh - thanks for testing and reporting. I am dropping the > patch from my tree. > > Viresh, I suggest to keep Anders/Naresh in the cc, for the next > version. Then I can wait for their tested-by tag before I apply again. Sorry for the trouble, I

Re: Kernel panic : Unable to handle kernel paging request at virtual address - dead address between user and kernel address ranges

2020-08-28 Thread Ulf Hansson
On Fri, 28 Aug 2020 at 12:29, Anders Roxell wrote: > > On Fri, 28 Aug 2020 at 11:35, Ulf Hansson wrote: > > > > On Fri, 28 Aug 2020 at 11:22, Naresh Kamboju > > wrote: > > > > > > On Thu, 27 Aug 2020 at 17:06, Naresh Kamboju > > > wrote: > > > > > > > > On Thu, 27 Aug 2020 at 15:42, Viresh Ku

Re: Kernel panic : Unable to handle kernel paging request at virtual address - dead address between user and kernel address ranges

2020-08-28 Thread Anders Roxell
On Fri, 28 Aug 2020 at 11:35, Ulf Hansson wrote: > > On Fri, 28 Aug 2020 at 11:22, Naresh Kamboju > wrote: > > > > On Thu, 27 Aug 2020 at 17:06, Naresh Kamboju > > wrote: > > > > > > On Thu, 27 Aug 2020 at 15:42, Viresh Kumar > > > wrote: > > > > > > > > On 27-08-20, 11:48, Arnd Bergmann wro

Re: Kernel panic : Unable to handle kernel paging request at virtual address - dead address between user and kernel address ranges

2020-08-28 Thread Naresh Kamboju
On Fri, 28 Aug 2020 at 15:05, Ulf Hansson wrote: > > On Fri, 28 Aug 2020 at 11:22, Naresh Kamboju > wrote: > > > > On Thu, 27 Aug 2020 at 17:06, Naresh Kamboju > > wrote: > > > > > > On Thu, 27 Aug 2020 at 15:42, Viresh Kumar > > > wrote: > > > > > > > > On 27-08-20, 11:48, Arnd Bergmann wro

Re: Kernel panic : Unable to handle kernel paging request at virtual address - dead address between user and kernel address ranges

2020-08-28 Thread Ulf Hansson
On Fri, 28 Aug 2020 at 11:22, Naresh Kamboju wrote: > > On Thu, 27 Aug 2020 at 17:06, Naresh Kamboju > wrote: > > > > On Thu, 27 Aug 2020 at 15:42, Viresh Kumar wrote: > > > > > > On 27-08-20, 11:48, Arnd Bergmann wrote: > > > > > > [3.680477] dev_pm_opp_put_clkname+0x30/0x58 > > > > > > [

Re: Kernel panic : Unable to handle kernel paging request at virtual address - dead address between user and kernel address ranges

2020-08-28 Thread Naresh Kamboju
On Thu, 27 Aug 2020 at 17:06, Naresh Kamboju wrote: > > On Thu, 27 Aug 2020 at 15:42, Viresh Kumar wrote: > > > > On 27-08-20, 11:48, Arnd Bergmann wrote: > > > > > [3.680477] dev_pm_opp_put_clkname+0x30/0x58 > > > > > [3.683431] sdhci_msm_probe+0x284/0x9a0 > > > > > > dev_pm_opp_put_cl

Re: Kernel panic : Unable to handle kernel paging request at virtual address - dead address between user and kernel address ranges

2020-08-27 Thread Naresh Kamboju
On Thu, 27 Aug 2020 at 15:42, Viresh Kumar wrote: > > On 27-08-20, 11:48, Arnd Bergmann wrote: > > > > [3.680477] dev_pm_opp_put_clkname+0x30/0x58 > > > > [3.683431] sdhci_msm_probe+0x284/0x9a0 > > > > dev_pm_opp_put_clkname() is part of the error handling in the > > probe function, so I

Re: Kernel panic : Unable to handle kernel paging request at virtual address - dead address between user and kernel address ranges

2020-08-27 Thread Viresh Kumar
On 27-08-20, 11:48, Arnd Bergmann wrote: > > > [3.680477] dev_pm_opp_put_clkname+0x30/0x58 > > > [3.683431] sdhci_msm_probe+0x284/0x9a0 > > dev_pm_opp_put_clkname() is part of the error handling in the > probe function, so I would deduct there are two problems: > > - something failed du

Re: Kernel panic : Unable to handle kernel paging request at virtual address - dead address between user and kernel address ranges

2020-08-27 Thread Arnd Bergmann
;next = LIST_POISON1; n->pprev = LIST_POISON2; } > > [3.514695] Mem abort info: > > [3.522421] ESR = 0x9644 > > [3.525096] EC = 0x25: DABT (current EL), IL = 32 bits > > [3.528236] SET = 0, FnV = 0 > > [3.533703] EA = 0, S1PTW =

Re: Kernel panic : Unable to handle kernel paging request at virtual address - dead address between user and kernel address ranges

2020-08-27 Thread Naresh Kamboju
] Mem abort info: > [3.522421] ESR = 0x9644 > [3.525096] EC = 0x25: DABT (current EL), IL = 32 bits > [3.528236] SET = 0, FnV = 0 > [3.533703] EA = 0, S1PTW = 0 > [3.536561] Data abort info: > [3.539601] ISV = 0, ISS = 0x0044 > [3.5

Re: Kernel panic : Unable to handle kernel paging request at virtual address - dead address between user and kernel address ranges

2020-08-27 Thread Viresh Kumar
0, S1PTW = 0 > [3.536561] Data abort info: > [3.539601] ISV = 0, ISS = 0x0044 > [3.542727] CM = 0, WnR = 1 > [3.546287] [dead0108] address between user and kernel address > ranges > [3.549414] Internal error: Oops: 9644 [#1] PRE

Kernel panic : Unable to handle kernel paging request at virtual address - dead address between user and kernel address ranges

2020-08-27 Thread Naresh Kamboju
[3.528236] SET = 0, FnV = 0 [3.533703] EA = 0, S1PTW = 0 [3.536561] Data abort info: [3.539601] ISV = 0, ISS = 0x0044 [3.542727] CM = 0, WnR = 1 [3.546287] [dead0108] address between user and kernel address ranges [3.549414] Internal error: Oops

Re: [RFC v2 00/27] Kernel Address Space Isolation

2020-07-01 Thread 黄金海
How about performance when running with ASI?

Re: [RFC v2 00/27] Kernel Address Space Isolation

2020-07-01 Thread 黄金海
How about performance when running with ASI?

Re: [RFC v2 00/27] Kernel Address Space Isolation

2020-07-01 Thread hackapple
How about performance when running kvm example or isolate other kernel data?

[PATCH v4 37/45] powerpc/8xx: Refactor kernel address boundary comparison

2020-05-18 Thread Christophe Leroy
0x8000 /* By simply checking Address >= 0x8000, we know if its a kernel address */ -#define SIMPLE_KERNEL_ADDRESS 1 + not.\scratch, \addr +#else + rlwinm \scratch, \addr, 16, 0xfff8 + cmpli cr0, \scratch, PAGE_OFFSET@h #endif +.endm /* * We need an

[PATCH v3 37/45] powerpc/8xx: Refactor kernel address boundary comparison

2020-05-11 Thread Christophe Leroy
0x8000 /* By simply checking Address >= 0x8000, we know if its a kernel address */ -#define SIMPLE_KERNEL_ADDRESS 1 + not.\scratch, \addr +#else + rlwinm \scratch, \addr, 16, 0xfff8 + cmpli cr0, \scratch, PAGE_OFFSET@h #endif +.endm /* * We need an

[PATCH v2 37/45] powerpc/8xx: Refactor kernel address boundary comparison

2020-05-06 Thread Christophe Leroy
0x8000 /* By simply checking Address >= 0x8000, we know if its a kernel address */ -#define SIMPLE_KERNEL_ADDRESS 1 + not.\scratch, \addr +#else + rlwinm \scratch, \addr, 16, 0xfff8 + cmpli cr0, \scratch, PAGE_OFFSET@h #endif +.endm /* * We need an

[RFC v4][PATCH part-1 1/7] mm/x86: Introduce kernel Address Space Isolation (ASI)

2020-05-04 Thread Alexandre Chartre
Introduce core functions and structures for implementing Address Space Isolation (ASI). Kernel address space isolation provides the ability to run some kernel code with a reduced kernel address space. An address space isolation is defined with a struct asi structure and associated with an ASI

Re: [PATCH] staging: vchiq: don't leak kernel address

2019-10-08 Thread Greg Kroah-Hartman
On Tue, Oct 08, 2019 at 05:25:17PM +0300, Dan Carpenter wrote: > On Tue, Oct 08, 2019 at 04:21:54PM +0200, Matteo Croce wrote: > > On Tue, Oct 8, 2019 at 3:16 PM Dan Carpenter > > wrote: > > > > > > The subject doesn't match the patch. It should just be "remove useless > > > printk". > > > > > >

Re: [PATCH] staging: vchiq: don't leak kernel address

2019-10-08 Thread Dan Carpenter
On Tue, Oct 08, 2019 at 04:21:54PM +0200, Matteo Croce wrote: > On Tue, Oct 8, 2019 at 3:16 PM Dan Carpenter wrote: > > > > The subject doesn't match the patch. It should just be "remove useless > > printk". > > > > regards, > > dan carpenter > > > > Well, it avoids leaking an address by removin

Re: [PATCH] staging: vchiq: don't leak kernel address

2019-10-08 Thread Matteo Croce
On Tue, Oct 8, 2019 at 3:16 PM Dan Carpenter wrote: > > The subject doesn't match the patch. It should just be "remove useless > printk". > > regards, > dan carpenter > Well, it avoids leaking an address by removing an useless printk. It seems that GKH already picked the patch in his staging tre

Re: [PATCH] staging: vchiq: don't leak kernel address

2019-10-08 Thread Dan Carpenter
The subject doesn't match the patch. It should just be "remove useless printk". regards, dan carpenter

[PATCH] staging: vchiq: don't leak kernel address

2019-10-08 Thread Matteo Croce
Since commit ad67b74d2469d9b8 ("printk: hash addresses printed with %p"), an obfuscated kernel pointer is printed at boot: vchiq: vchiq_init_state: slot_zero = (ptrval) Remove the the print completely, as it's useless without the address. Signed-off-by: Matteo Croce --- drivers/sta

Re: [PATCH v5] perf machine: arm/arm64: Improve completeness for kernel address space

2019-09-04 Thread Leo Yan
Hi Adrian, On Wed, Sep 04, 2019 at 10:26:13AM +0300, Adrian Hunter wrote: [...] > > Could you take chance to review my below replying? I'd like to get > > your confirmation before I send out offical patch. > > It is not necessary to do kallsyms__parse for x86_64, so it would be better > to che

Re: [PATCH v5] perf machine: arm/arm64: Improve completeness for kernel address space

2019-09-04 Thread Adrian Hunter
On 2/09/19 5:15 PM, Leo Yan wrote: > Hi Adrian, > > On Mon, Aug 26, 2019 at 08:51:05PM +0800, Leo Yan wrote: >> Hi Adrian, >> >> On Fri, Aug 16, 2019 at 04:00:02PM +0300, Adrian Hunter wrote: >>> On 16/08/19 4:45 AM, Leo Yan wrote: Hi Adrian, On Thu, Aug 15, 2019 at 02:45:57PM +0300

Re: [PATCH v5] perf machine: arm/arm64: Improve completeness for kernel address space

2019-09-02 Thread Leo Yan
Hi Adrian, On Mon, Aug 26, 2019 at 08:51:05PM +0800, Leo Yan wrote: > Hi Adrian, > > On Fri, Aug 16, 2019 at 04:00:02PM +0300, Adrian Hunter wrote: > > On 16/08/19 4:45 AM, Leo Yan wrote: > > > Hi Adrian, > > > > > > On Thu, Aug 15, 2019 at 02:45:57PM +0300, Adrian Hunter wrote: > > > > > > [..

Re: [PATCH v5] perf machine: arm/arm64: Improve completeness for kernel address space

2019-08-26 Thread Leo Yan
Hi Adrian, On Fri, Aug 16, 2019 at 04:00:02PM +0300, Adrian Hunter wrote: > On 16/08/19 4:45 AM, Leo Yan wrote: > > Hi Adrian, > > > > On Thu, Aug 15, 2019 at 02:45:57PM +0300, Adrian Hunter wrote: > > > > [...] > > > How come you cannot use kallsyms to get the information? > >>> > >>> Tha

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-08-22 Thread Alexandre Chartre
On 7/31/19 6:31 PM, Dario Faggioli wrote: Hello all, I know this is a bit of an old thread, so apologies for being late to the party. :-) And sorry for the late reply, I was away for a while. I would have a question about this: On 7/12/19 2:36 PM, Peter Zijlstra wrote: On Fri, Jul 12, 2

Re: [PATCH v5] perf machine: arm/arm64: Improve completeness for kernel address space

2019-08-16 Thread Adrian Hunter
On 16/08/19 4:45 AM, Leo Yan wrote: > Hi Adrian, > > On Thu, Aug 15, 2019 at 02:45:57PM +0300, Adrian Hunter wrote: > > [...] > How come you cannot use kallsyms to get the information? >>> >>> Thanks for pointing out this. Sorry I skipped your comment "I don't >>> know how you intend to ca

Re: [PATCH v5] perf machine: arm/arm64: Improve completeness for kernel address space

2019-08-15 Thread Leo Yan
Hi Adrian, On Thu, Aug 15, 2019 at 02:45:57PM +0300, Adrian Hunter wrote: [...] > >> How come you cannot use kallsyms to get the information? > > > > Thanks for pointing out this. Sorry I skipped your comment "I don't > > know how you intend to calculate ARM_PRE_START_SIZE" when you reviewed >

Re: [PATCH v5] perf machine: arm/arm64: Improve completeness for kernel address space

2019-08-15 Thread Adrian Hunter
4 >>> --- a/tools/perf/util/machine.c >>> +++ b/tools/perf/util/machine.c >>> @@ -2687,13 +2687,26 @@ int machine__get_kernel_start(struct machine >>> *machine) >>> machine->kernel_start = 1ULL << 63; >>> if (map) { >>&g

Re: [PATCH v5] perf machine: arm/arm64: Improve completeness for kernel address space

2019-08-15 Thread Leo Yan
< 63; > > if (map) { > > err = map__load(map); > > + if (err) > > + return err; > > + > > /* > > * On x86_64, PTI entry trampolines are less than the > > * start of kernel text, but still above 2^63. So

Re: [PATCH v5] perf machine: arm/arm64: Improve completeness for kernel address space

2019-08-15 Thread Adrian Hunter
ls/perf/util/machine.c > index f6ee7fbad3e4..e993f891bb82 100644 > --- a/tools/perf/util/machine.c > +++ b/tools/perf/util/machine.c > @@ -2687,13 +2687,26 @@ int machine__get_kernel_start(struct machine *machine) > machine->kernel_start = 1ULL << 63; >

[PATCH v5] perf machine: arm/arm64: Improve completeness for kernel address space

2019-08-15 Thread Leo Yan
err && !machine__is(machine, "x86_64")) + if (!machine__is(machine, "x86_64")) machine->kernel_start = map->start; + + /* +* On arm/arm64, the kernel uses some memory regions which are +* prior to '_s

[PATCH v4 2/2] perf machine: arm/arm64: Improve completeness for kernel address space

2019-08-10 Thread Leo Yan
++ b/tools/perf/arch/arm/util/machine.c @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include +#include + +#include "../../util/machine.h" + +void arch__fix_kernel_text_start(u64 *start) +{ + /* +* On arm, the 16MB virtual memory space prior

[PATCH v4 0/2] perf: arm/arm64: Improve completeness for kernel address space

2019-08-10 Thread Leo Yan
This patch set is to improve completeness for kernel address space for arm/arm64; it adds architecture specific tweaking for the kernel start address, thus can include the memory regions which are prior to '_stext' symbol. With this change, we can see the eBPF program can be parsed p

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-31 Thread Dario Faggioli
Hello all, I know this is a bit of an old thread, so apologies for being late to the party. :-) I would have a question about this: > > > On 7/12/19 2:36 PM, Peter Zijlstra wrote: > > > > On Fri, Jul 12, 2019 at 02:17:20PM +0200, Alexandre Chartre > > > > wrote: > > > > > On 7/12/19 1:44 PM, Pet

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-15 Thread Peter Zijlstra
On Sun, Jul 14, 2019 at 08:06:12AM -0700, Andy Lutomirski wrote: > On Fri, Jul 12, 2019 at 12:06 PM Peter Zijlstra wrote: > > > > On Fri, Jul 12, 2019 at 06:37:47PM +0200, Alexandre Chartre wrote: > > > On 7/12/19 5:16 PM, Thomas Gleixner wrote: > > > > > > Right. If we decide to expose more parts

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-15 Thread Thomas Gleixner
Alexandre, On Mon, 15 Jul 2019, Alexandre Chartre wrote: > On 7/12/19 9:48 PM, Thomas Gleixner wrote: > > As I said before, come up with a list of possible usage scenarios and > > protection scopes first and please take all the ideas other people have > > with this into account. This includes PTI

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-15 Thread Alexandre Chartre
On 7/12/19 9:48 PM, Thomas Gleixner wrote: On Fri, 12 Jul 2019, Alexandre Chartre wrote: On 7/12/19 5:16 PM, Thomas Gleixner wrote: On Fri, 12 Jul 2019, Peter Zijlstra wrote: On Fri, Jul 12, 2019 at 01:56:44PM +0200, Alexandre Chartre wrote: And then we've fully replaced PTI. So no, they'r

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-14 Thread Alexander Graf
On 12.07.19 16:36, Andy Lutomirski wrote: On Fri, Jul 12, 2019 at 6:45 AM Alexandre Chartre wrote: On 7/12/19 2:50 PM, Peter Zijlstra wrote: On Fri, Jul 12, 2019 at 01:56:44PM +0200, Alexandre Chartre wrote: I think that's precisely what makes ASI and PTI different and independent. PTI

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-14 Thread Mike Rapoport
On Fri, Jul 12, 2019 at 10:45:06AM -0600, Andy Lutomirski wrote: > > > > On Jul 12, 2019, at 10:37 AM, Alexandre Chartre > > wrote: > > > > > > > >> On 7/12/19 5:16 PM, Thomas Gleixner wrote: > >>> On Fri, 12 Jul 2019, Peter Zijlstra wrote: > On Fri, Jul 12, 2019 at 01:56:44PM +0200, Al

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-14 Thread Andy Lutomirski
On Fri, Jul 12, 2019 at 12:06 PM Peter Zijlstra wrote: > > On Fri, Jul 12, 2019 at 06:37:47PM +0200, Alexandre Chartre wrote: > > On 7/12/19 5:16 PM, Thomas Gleixner wrote: > > > > Right. If we decide to expose more parts of the kernel mappings then > > > that's > > > just adding more stuff to th

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Thomas Gleixner
On Fri, 12 Jul 2019, Alexandre Chartre wrote: > On 7/12/19 5:16 PM, Thomas Gleixner wrote: > > On Fri, 12 Jul 2019, Peter Zijlstra wrote: > > > On Fri, Jul 12, 2019 at 01:56:44PM +0200, Alexandre Chartre wrote: > > > And then we've fully replaced PTI. > > > > > > So no, they're not orthogonal. > >

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Peter Zijlstra
On Fri, Jul 12, 2019 at 06:37:47PM +0200, Alexandre Chartre wrote: > On 7/12/19 5:16 PM, Thomas Gleixner wrote: > > Right. If we decide to expose more parts of the kernel mappings then that's > > just adding more stuff to the existing user (PTI) map mechanics. > > If we expose more parts of the k

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Andy Lutomirski
> On Jul 12, 2019, at 10:37 AM, Alexandre Chartre > wrote: > > > >> On 7/12/19 5:16 PM, Thomas Gleixner wrote: >>> On Fri, 12 Jul 2019, Peter Zijlstra wrote: On Fri, Jul 12, 2019 at 01:56:44PM +0200, Alexandre Chartre wrote: I think that's precisely what makes ASI and PTI di

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Alexandre Chartre
On 7/12/19 5:16 PM, Thomas Gleixner wrote: On Fri, 12 Jul 2019, Peter Zijlstra wrote: On Fri, Jul 12, 2019 at 01:56:44PM +0200, Alexandre Chartre wrote: I think that's precisely what makes ASI and PTI different and independent. PTI is just about switching between userland and kernel page-ta

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Thomas Gleixner
On Fri, 12 Jul 2019, Alexandre Chartre wrote: > On 7/12/19 12:44 PM, Thomas Gleixner wrote: > > That ASI thing is just PTI on steroids. > > > > So why do we need two versions of the same thing? That's absolutely bonkers > > and will just introduce subtle bugs and conflicting decisions all over the

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Thomas Gleixner
On Fri, 12 Jul 2019, Alexandre Chartre wrote: > On 7/12/19 3:51 PM, Dave Hansen wrote: > > BTW, the PTI CR3 writes are not *strictly* about the interrupt coming > > from user vs. kernel. It's tricky because there's a window both in the > > entry and exit code where you are in the kernel but have a

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Peter Zijlstra
On Fri, Jul 12, 2019 at 06:54:22AM -0700, Dave Hansen wrote: > On 7/12/19 5:50 AM, Peter Zijlstra wrote: > > PTI is not mapping kernel space to avoid speculation > > crap (meltdown). > > ASI is not mapping part of kernel space to avoid (different) speculation > > crap (MDS). >

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Thomas Gleixner
On Fri, 12 Jul 2019, Peter Zijlstra wrote: > On Fri, Jul 12, 2019 at 01:56:44PM +0200, Alexandre Chartre wrote: > > > I think that's precisely what makes ASI and PTI different and independent. > > PTI is just about switching between userland and kernel page-tables, while > > ASI is about switching

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Andy Lutomirski
On Fri, Jul 12, 2019 at 6:45 AM Alexandre Chartre wrote: > > > On 7/12/19 2:50 PM, Peter Zijlstra wrote: > > On Fri, Jul 12, 2019 at 01:56:44PM +0200, Alexandre Chartre wrote: > > > >> I think that's precisely what makes ASI and PTI different and independent. > >> PTI is just about switching betwe

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Alexandre Chartre
interrupt handlers + * to figure out if we have entered isolation and switch back to +     * the kernel address space. + */ +    err = ASI_MAP_CPUVAR(asi, cpu_asi_session); +    if (err) +    return err; Also, this stuff seems to do naughty stuff (calling C code, touching per-cpu data)

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Dave Hansen
On 7/12/19 6:43 AM, Alexandre Chartre wrote: > The current approach is assuming that anything in the user address space > can be sensitive, and so the user address space shouldn't be mapped in ASI. Is this universally true? There's certainly *some* mitigation provided by SMAP that would allow use

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Dave Hansen
exposed to speculation attacks. We have to be very careful about what we map and expose here. The other (full kernel) address space we are more careful about what we *do* instead of what we map. We map everything but have to add mitigations to ensure that we don't leak anything back to

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Alexandre Chartre
On 7/12/19 3:07 PM, Peter Zijlstra wrote: On Fri, Jul 12, 2019 at 02:47:23PM +0200, Alexandre Chartre wrote: On 7/12/19 2:36 PM, Peter Zijlstra wrote: On Fri, Jul 12, 2019 at 02:17:20PM +0200, Alexandre Chartre wrote: On 7/12/19 1:44 PM, Peter Zijlstra wrote: AFAIK3 this wants/needs to be

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Dave Hansen
interrupt handlers > + * to figure out if we have entered isolation and switch back to > + * the kernel address space. > + */ > +    err = ASI_MAP_CPUVAR(asi, cpu_asi_session); > +    if (err) > +    return err; > > >> Also, this stuff seems to do na

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Alexandre Chartre
On 7/12/19 2:50 PM, Peter Zijlstra wrote: On Fri, Jul 12, 2019 at 01:56:44PM +0200, Alexandre Chartre wrote: I think that's precisely what makes ASI and PTI different and independent. PTI is just about switching between userland and kernel page-tables, while ASI is about switching page-table

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Peter Zijlstra
On Fri, Jul 12, 2019 at 02:47:23PM +0200, Alexandre Chartre wrote: > On 7/12/19 2:36 PM, Peter Zijlstra wrote: > > On Fri, Jul 12, 2019 at 02:17:20PM +0200, Alexandre Chartre wrote: > > > On 7/12/19 1:44 PM, Peter Zijlstra wrote: > > > > > > AFAIK3 this wants/needs to be combined with core-schedul

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Alexandre Chartre
On 7/12/19 2:36 PM, Peter Zijlstra wrote: On Fri, Jul 12, 2019 at 02:17:20PM +0200, Alexandre Chartre wrote: On 7/12/19 1:44 PM, Peter Zijlstra wrote: AFAIK3 this wants/needs to be combined with core-scheduling to be useful, but not a single mention of that is anywhere. No. This is actual

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Peter Zijlstra
On Fri, Jul 12, 2019 at 01:56:44PM +0200, Alexandre Chartre wrote: > I think that's precisely what makes ASI and PTI different and independent. > PTI is just about switching between userland and kernel page-tables, while > ASI is about switching page-table inside the kernel. You can have ASI witho

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Peter Zijlstra
On Fri, Jul 12, 2019 at 02:17:20PM +0200, Alexandre Chartre wrote: > On 7/12/19 1:44 PM, Peter Zijlstra wrote: > > AFAIK3 this wants/needs to be combined with core-scheduling to be > > useful, but not a single mention of that is anywhere. > > No. This is actually an alternative to core-scheduling

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Alexandre Chartre
On 7/12/19 1:44 PM, Peter Zijlstra wrote: On Thu, Jul 11, 2019 at 04:25:12PM +0200, Alexandre Chartre wrote: Kernel Address Space Isolation aims to use address spaces to isolate some parts of the kernel (for example KVM) to prevent leaking sensitive data between hyper-threads under

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Alexandre Chartre
all over the entry code? From a semantical perspective VMENTER/VMEXIT are very similar to the return to user / enter to user mechanics. Just that the transition happens in the VMM code and not at the regular user/kernel transition points. VMExit returns to the kernel, and ASI is used to run the

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Peter Zijlstra
On Thu, Jul 11, 2019 at 04:25:12PM +0200, Alexandre Chartre wrote: > Kernel Address Space Isolation aims to use address spaces to isolate some > parts of the kernel (for example KVM) to prevent leaking sensitive data > between hyper-threads under speculative execution attacks. You can r

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Thomas Gleixner
On Thu, 11 Jul 2019, Dave Hansen wrote: > On 7/11/19 7:25 AM, Alexandre Chartre wrote: > > - Kernel code mapped to the ASI page-table has been reduced to: > > . the entire kernel (I still need to test with only the kernel text) > > . the cpu entry area (because we need the GDT to be mapped) >

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-12 Thread Alexandre Chartre
atch 15/26): + /* +* Map the percpu ASI sessions. This is used by interrupt handlers +* to figure out if we have entered isolation and switch back to +* the kernel address space. +*/ + err = ASI_MAP_CPUVAR(asi, cpu_asi_session); + if (err) + return err;

Re: [RFC v2 01/26] mm/x86: Introduce kernel address space isolation

2019-07-12 Thread Alexandre Chartre
On 7/11/19 11:33 PM, Thomas Gleixner wrote: On Thu, 11 Jul 2019, Alexandre Chartre wrote: +/* + * When isolation is active, the address space doesn't necessarily map + * the percpu offset value (this_cpu_off) which is used to get pointers + * to percpu variables. So functions which can be invo

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-11 Thread Dave Hansen
On 7/11/19 7:25 AM, Alexandre Chartre wrote: > - Kernel code mapped to the ASI page-table has been reduced to: > . the entire kernel (I still need to test with only the kernel text) > . the cpu entry area (because we need the GDT to be mapped) > . the cpu ASI session (for managing ASI) > .

Re: [RFC v2 01/26] mm/x86: Introduce kernel address space isolation

2019-07-11 Thread Thomas Gleixner
On Thu, 11 Jul 2019, Alexandre Chartre wrote: > +/* > + * When isolation is active, the address space doesn't necessarily map > + * the percpu offset value (this_cpu_off) which is used to get pointers > + * to percpu variables. So functions which can be invoked while isolation > + * is active shoul

Re: [RFC v2 00/27] Kernel Address Space Isolation

2019-07-11 Thread Alexandre Chartre
t; RFC. The code has been completely changed compared to v1 and it now provides a generic kernel framework which provides Address Space Isolation; and KVM is now a simple consumer of that framework. That's why the RFC title has been changed from "KVM Address Space Isolation" to "

[RFC v2 00/27] Kernel Address Space Isolation

2019-07-11 Thread Alexandre Chartre
as been changed from "KVM Address Space Isolation" to "Kernel Address Space Isolation". Kernel Address Space Isolation aims to use address spaces to isolate some parts of the kernel (for example KVM) to prevent leaking sensitive data between hyper-threads under speculative exec

[RFC v2 01/26] mm/x86: Introduce kernel address space isolation

2019-07-11 Thread Alexandre Chartre
Introduce core functions and structures for implementing Address Space Isolation (ASI). Kernel address space isolation provides the ability to run some kernel code with a reduced kernel address space. An address space isolation is defined with a struct asi structure which has its own page-table

  1   2   3   4   5   >