From: april <aapril03@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Is compat_sys_ioctl called when both kernel and userland are 64bit ?
Date: Wed, 12 Aug 2009 17:27:27 +0800 [thread overview]
Message-ID: <d67deb790908120227s7816a02cr1ea173a4358fa301@mail.gmail.com> (raw)
Hi all:
I am doing something to support 32bit userland and 64bit kernel.
I know compat_sys_ioctl will be called if 32bit userland send ioctl to
64bit kernel.
The compat ioctl do some conversion(suppose I provide those ioctls).
For example:
if a struct has a field type is long or a pointer,which the size is
different between userland and kernel
I notice in the x86_64_defconfig file:
CONFIG_X86_64=y
CONFIG_IA32_EMULATION=y
and in "trap_init" function,
#ifdef CONFIG_IA32_EMULATION
set_system_intr_gate(IA32_SYSCALL_VECTOR, ia32_syscall);
set_bit(IA32_SYSCALL_VECTOR, used_vectors);
#endif
it seems when a kernel is built to x86_64, whenever a ioctl called
,the call flow will be ia32_syscall -->compat_sys_ioctl->compat
ioctl(if provided)
but I have some doubt:
My question is:
1. Is compat_sys_ioctl called when both kernel and userland are 64bit
(suppose I provide those compat ioctl functions)?
if so, it may have problem, for the compat ioctl suppose userland
is 32bit, and do the conversion, if a field is unsinged long or a
pointer, it will do the wrong things .
If not, how kernel knows the driver is 32bit or 64bit?
2. when using mmap, the 64bit kernel will return a 64bit address, and
a userland(32bit) application can only get the lower 32bit,
it can work when the memory is not large.
Is kernel do some conversion? or fortunately the higher 32bit is 00000000 ?
Thanks
next reply other threads:[~2009-08-12 9:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-12 9:27 april [this message]
2009-08-12 10:44 ` Andi Kleen
2009-08-12 13:00 ` april
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=d67deb790908120227s7816a02cr1ea173a4358fa301@mail.gmail.com \
--to=aapril03@gmail.com \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®