Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: michal@gortel.phys.ualberta.ca (Michal Jaegermann)
Subject: Re: DU binaries on 2.2.16
Date: 2000/06/16	[thread overview]
Message-ID: <8ido7u$eoc$2@pulp.srv.ualberta.ca> (raw)
In-Reply-To: slrn8kkcvd.4p.andrei@merkul.ioffe.rssi.ru

Andrei Malyshev (andrei@orient.ioffe.rssi.ru) wrote:
: I have been running a couple fo DU binaries on my Linux box (XL300, RH 5.x
: upgraded to about 6.0, kernel 2.2.13) without much trouble untill I upgraded
: the kernel to 2.2.16. After that all DU binaries (including netscape 3.x and
: 4.x) started crashing without any visible reason. If somebody is running DU
: netscape or other osf/1 binaries with 2.2.16 and no problems, please let me
: know.

The message which follows showed up on linux-kernel list.  Not tested
yet (RSN :-).  As this went through a few mailers you better apply
these few lines of patch by hand; white-space is likely not correct.

Apart of that there is an erratum to 2.2.16 which can be found
on http://www.linux.org.uk/

  Michal

 From: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
 Date: Fri, 16 Jun 2000 01:49:43 +0400
 Subject: [patch] Re: ac18: change in fs/read_write.c

 On Wed, Jun 14, 2000 at 02:50:46PM +0100, Alan Cox wrote:
 > > This code
 > > +   if((long) tot_len <0)
 > > +           return -EINVAL;
 > > +
 > > breaks Tru64 binaries on alpha (netscape, acroread).
 > > Could it be backed out?
 > 
 > Ok I'd like to know why its breaking stuff, and who is queueing
 > negative
 > length I/O's. 
 > 
 Oops. While thinking about alpha I've missed 2 bugs in that code.
 1. It won't help for iov_len arrays such as
	 { 0xffffffff, 2 }, { 0x40000000, 0x40000000, 0x80000000 } etc.
 2. It returns after kmalloc() without kfree(), thus allowing any user
    crash the system in a few seconds (bad news for 2.2.16).

 The patch fixes that and also returns EINVAL accordingly BSD docs.
 As a side effect OSF binaries are working again on alpha.
 Tested on x86 and alpha.
 Applies also to 2.2.16 (with offset 11 lines)

 Ivan.

--- 2.4.0.t1ac19/fs/read_write.c        Thu Jun 15 22:20:04 2000
+++ linux/fs/read_write.c       Thu Jun 15 22:22:02 2000
@@ -199,12 +199,19 @@
        if (copy_from_user(iov, vector, count*sizeof(*vector)))
                goto out;
 
+       /* BSD readv/writev returns EINVAL if one of the iov_len
+          values < 0 or tot_len overflowed a 32-bit integer. -ink */
        tot_len = 0;
-       for (i = 0 ; i < count ; i++)
-               tot_len += iov[i].iov_len;
-
-       if((long) tot_len <0)
-               return -EINVAL;
+       ret = -EINVAL;
+       for (i = 0 ; i < count ; i++) {
+               size_t tmp = tot_len;
+               int len = iov[i].iov_len;
+               if (len < 0)
+                       goto out;
+               (u32)tot_len += len;
+               if (tot_len < tmp || tot_len < (u32)len)
+                       goto out;
+       }
 
        inode = file->f_dentry->d_inode;
        /* VERIFY_WRITE actually means a read, as we write to user space */



      reply	other threads:[~2000-06-16  4:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-06-16  4:00 DU binaries on 2.2.16 Andrei Malyshev
2000-06-16  4:00 ` Michal Jaegermann [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox