[Crash-utility] [PATCH] Fix live debugging with lockdown=integrity

lijiang lijiang at redhat.com
Mon Nov 15 05:29:14 UTC 2021


Thank you for the fix, Philipp. Applied:
https://github.com/crash-utility/crash/commit/01d20ca1861ffaf449c1c60aa0536e9f42200ad3

On Fri, Nov 12, 2021 at 1:03 AM <crash-utility-request at redhat.com> wrote:

> Date: Thu, 11 Nov 2021 07:45:51 +0000
> From: HAGIO KAZUHITO(?????)     <k-hagio-ab at nec.com>
> To: Philipp Rudo <prudo at redhat.com>
> Cc: "Discussion list for crash utility usage,   maintenance and
>         development" <crash-utility at redhat.com>
> Subject: Re: [Crash-utility] [PATCH] Fix live debugging with
>         lockdown=integrity
> Message-ID:
>         <
> TYYPR01MB67772F7C8616E337FF66787CDD949 at TYYPR01MB6777.jpnprd01.prod.outlook.com
> >
>
> Content-Type: text/plain; charset="iso-2022-jp"
>
> -----Original Message-----
> > With kernel lockdown the access to kernel interfaces that allow to
> > extract confidential information (lockdown=confidentiality) or modify a
> > running kernel (lockdown=integrity) can be restricted. Two of the
> > interfaces that can be restricted are /dev/mem (integrity &
> > confidentiality) and /proc/kcore (confidentiality). With
> > lockdown=integrity this leads to a situation where /dev/mem exists but
> > is not readable while /proc/kcore exists and is readable. This breaks
> > crash's live debugging when it is invoked without argument, i.e.
> >
> > $ crash
> > [...]
> > crash: /dev/mem: Operation not permitted
> >
> > while passing /proc/kcore as image succeeds. The reason for this is that
> > crash always picks /dev/mem as source when it exits but doesn't check if
> > it is readable. Fix this by only selecting /dev/mem when it is readable.
> >
> > Signed-off-by: Philipp Rudo <prudo at redhat.com>
>
> Thank you for the patch.
>
> Acked-by: Kazuhito Hagio <k-hagio-ab at nec.com>
>
> Kazu
>
> > ---
> >  filesys.c | 2 +-
> >  main.c    | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/filesys.c b/filesys.c
> > index 3361b6c..43cbe82 100644
> > --- a/filesys.c
> > +++ b/filesys.c
> > @@ -3666,7 +3666,7 @@ get_live_memory_source(void)
> >       if (pc->live_memsrc)
> >               goto live_report;
> >
> > -     if (file_exists("/dev/mem", NULL))
> > +     if (file_readable("/dev/mem"))
> >               pc->live_memsrc = "/dev/mem";
> >       else if (file_exists("/proc/kcore", NULL)) {
> >               pc->flags &= ~DEVMEM;
> > diff --git a/main.c b/main.c
> > index 71c59d2..b278c22 100644
> > --- a/main.c
> > +++ b/main.c
> > @@ -1119,7 +1119,7 @@ setup_environment(int argc, char **argv)
> >       pc->flags2 |= REDZONE;
> >       pc->confd = -2;
> >       pc->machine_type = MACHINE_TYPE;
> > -     if (file_exists("/dev/mem", NULL)) {     /* defaults until argv[]
> is parsed */
> > +     if (file_readable("/dev/mem")) {     /* defaults until argv[] is
> parsed */
> >               pc->readmem = read_dev_mem;
> >               pc->writemem = write_dev_mem;
> >       } else if (file_exists("/proc/kcore", NULL)) {
> > --
> > 2.31.1
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20211115/7168a6b4/attachment.htm>


More information about the Crash-utility mailing list