mchoo7 wrote:

`/dev/mem` is only accessible with root privilege, so security doesn't really 
matter here. Thus the readonly option I added here isn't tied to security 
because lldb wouldn't load `/dev/mem` if there is no root privilege at the 
first place.

E.g.:
```console
$ lldb /boot/kernel/kernel -c /dev/mem
(lldb) target create "/boot/kernel/kernel" --core "/dev/mem"
error: Cannot open '/dev/mem': Permission denied.
```

That's why I chose the word "safety". System stability can be a synonym here.

> I'm ok with the code, and the settings part we already had reviewed. I just 
> want to know about:
> 
> > Implement ProcessFreeBSDKernelCore::DoWriteMemory() to write data on kernel 
> > dump or /dev/mem.
> 
> Can you define what "kernel dump" is here? Because I'm thinking of it like an 
> elf core, and writing to "memory" in an elf core I suppose could be done but 
> is generally not allowed.
> 
> Can you explain that a bit more?
> 
> I agree with this setting's importance for /dev/mem, which I understand to be 
> a window into the live kernel.

By kernel dump, I mean kernel crash dump described 
[here](https://docs.freebsd.org/en/books/developers-handbook/kerneldebug/). 
I'll reword the PR description.

Kernel crash dump is/isn't kernel crash dump depending on its format. Full 
kernel crash dump is a elf core. The whole system memory (including unused 
pages) are dumped onto physical storage. The downside of this is that there are 
systems using hundreds of GB or a few TB of ram, and sometimes it's difficult 
to secure a block storage with that capacity. So FreeBSD got another kernel 
crash dump format called minidump (itis different from lldb's minidump plugin 
which is windows crash dump only). Minidump is not elf core so it needs 
FreeBSD's `kvm` to handle memory read/write. This is the main blocker that 
prevents us from making FreeBSDKernelCore plugin cross-platform. A possible 
solution for this is creating a utility that converts minidump to elf format, 
but that's not in my scope for now.

https://github.com/llvm/llvm-project/pull/183553
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to