Permalink
Browse files

Fix for a segmentation violation when attempting to run live on a

a system without the crash.ko memory driver, and whose kernel was
configured with CONFIG_STRICT_DEVMEM.  Without the patch, if any
-d<value> is entered on the command line, the crash session fails
during initialization.
(dmair@suse.com)
  • Loading branch information...
crash-utility committed Nov 20, 2015
1 parent d83b0f7 commit 34842b66a121161a91b328f5eab47abd43661248
Showing with 13 additions and 10 deletions.
  1. +1 −0 defs.h
  2. +12 −10 memory.c
View
1 defs.h
@@ -328,6 +328,7 @@ struct number_option {
#define HEX_BIAS (0x8)
#define LONG_LONG (0x10)
#define RETURN_PARTIAL (0x20)
#define NO_DEVMEM_SWITCH (0x40)
#define SEEK_ERROR (-1)
#define READ_ERROR (-2)
View
@@ -2207,14 +2207,14 @@ readmem(ulonglong addr, int memtype, void *buffer, long size,
goto readmem_error;
case READ_ERROR:
if (PRINT_ERROR_MESSAGE) {
if ((pc->flags & DEVMEM) && (kt->flags & PRE_KERNEL_INIT) &&
devmem_is_restricted() && switch_to_proc_kcore())
return(readmem(addr, memtype, bufptr, size,
type, error_handle));
if (PRINT_ERROR_MESSAGE)
error(INFO, READ_ERRMSG, memtype_string(memtype, 0), addr, type);
}
goto readmem_error;
if ((pc->flags & DEVMEM) && (kt->flags & PRE_KERNEL_INIT) &&
!(error_handle & NO_DEVMEM_SWITCH) && devmem_is_restricted() &&
switch_to_proc_kcore())
return(readmem(addr, memtype, bufptr, size,
type, error_handle));
goto readmem_error;
case PAGE_EXCLUDED:
RETURN_ON_PARTIAL_READ();
@@ -2413,16 +2413,16 @@ devmem_is_restricted(void)
if (machine_type("X86") || machine_type("X86_64")) {
if (readmem(255*PAGESIZE(), PHYSADDR, &tmp,
sizeof(long), "devmem_is_allowed - pfn 255",
QUIET|RETURN_ON_ERROR) &&
QUIET|RETURN_ON_ERROR|NO_DEVMEM_SWITCH) &&
!(readmem(257*PAGESIZE(), PHYSADDR, &tmp,
sizeof(long), "devmem_is_allowed - pfn 257",
QUIET|RETURN_ON_ERROR)))
QUIET|RETURN_ON_ERROR|NO_DEVMEM_SWITCH)))
restricted = TRUE;
}
if (kernel_symbol_exists("jiffies") &&
!readmem(symbol_value("jiffies"), KVADDR, &tmp,
sizeof(ulong), "devmem_is_allowed - jiffies",
QUIET|RETURN_ON_ERROR))
QUIET|RETURN_ON_ERROR|NO_DEVMEM_SWITCH))
restricted = TRUE;
if (restricted)
@@ -2656,6 +2656,8 @@ char *error_handle_string(ulong error_handle)
sprintf(&ebuf[strlen(ebuf)], "%sHB", others++ ? "|" : "");
if (error_handle & RETURN_PARTIAL)
sprintf(&ebuf[strlen(ebuf)], "%sRP", others++ ? "|" : "");
if (error_handle & NO_DEVMEM_SWITCH)
sprintf(&ebuf[strlen(ebuf)], "%sNDS", others++ ? "|" : "");
strcat(ebuf, ")");

0 comments on commit 34842b6

Please sign in to comment.