public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Pete Wyckoff <pw@osc.edu>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] /proc/pid/mem and stack variables
Date: Fri, 12 Jan 2001 18:45:10 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590693005038@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590693005037@msgid-missing>

maciej@ccrl-nece.technopark.gmd.de said:
> I have recompiled the library on IA64 under 2.4.0-test12
> and using version 2.9-ia64-000216-final. The library works
> OK except when the address it tries to access via /proc/pid/mem
> refers to variables allocated on stack (e.g. local arrays defined
> in functions).
> 
> This is a snippet of code used to access memory via /proc/pid/mem:
> 
> void mem_read (int fd, void *buf, void *addr, size_t len) {
> 
> 	if (lseek (fd, (off_t)addr, SEEK_SET) = (off_t)-1)
>                 perror ("lseek");
> 	read (fd, buf, len);
> 
> lseek in this code fails (EINVAL) always when addr is address of
> a variable allocated on stack.

Try removing the "offset >= 0" check in default_llseek in
fs/read_write.c.  Stack pages seem to have the high bit set which
is flummoxing that test.

If you keep this "solution" you may want to write an llseek function
for /proc/pid/mem so that the entire kernel doesn't suffer any unforseen
consequences.

		-- Pete


  reply	other threads:[~2001-01-12 18:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-12 16:20 [Linux-ia64] /proc/pid/mem and stack variables Maciej Golebiewski
2001-01-12 18:45 ` Pete Wyckoff [this message]
2001-01-13  2:29 ` David Mosberger
2001-01-15 10:17 ` Maciej Golebiewski
2001-01-15 17:57 ` Erich Focht
2001-01-18  2:48 ` David Mosberger

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-105590693005038@msgid-missing \
    --to=pw@osc.edu \
    --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