From: Andrew Morton <akpm@osdl.org>
To: Eric Sandeen <sandeen@redhat.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [UPDATED PATCH] fix memory corruption from misinterpreted bad_inode_ops return values
Date: Thu, 4 Jan 2007 10:26:59 -0800 [thread overview]
Message-ID: <20070104102659.8c61d510.akpm@osdl.org> (raw)
In-Reply-To: <459D3E8E.7000405@redhat.com>
On Thu, 04 Jan 2007 11:51:10 -0600
Eric Sandeen <sandeen@redhat.com> wrote:
> Andrew Morton wrote:
>
> > Al is correct, of course. But the patch takes bad_inode.o from 280 up to 703
> > bytes, which is a bit sad for some cosmetic thing which nobody ever looks
> > at or modifies.
> >
> > Perhaps you can do
> >
> > static int return_EIO_int(void)
> > {
> > return -EIO;
> > }
> >
> > static int bad_file_release(struct inode * inode, struct file * filp)
> > __attribute__((alias("return_EIO_int")));
> > static int bad_file_fsync(struct inode * inode, struct file * filp)
> > __attribute__((alias("return_EIO_int")));
> >
> > etcetera?
> Ok, try this on for size. Even though the gcc manual says alias doesn't work
> on all target machines, I assume linux arches are ok since alias is used
> in the core module init & exit code...
>
> Also - is it ok to alias a function with one signature to a function with
> another signature?
Ordinarily I'd say no wucking fay, but that's effectively what we've been
doing in there for ages, and it seems to work.
I'd be a bit worried if any of these functions were returning pointers,
because one could certainly conceive of an arch+compiler combo which
returns pointers in a different register from integers (680x0?) but that's
not happening here.
> Note... I also realized that there are a couple of file ops which expect unsigned
> returns... poll and get_unmapped_area. The latter seems to be handled just fine by
> the caller, which does IS_ERR gyrations to check for errnos.
>
> I'm not so sure about poll; some callers put the return in a signed int, others
> unsigned, not sure anyone is really checking for -EIO... I think this op should
> probably be returning POLLERR, so that's what I've got in this version.
Yeah, that should all be OK.
next prev parent reply other threads:[~2007-01-04 18:27 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-03 23:46 Eric Sandeen
2007-01-04 0:26 ` Andrew Morton
2007-01-04 17:51 ` Eric Sandeen
2007-01-04 18:26 ` Andrew Morton [this message]
2007-01-04 18:33 ` Eric Sandeen
2007-01-04 18:54 ` Andrew Morton
2007-01-04 19:09 ` Linus Torvalds
2007-01-04 19:14 ` Al Viro
2007-01-04 19:22 ` Al Viro
2007-01-04 19:32 ` Linus Torvalds
2007-01-07 2:14 ` Roman Zippel
2007-01-04 19:30 ` Linus Torvalds
2007-01-04 20:24 ` Al Viro
2007-01-04 21:00 ` Andrew Morton
2007-01-04 21:04 ` Eric Sandeen
2007-01-04 21:10 ` Andrew Morton
2007-01-04 21:18 ` Eric Sandeen
2007-01-04 21:30 ` Linus Torvalds
2007-01-04 21:50 ` Eric Sandeen
2007-01-04 21:52 ` Al Viro
2007-01-04 22:38 ` Mitchell Blank Jr
2007-01-04 22:35 ` Linus Torvalds
2007-01-04 22:48 ` Eric Sandeen
2007-01-04 23:06 ` Andrew Morton
2007-01-04 23:17 ` Linus Torvalds
2007-01-04 23:28 ` Eric Sandeen
2007-01-04 23:21 ` Mitchell Blank Jr
2007-01-04 23:52 ` Al Viro
2007-01-05 5:59 ` Duplicated functions (was: fix memory corruption from misinterpreted bad_inode_ops return values) Mitchell Blank Jr
2007-01-05 15:40 ` [UPDATED PATCH] fix memory corruption from misinterpreted bad_inode_ops return values Arjan van de Ven
2007-01-04 19:23 Mikael Pettersson
[not found] <7zo1U-ht-9@gated-at.bofh.it>
[not found] ` <7zoEG-1kW-19@gated-at.bofh.it>
[not found] ` <7zF2R-1wJ-33@gated-at.bofh.it>
[not found] ` <7zFvU-2p5-21@gated-at.bofh.it>
[not found] ` <7zFFr-2AP-1@gated-at.bofh.it>
[not found] ` <7zFYY-31i-19@gated-at.bofh.it>
[not found] ` <7zGie-3Ji-17@gated-at.bofh.it>
[not found] ` <7zGif-3Ji-21@gated-at.bofh.it>
[not found] ` <7zGBC-49g-39@gated-at.bofh.it>
[not found] ` <7zHnX-5rJ-25@gated-at.bofh.it>
[not found] ` <7zI0B-6x2-5@gated-at.bofh.it>
[not found] ` <7zI0B-6x2-3@gated-at.bofh.it>
[not found] ` <7zIak-6JF-15@gated-at.bofh.it>
[not found] ` <7zIak-6JF-13@gated-at.bofh.it>
2007-01-05 16:33 ` Bodo Eggert
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=20070104102659.8c61d510.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sandeen@redhat.com \
--cc=viro@zeniv.linux.org.uk \
/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
Powered by JetHome