* [PATCH 2.4] Fix rlimit check in precheck_file_write()
@ 2004-12-22 21:57 Jason Uhlenkott
2004-12-23 11:29 ` Alan Cox
0 siblings, 1 reply; 3+ messages in thread
From: Jason Uhlenkott @ 2004-12-22 21:57 UTC (permalink / raw)
To: linux-kernel
Remove a broken assumption that rlimits are 32 bits which can cause
nasty things to happen on 64-bit machines if we try to write past the
2^32-1th character of a file and a larger file size limit exists.
Signed-off-by: Jason Uhlenkott <jasonuhl@sgi.com>
--- linux-2.4.29-pre3.orig/mm/filemap.c 2004-11-17 03:54:22.000000000 -0800
+++ linux-2.4.29-pre3/mm/filemap.c 2004-12-22 13:41:46.000000000 -0800
@@ -3088,9 +3088,9 @@
send_sig(SIGXFSZ, current, 0);
goto out;
}
- if (pos > 0xFFFFFFFFULL || *count > limit - (u32)pos) {
+ if (*count > limit - pos) {
/* send_sig(SIGXFSZ, current, 0); */
- *count = limit - (u32)pos;
+ *count = limit - pos;
}
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2.4] Fix rlimit check in precheck_file_write()
2004-12-22 21:57 [PATCH 2.4] Fix rlimit check in precheck_file_write() Jason Uhlenkott
@ 2004-12-23 11:29 ` Alan Cox
2004-12-23 16:28 ` Jason Uhlenkott
0 siblings, 1 reply; 3+ messages in thread
From: Alan Cox @ 2004-12-23 11:29 UTC (permalink / raw)
To: Jason Uhlenkott; +Cc: Linux Kernel Mailing List
On Mer, 2004-12-22 at 21:57, Jason Uhlenkott wrote:
> Remove a broken assumption that rlimits are 32 bits which can cause
> nasty things to happen on 64-bit machines if we try to write past the
> 2^32-1th character of a file and a larger file size limit exists.
>
> Signed-off-by: Jason Uhlenkott <jasonuhl@sgi.com>
>
> --- linux-2.4.29-pre3.orig/mm/filemap.c 2004-11-17 03:54:22.000000000 -0800
> +++ linux-2.4.29-pre3/mm/filemap.c 2004-12-22 13:41:46.000000000 -0800
> @@ -3088,9 +3088,9 @@
> send_sig(SIGXFSZ, current, 0);
> goto out;
> }
> - if (pos > 0xFFFFFFFFULL || *count > limit - (u32)pos) {
> + if (*count > limit - pos) {
> /* send_sig(SIGXFSZ, current, 0); */
> - *count = limit - (u32)pos;
> + *count = limit - pos;
> }
Are you sure this is safe for all conceivable 32bit cases as well as
your 64bit one ? I don't think it is looking at the overflow cases in
the if that you removed checking of.
Alan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2.4] Fix rlimit check in precheck_file_write()
2004-12-23 11:29 ` Alan Cox
@ 2004-12-23 16:28 ` Jason Uhlenkott
0 siblings, 0 replies; 3+ messages in thread
From: Jason Uhlenkott @ 2004-12-23 16:28 UTC (permalink / raw)
To: Alan Cox; +Cc: Linux Kernel Mailing List
On Thu, Dec 23, 2004 at 11:29:33AM +0000, Alan Cox wrote:
> On Mer, 2004-12-22 at 21:57, Jason Uhlenkott wrote:
> > Remove a broken assumption that rlimits are 32 bits which can cause
> > nasty things to happen on 64-bit machines if we try to write past the
> > 2^32-1th character of a file and a larger file size limit exists.
> >
> > Signed-off-by: Jason Uhlenkott <jasonuhl@sgi.com>
> >
> > --- linux-2.4.29-pre3.orig/mm/filemap.c 2004-11-17 03:54:22.000000000 -0800
> > +++ linux-2.4.29-pre3/mm/filemap.c 2004-12-22 13:41:46.000000000 -0800
> > @@ -3088,9 +3088,9 @@
> > send_sig(SIGXFSZ, current, 0);
> > goto out;
> > }
> > - if (pos > 0xFFFFFFFFULL || *count > limit - (u32)pos) {
> > + if (*count > limit - pos) {
> > /* send_sig(SIGXFSZ, current, 0); */
> > - *count = limit - (u32)pos;
> > + *count = limit - pos;
> > }
>
> Are you sure this is safe for all conceivable 32bit cases as well as
> your 64bit one ? I don't think it is looking at the overflow cases in
> the if that you removed checking of.
We can't overflow -- immediately above this, we bail out if pos >= limit.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-12-23 16:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-22 21:57 [PATCH 2.4] Fix rlimit check in precheck_file_write() Jason Uhlenkott
2004-12-23 11:29 ` Alan Cox
2004-12-23 16:28 ` Jason Uhlenkott
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).