* usercopy arch_within_stack_frames() is a no-op in almost all modern kernel configurations
@ 2020-08-18 2:34 Jann Horn
2020-08-18 20:30 ` Kees Cook
0 siblings, 1 reply; 2+ messages in thread
From: Jann Horn @ 2020-08-18 2:34 UTC (permalink / raw)
To: Kernel Hardening, Kees Cook
I was looking at some usercopy stuff and noticed that
arch_within_stack_frames() (the helper used by the usercopy
bounds-checking logic to detect copies that cross stack frames) seems
to be a no-op on almost all modern kernel configurations.
It is only defined for x86 - no implementation for e.g. arm64 exists
at all. The x86 version requires CONFIG_FRAME_POINTER, which is only
selected by CONFIG_UNWINDER_FRAME_POINTER (whereas the more modern
choice, and default, for x86-64 is CONFIG_UNWINDER_ORC).
Personally, I don't feel very attached to that check; but if people
are interested in keeping it, it should probably be reworked to use
the proper x86 unwinder API: unwind_start(), unwind_next_frame(),
unwind_get_return_address_ptr() and unwind_done() together would
probably help with this. Otherwise, it should probably be removed,
since in that case it's pretty much going to just be bitrot?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: usercopy arch_within_stack_frames() is a no-op in almost all modern kernel configurations
2020-08-18 2:34 usercopy arch_within_stack_frames() is a no-op in almost all modern kernel configurations Jann Horn
@ 2020-08-18 20:30 ` Kees Cook
0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2020-08-18 20:30 UTC (permalink / raw)
To: Jann Horn; +Cc: Kernel Hardening
On Tue, Aug 18, 2020 at 04:34:18AM +0200, Jann Horn wrote:
> I was looking at some usercopy stuff and noticed that
> arch_within_stack_frames() (the helper used by the usercopy
> bounds-checking logic to detect copies that cross stack frames) seems
> to be a no-op on almost all modern kernel configurations.
Yeah, this was unfortunate.
> It is only defined for x86 - no implementation for e.g. arm64 exists
> at all. The x86 version requires CONFIG_FRAME_POINTER, which is only
> selected by CONFIG_UNWINDER_FRAME_POINTER (whereas the more modern
> choice, and default, for x86-64 is CONFIG_UNWINDER_ORC).
usercopy hardening landed in upstream _just_ before the ORC unwinder.
> Personally, I don't feel very attached to that check; but if people
> are interested in keeping it, it should probably be reworked to use
> the proper x86 unwinder API: unwind_start(), unwind_next_frame(),
> unwind_get_return_address_ptr() and unwind_done() together would
> probably help with this. Otherwise, it should probably be removed,
> since in that case it's pretty much going to just be bitrot?
Right -- this was discussed at the time, and it seemed like it might be
a relatively expensive change. The coverage provided by
arch_within_stack_frames() just made sure that a given vector didn't
cross frames (and didn't reside entirely between frames).
I'm not too attached to the check, though I might be curious to see just
_how_ expensive it would be to implement it with the unwinder API.
--
Kees Cook
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-18 20:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-18 2:34 usercopy arch_within_stack_frames() is a no-op in almost all modern kernel configurations Jann Horn
2020-08-18 20:30 ` Kees Cook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox