public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Yoav Artzi <yoavar@checkpoint.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Sending IOCTLs from 32-bit userland to 64-bit Kernel module
Date: Tue, 29 Jan 2008 16:05:01 +0300	[thread overview]
Message-ID: <479F247D.8040401@msgid.tls.msk.ru> (raw)
In-Reply-To: <479F1866.4050007@checkpoint.com>

Yoav Artzi wrote:
> Hi,
> 
> 
> I have a 32-bit user land application which sends an IOCTL to a 64-bit
> Kernel module. I have a few different cmd codes that I can send through
> the IOCTL. For some reason I seem to always get the same IOCTL cmd from
> user land, no matter what the ioctl() call is given. This cmd code that
> I get has some bytes (W/R and the module code) that are OK, but the rest
> is just garbage or zeros. This was originally a 32-bit system, and we
> are no converting the Kernel module to 64-bit, so maybe there's
> something special for 32-64 communication that miss.

Please see numerous examples in kernel source, in many files named
compat_ioctl.c.  If your ioctls uses structures with fields that
have different sizes in 32- and 64-bit worlds (most notable int,
various enums etc), there should be corresponding translation
layer as in those examples.  If it's your kernel code, that is.
(And try to avoid such types there, use u32 or u64 and the like
that explicitly specify size).

Another possible problem is different alignment of fields in
64- vs 32-bits worlds.

> I am working on Linux Kernel v2.6.18.

If the kernel side isn't your code, the chances are quite high
that this problem has long been fixed in more recent kernels.

/mjt

  reply	other threads:[~2008-01-29 13:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-29 12:13 Sending IOCTLs from 32-bit userland to 64-bit Kernel module Yoav Artzi
2008-01-29 13:05 ` Michael Tokarev [this message]
2008-01-29 13:23   ` Jiri Slaby
2008-01-29 13:23 ` Matti Aarnio
  -- strict thread matches above, loose matches on Subject: below --
2008-01-29 13:08 Yoav Artzi
2008-01-29 13:18 Yoav Artzi
2008-01-29 15:29 ` Jiri Slaby

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=479F247D.8040401@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yoavar@checkpoint.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