Messages in this thread | | | From | Denis Efremov <> | Subject | Re: [PATCH] seccomp: Use current_pt_regs() | Date | Mon, 24 Aug 2020 21:03:33 +0300 |
| |
On 8/24/20 7:34 PM, Kees Cook wrote: > On Mon, Aug 24, 2020 at 03:59:21PM +0300, Denis Efremov wrote: >> Modify seccomp_do_user_notification(), __seccomp_filter(), >> __secure_computing() to use current_pt_regs(). > > This looks okay. It seems some architectures have a separate > define for current_pt_regs(), though it's overlapped directly with > task_pt_regs(). I'm curious what the benefit of the change is? >
Generally, it's just a shorthand. From: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a3460a59747cfddfa7be4758e5ef08bf5d751d59 - arch versions are "optimized versions" - some architectures have task_pt_regs() working only for traced tasks blocked on signal delivery. current_pt_regs() needs to work for *all* processes
My motivation: I'm going to add cocci rule for using current_uid(), current_xxx(), ... instead of raw accesses to current->cred, current->cred->uid https://elixir.bootlin.com/linux/latest/source/include/linux/cred.h#L379 These interfaces use rcu_dereference_protected() internally for access check.
I though that adding current_pt_regs(), current_user_stack_pointer() to this cocci rule will be a good idea.
Thanks, Denis
| |