From: Kristina Martsenko <kristina.martsenko@arm.com>
To: Dave Martin <Dave.Martin@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Amit Kachhap <amit.kachhap@arm.com>,
Will Deacon <will.deacon@arm.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] arm64: add ptrace regsets for ptrauth key management
Date: Tue, 22 Jan 2019 19:08:25 +0000 [thread overview]
Message-ID: <b8afbda4-c782-ceee-8294-a96a1fec02df@arm.com> (raw)
In-Reply-To: <20190116151254.GA3578@e103592.cambridge.arm.com>
On 16/01/2019 15:13, Dave Martin wrote:
> On Tue, Jan 15, 2019 at 07:32:30PM +0000, Kristina Martsenko wrote:
>> On 11/01/2019 13:58, Dave Martin wrote:
>>> On Thu, Jan 10, 2019 at 07:41:15PM +0000, Kristina Martsenko wrote:
>>>> On 10/01/2019 19:35, Kristina Martsenko wrote:
>>>> @@ -80,12 +65,12 @@ static inline unsigned long ptrauth_strip_insn_pac(unsigned long ptr)
>>>> #define ptrauth_thread_init_user(tsk) \
>>>> do { \
>>>> struct task_struct *__ptiu_tsk = (tsk); \
>>>
>>> Not added by this patch, but __ptiu_tsk doesn't seem to do anything
>>> except make the subsquent lines more verbose than otherwise (and pollute
>>> the identifier namespace -- though unlikely to be a problem).
>>>
>>> It may not be worth dropping it now that it's there though.
>>
>> Using __ptiu_tsk prevents the argument (tsk) from being evaluated twice,
>> which could have side effects.
>
> Ah, right.
>
> Actually, could this be a function instead? That would avoid multiple-
> evaulation a clean way.
If it were a function, then this file (pointer_auth.h) would need to
#include <linux/sched.h> (for the struct task_struct definition), which
would create a circular header dependency, since sched.h #includes
asm/processor.h, which #includes pointer_auth.h. Alternatively the
function could be moved to pointer_auth.c, but that would prevent it
from being inlined, so I'd prefer to keep it as a macro for now.
>>>> - ptrauth_keys_init(&__ptiu_tsk->thread.keys_user); \
>>>> - ptrauth_keys_switch(&__ptiu_tsk->thread.keys_user); \
>>>> + ptrauth_keys_init(&__ptiu_tsk->thread.uw.keys_user); \
>>>> + ptrauth_keys_switch(&__ptiu_tsk->thread.uw.keys_user); \
>>>> } while (0)
>>>>
>>>> #define ptrauth_thread_switch(tsk) \
>>>> - ptrauth_keys_switch(&(tsk)->thread.keys_user)
>>>> + ptrauth_keys_switch(&(tsk)->thread.uw.keys_user)
>
> Similarly, can this be a function?
Same reasons as above.
> (Technically tsk may be evaulated twice in this macro. Given the way
> these macros are used, I'm not sure that matters though.)
tsk is only used once here, so I think it's only evaluated once.
>> Also note that with this patch we have struct "user_pac_address_keys" in
>> struct ptrauth_keys, which may be confusing once we start using pointer
>> authentication in the kernel and use struct ptrauth_keys for kernel keys
>> as well, not just user keys.
>
> Not a big deal either way.
>
> The main thing to freeze now are the user ABI and the UAPI header. We
> can refactor the kernel's internal implementation later if we want.
Ok.
Kristina
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-01-22 19:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-10 19:35 [PATCH v2] arm64: add ptrace regsets for ptrauth key management Kristina Martsenko
2019-01-10 19:41 ` Kristina Martsenko
2019-01-11 13:58 ` Dave Martin
2019-01-15 19:32 ` Kristina Martsenko
2019-01-16 15:13 ` Dave Martin
2019-01-19 23:21 ` Will Deacon
2019-01-22 19:07 ` Kristina Martsenko
2019-01-22 19:08 ` Kristina Martsenko [this message]
2019-01-23 11:23 ` Dave Martin
2019-01-11 13:31 ` Dave Martin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b8afbda4-c782-ceee-8294-a96a1fec02df@arm.com \
--to=kristina.martsenko@arm.com \
--cc=Dave.Martin@arm.com \
--cc=amit.kachhap@arm.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).