* [patch] uts-semaphore fix for sparc64 solaris emu for kernel-2.6.9-rc1-bk6
@ 2004-08-31 10:50 Alexander Stohr
0 siblings, 0 replies; only message in thread
From: Alexander Stohr @ 2004-08-31 10:50 UTC (permalink / raw)
To: linux-kernel
[-- 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 */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-08-31 10:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-31 10:50 [patch] uts-semaphore fix for sparc64 solaris emu for kernel-2.6.9-rc1-bk6 Alexander Stohr
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®