Re: [trinity] WARNING: CPU: 0 PID: 515 at drivers/pci/pci-sysfs.c:1224 pci_mmap_resource+0xd6/0x10e

From: Fengguang Wu
Date: Tue Nov 28 2017 - 07:21:41 EST


Hi Dave,

On Mon, Nov 27, 2017 at 04:30:01PM -0500, Dave Jones wrote:
On Fri, Nov 24, 2017 at 08:11:39AM +0800, Fengguang Wu wrote:
> Hello,
>
> FYI this happens in mainline kernel 4.14.0-12995-g0c86a6b.
> It at least dates back to v4.9 .
>
> I wonder where can we avoid this warning, by improving trinity (or how
> we use it), or the pci subsystem?
>
> [main] Added 42 filenames from /dev
> [main] Added 13651 filenames from /proc
> [main] Added 11163 filenames from /sys
> [ 19.452176] ------------[ cut here ]------------
> [ 19.452938] process "trinity-main" tried to map 0x00004000 bytes at page 0x00000001 on 0000:00:06.0 BAR 4 (start 0x fe008000, size 0x 4000)
> [ 19.454804] WARNING: CPU: 0 PID: 515 at drivers/pci/pci-sysfs.c:1224 pci_mmap_resource+0xd6/0x10e

That's a root-only operation, where we allow the user to shoot
themselves in the foot afaik. What you could do now that you're
running an up to date trinity in 0day, is pass the --dropprivs flag
to setuid to nobody in the child processes.

Got it. I wonder if running trinity in root mode (in QEMU, of course)
will help catch more bugs. If so, I'd like to keep the current state,
but ignore the known trinity specific oops (like this one and OOM). We
already have the code to ignore trinity triggered OOM, so it'd be
trivial to add one more oops pattern to ignore.

Thanks,
Fengguang