public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Ferber <aferber@techfak.uni-bielefeld.de>
To: Andi Kleen <ak@suse.de>
Cc: Crispin Cowan <crispin@wirex.com>,
	hch@infradead.org, greg@kroah.com, torvalds@transmeta.com,
	linux-kernel@vger.kernel.org, linux-security-module@wirex.com,
	davem@redhat.com
Subject: Re: [PATCH] remove sys_security
Date: Fri, 18 Oct 2002 13:43:11 +0200	[thread overview]
Message-ID: <20021018134311.A30059@devcon.net> (raw)
In-Reply-To: <p73wuognlox.fsf@oldwotan.suse.de>; from ak@suse.de on Fri, Oct 18, 2002 at 11:25:02AM +0200

On Fri, Oct 18, 2002 at 11:25:02AM +0200, Andi Kleen wrote:
> 
> The 32bit and the 64bit worlds have different data types. Structure
> layout are different. To handle this the kernel has an emulation
> layer that converts the arguments of ioctls and system calls between 
> 32bit and 64bit.
> 
> This emulation layer sits at the 'edge' of the kernel. For example
> to convert an ioctl it first figures out the ioctl, converts it
> then reissues the same ioctl internally with 64bit arguments. When
> the ioctl returns outgoing arguments are converted too as needed.
> 
> For this to work all data structures need to be transparent.
> The emulation layer needs to have a way to figure out what and
> how to convert without looking at internal state in the kernel.
> Otherwise it cannot do its job. 

Why not let the security module supply the information about the
struct layout?

I'm thinking of something roughly like stdarg.h, e.g.

    #include <linux/user_args.h>
    
    user_args args;

    user_args_start(&args, ptr);

where args is some variable where user_args can save internal state
and ptr is the pointer to the struct from userland (which is
translated appropriately to a kernel space pointer; maybe also a size
argument might be handy, so that you can copy the struct from
userspace memory to kernel memory at once instead of accessing user
address space for every struct member individually), then

    struct.longlongmember = user_args_get(&args, long long);

which applies the right alignment, translates 32bit to 64bit etc.
Due to complexity probably one wants to restrict that to a set of
common types instead of making it full generic (and e.g. use something
like user_args_get_longlong() instead of the type argument), but I
don't think this would be a serious restriction (you can always extend
it later if you really need another type to get through).

This wouldn't work on an architecture where members following later in
a struct could affect the alignment of previous members, but are there
any (sane) architectures around where this is the case? Personally I
can't think of any reason why one possibly wanted to do that...

Andreas
-- 
       Andreas Ferber - dev/consulting GmbH - Bielefeld, FRG
     ---------------------------------------------------------
         +49 521 1365800 - af@devcon.net - www.devcon.net

  parent reply	other threads:[~2002-10-18 11:37 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20021017201030.GA384@kroah.com.suse.lists.linux.kernel>
     [not found] ` <20021017211223.A8095@infradead.org.suse.lists.linux.kernel>
     [not found]   ` <3DAFB260.5000206@wirex.com.suse.lists.linux.kernel>
     [not found]     ` <20021018.000738.05626464.davem@redhat.com.suse.lists.linux.kernel>
     [not found]       ` <3DAFC6E7.9000302@wirex.com.suse.lists.linux.kernel>
2002-10-18  9:25         ` [PATCH] remove sys_security Andi Kleen
2002-10-18  9:36           ` Crispin Cowan
2002-10-18  9:44             ` Andi Kleen
2002-10-18  9:55           ` Russell Coker
2002-10-18 10:13             ` Andi Kleen
2002-10-18 17:24             ` Rik van Riel
2002-10-18 11:43           ` Andreas Ferber [this message]
     [not found] <20021023155457.L2732@redhat.com.suse.lists.linux.kernel>
     [not found] ` <Pine.GSO.4.33.0210231112420.7042-100000@raven.suse.lists.linux.kernel>
2002-10-23 16:33   ` Andi Kleen
2002-10-17 18:50 Christoph Hellwig
2002-10-17 18:53 ` Greg KH
2002-10-17 18:58   ` Christoph Hellwig
2002-10-17 19:07     ` Greg KH
2002-10-17 20:04       ` Christoph Hellwig
2002-10-17 20:10         ` Greg KH
2002-10-17 20:12           ` Christoph Hellwig
2002-10-18  7:04             ` Crispin Cowan
2002-10-18  7:07               ` David S. Miller
2002-10-18  8:31                 ` Crispin Cowan
2002-10-18  8:29                   ` David S. Miller
2002-10-18 12:52                   ` Christoph Hellwig
2002-10-18 15:04                     ` Greg KH
2002-10-19  2:05                       ` Crispin Cowan
2002-10-18  7:11               ` Greg KH
2002-10-18  7:28               ` Alexander Viro
2002-10-18  9:02                 ` Crispin Cowan
2002-10-18 13:05                   ` Christoph Hellwig
2002-10-18 15:14                     ` Valdis.Kletnieks
2002-10-18 15:18                       ` Christoph Hellwig
2002-10-18 16:30                         ` Russell Coker
2002-10-18 16:33                           ` Christoph Hellwig
2002-10-18 16:53                             ` Greg KH
2002-10-18 16:54                             ` Russell Coker
2002-10-18 17:15                             ` Stephen Smalley
2002-10-18 22:36                               ` Chris Wright
2002-10-21 13:54                               ` Mike Wray
2002-10-21 14:09                                 ` Christoph Hellwig
2002-10-21 16:44                                   ` Mike Wray
2002-10-21 17:36                                     ` Christoph Hellwig
2002-10-18 20:36                             ` David Wagner
2002-10-18 17:44                           ` Stephen Smalley
2002-10-18 16:38                       ` Russell Coker
2002-10-18 16:52                         ` Richard B. Johnson
2002-10-18  9:09                 ` David Wagner
2002-10-18 10:14                 ` Russell Coker
2002-10-18 12:50               ` Christoph Hellwig
2002-10-17 20:30           ` Jeff Garzik
2002-10-17 21:00             ` Russell Coker
2002-10-17 21:10               ` Jeff Garzik
2002-10-17 21:37                 ` Russell Coker
2002-10-17 21:49                   ` Alexander Viro
2002-10-17 22:14                     ` Russell Coker
2002-10-17 22:22                       ` Andreas Dilger
2002-10-23  0:35                       ` Stephen C. Tweedie
2002-10-23 11:43                         ` Russell Coker
2002-10-23 11:59                           ` Stephen C. Tweedie
2002-10-23 14:27                             ` Stephen Smalley
2002-10-23 14:54                               ` Stephen C. Tweedie
2002-10-23 16:09                                 ` Stephen Smalley
2002-10-23 16:24                                   ` Christoph Hellwig
2002-10-23 16:34                                     ` Stephen Smalley
2002-10-23 16:36                                       ` Christoph Hellwig
2002-10-23 16:51                                         ` Stephen Smalley
2002-10-24  6:26                                           ` Nathan Scott
2002-10-24  8:45                                             ` Russell Coker
2002-10-17 20:45           ` Russell Coker
2002-10-21 13:57           ` Alan Cox
2002-10-21 21:12             ` Crispin Cowan
2002-10-21 21:17               ` Greg KH
2002-10-22 12:22               ` Stephen Smalley
2002-10-17 20:20       ` Russell Coker
2002-10-17 20:27         ` Christoph Hellwig
2002-10-17 20:28         ` Greg KH
2002-10-17 19:05   ` Alexander Viro
2002-10-17 20:18   ` David S. Miller
2002-10-17 20:36     ` Greg KH
2002-10-17 20:38       ` David S. Miller
2002-10-17 20:58         ` Greg KH
2002-10-17 20:58           ` David S. Miller
2002-10-17 22:09             ` Greg KH
2002-10-17 22:07               ` David S. Miller
2002-10-17 22:19                 ` Greg KH
2002-10-18  8:00             ` Crispin Cowan
2002-10-18  7:57               ` David S. Miller
2002-10-18 13:08               ` Christoph Hellwig
2002-10-17 21:54     ` David Wagner
2002-10-17 22:36       ` David S. Miller
2002-10-17 23:04         ` Chris Wright
2002-10-17 23:08           ` David S. Miller
2002-10-18 14:24             ` Jakob Oestergaard
2002-10-17 22:51     ` Andreas Steinmetz
2002-10-17 22:51       ` David S. Miller
2002-10-18 17:47         ` Daniel Egger
2002-10-17 23:00       ` Jeff Garzik
2002-10-17 22:56         ` David S. Miller
2002-10-17 23:09           ` Greg KH
2002-10-17 23:10             ` Chris Wright
2002-10-17 23:10           ` Andreas Steinmetz
2002-10-18 13:11             ` Christoph Hellwig
2002-10-17 23:11         ` Greg KH

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=20021018134311.A30059@devcon.net \
    --to=aferber@techfak.uni-bielefeld.de \
    --cc=ak@suse.de \
    --cc=crispin@wirex.com \
    --cc=davem@redhat.com \
    --cc=greg@kroah.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@wirex.com \
    --cc=torvalds@transmeta.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