linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Linux-2.4.0-test4 - problems in memory management?
@ 2000-07-18 14:36 Pavel Roskin
  2000-07-19  0:15 ` Pavel Roskin
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Roskin @ 2000-07-18 14:36 UTC (permalink / raw)
  To: linuxppc-embedded


Hello!

If I boot Linux-2.4.0-test4 on RPX/Lite and try to "cat" a file I'm
getting a "Bad address" error for some files. Writing, executing and
low-level reading are Ok. In fact, I have to use "init=/bin/sh" to boot
the kernel, since init from Busybox cannot even read /etc/inittab

This is a minimal test program (which is the result of subsequent
"unrolling" and simplification of libc internals):
=======================
#include <stdio.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#define BUF_SIZE 0x10000

int main(int argc, char **argv)
{
	int fd;
	char *p;
	fd = open (argv[1], O_RDONLY);
	p = (char *) mmap(0, BUF_SIZE, PROT_READ | PROT_WRITE,
		MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
//	*(p) = 0;
	perror("point1");
	read (fd, p, BUF_SIZE);
	perror("point2");
	exit (0);
}
=======================

This program always works on existing regular files on Linux/PPC (G3,
kernel 2.2.14) and RPX/Lite with the Montavista kernel 2.2.13-7.

However, it fails on some (maybe all) regular files if Linux-2.4.0-test4
is used. It fails on NFS and procfs, but not on character devices:

# t1 /dev/zero
point1: Success
point2: Success
# t1 /proc/version
point1: Success
point2: Bad address
# t1 /bin/sh
point1: Success
point2: Bad address

If I uncomment "*(p) = 0;" it works on all files, but it's a workaround,
not a solution.

The same results have been reproduced with Linux-2.4.0-test5-pre1

Regards,
Pavel Roskin


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Linux-2.4.0-test4 - problems in memory management?
  2000-07-18 14:36 Linux-2.4.0-test4 - problems in memory management? Pavel Roskin
@ 2000-07-19  0:15 ` Pavel Roskin
  2000-07-19  1:49   ` Murray Jensen
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Roskin @ 2000-07-19  0:15 UTC (permalink / raw)
  To: linuxppc-embedded


Hello!

> If I boot Linux-2.4.0-test4 on RPX/Lite and try to "cat" a file I'm
> getting a "Bad address" error for some files. Writing, executing and
> low-level reading are Ok. In fact, I have to use "init=/bin/sh" to boot
> the kernel, since init from Busybox cannot even read /etc/inittab

After going all the way down from fread() to __copy_tofrom_user() it
appears that the later is at fault. It fails to copy large amounts of data
(216 bytes is enough to be a problem) to the pages that have just been
mmap'ed.

Replacing arch/ppc/lib/string.S with the version from 2.2.13-7 fixes the
problem. Linux-2.4.0-test4 appears to be functional after that!!! Feel
free to test.

Of course, it would be nice to know what exactly is broken in
__copy_tofrom_user(). Maybe next evening :-)

Regards,
Pavel Roskin


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Linux-2.4.0-test4 - problems in memory management?
  2000-07-19  0:15 ` Pavel Roskin
@ 2000-07-19  1:49   ` Murray Jensen
  0 siblings, 0 replies; 3+ messages in thread
From: Murray Jensen @ 2000-07-19  1:49 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: linuxppc-embedded


On Tue, 18 Jul 2000 20:15:22 -0400 (EDT), Pavel Roskin <proski@gnu.org> writes:
>After going all the way down from fread() to __copy_tofrom_user() it
>appears that the later is at fault. It fails to copy large amounts of data
>(216 bytes is enough to be a problem) to the pages that have just been
>mmap'ed.

Hi Pavel, check out the thread "Help with string.S" in the linuxppc-dev
mailing list - it begins with this message:

http://lists.linuxppc.org/listarcs/linuxppc-dev/200007/msg00155.html

In particular, check out this message:

http://lists.linuxppc.org/listarcs/linuxppc-dev/200007/msg00153.html

Cheers!
								Murray...
--
Murray Jensen, CSIRO Manufacturing Sci & Tech,         Phone: +61 3 9662 7763
Locked Bag No. 9, Preston, Vic, 3072, Australia.         Fax: +61 3 9662 7853
Internet: Murray.Jensen@cmst.csiro.au  (old address was mjj@mlb.dmt.csiro.au)


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-07-19  1:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-07-18 14:36 Linux-2.4.0-test4 - problems in memory management? Pavel Roskin
2000-07-19  0:15 ` Pavel Roskin
2000-07-19  1:49   ` Murray Jensen

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).