kernel update (relative to 2.4.29)
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.
Quoted 4 lines · Bjorn Helgaas
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
- addunw_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
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);
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Bjorn Helgaas
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 <[email protected]>
* 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
ia64/_mcount.S +4 -3
@@ -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)