From: Jakub Jelinek <jakub@redhat.com>
To: Andrew Morton <akpm@osdl.org>, Arnd Bergmann <arnd@arndb.de>
Cc: linux-kernel@vger.kernel.org
Subject: Two minor nits about mq patches
Date: Fri, 9 Apr 2004 06:34:56 -0400 [thread overview]
Message-ID: <20040409103456.GR31589@devserv.devel.redhat.com> (raw)
Hi!
kernel/signal.c has:
case __SI_RT: /* This is not generated by the kernel as of now. */
case __SI_MESGQ: /* But this is */
err |= __put_user(from->si_pid, &to->si_pid);
err |= __put_user(from->si_uid, &to->si_uid);
err |= __put_user(from->si_int, &to->si_int);
err |= __put_user(from->si_ptr, &to->si_ptr);
break;
but si_int and si_ptr are union members, so it is enough
to __put_user si_ptr. On big-endian we have a bad problem
in 32-bit compatibility when translating 64-bit sigval_t to 32-bit,
whether to choose high or low 32-bits of si_ptr but without
union sigval { struct { int _pad; int _sival_int; } _u; void *sival_ptr; }
like definition for BE 64-bit arches (which I'm not sure POSIX would allow)
I'm afraid there is nothing to do about it.
In
http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.5/2.6.5-mc3/broken-out/compat_mq.patch
there is:
+asmlinkage long compat_sys_mq_open(const char __user *u_name,
+ int oflag, compat_mode_t mode,
+ struct compat_mq_attr __user *u_attr)
+{
+ struct mq_attr attr;
+ mm_segment_t oldfs;
+ char *name;
+ long ret;
+
+ if (!u_attr)
+ return sys_mq_open(u_name, oflag, mode, 0);
which is incorrect. If oflag does not have O_CREAT set in oflag,
u_attr might contain complete garbage, and thus return -EFAULT
even when it must not or doing kernel copies of name/u_attr
unnecessarily.
So the above if should be either:
if ((oflag & O_CREAT) == 0 || !u_attr)
instead, or sys_mq_open could be split into do_mq_open
which would only deal with kernel pointers and sys_mq_open
and compat_sys_mq_open wrappers around it.
Another problem in compat-mq.patch is that __SI_MESGQ should be
handled in all 32-bit compat layers.
Jakub
reply other threads:[~2004-04-09 10:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20040409103456.GR31589@devserv.devel.redhat.com \
--to=jakub@redhat.com \
--cc=akpm@osdl.org \
--cc=arnd@arndb.de \
--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