2022-01-18 02:33:22

by Madhavan T. Venkataraman

[permalink] [raw]
Subject: [PATCH v13 11/11] arm64: Select HAVE_RELIABLE_STACKTRACE

From: "Madhavan T. Venkataraman" <[email protected]>

Select HAVE_RELIABLE_STACKTRACE in arm64/Kconfig to allow
arch_stack_walk_reliable() to be used.

Note that this is conditional upon STACK_VALIDATION which will be added
when frame pointer validation is implemented (say via objtool).

Signed-off-by: Madhavan T. Venkataraman <[email protected]>
---
arch/arm64/Kconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index f6e333b59314..bc7b3514b563 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -223,6 +223,7 @@ config ARM64
select THREAD_INFO_IN_TASK
select HAVE_ARCH_USERFAULTFD_MINOR if USERFAULTFD
select TRACE_IRQFLAGS_SUPPORT
+ select HAVE_RELIABLE_STACKTRACE if FRAME_POINTER && STACK_VALIDATION
help
ARM 64-bit (AArch64) Linux support.

--
2.25.1


2022-01-25 08:57:40

by [email protected]

[permalink] [raw]
Subject: RE: [PATCH v13 11/11] arm64: Select HAVE_RELIABLE_STACKTRACE

Hi Madhavan,

> Select HAVE_RELIABLE_STACKTRACE in arm64/Kconfig to allow
> arch_stack_walk_reliable() to be used.
>
> Note that this is conditional upon STACK_VALIDATION which will be added when frame pointer validation is implemented (say
> via objtool).

I know that Julien Thierry published objtool support for arm64 [1], but I'm not
sure if it has been updated. Could you tell me other threads if you know?

[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/


Thanks,
Keiya

>
> Signed-off-by: Madhavan T. Venkataraman <[email protected]>
> ---
> arch/arm64/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index f6e333b59314..bc7b3514b563 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -223,6 +223,7 @@ config ARM64
> select THREAD_INFO_IN_TASK
> select HAVE_ARCH_USERFAULTFD_MINOR if USERFAULTFD
> select TRACE_IRQFLAGS_SUPPORT
> + select HAVE_RELIABLE_STACKTRACE if FRAME_POINTER && STACK_VALIDATION
> help
> ARM 64-bit (AArch64) Linux support.
>
> --
> 2.25.1

2022-01-25 19:44:28

by Madhavan T. Venkataraman

[permalink] [raw]
Subject: Re: [PATCH v13 11/11] arm64: Select HAVE_RELIABLE_STACKTRACE

I have not seen any activity on that in a long time. IIRC, Julien quit RedHat.
I don't know if anyone else has taken over this work in RedHat.

Sorry, I don't have any more information.

Madhavan

On 1/24/22 23:21, [email protected] wrote:
> Hi Madhavan,
>
>> Select HAVE_RELIABLE_STACKTRACE in arm64/Kconfig to allow
>> arch_stack_walk_reliable() to be used.
>>
>> Note that this is conditional upon STACK_VALIDATION which will be added when frame pointer validation is implemented (say
>> via objtool).
>
> I know that Julien Thierry published objtool support for arm64 [1], but I'm not
> sure if it has been updated. Could you tell me other threads if you know?
>
> [1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
>
>
> Thanks,
> Keiya
>
>>
>> Signed-off-by: Madhavan T. Venkataraman <[email protected]>
>> ---
>> arch/arm64/Kconfig | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index f6e333b59314..bc7b3514b563 100644
>> --- a/arch/arm64/Kconfig
>> +++ b/arch/arm64/Kconfig
>> @@ -223,6 +223,7 @@ config ARM64
>> select THREAD_INFO_IN_TASK
>> select HAVE_ARCH_USERFAULTFD_MINOR if USERFAULTFD
>> select TRACE_IRQFLAGS_SUPPORT
>> + select HAVE_RELIABLE_STACKTRACE if FRAME_POINTER && STACK_VALIDATION
>> help
>> ARM 64-bit (AArch64) Linux support.
>>
>> --
>> 2.25.1
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

2022-01-26 21:02:45

by [email protected]

[permalink] [raw]
Subject: RE: [PATCH v13 11/11] arm64: Select HAVE_RELIABLE_STACKTRACE

> I have not seen any activity on that in a long time. IIRC, Julien quit RedHat.
> I don't know if anyone else has taken over this work in RedHat.
>
> Sorry, I don't have any more information.
>
> Madhavan

Thanks for your information.

By the way, I'm considering test code for arch_stack_walk_reliable().
Specifically, I apply Suraj's patch to enable livepatch, and added a function
that sleeps between SYM_CODE_START and SYM_CODE_END, then livepatch
checks if the task has an unreliable stack.
For now my internal test code working correctly, but my Kconfig excludes
STACK_VALIDATION dependency.

It seems that objtool will not be enabled yet, so I would like to test it easier.
If you are already testing with this patch, could you tell me how to do it?


Thanks,
Keiya

>
> On 1/24/22 23:21, [email protected] wrote:
> > Hi Madhavan,
> >
> >> Select HAVE_RELIABLE_STACKTRACE in arm64/Kconfig to allow
> >> arch_stack_walk_reliable() to be used.
> >>
> >> Note that this is conditional upon STACK_VALIDATION which will be
> >> added when frame pointer validation is implemented (say via objtool).
> >
> > I know that Julien Thierry published objtool support for arm64 [1],
> > but I'm not sure if it has been updated. Could you tell me other threads if you know?
> >
> > [1]
> > https://lore.kernel.org/linux-arm-kernel/20210303170932.1838634-1-jthi
> > [email protected]/
> >
> >
> > Thanks,
> > Keiya
> >
> >>
> >> Signed-off-by: Madhavan T. Venkataraman
> >> <[email protected]>
> >> ---
> >> arch/arm64/Kconfig | 1 +
> >> 1 file changed, 1 insertion(+)
> >>
> >> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index
> >> f6e333b59314..bc7b3514b563 100644
> >> --- a/arch/arm64/Kconfig
> >> +++ b/arch/arm64/Kconfig
> >> @@ -223,6 +223,7 @@ config ARM64
> >> select THREAD_INFO_IN_TASK
> >> select HAVE_ARCH_USERFAULTFD_MINOR if USERFAULTFD
> >> select TRACE_IRQFLAGS_SUPPORT
> >> + select HAVE_RELIABLE_STACKTRACE if FRAME_POINTER &&
> >> +STACK_VALIDATION
> >> help
> >> ARM 64-bit (AArch64) Linux support.
> >>
> >> --
> >> 2.25.1
> >
> >
> > _______________________________________________
> > linux-arm-kernel mailing list
> > [email protected]
> > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

2022-01-26 22:22:55

by Madhavan T. Venkataraman

[permalink] [raw]
Subject: Re: [PATCH v13 11/11] arm64: Select HAVE_RELIABLE_STACKTRACE



On 1/26/22 04:20, [email protected] wrote:
>> I have not seen any activity on that in a long time. IIRC, Julien quit RedHat.
>> I don't know if anyone else has taken over this work in RedHat.
>>
>> Sorry, I don't have any more information.
>>
>> Madhavan
>
> Thanks for your information.
>
> By the way, I'm considering test code for arch_stack_walk_reliable().
> Specifically, I apply Suraj's patch to enable livepatch, and added a function
> that sleeps between SYM_CODE_START and SYM_CODE_END, then livepatch
> checks if the task has an unreliable stack.
> For now my internal test code working correctly, but my Kconfig excludes
> STACK_VALIDATION dependency.
>
> It seems that objtool will not be enabled yet, so I would like to test it easier.
> If you are already testing with this patch, could you tell me how to do it?
>
>

For now, I have an instrumented kernel that directly invokes arch_stack_walk_reliable()
from various places in the kernel (interrupt handlers, exception handlers, ftrace entry,
kprobe handler, etc). I also have a test driver to induce conditions like null pointer
dereference. I use this to test different cases where arch_stack_walk_reliable() should
return an error.

As for livepatch testing, I have enhanced objtool and the kernel so the frame pointer can
be validated dynamically rather than statically. I have tested various different livepatch
selftests successfully. I have also written my own livepatch tests to add to the selftests.
I am currently working on preparing an RFC patch series for review. Basically, this series
implements STACK_VALIDATION in a different way.

I plan to publish my work soon (hopefully Feb 2022). I was going to do in December. However,
my workload in Microsoft did not permit me to do that. I am also planning to set up a github
repo so people can try out my changes, if they are interested.

So, stay tuned.

Madhavan

2022-01-26 22:23:11

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v13 11/11] arm64: Select HAVE_RELIABLE_STACKTRACE

On Tue, Jan 25, 2022 at 05:21:27AM +0000, [email protected] wrote:

> I know that Julien Thierry published objtool support for arm64 [1], but I'm not
> sure if it has been updated. Could you tell me other threads if you know?

I've not heard of anyone else picking that up.


Attachments:
(No filename) (287.00 B)
signature.asc (499.00 B)
Download all attachments

2022-01-27 08:59:52

by [email protected]

[permalink] [raw]
Subject: RE: [PATCH v13 11/11] arm64: Select HAVE_RELIABLE_STACKTRACE

> >> I have not seen any activity on that in a long time. IIRC, Julien quit RedHat.
> >> I don't know if anyone else has taken over this work in RedHat.
> >>
> >> Sorry, I don't have any more information.
> >>
> >> Madhavan
> >
> > Thanks for your information.
> >
> > By the way, I'm considering test code for arch_stack_walk_reliable().
> > Specifically, I apply Suraj's patch to enable livepatch, and added a function
> > that sleeps between SYM_CODE_START and SYM_CODE_END, then livepatch
> > checks if the task has an unreliable stack.
> > For now my internal test code working correctly, but my Kconfig excludes
> > STACK_VALIDATION dependency.
> >
> > It seems that objtool will not be enabled yet, so I would like to test it easier.
> > If you are already testing with this patch, could you tell me how to do it?
> >
> >
>
> For now, I have an instrumented kernel that directly invokes arch_stack_walk_reliable()
> from various places in the kernel (interrupt handlers, exception handlers, ftrace entry,
> kprobe handler, etc). I also have a test driver to induce conditions like null pointer
> dereference. I use this to test different cases where arch_stack_walk_reliable() should
> return an error.

That's good to know, thanks.

>
> As for livepatch testing, I have enhanced objtool and the kernel so the frame pointer can
> be validated dynamically rather than statically. I have tested various different livepatch
> selftests successfully. I have also written my own livepatch tests to add to the selftests.
> I am currently working on preparing an RFC patch series for review. Basically, this series
> implements STACK_VALIDATION in a different way.
>
> I plan to publish my work soon (hopefully Feb 2022). I was going to do in December. However,
> my workload in Microsoft did not permit me to do that. I am also planning to set up a github
> repo so people can try out my changes, if they are interested.
>
> So, stay tuned.
>
> Madhavan

I'm very interested, so I would to be happy if you could tell me when the github repo is set up.


Thanks again,

Keiya