public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Erik Andersen <andersen@codepoet.org>
To: Matthew Wilcox <willy@debian.org>
Cc: Alexander Viro <viro@math.psu.edu>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] work around duff ABIs
Date: Mon, 21 Oct 2002 22:43:10 -0600	[thread overview]
Message-ID: <20021022044309.GA25172@codepoet.org> (raw)
In-Reply-To: <20021020135109.D5285@parcelfarce.linux.theplanet.co.uk>

On Sun Oct 20, 2002 at 01:51:09PM +0100, Matthew Wilcox wrote:
> On Sat, Oct 19, 2002 at 10:51:49PM -0600, Erik Andersen wrote:
> > Nonono.  Please see __LONG_LONG_PAIR in /usr/include/endian.h.
> > Your user space code should be doing something like this:
> > 
> >     static inline _syscall5(ssize_t, __syscall_pread, int, fd, void *, buf,
> > 	    size_t, count, off_t, offset_hi, off_t, offset_lo);
> > 
> >     ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
> >     {
> > 	return(__syscall_pread(fd,buf,count,__LONG_LONG_PAIR((off_t)0,offset)));
> >     }
> > 
> >     ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset)
> >     {
> > 	return(__syscall_pread(fd, buf, count,
> > 		    __LONG_LONG_PAIR((off_t)(offset>>32),
> > 		    (off_t)(offset&0xffffffff))));
> >     }
> > 
> > Your patch is going to break GNU libc, uClibc, and anyone else in
> > userspace that is doing pread and pread64 correctly....
> 
> Well... since you just proved that you don't understand the problem,
> I'd hazard a guess that uClibc is also broken, as well as glibc.

I understand the problem very well.  Passing 64 bit stuff via
syscalls is a major pain in the butt.  But your patch is not just
changing hppa and mips -- you are breaking the ABI on x86, arm,
powerpc, etc, etc. etc where it is currently working.  Look very
closely at your patch.  See those endianness ifdefs?  You are
adding endianness specific ifdefs into pread, truncate, and
ftruncate to switch the argument order.  User space is already
doing that too.  At no time on any architecture is the low stuff
passed into arg3.  Ergo, your patch is going to break userspace
where pread and pread64 are now working correctly....

If you want to change the kernel to passing eliminate 64 bit
stuff via syscalls, and instead pass pairs of 32bit entities --
I'm all for that as that would make explicit what user space is
doing anyways.  But don't break binary compatibility for no
reason.  Why make both user-space _and_ kernel space add ifdefs
for endianness?  Make arg3 _always_ contain the hi-bits.

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--

  parent reply	other threads:[~2002-10-22  4:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-20  4:31 [PATCH] work around duff ABIs Matthew Wilcox
2002-10-20  4:45 ` John Levon
2002-10-20  4:51 ` Erik Andersen
2002-10-20 12:51   ` Matthew Wilcox
2002-10-21 12:14     ` Alan Cox
2002-10-22  4:43     ` Erik Andersen [this message]
2002-10-22 13:04       ` Matthew Wilcox
2002-10-21 12:13 ` Alan Cox
2002-10-21 13:48   ` Matthew Wilcox
2002-10-21 16:26     ` Alan Cox
2002-11-04  5:10 ` Richard Henderson

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=20021022044309.GA25172@codepoet.org \
    --to=andersen@codepoet.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@math.psu.edu \
    --cc=willy@debian.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