From: "Alexander Stohr" <Alexander.Stohr@gmx.de>
To: linux-kernel@vger.kernel.org
Subject: [patch] uts-semaphore fix for sparc64 solaris emu for kernel-2.6.9-rc1-bk6
Date: Tue, 31 Aug 2004 12:50:12 +0200 (MEST) [thread overview]
Message-ID: <19813.1093949412@www4.gmx.net> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 606 bytes --]
Hello,
when copy-to-user and alikes does fail
for the solaris personality on sparc64
did fail then it is possible that the
current function gets left with an error
without prior releasing the uts-semphore.
the attached diff provides a patch that
is supposed to fixe that behaviour.
i was not able to test test this in the wild
due to lack of the respective hardware, so
any reports from machine owners would be nice.
-Alex.
PS: please CC me on replys, i am not subscribed to this list.
--
NEU: Bis zu 10 GB Speicher für e-mails & Dateien!
1 GB bereits bei GMX FreeMail http://www.gmx.net/de/go/mail
[-- Attachment #2: linux-2.6.9-rc1-bk6-sparcsolarisutsfield.diff --]
[-- Type: application/octet-stream, Size: 3104 bytes --]
diff -Nur linux-2.6.9-rc1-bk6.orig/arch/sparc64/solaris/misc.c linux-2.6.9-rc1-bk6/arch/sparc64/solaris/misc.c
--- linux-2.6.9-rc1-bk6.orig/arch/sparc64/solaris/misc.c 2004-08-25 07:38:42.000000000 +0200
+++ linux-2.6.9-rc1-bk6/arch/sparc64/solaris/misc.c 2004-08-31 12:30:29.000000000 +0200
@@ -137,20 +137,22 @@
return sunos_brk(brk);
}
-#define set_utsfield(to, from, dotchop, countfrom) { \
- char *p; \
- int i, len = (countfrom) ? \
- ((sizeof(to) > sizeof(from) ? \
- sizeof(from) : sizeof(to))) : sizeof(to); \
- if (copy_to_user(to, from, len)) \
- return -EFAULT; \
- if (dotchop) \
- for (p=from,i=0; *p && *p != '.' && --len; p++,i++); \
- else \
- i = len - 1; \
- if (__put_user('\0', (char __user *)((to)+i))) \
- return -EFAULT; \
-}
+#define set_utsfield(to, from, dotchop, countfrom, perror) do { \
+ char *p; \
+ int i, len = (countfrom) ? \
+ ((sizeof(to) > sizeof(from) ? \
+ sizeof(from) : sizeof(to))) : sizeof(to); \
+ if (copy_to_user(to, from, len)) \
+ *perror = -EFAULT; \
+ else { \
+ if (dotchop) \
+ for (p=from,i=0; *p && *p != '.' && --len; p++,i++); \
+ else \
+ i = len - 1; \
+ if (__put_user('\0', (char __user *)((to)+i))) \
+ *perror = -EFAULT; \
+ } \
+} while (0)
struct sol_uname {
char sysname[9];
@@ -221,15 +223,17 @@
struct sol_uname __user *v = A(buf);
switch (which) {
case 0: /* old uname */
- /* Let's cheat */
- set_utsfield(v->sysname, "SunOS", 1, 0);
- down_read(&uts_sem);
- set_utsfield(v->nodename, system_utsname.nodename, 1, 1);
- up_read(&uts_sem);
- set_utsfield(v->release, "2.6", 0, 0);
- set_utsfield(v->version, "Generic", 0, 0);
- set_utsfield(v->machine, machine(), 0, 0);
- return 0;
+ { int error = 0;
+ /* Let's cheat */
+ set_utsfield(v->sysname, "SunOS", 1, 0, &error);
+ down_read(&uts_sem);
+ set_utsfield(v->nodename, system_utsname.nodename, 1, 1, &error);
+ up_read(&uts_sem);
+ set_utsfield(v->release, "2.6", 0, 0, &error);
+ set_utsfield(v->version, "Generic", 0, 0, &error);
+ set_utsfield(v->machine, machine(), 0, 0, &error);
+ return error;
+ }
case 2: /* ustat */
return -ENOSYS;
case 3: /* fusers */
@@ -241,16 +245,17 @@
asmlinkage int solaris_utsname(u32 buf)
{
+ int error = 0;
struct sol_utsname __user *v = A(buf);
/* Why should we not lie a bit? */
down_read(&uts_sem);
- set_utsfield(v->sysname, "SunOS", 0, 0);
- set_utsfield(v->nodename, system_utsname.nodename, 1, 1);
- set_utsfield(v->release, "5.6", 0, 0);
- set_utsfield(v->version, "Generic", 0, 0);
- set_utsfield(v->machine, machine(), 0, 0);
+ set_utsfield(v->sysname, "SunOS", 0, 0, &error);
+ set_utsfield(v->nodename, system_utsname.nodename, 1, 1, &error);
+ set_utsfield(v->release, "5.6", 0, 0, &error);
+ set_utsfield(v->version, "Generic", 0, 0, &error);
+ set_utsfield(v->machine, machine(), 0, 0, &error);
up_read(&uts_sem);
- return 0;
+ return error;
}
#define SI_SYSNAME 1 /* return name of operating system */
reply other threads:[~2004-08-31 10:50 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=19813.1093949412@www4.gmx.net \
--to=alexander.stohr@gmx.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
all inboxes | Powered by JetHome®