From: Arnd Bergmann <arnd@arndb.de>
To: spereira@tusc.com.au
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
Andi Kleen <ak@muc.de>,
linux-kenel <linux-kernel@vger.kernel.org>,
x25 maintainer <eis@baty.hanse.de>,
"David S. Miller" <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>, SP <pereira.shaun@gmail.com>
Subject: Re: [PATCH 2/4 - 2.6.15]net: 32 bit (socket layer) ioctl emulation for 64 bit kernels
Date: Fri, 13 Jan 2006 11:46:47 +0000 [thread overview]
Message-ID: <200601131146.48128.arnd@arndb.de> (raw)
In-Reply-To: <1137122079.5589.34.camel@spereira05.tusc.com.au>
On Friday 13 January 2006 03:14, Shaun Pereira wrote:
> Thank you for reviewing that bit of code.
> I had a look at compat_sys_gettimeofday and sys32_gettimeofday codes.
> They seem to work in a similar way, casting a pointer to the structure
> from user space to a compat_timeval type.
The part with the case is ok, except that you don't have to write
struct compat_timeval __user *ctv;
ctv = (struct compat_timeval __user*) userstamp;
Instead,
struct compat_timeval __user *ctv = userstamp;
is the more common way to write it. The result is the same, since
userstamp is a 'void __user *'.
> But to make sure I have tested the routine by forcing the sk-
> >sk_stamp.tv_sec value to 0 in the x25_module ( for testing purposes
> only, as it is initialised to -1). Now when
> I make a 32 bit userspace SIOCGSTAMP ioctl to the 64 bit kernel I should
> get the current time back in user space. This seems to work, the ioctl
> returns the system time (just after TEST6:)
>
> So I have left the patch as is for now. However if necessary to use
> the element-by-element __put_user routine as in put_tv32, then I can
> make the change, just let me know.
You need to to exactly that, yes. I'm not sure what exactly you have
tested, but the expected result of your code would be that you see
the sk_stamp.tv_sec value in the output, but not the tv_usec value.
On little-endian system like x86_64, that is not much of a difference
(less than a second) that you might miss in a test case, but on
big-endian, it would be fatal.
The layout of the structures on most systems is
64 bit LE 64 bit BE 32 bit
bytes 0-3 tv_sec low tv_sec high tv_sec low
bytes 4-7 tv_sec high tv_sec low tv_usec low
bytes 8-11 tv_usec low tv_usec high
bytes 12-15 tv_usec high tv_usec low
You code copies the first eight bytes of the 64 bit data structure
into the 32 bit data structure.
Arnd <><
next prev parent reply other threads:[~2006-01-13 11:46 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-12 6:02 [PATCH 2/4 - 2.6.15]net: 32 bit (socket layer) ioctl emulation for 64 bit kernels Shaun Pereira
2006-01-12 19:24 ` Arnd Bergmann
2006-01-13 3:14 ` Shaun Pereira
2006-01-13 11:46 ` Arnd Bergmann [this message]
2006-01-16 5:59 ` Shaun Pereira
2006-01-16 6:41 ` YOSHIFUJI Hideaki / 吉藤英明
[not found] ` <200601161043.31742.arnd@arndb.de>
2006-01-16 23:11 ` [PATCH 1/4 - 2.6.15 ]net : " Shaun Pereira
2006-01-16 23:11 ` [PATCH 2/4 - 2.6.15]net: " Shaun Pereira
2006-01-16 23:12 ` [PATCH 3/4 -2.6.15]:x25: " Shaun Pereira
2006-01-17 0:15 ` Arnd Bergmann
2006-01-17 4:20 ` [PATCH 3/4 -2.6.15- RESEND]:x25: " Shaun Pereira
2006-01-18 6:56 ` Shaun Pereira
2006-01-19 0:57 ` Arnd Bergmann
2006-01-19 1:05 ` David S. Miller
2006-01-16 23:12 ` [PATCH 4/4]x25: " Shaun Pereira
2006-01-16 9:39 ` Arnd Bergmann
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=200601131146.48128.arnd@arndb.de \
--to=arnd@arndb.de \
--cc=acme@ghostprotocols.net \
--cc=ak@muc.de \
--cc=davem@davemloft.net \
--cc=eis@baty.hanse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pereira.shaun@gmail.com \
--cc=spereira@tusc.com.au \
/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;
as well as URLs for NNTP newsgroup(s).