[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87wo14n9ru.fsf@collabora.com>
Date: Tue, 08 Sep 2020 00:59:49 -0400
From: Gabriel Krisman Bertazi <krisman@...labora.com>
To: Christian Brauner <christian.brauner@...ntu.com>
Cc: luto@...nel.org, tglx@...utronix.de, keescook@...omium.org,
x86@...nel.org, linux-kernel@...r.kernel.org,
linux-api@...r.kernel.org, willy@...radead.org,
linux-kselftest@...r.kernel.org, shuah@...nel.org,
kernel@...labora.com
Subject: Re: [PATCH v6 1/9] kernel: Support TIF_SYSCALL_INTERCEPT flag
Christian Brauner <christian.brauner@...ntu.com> writes:
> On Fri, Sep 04, 2020 at 04:31:39PM -0400, Gabriel Krisman Bertazi wrote:
>> index afe01e232935..3511c98a7849 100644
>> --- a/include/linux/sched.h
>> +++ b/include/linux/sched.h
>> @@ -959,7 +959,11 @@ struct task_struct {
>> kuid_t loginuid;
>> unsigned int sessionid;
>> #endif
>> - struct seccomp seccomp;
>> +
>> + struct {
>> + unsigned int syscall_intercept;
>> + struct seccomp seccomp;
>> + };
>
> If there's no specific reason to do this I'd not wrap this in an
> anonymous struct. It doesn't really buy anything and there doesn't seem
> to be precedent in struct task_struct right now. Also, if this somehow
> adds padding it seems you might end up increasing the size of struct
> task_struct more than necessary by accident? (I might be wrong
> though.)
Hi Christian,
Thanks for your review on this and on the other patches of this series.
I wrapped these to prevent struct layout randomization from separating
the flags field from seccomp, as they are going to be used together and
I was trying to reduce overhead to seccomp entry due to two cache misses
when reading this structure. Measuring it seccomp_benchmark didn't show
any difference with the unwrapped version, so perhaps it was a bit of
premature optimization?
>> diff --git a/include/linux/syscall_intercept.h b/include/linux/syscall_intercept.h
>> new file mode 100644
>> index 000000000000..725d157699da
>> --- /dev/null
>> +++ b/include/linux/syscall_intercept.h
>> @@ -0,0 +1,70 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +/*
>> + * Copyright (C) 2020 Collabora Ltd.
>> + */
>> +#ifndef _SYSCALL_INTERCEPT_H
>> +#define _SYSCALL_INTERCEPT_H
>> +
>> +#include <linux/sched.h>
>> +#include <linux/sched/signal.h>
>> +#include <linux/thread_info.h>
>> +
>> +#define SYSINT_SECCOMP 0x1
>
> <bikeshed>
>
> Can we maybe use a better name for this? I noone minds the extra
> characters I'd suggest:
> SYSCALL_INTERCEPT_SECCOMP
> or
> SYS_INTERCEPT_SECCOMP
>
> </bikeshed>
>
will do.
Thanks,
--
Gabriel Krisman Bertazi
Powered by blists - more mailing lists