* IA-32 support patch: fcntl64 calls are broken
@ 2003-06-24 22:51 Arun Sharma
2003-06-25 16:53 ` Bjorn Helgaas
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Arun Sharma @ 2003-06-24 22:51 UTC (permalink / raw)
To: linux-ia64
[-- Attachment #1: Type: text/plain, Size: 398 bytes --]
Currently, sys32_fcntl64() is broken, because it passes F_*64 commands to sys_fcntl(), which it doesn't understand. The F_XXX64 commands need to be converted to F_XXX before calling sys_fcntl().
We also eliminated a copy, because the 32 bit struct flock64 and the 64 bit struct flock seem to be identical.
This patch is relevant only to 2.4, as it has already been taken care of in 2.5.
-Arun
[-- Attachment #2: fcntl.29.txt --]
[-- Type: text/plain, Size: 654 bytes --]
--- linux/arch/ia64/ia32/sys_ia32.c- 2003-05-28 23:37:02.000000000 -0700
+++ linux/arch/ia64/ia32/sys_ia32.c 2003-06-24 02:47:10.000000000 -0700
@@ -3618,14 +3595,9 @@
case F_GETLK64:
case F_SETLK64:
case F_SETLKW64:
- if (ia32_get_flock(&f, arg))
- return -EFAULT;
- old_fs = get_fs();
- set_fs(KERNEL_DS);
- ret = sys_fcntl(fd, cmd, (unsigned long) &f);
- set_fs(old_fs);
- if (cmd == F_GETLK && ia32_put_flock(&f, arg))
- return -EFAULT;
+ ret = sys_fcntl(fd, (cmd == F_GETLK64) ? F_GETLK :
+ ((cmd == F_SETLK64) ? F_SETLK : F_SETLKW),
+ (unsigned long)arg);
break;
default:
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: IA-32 support patch: fcntl64 calls are broken
2003-06-24 22:51 IA-32 support patch: fcntl64 calls are broken Arun Sharma
@ 2003-06-25 16:53 ` Bjorn Helgaas
2003-06-25 18:18 ` Arun Sharma
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2003-06-25 16:53 UTC (permalink / raw)
To: linux-ia64
On Tuesday 24 June 2003 4:51 pm, Arun Sharma wrote:
> Currently, sys32_fcntl64() is broken, because it passes F_*64 commands to sys_fcntl(), which it doesn't understand. The F_XXX64 commands need to be converted to F_XXX before calling sys_fcntl().
>
> We also eliminated a copy, because the 32 bit struct flock64 and the 64 bit struct flock seem to be identical.
>
> This patch is relevant only to 2.4, as it has already been taken care of in 2.5.
2.5 has this code, which looks suspicious to me (do we really mean
to call sys_fcntl() twice?):
case F_GETLK64:
case F_SETLK64:
case F_SETLKW64:
ret = get_compat_flock64(&f, compat_ptr(arg));
if (ret != 0)
break;
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_fcntl(fd, F_GETLK, (unsigned long)&f);
ret = sys_fcntl(fd, (cmd = F_GETLK64) ? F_GETLK :
((cmd = F_SETLK64) ? F_SETLK : F_SETLKW),
(unsigned long)&f);
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: IA-32 support patch: fcntl64 calls are broken
2003-06-24 22:51 IA-32 support patch: fcntl64 calls are broken Arun Sharma
2003-06-25 16:53 ` Bjorn Helgaas
@ 2003-06-25 18:18 ` Arun Sharma
2003-06-25 21:06 ` Bjorn Helgaas
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Arun Sharma @ 2003-06-25 18:18 UTC (permalink / raw)
To: linux-ia64
Bjorn Helgaas wrote:
> 2.5 has this code, which looks suspicious to me (do we really mean
> to call sys_fcntl() twice?):
Cc'ing the author of this patch in 2.5. Stephen, did you mean to call sys_fcntl() twice ?
-Arun
>
> case F_GETLK64:
> case F_SETLK64:
> case F_SETLKW64:
> ret = get_compat_flock64(&f, compat_ptr(arg));
> if (ret != 0)
> break;
> old_fs = get_fs();
> set_fs(KERNEL_DS);
> ret = sys_fcntl(fd, F_GETLK, (unsigned long)&f);
> ret = sys_fcntl(fd, (cmd = F_GETLK64) ? F_GETLK :
> ((cmd = F_SETLK64) ? F_SETLK : F_SETLKW),
> (unsigned long)&f);
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: IA-32 support patch: fcntl64 calls are broken
2003-06-24 22:51 IA-32 support patch: fcntl64 calls are broken Arun Sharma
2003-06-25 16:53 ` Bjorn Helgaas
2003-06-25 18:18 ` Arun Sharma
@ 2003-06-25 21:06 ` Bjorn Helgaas
2003-06-26 1:27 ` Stephen Rothwell
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2003-06-25 21:06 UTC (permalink / raw)
To: linux-ia64
On Tuesday 24 June 2003 4:51 pm, Arun Sharma wrote:
> Currently, sys32_fcntl64() is broken, because it passes F_*64 commands to sys_fcntl(), which it doesn't understand. The F_XXX64 commands need to be converted to F_XXX before calling sys_fcntl().
As far as I can tell, this is almost equivalent to, but uglier than,
the mips64 version:
sys32_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg)
{
switch (cmd) {
case F_GETLK64:
return sys_fcntl(fd, F_GETLK, arg);
case F_SETLK64:
return sys_fcntl(fd, F_SETLK, arg);
case F_SETLKW64:
return sys_fcntl(fd, F_SETLKW, arg);
}
return sys32_fcntl(fd, cmd, arg);
}
parisc, ppc64, s390, and sparc64 have this, which I think is
also equivalent, but uglier:
asmlinkage long sys32_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg)
{
if (cmd >= F_GETLK64 && cmd <= F_SETLKW64)
return sys_fcntl(fd, cmd + F_GETLK - F_GETLK64, arg);
return sys32_fcntl(fd, cmd, arg);
}
I'd like to see the ia64 version be similar to the mips64 version.
The remaining difference is the int/long argument; maybe you
can resolve that too...
Bjorn
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: IA-32 support patch: fcntl64 calls are broken
2003-06-24 22:51 IA-32 support patch: fcntl64 calls are broken Arun Sharma
` (2 preceding siblings ...)
2003-06-25 21:06 ` Bjorn Helgaas
@ 2003-06-26 1:27 ` Stephen Rothwell
2003-06-26 5:02 ` Bjorn Helgaas
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Stephen Rothwell @ 2003-06-26 1:27 UTC (permalink / raw)
To: linux-ia64
On Wed, 25 Jun 2003 11:18:17 -0700 Arun Sharma <arun.sharma@intel.com>
wrote:
>
> Bjorn Helgaas wrote:
> > 2.5 has this code, which looks suspicious to me (do we really mean
> > to call sys_fcntl() twice?):
>
> Cc'ing the author of this patch in 2.5. Stephen, did you mean to call
> sys_fcntl() twice ?
No. Rats! :-( Cut and paste error (I assume). I will submit a patch
to Linus.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: IA-32 support patch: fcntl64 calls are broken
2003-06-24 22:51 IA-32 support patch: fcntl64 calls are broken Arun Sharma
` (3 preceding siblings ...)
2003-06-26 1:27 ` Stephen Rothwell
@ 2003-06-26 5:02 ` Bjorn Helgaas
2003-07-08 18:57 ` Arun Sharma
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2003-06-26 5:02 UTC (permalink / raw)
To: linux-ia64
On Wednesday 25 June 2003 3:06 pm, I wrote:
> On Tuesday 24 June 2003 4:51 pm, Arun Sharma wrote:
> > Currently, sys32_fcntl64() is broken, because it passes F_*64 commands to sys_fcntl(), which it doesn't understand. The F_XXX64 commands need to be converted to F_XXX before calling sys_fcntl().
>
> As far as I can tell, this is almost equivalent to, but uglier than,
> the mips64 version:
Never mind. Besides being unnecessarily rude, I had obviouisly
forgotten the fragment from 2.5 that I just quoted. Your patch
looks very much like the 2.5 code, which I think is the best
approach. Even though I think the switch is more readable than
the nested ternary expressions, it's better to follow 2.5.
I apologize.
Bjorn
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: IA-32 support patch: fcntl64 calls are broken
2003-06-24 22:51 IA-32 support patch: fcntl64 calls are broken Arun Sharma
` (4 preceding siblings ...)
2003-06-26 5:02 ` Bjorn Helgaas
@ 2003-07-08 18:57 ` Arun Sharma
2003-07-08 19:16 ` Matthew Wilcox
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Arun Sharma @ 2003-07-08 18:57 UTC (permalink / raw)
To: linux-ia64
[-- Attachment #1: Type: text/plain, Size: 644 bytes --]
Arun Sharma wrote:
>
> Currently, sys32_fcntl64() is broken, because it passes F_*64 commands
> to sys_fcntl(), which it doesn't understand. The F_XXX64 commands need
> to be converted to F_XXX before calling sys_fcntl().
>
> We also eliminated a copy, because the 32 bit struct flock64 and the 64
> bit struct flock seem to be identical.
>
Turns out that the structures are not identical (even though the data types of all the members have the same size) due to alignment issues. So the copy can not be eliminated.
> This patch is relevant only to 2.4, as it has already been taken care of
> in 2.5.
A new patch is attached.
-Arun
[-- Attachment #2: fcntl.29.txt --]
[-- Type: text/plain, Size: 594 bytes --]
--- linux/arch/ia64/ia32/sys_ia32.c- Tue Jun 24 15:43:39 2003
+++ linux/arch/ia64/ia32/sys_ia32.c Tue Jul 1 14:09:27 2003
@@ -3622,9 +3622,11 @@
return -EFAULT;
old_fs = get_fs();
set_fs(KERNEL_DS);
- ret = sys_fcntl(fd, cmd, (unsigned long) &f);
+ ret = sys_fcntl(fd, (cmd == F_GETLK64) ? F_GETLK :
+ ((cmd == F_SETLK64) ? F_SETLK : F_SETLKW),
+ (unsigned long) &f);
set_fs(old_fs);
- if (cmd == F_GETLK && ia32_put_flock(&f, arg))
+ if (cmd == F_GETLK64 && ia32_put_flock(&f, arg))
return -EFAULT;
break;
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: IA-32 support patch: fcntl64 calls are broken
2003-06-24 22:51 IA-32 support patch: fcntl64 calls are broken Arun Sharma
` (5 preceding siblings ...)
2003-07-08 18:57 ` Arun Sharma
@ 2003-07-08 19:16 ` Matthew Wilcox
2003-07-08 21:51 ` Arun Sharma
2003-07-15 19:26 ` Bjorn Helgaas
8 siblings, 0 replies; 10+ messages in thread
From: Matthew Wilcox @ 2003-07-08 19:16 UTC (permalink / raw)
To: linux-ia64
On Tue, Jul 08, 2003 at 11:57:21AM -0700, Arun Sharma wrote:
> --- linux/arch/ia64/ia32/sys_ia32.c- Tue Jun 24 15:43:39 2003
> +++ linux/arch/ia64/ia32/sys_ia32.c Tue Jul 1 14:09:27 2003
> @@ -3622,9 +3622,11 @@
> return -EFAULT;
> old_fs = get_fs();
> set_fs(KERNEL_DS);
> - ret = sys_fcntl(fd, cmd, (unsigned long) &f);
> + ret = sys_fcntl(fd, (cmd = F_GETLK64) ? F_GETLK :
looks like you're using spaces instead of tabs. tsk.
--
"It's not Hollywood. War is real, war is primarily not about defeat or
victory, it is about death. I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: IA-32 support patch: fcntl64 calls are broken
2003-06-24 22:51 IA-32 support patch: fcntl64 calls are broken Arun Sharma
` (6 preceding siblings ...)
2003-07-08 19:16 ` Matthew Wilcox
@ 2003-07-08 21:51 ` Arun Sharma
2003-07-15 19:26 ` Bjorn Helgaas
8 siblings, 0 replies; 10+ messages in thread
From: Arun Sharma @ 2003-07-08 21:51 UTC (permalink / raw)
To: linux-ia64
[-- Attachment #1: Type: text/plain, Size: 588 bytes --]
Matthew Wilcox wrote:
> On Tue, Jul 08, 2003 at 11:57:21AM -0700, Arun Sharma wrote:
>
>>--- linux/arch/ia64/ia32/sys_ia32.c- Tue Jun 24 15:43:39 2003
>>+++ linux/arch/ia64/ia32/sys_ia32.c Tue Jul 1 14:09:27 2003
>>@@ -3622,9 +3622,11 @@
>> return -EFAULT;
>> old_fs = get_fs();
>> set_fs(KERNEL_DS);
>>- ret = sys_fcntl(fd, cmd, (unsigned long) &f);
>>+ ret = sys_fcntl(fd, (cmd == F_GETLK64) ? F_GETLK :
>
>
> looks like you're using spaces instead of tabs. tsk.
>
I admit to cutting and pasting from 2.5 :) An updated patch with tabs is attached.
-Arun
[-- Attachment #2: fcntl.29.txt --]
[-- Type: text/plain, Size: 538 bytes --]
--- linux/arch/ia64/ia32/sys_ia32.c- Tue Jun 24 15:43:39 2003
+++ linux/arch/ia64/ia32/sys_ia32.c Tue Jul 8 14:46:57 2003
@@ -3622,9 +3622,11 @@
return -EFAULT;
old_fs = get_fs();
set_fs(KERNEL_DS);
- ret = sys_fcntl(fd, cmd, (unsigned long) &f);
+ ret = sys_fcntl(fd, (cmd == F_GETLK64) ? F_GETLK :
+ ((cmd == F_SETLK64) ? F_SETLK : F_SETLKW),
+ (unsigned long) &f);
set_fs(old_fs);
- if (cmd == F_GETLK && ia32_put_flock(&f, arg))
+ if (cmd == F_GETLK64 && ia32_put_flock(&f, arg))
return -EFAULT;
break;
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: IA-32 support patch: fcntl64 calls are broken
2003-06-24 22:51 IA-32 support patch: fcntl64 calls are broken Arun Sharma
` (7 preceding siblings ...)
2003-07-08 21:51 ` Arun Sharma
@ 2003-07-15 19:26 ` Bjorn Helgaas
8 siblings, 0 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2003-07-15 19:26 UTC (permalink / raw)
To: linux-ia64
On Tuesday 08 July 2003 3:51 pm, Arun Sharma wrote:
> Matthew Wilcox wrote:
> > On Tue, Jul 08, 2003 at 11:57:21AM -0700, Arun Sharma wrote:
> >
> >>--- linux/arch/ia64/ia32/sys_ia32.c- Tue Jun 24 15:43:39 2003
> >>+++ linux/arch/ia64/ia32/sys_ia32.c Tue Jul 1 14:09:27 2003
> >>@@ -3622,9 +3622,11 @@
> >> return -EFAULT;
> >> old_fs = get_fs();
> >> set_fs(KERNEL_DS);
> >>- ret = sys_fcntl(fd, cmd, (unsigned long) &f);
> >>+ ret = sys_fcntl(fd, (cmd = F_GETLK64) ? F_GETLK :
> >
> >
> > looks like you're using spaces instead of tabs. tsk.
> >
>
> I admit to cutting and pasting from 2.5 :) An updated patch with tabs is attached.
Applied this to 2.4. Whew :-)
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2003-07-15 19:26 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-24 22:51 IA-32 support patch: fcntl64 calls are broken Arun Sharma
2003-06-25 16:53 ` Bjorn Helgaas
2003-06-25 18:18 ` Arun Sharma
2003-06-25 21:06 ` Bjorn Helgaas
2003-06-26 1:27 ` Stephen Rothwell
2003-06-26 5:02 ` Bjorn Helgaas
2003-07-08 18:57 ` Arun Sharma
2003-07-08 19:16 ` Matthew Wilcox
2003-07-08 21:51 ` Arun Sharma
2003-07-15 19:26 ` Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox