public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* kernel update (relative to 2.4.29)
@ 2005-03-14 23:43 Bjorn Helgaas
  2005-03-15  0:42 ` Keith Owens
  2005-03-21 22:06 ` David Mosberger
  0 siblings, 2 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2005-03-14 23:43 UTC (permalink / raw)
  To: linux-ia64

The ia64 kernel patch for Linux 2.4.29 is available here:

  ftp://ftp.kernel.org/pub/linux/kernel/ports/ia64/v2.4/linux-2.4.29-ia64-050312.diff.gz

The current 2.4-based ia64 tree is also available as a BitKeeper
repository.  You can browse the changelog and the source files with a
normal browser at:

    http://lia64.bkbits.net:8080/linux-ia64-2.4

or you can use the BitKeeper tools to maintain a local copy of the
tree like this:

    $ bk clone bk://lia64.bkbits.net/linux-ia64-2.4 linux-ia64-2.4

Bjorn

IA64-related changes since 2.4.26:
  * Perfmon:
    - use seq_file for /proc to avoid buffer overflows (Stephane Eranian, Dean Nelson).
    - fix /proc/pal/CPU*/bus_info descriptions (Stephane Eranian).
    - fix perfmon "BEER promotion" typo (Stephane Eranian).
    - clear sampling buffer at init (Stephane Eranian).
  * Misc bug-fixes:
    - allow IO port space without EFI RT attribute (Bjorn Helgaas).
    - fix FPH state check to keep task from seeing another task's regs (Arun Sharma).
    - fix pte_modify bug that allowed mprotect() to change too many bits (David Mosberger).
    - add unw_unwind_to_user() sanity check (Keith Owens).
    - add missing syscall slot.
    - fix ptrace corner cases (Yanmin Zhang).

N.B.  While testing this patch, I noticed that the ptrace fixes caused
anything linked with the profiling libc in Debian to fail.  The same
thing happens with the current 2.6 kernel, so I think the problem is
most likely in the Debian profiling libc.




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

* Re: kernel update (relative to 2.4.29)
  2005-03-14 23:43 kernel update (relative to 2.4.29) Bjorn Helgaas
@ 2005-03-15  0:42 ` Keith Owens
  2005-03-21 22:06 ` David Mosberger
  1 sibling, 0 replies; 3+ messages in thread
From: Keith Owens @ 2005-03-15  0:42 UTC (permalink / raw)
  To: linux-ia64

On Mon, 14 Mar 2005 16:43:19 -0700, 
Bjorn Helgaas <bjorn.helgaas@hp.com> wrote:
>The ia64 kernel patch for Linux 2.4.29 is available here:
>
>  ftp://ftp.kernel.org/pub/linux/kernel/ports/ia64/v2.4/linux-2.4.29-ia64-050312.diff.gz
>    - add unw_unwind_to_user() sanity check (Keith Owens).

This patch brings the unw_unwind_to_user() fix in 2.4.29 in line with
linux-ia64-test-2.6.12, including
http://lia64.bkbits.net:8080/linux-ia64-test-2.6.12/cset@42321d3fEXH4rqojRfbWYforyFKPWw?nav=index.html|ChangeSet@-4d

Signed-off-by: Keith Owens <kaos@sgi.com>

Index: 2.4.29-ia64-050312/arch/ia64/kernel/unwind.c
=================================--- 2.4.29-ia64-050312.orig/arch/ia64/kernel/unwind.c	2005-03-15 11:36:40.000000000 +1100
+++ 2.4.29-ia64-050312/arch/ia64/kernel/unwind.c	2005-03-15 11:36:42.000000000 +1100
@@ -48,6 +48,8 @@
 
 #define MIN(a,b)	((a) < (b) ? (a) : (b))
 #define p5		5
+#define PRED_USER_STACK pUser
+#define p3		3	/* for pUser */
 
 #define UNW_LOG_CACHE_SIZE	7	/* each unw_script is ~256 bytes in size */
 #define UNW_CACHE_SIZE		(1 << UNW_LOG_CACHE_SIZE)
@@ -1916,27 +1918,30 @@ EXPORT_SYMBOL(unw_unwind);
 int
 unw_unwind_to_user (struct unw_frame_info *info)
 {
-	unsigned long ip, sp;
+	unsigned long ip, sp, pr = 0;
 
 	while (unw_unwind(info) >= 0) {
-		if (unw_get_rp(info, &ip) < 0) {
-			unw_get_ip(info, &ip);
-			UNW_DPRINT(0, "unwind.%s: failed to read return pointer (ip=0x%lx)\n",
-				   __FUNCTION__, ip);
-			return -1;
-		}
 		unw_get_sp(info, &sp);
-		if (sp >= (unsigned long)info->task + IA64_STK_OFFSET)
+		if ((long)((unsigned long)info->task + IA64_STK_OFFSET - sp)
+		    < IA64_PT_REGS_SIZE) {
+			UNW_DPRINT(0, "unwind.%s: ran off the top of the kernel stack\n",
+				   __FUNCTION__);
 			break;
-		/*
-		 * We don't have unwind info for the gate page, so we consider that part
-		 * of user-space for the purpose of unwinding.
-		 */
-		if (ip < GATE_ADDR + PAGE_SIZE)
+		}
+		if (unw_is_intr_frame(info) &&
+		    (pr & (1UL << PRED_USER_STACK)))
 			return 0;
+		if (unw_get_pr (info, &pr) < 0) {
+			unw_get_rp(info, &ip);
+			UNW_DPRINT(0, "unwind.%s: failed to read "
+				   "predicate register (ip=0x%lx)\n",
+				__FUNCTION__, ip);
+			return -1;
+		}
 	}
 	unw_get_ip(info, &ip);
-	UNW_DPRINT(0, "unwind.%s: failed to unwind to user-level (ip=0x%lx)\n", __FUNCTION__, ip);
+	UNW_DPRINT(0, "unwind.%s: failed to unwind to user-level (ip=0x%lx)\n",
+		   __FUNCTION__, ip);
 	return -1;
 }
 EXPORT_SYMBOL(unw_unwind_to_user);


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

* Re: kernel update (relative to 2.4.29)
  2005-03-14 23:43 kernel update (relative to 2.4.29) Bjorn Helgaas
  2005-03-15  0:42 ` Keith Owens
@ 2005-03-21 22:06 ` David Mosberger
  1 sibling, 0 replies; 3+ messages in thread
From: David Mosberger @ 2005-03-21 22:06 UTC (permalink / raw)
  To: linux-ia64

>>>>> On Mon, 14 Mar 2005 16:43:19 -0700, Bjorn Helgaas <bjorn.helgaas@hp.com> said:

  Bjorn> N.B.  While testing this patch, I noticed that the ptrace
  Bjorn> fixes caused anything linked with the profiling libc in
  Bjorn> Debian to fail.  The same thing happens with the current 2.6
  Bjorn> kernel, so I think the problem is most likely in the Debian
  Bjorn> profiling libc.

I looked into this quickly and it's indeed a rather ugly trick in the
mcount stub which caused this issue (my bad).  The simple fix is
attached below.  I submitted the patch to the libc maintainers [1].
Backports to older libcs should be trivial, since that code hasn't
changed in ages.

Thanks,

	--david

[1] http://sources.redhat.com/ml/libc-hacker/2005-03/msg00058.html

ChangeLog

2005-03-21  David Mosberger  <davidm@hpl.hp.com>

	* sysdeps/ia64/_mcount.S: Newer kernels don't like register-frames
	with more than 8 output registers.  Fix this by passing original
	ar.pfs to _mcount_ret_helper via r3.

Index: sysdeps/ia64/_mcount.S
=================================RCS file: /cvs/glibc/libc/sysdeps/ia64/_mcount.S,v
retrieving revision 1.4
diff -u -r1.4 _mcount.S
--- sysdeps/ia64/_mcount.S	6 Jul 2001 04:55:54 -0000	1.4
+++ sysdeps/ia64/_mcount.S	21 Mar 2005 21:15:55 -0000
@@ -72,6 +72,7 @@
 	mov b7 = loc0
 	mov rp = in2
 	;;
+	mov r3 = in0
 	mov r8 = loc2
 	mov r15 = loc3
 	mov b6 = r2
@@ -81,10 +82,10 @@
 LOCAL_LEAF(_mcount_ret_helper)
 	.prologue
 	.altrp b7
-	.save ar.pfs, r40
+	.save ar.pfs, r3
 	.body
-	alloc r2 = ar.pfs, 0, 0, 9, 0
-	mov ar.pfs = r40
+	alloc r2 = ar.pfs, 0, 0, 8, 0
+	mov ar.pfs = r3
 	br b7
 END(_mcount_ret_helper)
 

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

end of thread, other threads:[~2005-03-21 22:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-14 23:43 kernel update (relative to 2.4.29) Bjorn Helgaas
2005-03-15  0:42 ` Keith Owens
2005-03-21 22:06 ` David Mosberger

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