osi-probe-avoid-out-of-range-memory-reads-20061006

FIXES 41858

avoid oops on opteron due to accessing unmapped memory
This commit is contained in:
Chaskiel M Grundman 2006-10-06 14:59:54 +00:00 committed by Derrick Brashear
parent 775ea6f1b7
commit e39f4d8789

View File

@ -1009,6 +1009,12 @@ static void *try(probectl *P, tryctl *T, PROBETYPE *aptr,
#else
ptr = aptr;
#endif
if ((unsigned long)ptr < init_mm.start_code ||
(unsigned long)ptr > init_mm.end_data) {
/* printk("address 0x%lx (from 0x%lx %d) is out of range in check_table. wtf?\n", (unsigned long)x, (unsigned long)ptr, i);*/
continue;
}
ret = check_table(P, ptr);
if (ret >= 0) {
/* return value is number of entries to skip */
@ -1113,6 +1119,11 @@ static void *try_harder(probectl *P, PROBETYPE *ptr, unsigned long datalen)
printk("<7>osi_probe: %s try_harder\n", P->symbol);
#endif
for (offset = 0; offset < datalen; offset++, ptr++) {
if ((unsigned long)ptr < init_mm.start_code ||
(unsigned long)ptr > init_mm.end_data) {
/* printk("address 0x%lx (from 0x%lx %d) is out of range in check_table. wtf?\n", (unsigned long)x, (unsigned long)ptr, i);*/
continue;
}
ret = check_table(P, ptr);
if (ret >= 0) {
/* return value is number of entries to skip */