From: David Mosberger <davidm@hpl.hp.com>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] ptrace fix (relative to 2.4.4 + 010508 ia64 patch)
Date: Thu, 17 May 2001 21:49:47 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590693005610@msgid-missing> (raw)
Here is a fix for the ptrace() problem that showed with "strace -f".
There was corner case where a POKETEXT or POKEDATA while a system call
was in progress would corrupt the backing store pointer of the target
process. The patch below fixes this.
--david
--- ../lia64/arch/ia64/kernel/ptrace.c Thu Apr 12 19:21:07 2001
+++ arch/ia64/kernel/ptrace.c Thu May 17 14:26:02 2001
@@ -438,6 +438,25 @@
}
/*
+ * Simulate user-level "flushrs". Note: we can't just add pt->loadrs>>16 to
+ * pt->ar_bspstore because the kernel backing store and the user-level backing store may
+ * have different alignments (and therefore a different number of intervening rnat slots).
+ */
+static void
+user_flushrs (struct task_struct *task, struct pt_regs *pt)
+{
+ unsigned long *krbs;
+ long ndirty;
+
+ krbs = (unsigned long *) task + IA64_RBS_OFFSET/8;
+ ndirty = ia64_rse_num_regs(krbs, krbs + (pt->loadrs >> 19));
+
+ pt->ar_bspstore = (unsigned long) ia64_rse_skip_regs((unsigned long *) pt->ar_bspstore,
+ ndirty);
+ pt->loadrs = 0;
+}
+
+/*
* Synchronize the RSE backing store of CHILD and all tasks that share the address space
* with it. CHILD_URBS_END is the address of the end of the register backing store of
* CHILD. If MAKE_WRITABLE is set, a user-level "flushrs" is simulated such that the VM
@@ -467,11 +486,8 @@
sw = (struct switch_stack *) (child->thread.ksp + 16);
pt = ia64_task_regs(child);
ia64_sync_user_rbs(child, sw, pt->ar_bspstore, child_urbs_end);
- if (make_writable) {
- /* simulate a user-level "flushrs": */
- pt->loadrs = 0;
- pt->ar_bspstore = child_urbs_end;
- }
+ if (make_writable)
+ user_flushrs(child, pt);
} else {
read_lock(&tasklist_lock);
{
@@ -481,11 +497,8 @@
pt = ia64_task_regs(p);
urbs_end = ia64_get_user_rbs_end(p, pt, NULL);
ia64_sync_user_rbs(p, sw, pt->ar_bspstore, urbs_end);
- if (make_writable) {
- /* simulate a user-level "flushrs": */
- pt->loadrs = 0;
- pt->ar_bspstore = urbs_end;
- }
+ if (make_writable)
+ user_flushrs(p, pt);
}
}
}
reply other threads:[~2001-05-17 21:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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-105590693005610@msgid-missing \
--to=davidm@hpl.hp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.