All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Collins <bcollins@debian.org>
To: sparclinux@vger.kernel.org
Subject: Re: size-differences of long(userspace) / long(kernel)
Date: Tue, 15 Feb 2005 03:40:48 +0000	[thread overview]
Message-ID: <20050215034048.GE6838@phunnypharm.org> (raw)
In-Reply-To: <Pine.LNX.4.61.0502141648360.6890@l01.thnet>

32-bit applications communicating with the kernel using standard calls
like ioctl() pass through a translation layer that converts the 32-bit
information into 64-bit counterparts, processes them, and converts them
back again before passing them back to userspace.

This is pretty common in sparc64, x86-64, ppc64, mips64, ia64, etc.

When binaries on sparc64 are compiled as 64-bit, the translation layer is
not used, and native calls take place within the kernel.

On Mon, Feb 14, 2005 at 04:56:13PM +0100, Michael Tautschnig wrote:
> Hello!
> 
> Is there any generic way in situations, where (pointers 
> to) structs are transferred from user- to kernelspace and vice versa? 
> Any struct containing a long int or a pointer will have a different 
> size in kernel space! This usually happens when doing ioctls ...
> 
> I'm not sure, whether it causes any troubles, but, e.g., ifreq contains 
> another struct (ifmap) that in turn contains long ints . Thus the size of 
> ifreq is 32 byte in userspace and 40 byte in kernelspace. If an 
> application reserves sizeof(ifreq) bytes, then lets the kernel initialize 
> the struct, which in turn copies it back to userspace - and thus might 
> overwrite 8bytes that were not reserved for that struct ... Oops :-)
> 
> Any thoughts?
> 
> Michael
> 
> -
> To unsubscribe from this list: send the line "unsubscribe sparclinux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Debian     - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
Subversion - http://subversion.tigris.org/
WatchGuard - http://www.watchguard.com/

  parent reply	other threads:[~2005-02-15  3:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-14 15:56 size-differences of long(userspace) / long(kernel) Michael Tautschnig
2005-02-14 16:13 ` David S. Miller
2005-02-14 16:32 ` Jurzitza, Dieter
2005-02-14 16:34 ` Michael Tautschnig
2005-02-14 16:43 ` David S. Miller
2005-02-15  3:40 ` Ben Collins [this message]
2005-02-18  8:19 ` Jurzitza, Dieter
2005-02-18 16:22 ` Jurzitza, Dieter

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=20050215034048.GE6838@phunnypharm.org \
    --to=bcollins@debian.org \
    --cc=sparclinux@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.