Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1461339
| From | Kees Cook <keescook@chromium.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3 51/51] x86/mm: convert arch_within_stack_frames() to use the new unwinder |
| Date | 2016-08-12 19:40 +0200 |
| Message-ID | <s5oB4-4Ie-5@gated-at.bofh.it> (permalink) |
| References | <s5lMR-2Ra-3@gated-at.bofh.it> <s5lMS-2Ra-11@gated-at.bofh.it> <s5mpz-3m3-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Aug 12, 2016 at 8:17 AM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> On Fri, Aug 12, 2016 at 09:29:10AM -0500, Josh Poimboeuf wrote:
>> Convert arch_within_stack_frames() to use the new unwinder.
>>
>> Boot tested with CONFIG_HARDENED_USERCOPY.
>>
>> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
>> ---
>> arch/x86/lib/usercopy.c | 25 +++++++++++++++++++------
>> 1 file changed, 19 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/x86/lib/usercopy.c b/arch/x86/lib/usercopy.c
>> index 96ce151..9d0913c 100644
>> --- a/arch/x86/lib/usercopy.c
>> +++ b/arch/x86/lib/usercopy.c
>> @@ -50,12 +50,21 @@ int arch_within_stack_frames(const void * const stack,
>> const void * const stackend,
>> const void *obj, unsigned long len)
>> {
>> - const void *frame = NULL;
>> - const void *oldframe;
>> + struct unwind_state state;
>> + const void *frame, *oldframe;
>> +
>> + unwind_start(&state, current, NULL, NULL);
>> +
>> + if (!unwind_next_frame(&state))
>> + return 0;
>> +
>> + oldframe = unwind_get_stack_ptr(&state);
>
> Actually, I think this isn't quite right. Now that the function isn't
> inlined, this needs to unwind another frame to be equivalent to current
> behavior.
Yeah, that seems right. And IIUC, as long as this is wrapped in the
CONFIG_FRAME_POINTER check, this won't use the guessing unwinder,
right? (Which is how it should be.)
-Kees
--
Kees Cook
Nexus Security
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 51/51] x86/mm: convert arch_within_stack_frames() to use the new unwinder Josh Poimboeuf <jpoimboe@redhat.com> - 2016-08-12 16:40 +0200
Re: [PATCH v3 51/51] x86/mm: convert arch_within_stack_frames() to use the new unwinder Josh Poimboeuf <jpoimboe@redhat.com> - 2016-08-12 17:20 +0200
Re: [PATCH v3 51/51] x86/mm: convert arch_within_stack_frames() to use the new unwinder Kees Cook <keescook@chromium.org> - 2016-08-12 19:40 +0200
Re: [PATCH v3 51/51] x86/mm: convert arch_within_stack_frames() to use the new unwinder Josh Poimboeuf <jpoimboe@redhat.com> - 2016-08-12 21:20 +0200
Re: [PATCH v3 51/51] x86/mm: convert arch_within_stack_frames() to use the new unwinder Josh Poimboeuf <jpoimboe@redhat.com> - 2016-08-12 22:50 +0200
Re: [PATCH v3 51/51] x86/mm: convert arch_within_stack_frames() to use the new unwinder Kees Cook <keescook@chromium.org> - 2016-08-12 23:00 +0200
csiph-web