runtime: Process.MainModule.FileName incorrect with kernel 5.0.0-27-generic (causing MSBuild to be broken)

See https://github.com/dotnet/core/issues/3312 and https://github.com/dotnet/core/issues/3309 .

There are various reports of Process.GetCurrentProcess().MainModule.FileName returning an incorrect value when running .NET Core inside a container on Ubuntu 19.04 using kernel 5.0.0-27-generic. Reverting back to kernel 5.0.0-25-generic fixes this issue.

The same issue also reproduces on the Azure variant of Ubuntu, with kernel version 5.0.0-1018.

The simplest steps to repro that I know of are in https://github.com/dotnet/core/issues/3309 .

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 35 (23 by maintainers)

Commits related to this issue

Most upvoted comments

OK, I opened https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1843018 . I hope that’s the right location to report Ubuntu kernel bugs. If anyone knows about a better way of contacting the Ubuntu team, let me know 😃.

We read this from the /proc/<pid>/maps file. Using kernel 5.0.0-27-generic on Ubuntu 18.04 in a container, every pathname is / instead of the mapped file path.

5.0.0-25-generic (working):

$ sudo docker run ubuntu cat /proc/1/maps
56324a3f5000-56324a3fd000 r-xp 00000000 fc:01 665673                     /bin/cat
56324a5fc000-56324a5fd000 r--p 00007000 fc:01 665673                     /bin/cat
56324a5fd000-56324a5fe000 rw-p 00008000 fc:01 665673                     /bin/cat
56324a8eb000-56324a90c000 rw-p 00000000 00:00 0                          [heap]
7f8ab5f91000-7f8ab6178000 r-xp 00000000 fc:01 666073                     /lib/x86_64-linux-gnu/libc-2.27.so
7f8ab6178000-7f8ab6378000 ---p 001e7000 fc:01 666073                     /lib/x86_64-linux-gnu/libc-2.27.so
7f8ab6378000-7f8ab637c000 r--p 001e7000 fc:01 666073                     /lib/x86_64-linux-gnu/libc-2.27.so
7f8ab637c000-7f8ab637e000 rw-p 001eb000 fc:01 666073                     /lib/x86_64-linux-gnu/libc-2.27.so
7f8ab637e000-7f8ab6382000 rw-p 00000000 00:00 0 
7f8ab6382000-7f8ab63a9000 r-xp 00000000 fc:01 666055                     /lib/x86_64-linux-gnu/ld-2.27.so
7f8ab6583000-7f8ab65a7000 rw-p 00000000 00:00 0 
7f8ab65a9000-7f8ab65aa000 r--p 00027000 fc:01 666055                     /lib/x86_64-linux-gnu/ld-2.27.so
7f8ab65aa000-7f8ab65ab000 rw-p 00028000 fc:01 666055                     /lib/x86_64-linux-gnu/ld-2.27.so
7f8ab65ab000-7f8ab65ac000 rw-p 00000000 00:00 0 
7ffc25954000-7ffc25975000 rw-p 00000000 00:00 0                          [stack]
7ffc259f1000-7ffc259f4000 r--p 00000000 00:00 0                          [vvar]
7ffc259f4000-7ffc259f5000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

5.0.0-27-generic (broken):

$ sudo docker run ubuntu cat /proc/1/maps
55de0e052000-55de0e05a000 r-xp 00000000 fc:01 665673                     /
55de0e259000-55de0e25a000 r--p 00007000 fc:01 665673                     /
55de0e25a000-55de0e25b000 rw-p 00008000 fc:01 665673                     /
55de0fcb3000-55de0fcd4000 rw-p 00000000 00:00 0                          [heap]
7f7a8d881000-7f7a8da68000 r-xp 00000000 fc:01 666073                     /
7f7a8da68000-7f7a8dc68000 ---p 001e7000 fc:01 666073                     /
7f7a8dc68000-7f7a8dc6c000 r--p 001e7000 fc:01 666073                     /
7f7a8dc6c000-7f7a8dc6e000 rw-p 001eb000 fc:01 666073                     /
7f7a8dc6e000-7f7a8dc72000 rw-p 00000000 00:00 0 
7f7a8dc72000-7f7a8dc99000 r-xp 00000000 fc:01 666055                     /
7f7a8de73000-7f7a8de97000 rw-p 00000000 00:00 0 
7f7a8de99000-7f7a8de9a000 r--p 00027000 fc:01 666055                     /
7f7a8de9a000-7f7a8de9b000 rw-p 00028000 fc:01 666055                     /
7f7a8de9b000-7f7a8de9c000 rw-p 00000000 00:00 0 
7ffc744bd000-7ffc744de000 rw-p 00000000 00:00 0                          [stack]
7ffc7452d000-7ffc74530000 r--p 00000000 00:00 0                          [vvar]
7ffc74530000-7ffc74531000 r-xp 00000000 00:00 0                          [vdso]

To those having the mentioned error under their azure vm running Ubuntu: Kernel 5.0.0-1018-azure is affected as well. 5.0.0-1016-azure works.

I enabled the grub timeout following this guide, used the serial console in the azure portal to select the working kernel from the boot menu, and then uninstalled the bad kernel version by calling apt purge linux-image-5.0.0-1018-azure and apt purge linux-headers-5.0.0-1018-azure.

The new Linux Kernel 5.0.0-31 on Ubuntu 18.04.3 LTS with HWE enabled fixes the bug for me.

@danmosemsft, @MichaelSimons: Just so you know, I believe this is still an issue on Azure Ubuntu VMs.

For anyone who has the same issue running Docker builds on Azure Hosted Linux agents, switching to Ubuntu 16.04 fixes the issue. ubuntu:latest has this issue in our case since today.

I’ve escalated internally to the folks who own the GitHub Actions images, but don’t yet have anything concrete to share.

I am getting this on @github actions! Building my docker images is now broken using github actions 😕

Im also seeing this issue on 5.0.0-1020-azure on a Ubuntu 18.04-LTS VM created today so its not fixed yet.

Does this mean that this would be broken in all azure VMs created with that image?

No ETA as of yet, but:

To those having the mentioned error under their azure vm running Ubuntu: Kernel 5.0.0-1018-azure is affected as well. 5.0.0-1016-azure works. Im also seeing this issue on 5.0.0-1020-azure on a Ubuntu 18.04-LTS VM created today so its not fixed yet.

If someone finds a later version does work, that would be good to share here.

I updated my Ubuntu host (18.04.3 LTS) to kernel version 5.2.17 and now it works!

With these instructions it was very easy! https://www.omgubuntu.co.uk/2017/02/ukuu-easy-way-to-install-mainline-kernel-ubuntu

I am getting this on @github actions! Building my docker images is now broken using github actions 😕

Google pointed me here after I teared my hairs out when trying to figure out why my GitHub Actions broken. 😦

changed my dockerimage.yml to runs-on: ubuntu-16.04 temporary solved the problem.

Those hitting this issue, please note that the 5.0.0-27-generic kernel (the current Ubuntu kernel) contains a couple of security fixes, see https://usn.ubuntu.com/4114-1/ and https://usn.ubuntu.com/4115-1/. You may want consider that when reverting your kernel.

PS: There’s a “Does this bug affect you?” link at the top of the page (green text, below the but title) that those who are interested can use to upvote this issue in Launchpad.