linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: takahiro.akashi@linaro.org (AKASHI Takahiro)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] arm64: audit: Add AArch32 support
Date: Mon, 11 Nov 2013 16:40:07 +0900	[thread overview]
Message-ID: <528089D7.1070009@linaro.org> (raw)
In-Reply-To: <20131108145527.GL17461@mudshark.cambridge.arm.com>

On 11/08/2013 11:55 PM, Will Deacon wrote:
> On Wed, Nov 06, 2013 at 10:25:45AM +0000, AKASHI Takahiro wrote:
>> ---
>>   arch/arm64/include/asm/audit32.h  |   12 ++
>>   arch/arm64/include/asm/unistd32.h |  387 +++++++++++++++++++++++++++++++++++++
>>   arch/arm64/kernel/Makefile        |    3 +
>>   arch/arm64/kernel/audit.c         |   18 ++
>>   arch/arm64/kernel/audit32.c       |   46 +++++
>>   5 files changed, 466 insertions(+)
>>   create mode 100644 arch/arm64/include/asm/audit32.h
>>   create mode 100644 arch/arm64/kernel/audit32.c
>>
>> diff --git a/arch/arm64/include/asm/audit32.h b/arch/arm64/include/asm/audit32.h
>> new file mode 100644
>> index 0000000..debfe57
>> --- /dev/null
>> +++ b/arch/arm64/include/asm/audit32.h
>> @@ -0,0 +1,12 @@
>> +#ifndef __ASM_AUDIT32_H
>> +#define __ASM_AUDIT32_H
>> +
>> +extern unsigned aarch32_dir_class[];
>> +extern unsigned aarch32_read_class[];
>> +extern unsigned aarch32_write_class[];
>> +extern unsigned aarch32_chattr_class[];
>> +extern unsigned aarch32_signal_class[];
>> +
>> +extern int aarch32_classify_syscall(unsigned);
>> +
>> +#endif /* __ASM_AUDIT32_H */
>> diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
>> index 58125bf..fdf5e56 100644
>> --- a/arch/arm64/include/asm/unistd32.h
>> +++ b/arch/arm64/include/asm/unistd32.h
>> @@ -21,6 +21,393 @@
>>   #define __SYSCALL(x, y)
>>   #endif
>>
>> +#ifdef __AARCH32_AUDITSYSCALL
>> +/*
>> + * FIXME: Currenty only audit uses (part of) these definitions.
>> + * See audit32.c
>> + */
>> +#define __NR_restart_syscall 0
>> +#define __NR_exit 1
>> +#define __NR_fork 2
>> +#define __NR_read 3
>
> Don't bother with this file. It's a needless replication of data already in
> the file and you don't even need it all.

Unfortunately, I need them not only for aarch32_classify_syscall(), but 
also in asm-generic/audit_*.h. Actually 47 of __NR_xxx are referred to 
in those files.
The problem is that aarch64 and aarch32 have different system call
numbers, but that there are no __NR_xxx definitions for aarch32 in
asm/unistd32.h.

>> diff --git a/arch/arm64/kernel/audit32.c b/arch/arm64/kernel/audit32.c
>> new file mode 100644
>> index 0000000..2aa4d7d
>> --- /dev/null
>> +++ b/arch/arm64/kernel/audit32.c
>> @@ -0,0 +1,46 @@
>> +#define __AARCH32_AUDITSYSCALL
>> +#include <asm/unistd32.h>
>> +
>> +unsigned aarch32_dir_class[] = {
>> +#include <asm-generic/audit_dir_write.h>
>> +~0U
>> +};
>> +
>> +unsigned aarch32_read_class[] = {
>> +#include <asm-generic/audit_read.h>
>> +~0U
>> +};
>> +
>> +unsigned aarch32_write_class[] = {
>> +#include <asm-generic/audit_write.h>
>> +~0U
>> +};
>> +
>> +unsigned aarch32_chattr_class[] = {
>> +#include <asm-generic/audit_change_attr.h>
>> +~0U
>> +};
>> +
>> +unsigned aarch32_signal_class[] = {
>> +#include <asm-generic/audit_signal.h>
>> +~0U
>> +};
>> +
>> +int aarch32_classify_syscall(unsigned syscall)
>> +{
>> +       switch(syscall) {
>> +       case __NR_open:
>> +               return 2;
>> +       case __NR_openat:
>> +               return 3;
>> +       /*
>> +        * obsolute in EABI
>> +        * case __NR_socketcall:
>> +        *      return 4;
>> +        */
>> +       case __NR_execve:
>> +               return 5;
>> +       default:
>> +               return 1; /* 32-bit on biarch */
>> +       }
>
> Instead, just add __NR_compat_{open,openat,execve}, like we have done for
> the signal-related syscalls.

As far as xxx_classify_syscall is concerned, it is possible to change
the code to use __NR_compat_..., but it is difficult to remove __NR_...
from unistd32.h because, as I mentioned above, asm-generic/audit_xxx.h
use __NR_...

> Also, can't the generic lib/audit.c be reworked to work with compat too?

I hope so, but don't think re-work is practical unless we have
generic solution against this issue.
(In addition, other architectures already have their own
implementation.)

-Takahiro AKASHI

> Will
>

  reply	other threads:[~2013-11-11  7:40 UTC|newest]

Thread overview: 118+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06 10:25 [PATCH 0/4] arm64: Add audit support AKASHI Takahiro
2013-11-06 10:25 ` [PATCH 1/4] audit: Enable arm64 support AKASHI Takahiro
2013-11-06 10:25 ` [PATCH 2/4] arm64: Add audit support AKASHI Takahiro
2013-11-08 14:43   ` Will Deacon
2013-11-11  6:48     ` AKASHI Takahiro
2013-11-06 10:25 ` [PATCH 3/4] arm64: audit: Add AArch32 support AKASHI Takahiro
2013-11-08 14:55   ` Will Deacon
2013-11-11  7:40     ` AKASHI Takahiro [this message]
2013-11-06 10:25 ` [PATCH 4/4] arm64: audit: Add audit hook in ptrace/syscall_trace AKASHI Takahiro
2013-11-08 14:34 ` [PATCH 0/4] arm64: Add audit support Will Deacon
2013-11-11  6:38   ` AKASHI Takahiro
2014-01-17  8:13 ` [PATCH v2 0/6] " AKASHI Takahiro
2014-01-17  8:13   ` [PATCH v2 1/6] audit: Enable arm64 support AKASHI Takahiro
2014-01-23 14:18     ` Catalin Marinas
2014-01-27  5:12       ` AKASHI Takahiro
2014-01-27 14:49         ` Catalin Marinas
2014-01-29 20:21         ` Richard Guy Briggs
2014-01-29 22:36           ` Richard Guy Briggs
2014-02-03  5:59             ` AKASHI Takahiro
2014-02-03 16:06               ` Richard Guy Briggs
2014-02-04 16:25                 ` Richard Guy Briggs
2014-02-03  6:00             ` [PATCH] audit: Add CONFIG_HAVE_ARCH_AUDITSYSCALL AKASHI Takahiro
2014-02-25  9:16               ` [PATCH v2 0/1] " AKASHI Takahiro
2014-02-25  9:16                 ` [PATCH v2 1/1] " AKASHI Takahiro
2014-02-25 14:53                   ` Will Deacon
2014-02-25 15:25                   ` Richard Guy Briggs
2014-02-25 17:40                   ` Matt Turner
2014-02-26 12:31                   ` Michael Ellerman
2014-01-17  8:13   ` [PATCH v2 2/6] arm64: Add regs_return_value() in syscall.h AKASHI Takahiro
2014-01-17  8:13   ` [PATCH v2 3/6] arm64: Add audit support AKASHI Takahiro
2014-01-17  8:13   ` [PATCH v2 4/6] arm64: audit: Add 32-bit (compat) syscall support AKASHI Takahiro
2014-01-17 16:46     ` Will Deacon
2014-01-20  5:23       ` AKASHI Takahiro
2014-01-17  8:13   ` [PATCH v2 5/6] arm64: audit: Add makefile rule to create unistd_32.h for compat syscalls AKASHI Takahiro
2014-01-23 14:53     ` Catalin Marinas
2014-01-27  6:13       ` AKASHI Takahiro
2014-01-17  8:13   ` [PATCH v2 6/6] arm64: audit: Add audit hook in ptrace/syscall_trace AKASHI Takahiro
2014-01-23 14:56     ` Catalin Marinas
2014-01-17 19:44   ` [PATCH v2 0/6] arm64: Add audit support Richard Guy Briggs
2014-02-03  6:56   ` [PATCH v3 0/3] " AKASHI Takahiro
2014-02-03  6:56     ` [PATCH v3 1/3] arm64: Add regs_return_value() in syscall.h AKASHI Takahiro
2014-02-04 17:30       ` Will Deacon
2014-02-03  6:56     ` [PATCH v3 2/3] arm64: Add audit support AKASHI Takahiro
2014-02-04 17:30       ` Will Deacon
2014-02-03  6:56     ` [PATCH v3 3/3] arm64: audit: Add audit hook in ptrace/syscall_trace AKASHI Takahiro
2014-02-04 17:31       ` Will Deacon
2014-02-05  1:54         ` AKASHI Takahiro
2014-02-07 10:07           ` [PATCH] arm64: make a single hook to syscall_trace() for all syscall features AKASHI Takahiro
2014-02-11 13:49             ` Richard Guy Briggs
2014-02-17 17:35             ` Will Deacon
2014-02-19 11:53               ` AKASHI Takahiro
2014-02-25  9:14             ` [PATCH v2 0/1] " AKASHI Takahiro
2014-02-25  9:14               ` [PATCH v2 1/1] " AKASHI Takahiro
2014-02-25 15:00                 ` Will Deacon
2014-02-26  2:00                   ` AKASHI Takahiro
2014-02-26 11:25                     ` Will Deacon
2014-02-27  1:33                       ` AKASHI Takahiro
2014-02-28  5:14               ` [PATCH v3 0/2] arm64: prerequisites for audit and ftrace AKASHI Takahiro
2014-02-28  5:14                 ` [PATCH v3 1/2] arm64: make a single hook to syscall_trace() for all syscall features AKASHI Takahiro
2014-02-28 15:57                   ` Will Deacon
2014-02-28  5:14                 ` [PATCH v3 2/2] arm64: Add regs_return_value() in syscall.h AKASHI Takahiro
2014-03-13 10:11                 ` [PATCH v4 0/3] arm64: prerequisites for audit and ftrace AKASHI Takahiro
2014-03-13 10:11                   ` [PATCH v4 1/3] arm64: make a single hook to syscall_trace() for all syscall features AKASHI Takahiro
2014-03-13 18:28                     ` Will Deacon
2014-03-13 10:11                   ` [PATCH v4 2/3] arm64: split syscall_trace() into separate functions for enter/exit AKASHI Takahiro
2014-03-13 18:41                     ` Will Deacon
2014-03-14 16:51                       ` AKASHI Takahiro
2014-03-13 10:11                   ` [PATCH v4 3/3] arm64: Add regs_return_value() in syscall.h AKASHI Takahiro
2014-03-15  5:39                   ` [PATCH v5 0/4] arm64: prerequisites for audit and ftrace AKASHI Takahiro
2014-03-15  5:39                     ` [PATCH v5 1/4] arm64: make a single hook to syscall_trace() for all syscall features AKASHI Takahiro
2014-03-15  5:39                     ` [PATCH v5 2/4] arm64: split syscall_trace() into separate functions for enter/exit AKASHI Takahiro
2014-03-16 19:46                       ` Richard Guy Briggs
2014-04-16 13:27                       ` Will Deacon
2014-04-28  9:58                         ` AKASHI Takahiro
2014-03-15  5:39                     ` [PATCH v5 3/4] arm64: Add regs_return_value() in syscall.h AKASHI Takahiro
2014-03-15  5:39                     ` [PATCH v5 4/4] arm64: is_compat_task is defined both in asm/compat.h and linux/compat.h AKASHI Takahiro
2014-03-16 19:48                       ` Richard Guy Briggs
2014-04-16 13:29                       ` Will Deacon
2014-04-30  9:51                     ` [PATCH v6 0/4] arm64: prerequisites for audit and ftrace AKASHI Takahiro
2014-04-30  9:51                       ` [PATCH v6 1/4] arm64: make a single hook to syscall_trace() for all syscall features AKASHI Takahiro
2014-04-30  9:51                       ` [PATCH v6 2/4] arm64: split syscall_trace() into separate functions for enter/exit AKASHI Takahiro
2014-04-30  9:51                       ` [PATCH v6 3/4] arm64: Add regs_return_value() in syscall.h AKASHI Takahiro
2014-04-30  9:51                       ` [PATCH v6 4/4] arm64: is_compat_task is defined both in asm/compat.h and linux/compat.h AKASHI Takahiro
2014-05-12 15:52                       ` [PATCH v6 0/4] arm64: prerequisites for audit and ftrace Catalin Marinas
2014-02-07 10:10     ` [PATCH v4 0/3] arm64: Add audit support AKASHI Takahiro
2014-02-07 10:10       ` [PATCH v4 1/3] arm64: Add regs_return_value() in syscall.h AKASHI Takahiro
2014-02-07 10:10       ` [PATCH v4 2/3] arm64: Add audit support AKASHI Takahiro
2014-02-07 10:10       ` [PATCH v4 3/3] arm64: audit: Add audit hook in ptrace/syscall_trace AKASHI Takahiro
2014-02-17 17:42         ` Will Deacon
2014-02-11 13:51       ` [PATCH v4 0/3] arm64: Add audit support Richard Guy Briggs
2014-02-25  9:18       ` [PATCH v5 " AKASHI Takahiro
2014-02-25  9:18         ` [PATCH v5 1/3] arm64: Add regs_return_value() in syscall.h AKASHI Takahiro
2014-02-25  9:18         ` [PATCH v5 2/3] arm64: Add audit support AKASHI Takahiro
2014-02-25  9:18         ` [PATCH v5 3/3] arm64: audit: Add audit hook in ptrace/syscall_trace AKASHI Takahiro
2014-02-28  5:17         ` [PATCH v6 0/2] arm64: Add audit support AKASHI Takahiro
2014-02-28  5:17           ` [PATCH v6 1/2] " AKASHI Takahiro
2014-03-05  2:50             ` Richard Guy Briggs
2014-03-06  2:21               ` AKASHI Takahiro
2014-02-28  5:17           ` [PATCH v6 2/2] arm64: audit: Add audit hook in ptrace/syscall_trace AKASHI Takahiro
2014-02-28 16:15             ` Will Deacon
2014-02-28 20:45               ` Richard Guy Briggs
2014-03-06  2:10               ` AKASHI Takahiro
2014-03-06  2:55                 ` Richard Guy Briggs
2014-03-13 10:16           ` [PATCH v7 0/2] arm64: Add audit support AKASHI Takahiro
2014-03-13 10:16             ` [PATCH v7 1/2] " AKASHI Takahiro
2014-03-13 10:16             ` [PATCH v7 2/2] arm64: audit: Add audit hook in syscall_trace_enter/exit() AKASHI Takahiro
2014-03-13 18:43               ` Will Deacon
2014-03-15  5:49             ` [PATCH_v8 0/2] arm64: Add audit support AKASHI Takahiro
2014-03-15  5:49               ` [PATCH_v8 1/2] " AKASHI Takahiro
2014-03-15  5:49               ` [PATCH_v8 2/2] arm64: audit: Add audit hook in syscall_trace_enter/exit() AKASHI Takahiro
2014-04-16 11:30                 ` Will Deacon
2014-04-28  9:55                   ` AKASHI Takahiro
2014-04-11 21:37               ` [PATCH_v8 0/2] arm64: Add audit support Don Dutile
2014-04-28  9:51                 ` AKASHI Takahiro
2014-04-28 22:25                   ` Don Dutile
2014-04-30  9:57               ` [PATCH v9 " AKASHI Takahiro
2014-04-30  9:57                 ` [PATCH v9 1/2] " AKASHI Takahiro
2014-04-30  9:57                 ` [PATCH v9 2/2] arm64: audit: Add audit hook in syscall_trace_enter/exit() AKASHI Takahiro

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=528089D7.1070009@linaro.org \
    --to=takahiro.akashi@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).