Skip to content

get-process -module can't get all module for process module map r--s like #27090

@bakamake

Description

@bakamake

Prerequisites

Steps to reproduce

1.dev env

PS /home/bakamake> dotnet --info
.NET SDK:
 Version:           10.0.104
 Commit:            80d3e14f5e
 Workload version:  10.0.100-manifests.c7707153
 MSBuild version:   18.0.11+80d3e14f5

运行时环境:
 OS Name:     ubuntu
 OS Version:  25.10
 OS Platform: Linux
 RID:         ubuntu.25.10-x64
 Base Path:   /usr/lib/dotnet/sdk/10.0.104/

已安装 .NET 工作负载:
没有要显示的已安装工作负载。
已配置为在安装新清单时使用 workload sets。
未安装任何 workload sets。运行 “dotnet workload restore” 以安装工作负载集。

Host:
  Version:      10.0.4
  Architecture: x64
  Commit:       80d3e14f5e

.NET SDKs installed:
  8.0.125 [/usr/lib/dotnet/sdk]
  10.0.104 [/usr/lib/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.25 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 10.0.4 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.25 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 10.0.4 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_BUNDLE_EXTRACT_BASE_DIR           [/home/bakamake/.cache/dotnet_bundle_extract]

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

PS /home/bakamake> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.6.0-preview.6
PSEdition                      Core
GitCommitId                    7.6.0-preview.6
OS                             Ubuntu 25.10
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.4
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

2.dev dir project

  >git clone https://github.com/Linsxyx/KugouMusic.NET.git
  >dotnet restore
  >dotnet publish KugouMusic.NET.slnx -r linux-x64 -c release -o ~/bin/kugou


  >start-Job {. ./bin/kugou/KugouAvaloniaPlayer}

3.get-error

  > (get-process *Kugou* -module|? {([System.IO.FileInfo]$_.Path).Extension -eq ".dll" } ) -eq $null
  True

4.search source code

dev/PowerShell/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs

using System.Diagnostics Modules method from
dev/dotnet/src/runtime/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/ProcessManager.Linux.cs
using ParseMapsModules method from
dev/dotnet/src/runtime/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs

in Interop.ProcFsStat.ParseMapModules.cs
ParseMapsModules -> ParseMapsModulesCore : if HasReadAndExecFlags {CommitCurrentModule}
HasReadAndExecFlags == 'r' ,'x' both in linux proc map perms

5. check dotnet build bin module linux proc map perms

PS /home/bakamake> cat /proc/$((Get-Process -Name pwsh)[0].Id)/maps | Where-Object { $_ -match '\.dll$' } | ForEach-Object {
       $fields = $_ -split '\s+', 6
       [PSCustomObject]@{
           Address = $fields[0]
           Perms        = $fields[1]
           Offset       = $fields[2]
           Device       = $fields[3]
           Inode        = $fields[4]
           Path         = $fields[5]
       }
   }|? {'r' -in $_.Perms.ToCharArray() -and 'x'-in $_.Perms.ToCharArray() }|select -First 10|ft

Address                   Perms Offset   Device Inode Path
-------                   ----- ------   ------ ----- ----
7470b2c70000-7470b37ba000 r-xp  00000000 103:02 28369 /opt/microsoft/powershell/7/System.Private.CoreLib.dll
7470b3d80000-7470b3da1000 r-xp  00000000 103:02 35710 /opt/microsoft/powershell/7/pwsh.dll
7470b3e00000-7470b4c17000 r-xp  00000000 103:02 28341 /opt/microsoft/powershell/7/System.Management.Automation.dll
7470b50d0000-7470b5135000 r-xp  00000000 103:02 28182 /opt/microsoft/powershell/7/Microsoft.PowerShell.ConsoleHost.dll
7470b51e0000-7470b5213000 r-xp  00000000 103:02 28226 /opt/microsoft/powershell/7/System.Collections.dll
7470b5290000-7470b5515000 r-xp  00000000 103:02 28337 /opt/microsoft/powershell/7/System.Linq.Expressions.dll
7470b56c0000-7470b56cd000 r-xp  00000000 103:02 28988 /opt/microsoft/powershell/7/System.Threading.dll
7470b5750000-7470b5d7b000 r-xp  00000000 103:02 28375 /opt/microsoft/powershell/7/System.Private.Xml.dll
7470b5f90000-7470b5fc0000 r-xp  00000000 103:02 28218 /opt/microsoft/powershell/7/System.Collections.Concurrent.dll
7470b6060000-7470b61bf000 r-xp  00000000 103:02 28210 /opt/microsoft/powershell/7/Newtonsoft.Json.dll

PS /home/bakamake> cat /proc/$((Get-Process -Name *kugou*)[0].Id)/maps | Where-Object { $_ -match '\.dll$' } | ForEach-Object {
       $fields = $_ -split '\s+', 6
       [PSCustomObject]@{
           Address = $fields[0]
           Perms        = $fields[1]
           Offset       = $fields[2]
           Device       = $fields[3]
           Inode        = $fields[4]
           Path         = $fields[5]
       }
   }|? {'r' -in $_.Perms.ToCharArray() -and 'x'-in $_.Perms.ToCharArray() }|select -First 10|ft
PS /home/bakamake> cat /proc/$((Get-Process -Name *kugou*)[0].Id)/maps | Where-Object { $_ -match '\.dll$' } | ForEach-Object {
       $fields = $_ -split '\s+', 6
       [PSCustomObject]@{
           Address = $fields[0]
           Perms        = $fields[1]
           Offset       = $fields[2]
           Device       = $fields[3]
           Inode        = $fields[4]
           Path         = $fields[5]
       }
   }|Sort-Object -Unique Perms|ft

Address                   Perms Offset   Device Inode   Path
-------                   ----- ------   ------ -----   ----
7fef0c8fd000-7fef0c91d000 r--s  00000000 103:02 9205015 /home/bakamake/bin/kugou/System.IO.Compression.dll

try pwsh not bug

Expected behavior

> (get-process *Kugou* -module|? {([System.IO.FileInfo]$_.Path).Extension -eq ".dll" } ) -eq $null
  false

Actual behavior

> (get-process *Kugou* -module|? {([System.IO.FileInfo]$_.Path).Extension -eq ".dll" } ) -eq $null
  True

Error details

upstream depend - dotnet bug

Environment data

PS /home/bakamake> dotnet --info
.NET SDK:
 Version:           10.0.104
 Commit:            80d3e14f5e
 Workload version:  10.0.100-manifests.c7707153
 MSBuild version:   18.0.11+80d3e14f5

运行时环境:
 OS Name:     ubuntu
 OS Version:  25.10
 OS Platform: Linux
 RID:         ubuntu.25.10-x64
 Base Path:   /usr/lib/dotnet/sdk/10.0.104/

已安装 .NET 工作负载:
没有要显示的已安装工作负载。
已配置为在安装新清单时使用 workload sets。
未安装任何 workload sets。运行 dotnet workload restore 以安装工作负载集。

Host:
  Version:      10.0.4
  Architecture: x64
  Commit:       80d3e14f5e

.NET SDKs installed:
  8.0.125 [/usr/lib/dotnet/sdk]
  10.0.104 [/usr/lib/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 8.0.25 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 10.0.4 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 8.0.25 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 10.0.4 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_BUNDLE_EXTRACT_BASE_DIR           [/home/bakamake/.cache/dotnet_bundle_extract]

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

PS /home/bakamake> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.6.0-preview.6
PSEdition                      Core
GitCommitId                    7.6.0-preview.6
OS                             Ubuntu 25.10
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.4
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageThe issue is new and needs to be triaged by a work group.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions