public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: "Michał Mirosław" <mirqus@gmail.com>
Cc: John Calixto <john.calixto@modsystems.com>,
	linux-mmc@vger.kernel.org,
	Andrei Warkentin <andreiw@motorola.com>,
	Chris Ball <cjb@laptop.org>
Subject: Re: [PATCH v6] mmc: Add mmc CMD+ACMD passthrough ioctl
Date: Thu, 21 Apr 2011 07:11:15 +0200	[thread overview]
Message-ID: <201104210711.15457.arnd@arndb.de> (raw)
In-Reply-To: <BANLkTim4V9J1VahxynPQp_hv+r5j2-yK6w@mail.gmail.com>

On Wednesday 20 April 2011 21:46:04 Michał Mirosław wrote:
> 2011/4/20 Arnd Bergmann <arnd@arndb.de>:
> > No, please don't try to invent random new ways of doing this.
> > Your example relies on the assumption that the task is calling
> > the entry point for its native word size. Some architectures
> > intentionally allow calling the 32 bit entry point from 64 bit
> > tasks and vice versa, e.g. for user space emulators converting
> > to a different ABI, and in that case is_compat_task() produces
> > the wrong result. Don't ever rely on that.
> 
> This doesn't make sense to me. If you call 32-bit entry point from
> 64-bit process, you can't reliably pass pointers through the call
> (unless you limit 64-bit process to 32-bit address space).
> 
> Do you know a working example of something using this kind of cross-call?

There are people that use 32 bit programs on x86_64 in 64 bit mode
and switch on the ADDR_LIMIT_32BIT personality, IIRC.
This gives you more registers and lets you do 64 bit arithmetic
while not using any more memory to store long pointers.
There are a few problems with this, and the new x32 ABI will make it
cleaner.

I believe qemu also does this to run foreign user binaries. You
can use qemu-user to emulate user space with a different instruction
set, but when you call into the kernel, you have to use the native
data structures that the host understands.

> >> I'm okay with the anon union + ``compat_ptr(*(u32 *))`` part of your
> >> solution.  If everyone else thinks it is reasonable, I'll submit a v7
> >> with it.
> > No need for a union or a ptr_size member in the struct. Just use
> > a single __u64 and let the user cast the pointer to that. This
> > will work on all architectures.
> 
> Union is just hiding this cast (it will be done in kernel) and allows
> cleaner code for userspace (there's a single kernel and possibly
> multiple applications that will implement this call).

As I explained, it doesn't work. Please read my earlier mails.

> >> However, I still think it should be implemented in compat_ioctl()
> >> because compat_blkdev_ioctl() expects it.  Either that, or I add to the
> >> big switch in compat_blkdev_driver_ioctl(), and spreading this change
> >> out to block/compat_ioctl.c does not seem like The Right Thing to me.
> > Yes, you definitely need to fill the .compat_ioctl member. We don't want
> > new entries in the switch statement, in particular none that are specific
> > to a single driver.
> 
> Hmm, you're right. fs/compat_ioctl.c falls back to plain .ioctl if
> .compat_ioctl == NULL.

No, it doesn't.


	Arnd

  parent reply	other threads:[~2011-04-21  5:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-14  0:34 v6 changelog for mmc ioctl patch John Calixto
2011-04-14  0:38 ` [PATCH v6] mmc: Add mmc CMD+ACMD passthrough ioctl John Calixto
2011-04-20 17:12   ` John Calixto
2011-04-20 17:29     ` Chris Ball
2011-04-21 10:47       ` Arnd Bergmann
2011-04-20 17:31   ` Michał Mirosław
2011-04-20 17:38     ` John Calixto
2011-04-20 18:06       ` Michał Mirosław
2011-04-20 18:23     ` Michał Mirosław
2011-04-20 19:06       ` John Calixto
2011-04-20 19:17         ` Arnd Bergmann
2011-04-20 19:34           ` John Calixto
2011-04-20 19:38             ` Arnd Bergmann
2011-04-20 19:46           ` Michał Mirosław
2011-04-20 20:47             ` John Calixto
2011-04-20 22:28               ` Chris Ball
2011-04-21  5:11             ` Arnd Bergmann [this message]
2011-04-21 10:28               ` Michał Mirosław
2011-04-21 11:15                 ` Arnd Bergmann
2011-04-21 11:47                   ` Michał Mirosław
2011-04-21 12:39                     ` Arnd Bergmann
2011-04-21 13:40                       ` Michał Mirosław
2011-04-20 22:13   ` Chris Ball

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=201104210711.15457.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=andreiw@motorola.com \
    --cc=cjb@laptop.org \
    --cc=john.calixto@modsystems.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mirqus@gmail.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