public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
From: Paul Moore <pmoore@redhat.com>
To: Eric Paris <eparis@redhat.com>
Cc: linux-audit@redhat.com
Subject: Re: ABIs, syscall tables, and the AUDIT_ARCH_* defines
Date: Tue, 29 Oct 2013 17:56:29 -0400	[thread overview]
Message-ID: <1463144.FkBVP3CnDg@sifl> (raw)
In-Reply-To: <1383082181.28218.7.camel@flatline.rdu.redhat.com>

On Tuesday, October 29, 2013 05:29:41 PM Eric Paris wrote:
> On Tue, 2013-10-29 at 17:28 -0400, Paul Moore wrote:
> > Take x86_64 and x32 as an example (think of x32 as a 32-bit version of
> > x86_64).  Both x32 and x86_64 use the AUDIT_ARCH_X86_64 value and general
> > calling convention, but they have a different syscall table.
> 
> I guess a good question is "is that right" ?
> 
> #define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
> 
> Would we not be better off with a:
> 
> #define AUDIT_ARCH_X32 (EM_X86_64|__AUDIT_ARCH_LE)   ?

If you look at the libseccomp code, that is exactly how we define 
SCMP_ARCH_X32.  To me it makes sense.

However, I think it may already be too late to change things in the kernel.  
Support for x32 has been in mainline for a while now and userspace has already 
had to deal with it; changing to AUDIT_ARCH_X32, while arguably The Right 
Thing To Do, would likely involve userspace breakage.  At least it would break 
libseccomp :)

> Do x86_64 and x32 share the same syscall entry code?

I can't say off the top of my head, but if I had to guess, I would say yes.

UPDATE: I took a quick peek and while I'm not well versed on the syscall entry 
code, it does appear that they share most of the important bits.

> Is there where the AUDIT_ARCH_X86_64 comes from?

I believe so.  Depending on the state of CONFIG_AUDITSYSCALL it either gets 
passed directly as the first argument to __audit_syscall_entry() in entry_64.S 
or via syscall_trace_enter() which once again just uses AUDIT_ARCH_X86_64.

In both cases it should be possible to set it to a new AUDIT_ARCH_X32, but my 
previous concerns about userspace breakage still apply.

> Is this similar for ARM?  Right now, the only thing we have is:
> 
> #define AUDIT_ARCH_ARM          (EM_ARM|__AUDIT_ARCH_LE)
> #define AUDIT_ARCH_ARMEB        (EM_ARM)
> 
> Is this enough?  Should we add more?

No idea really, I'm still getting up to speed on ARM.  Personally, ARM OABI is 
really weird and considering that most everything is EABI now, I don't think 
I'm ever going to support ARM OABI in libseccomp.

The answer might not be as easy for audit since the kernel technically already 
supports ARM OABI, but I'm guessing that if you haven't head anyone shouting 
at you by now you might not have to worry too much about it.

> I'm way way way more ARM idiotic than I am about x86_64.

Me too.  Although the more I learn about ARM the more it scares me.

> I know the ARM people at least told us that ARM wasn't going to work right
> with what we have today...  So they added to the audit Kconfig:
> 
> depends on AUDIT && (X86 || PPC || S390 || IA64 || UML || SPARC64 ||
> SUPERH || (ARM && AEABI && !OABI_COMPAT))

Hmm, so that might be your "out" here, unless you really want to deal with ARM 
OABI :)  I'm not even entirely sure if OABI works on the newer ARM hardware.

> Is fixing this with differentiated AUDIT_ARCH flags even possible?  Am I
> just talking out of my bum?

/me shrugs

Sorry, still learning this stuff too.

-- 
paul moore
security and virtualization @ redhat

      reply	other threads:[~2013-10-29 21:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-29 21:28 ABIs, syscall tables, and the AUDIT_ARCH_* defines Paul Moore
2013-10-29 21:29 ` Eric Paris
2013-10-29 21:56   ` Paul Moore [this message]

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=1463144.FkBVP3CnDg@sifl \
    --to=pmoore@redhat.com \
    --cc=eparis@redhat.com \
    --cc=linux-audit@redhat.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