public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Richard Hirst <rhirst@linuxcare.com>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] 010626 kernel, copy_from_user() broken?
Date: Thu, 12 Jul 2001 11:16:58 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590693005846@msgid-missing> (raw)

Hi,
  Summary:  I had to change PIPE_DEPTH in arch/ia64/lib/copy_user.S
from 21 to 4 to make copy_from_user() work with non-aligned user
addresses on my B3 cpu.  PIPE_DEPTH was 4 in the 010530 kernel.

Long description of how I got to this point:

  I'm working on the debian installer for ia64.  Most of the functionality,
including /bin/mount, is provided by busybox.  The first thing rcS does
on booting the installer is "mount proc /proc -t proc".  That worked fine
with the 010530 kernel, but fails with 010626.

Basically the kernel seems to have trouble reading the filesystem type
parameter, thinks it is an empty string, and ends up calling modprobe
for module name "".

Busybox mount uses getopt() to process its arguments, and when it finds
-t it simply sents char *filesystemtype = optarg.  That means the type
argument to mount() is different from device and dir, because it is
referencing env space.  If I make busybox malloc space for the type
string and copy optarg there, it works fine.

I got busybox mount to print the first three args to mount() before and
after the call:

0x60000000000150e0=/proc
0x60000000000160f0=/proc
0x80000fffffffbf84=proc

same before and after, as expected.  I got the kernel sys_mount to print
the address in user space of the type arg, which matched the users idea
of the value.  sys_mount() calls copy_mount_options (type, &type_page),
but if I then printk("'%s'\n", (char *)type_page), it yields ''.

I added printk's to copy_mount_options(), and saw it calls

copy_from_user(0xe00000003dc98000,0x80000fffffffbf84, 0x4000), which
claims to copy 0x7c bytes (i.e. to end of page).

I then did "export a=b" and tried the mount again; this time the type
param was at user address 0x80000fffffffbf80, and the mount worked.

Checking kernel changes, I found this.  Reverting the change made it work
again:

 
diff -urN linux-2.4.5/arch/ia64/lib/copy_user.S linux-2.4.5-lia/arch/ia64/lib/copy_user.S
--- linux-2.4.5/arch/ia64/lib/copy_user.S	Sun Apr 29 15:49:26 2001
+++ linux-2.4.5-lia/arch/ia64/lib/copy_user.S	Tue Jun 26 22:31:21 2001
@@ -35,7 +35,7 @@
 // Tuneable parameters
 //
 #define COPY_BREAK	16	// we do byte copy below (must be >\x16)
-#define PIPE_DEPTH	4	// pipe depth
+#define PIPE_DEPTH	21	// pipe depth
 
 #define EPI		p[PIPE_DEPTH-1] // PASTE(p,16+PIPE_DEPTH-1)
 


Richard



             reply	other threads:[~2001-07-12 11:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-12 11:16 Richard Hirst [this message]
2001-07-19 19:25 ` [Linux-ia64] 010626 kernel, copy_from_user() broken? David Mosberger
2001-07-19 22:14 ` Nakajima, Jun
2001-07-20 17:33 ` Richard Hirst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=marc-linux-ia64-105590693005846@msgid-missing \
    --to=rhirst@linuxcare.com \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox