Skip to contentSkip to conversation

sh: fix semtimedop syscall

PATCH Applied Yoshihiro Shimoda 2 participants 3 messages Aug 27, 2008 – Aug 28, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: fix semtimedop syscall

fix the problem that cannot work semtimedop system call.

---

I think that SPARC has the similar bug.
However I cannot confirm it, because I don't have SPARC system.

 arch/sh/kernel/sys_sh.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/sh/kernel/sys_sh.c +1 -1
index 59cd285..9061b86 100644
@@ -170,7 +170,7 @@ asmlinkage int sys_ipc(uint call, int first, int second,
 	version = call >> 16; /* hack for backward compatibility */
 	call &= 0xffff;
 
-	if (call <= SEMCTL)
+	if (call <= SEMTIMEDOP)
 		switch (call) {
 		case SEMOP:
 			return sys_semtimedop(first,
Signature · 1 line
1.5.5
#1 lore raw
Quoted 16 lines · Yoshihiro Shimoda

fix the problem that cannot work semtimedop system call.

---

I think that SPARC has the similar bug.
However I cannot confirm it, because I don't have SPARC system.

 arch/sh/kernel/sys_sh.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/sh/kernel/sys_sh.c +0 -0
index 59cd285..9061b86 100644

arch/sh/kernel/sys_sh.c asmlinkage int sys_ipc(uint call, int first, int second, · line 176

Quoted 8 lines
arch/sh/kernel/sys_sh.c +1 -1
@@ -170,7 +170,7 @@ asmlinkage int sys_ipc(uint call, int first, int second,
 	version = call >> 16; /* hack for backward compatibility */
 	call &= 0xffff;
 
-	if (call <= SEMCTL)
+	if (call <= SEMTIMEDOP)
 		switch (call) {
 		case SEMOP:
 			return sys_semtimedop(first,

Good catch! This has been broken for a long time, at least it predates git history. At first glance, sh, sparc, and sparc64 have a sys_semtimedop() reference that will never be invoked, while other platforms (h8300, m68k, and m68knommu) don't implement it at all and simply -ENOSYS (or -EINVAL) out.

Since these nommu platforms haven't supported semtimedop() since its introduction in 2.5.52, they may want to think about hooking it up at some point. Both glibc and uClibc support it today.

sparc64's compat_sys_ipc() does the right thing while the built-in sys_ipc() has the same bug you've noted. So, here are the sparc/sparc64 bits.

---

 arch/sparc/kernel/sys_sparc.c   |    2 +-
 arch/sparc64/kernel/sys_sparc.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/sparc/kernel/sys_sparc.c +1 -1
index 4d73421..af653a1 100644
@@ -119,7 +119,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user
 	version = call >> 16; /* hack for backward compatibility */
 	call &= 0xffff;
 
-	if (call <= SEMCTL)
+	if (call <= SEMTIMEDOP)
 		switch (call) {
 		case SEMOP:
 			err = sys_semtimedop (first, (struct sembuf __user *)ptr, second, NULL);
arch/sparc64/kernel/sys_sparc.c +1 -1
index 39749e3..4446730 100644
@@ -439,7 +439,7 @@ asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second,
 	long err;
 
 	/* No need for backward compatibility. We can start fresh... */
-	if (call <= SEMCTL) {
+	if (call <= SEMTIMEDOP) {
 		switch (call) {
 		case SEMOP:
 			err = sys_semtimedop(first, ptr,