----- Original Message -----
> On 11/19/2015 08:37 AM, David Mair wrote:
> > On 11/19/2015 07:45 AM, Dave Anderson wrote:
> > 
> > Hi Dave,
> > 
> >> ----- Original Message -----
> > <snip>
> >>
> >>> (2) Execute "crash -d8" on physical machine will cause crash utility core
> >>> dump.
> >>
> >> I can reproduce this, so I'll look into it.  It's related to the /dev/mem 
> >> "test"
> >> to determine whether the kernel was configured with CONFIG_STRICT_DEVMEM, 
> >> where
> >> it tries to read from pfn 257 (just above the CONFIG_STRICT_DEVMEM limit), 
> >> but
> >> gets into an infinite loop when used in conjunction with -d.
> >>
> >> Anyway, just continue to use /proc/kcore and you should be fine.
> > 
> > This is the cause in readmem():
> > 
> > switch(READMEM(...))
> > {
> >     .
> >     .
> >     .
> > case READ_ERROR:
> >     if (PRINT_ERROR_MESSAGE) ********** THIS ***********
> >     {
> >             causes a nested readmem() call before the goto gives it
> >             to the caller to deal with
> >     }
> >     goto readmem_error
> > }
> >     .
> >     .
> >     .
> > switch(error_handle)
> > {
> >     case (RETURN_ON_ERROR):
> > }
> > 
> > The PRINT_ERROR_MESSAGE I assume is an escalation from -d 8 in this case.
> > 
> 
> The whole switch_to_proc_kcore() probably shouldn't be conditional on
> the presence of PRINT_ERROR_MESSAGE, only the actual error message
> should be.
> 
> Patch shortly.
> 
> --
> David.

Yeah, I agree.  It was done that way to catch the very first non-QUIET readmem()
call from kernel_init(), and make the bait-and-switch right there.  Without the 
CRASHDEBUG(x) override, it works as-is because the readmem() calls in 
devmem_is_restricted() are purposely set to QUIET.  

So we're thinking something like this, right?:

diff --git a/memory.c b/memory.c
index 824b3ae..2282ba9 100644
--- a/memory.c
+++ b/memory.c
@@ -2207,13 +2207,12 @@ 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 ((pc->flags & DEVMEM) && (kt->flags & 
PRE_KERNEL_INIT) && 
+                           !(error_handle & QUIET) && 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;
 
                case PAGE_EXCLUDED:

Works for me, and is better than hiding a recursive-call check in 
devmem_is_restricted().

Dave



--
Crash-utility mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/crash-utility

Reply via email to