Home
%3CLINGO-SUB%20id%3D%22lingo-sub-723574%22%20slang%3D%22en-US%22%3EThe%20Case%20of%20the%20Unexpected%20PsList%20Error%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-723574%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3E%20First%20published%20on%20TechNet%20on%20Jul%2005%2C%202007%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%3CP%20class%3D%22MsoNormal%22%20style%3D%22MARGIN%3A%200in%200in%2010pt%22%3E%3CFONT%20face%3D%22Calibri%22%20size%3D%223%22%3E%20Not%20long%20after%20I%20deployed%20Windows%20Vista%20on%20my%20main%20desktop%20system%20I%20noticed%20that%20a%20process%20became%20unresponsive%20and%20appeared%20to%20be%20consuming%20excessive%20amounts%20of%20CPU.%20I%20had%20a%20command%20prompt%20handy%2C%20so%20I%20ran%20%3C%2FFONT%3E%3CA%20href%3D%22http%3A%2F%2Fwww.microsoft.com%2Ftechnet%2Fsysinternals%2Futilities%2Fpslist.mspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CFONT%20face%3D%22Calibri%22%20size%3D%223%22%3EPsList%20%3C%2FFONT%3E%3C%2FA%3E%3CFONT%20face%3D%22Calibri%22%20size%3D%223%22%3Eto%20dump%20detailed%20information%20about%20the%20process%20as%20one%20of%20my%20troubleshooting%20steps.%20Instead%20of%20reporting%20apage%20full%20of%20statistics%20like%20I%20expected%2C%20however%2C%20PsList%20printed%20its%20banner%2C%20an%20error%20message%2C%20and%20exited%3A%20%3C%2FFONT%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%20class%3D%22MsoNormal%22%20style%3D%22MARGIN%3A%200in%200in%2010pt%22%3E%3CSPAN%20style%3D%22mso-spacerun%3A%20yes%22%3E%20%3CFONT%20face%3D%22Calibri%22%20size%3D%223%22%3E%20%3C%2FFONT%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%20class%3D%22MsoNormal%22%20style%3D%22MARGIN%3A%200in%200in%2010pt%22%3E%3CFONT%20face%3D%22Calibri%22%20size%3D%223%22%3E%20%3CIMG%20height%3D%22178%22%20mce_src%3D%22http%3A%2F%2Fblogs.technet.com%2Fphotos%2Fmarkrussinovich%2Fimages%2F1449287%2Foriginal.aspx%22%20original-url%3D%22http%3A%2F%2Fblogs.technet.com%2Fphotos%2Fmarkrussinovich%2Fimages%2F1449287%2Foriginal.aspx%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F120970i9D451B8D46D1919A%22%20style%3D%22WIDTH%3A%20550px%3B%20HEIGHT%3A%20178px%22%20width%3D%22550%22%20%2F%3E%20%3C%2FFONT%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%20class%3D%22MsoNormal%22%20style%3D%22MARGIN%3A%200in%200in%2010pt%22%3E%3CFONT%20face%3D%22Calibri%22%20size%3D%223%22%3E%20PsList%20obtains%20information%20from%20the%20system%20performance%20counters%2C%20which%20an%20application%20accesses%20using%20standard%20Registry%20functions%20directed%20at%20the%20virtual%20HKEY_PERFORMANCE_DATA%20key%2C%20so%20the%20message%20indicated%20that%20PsList%20was%20unable%20to%20query%20the%20virtual%20performance%20keys.%20When%20you%20point%20PsList%20at%20a%20remote%20system%20and%20don%E2%80%99t%20have%20administrative%20rights%20on%20that%20system%2C%20or%20the%20system%20isn%E2%80%99t%20running%20the%20Remote%20Registry%20service%2C%20then%20PsList%20reports%20the%20same%20error%2C%20but%20I%20had%20never%20seen%20the%20message%20when%20using%20PsList%20to%20look%20at%20a%20local%20system.%20Something%20was%20different%20about%20Windows%20Vista%20and%20I%20set%20out%20to%20learn%20what.%20%3C%2FFONT%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%20class%3D%22MsoNormal%22%20style%3D%22MARGIN%3A%200in%200in%2010pt%22%3E%3CFONT%20face%3D%22Calibri%22%20size%3D%223%22%3EPutting%20my%20original%20troubleshooting%20mission%20on%20hold%2C%20I%20launched%20%3C%2FFONT%3E%3CA%20href%3D%22http%3A%2F%2Fwww.microsoft.com%2Ftechnet%2Fsysinternals%2Fprocessesandthreads%2Fprocessmonitor.mspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CFONT%20face%3D%22Calibri%22%20size%3D%223%22%3EProcess%20Monitor%20%3C%2FFONT%3E%3C%2FA%3E%3CFONT%20face%3D%22Calibri%22%20size%3D%223%22%3Eand%20repeated%20the%20PsList%20command%20with%20Process%20Monitor%20looking%20on.%20I%20didn%E2%80%99t%20have%20a%20firm%20expectation%20that%20it%20would%20reveal%20the%20cause%20of%20the%20problem%2C%20but%20experience%20has%20taught%20me%20that%20Process%20Monitor%20(and%20its%20predecessors%20Filemon%20and%20Regmon)%20often%20solves%20seemingly%20unexplainable%20problems%20like%20this.%20I%20scanned%20the%20trace%20looking%20for%20anomalous%20error%20codes%2C%20because%20when%20they%E2%80%99re%20present%20they%20almost%20always%20point%20to%20the%20source%20of%20a%20problem%2C%20and%20found%20an%20access%20denied%20error%3A%20%3C%2FFONT%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%20class%3D%22MsoNormal%22%20style%3D%22MARGIN%3A%200in%200in%2010pt%22%3E%3CIMG%20height%3D%2273%22%20mce_src%3D%22http%3A%2F%2Fblogs.technet.com%2Fphotos%2Fmarkrussinovich%2Fimages%2F1449289%2Foriginal.aspx%22%20original-url%3D%22http%3A%2F%2Fblogs.technet.com%2Fphotos%2Fmarkrussinovich%2Fimages%2F1449289%2Foriginal.aspx%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F120971i50AAED5CD7998CE4%22%20style%3D%22WIDTH%3A%20566px%3B%20HEIGHT%3A%2073px%22%20width%3D%22566%22%20%2F%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%20class%3D%22MsoNormal%22%20style%3D%22MARGIN%3A%200in%200in%2010pt%22%3E%3CFONT%20size%3D%223%22%3E%20%3CFONT%20face%3D%22Calibri%22%3E%20For%20some%20reason%2C%20PsList%2C%20running%20as%20a%20standard%20user%20because%20I%20hadn%E2%80%99t%20elevated%20the%20command%20prompt%20from%20which%20I%20ran%20it%2C%20was%20unable%20to%20open%20the%20PerfLib%20registry%20key%20for%20read%20access.%20I%20was%20perplexed%20because%20on%20Windows%20XP%20I%20had%20been%20able%20to%20run%20PsList%20as%20a%20standard%20user.%20I%20launched%20Regedit%2C%20navigated%20to%20the%20key%2C%20and%20viewed%20its%20permissions.%20As%20I%20suspected%2C%20standard%20users%20aren%E2%80%99t%20members%20of%20any%20of%20the%20groups%20the%20permissions%20grant%20access%20(note%20the%20presence%20of%20two%20new%20performance-related%20groups%2C%20Performance%20Log%26nbsp%3BUsers%20and%20Performance%20Monitor%20Users)%3A%20%3C%2FFONT%3E%20%3C%2FFONT%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%20class%3D%22MsoNormal%22%20style%3D%22MARGIN%3A%200in%200in%2010pt%22%3E%3CSPAN%20style%3D%22mso-spacerun%3A%20yes%22%3E%20%3CFONT%20face%3D%22Calibri%22%20size%3D%223%22%3E%20%3CIMG%20height%3D%22275%22%20mce_src%3D%22http%3A%2F%2Fblogs.technet.com%2Fphotos%2Fmarkrussinovich%2Fimages%2F1449291%2Foriginal.aspx%22%20original-url%3D%22http%3A%2F%2Fblogs.technet.com%2Fphotos%2Fmarkrussinovich%2Fimages%2F1449291%2Foriginal.aspx%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F120972iA9629C63B38CEF16%22%20style%3D%22WIDTH%3A%20550px%3B%20HEIGHT%3A%20275px%22%20width%3D%22550%22%20%2F%3E%20%3C%2FFONT%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%20class%3D%22MsoNormal%22%20style%3D%22MARGIN%3A%200in%200in%2010pt%22%3E%3CFONT%20face%3D%22Calibri%22%20size%3D%223%22%3E%20I%20quickly%20confirmed%20that%20to%20be%20the%20reason%20for%20PsList%E2%80%99s%20failure%20by%20granting%20the%20Interactive%20Users%20group%20read%20access%20to%20the%20key%20and%20verifying%20that%20PsList%20subsequently%20worked.%20Now%20I%20was%20left%20with%20the%20question%20of%20what%20permissions%20Windows%20XP%20assigns%20the%20key.%20I%20switched%20to%20a%20Windows%20XP%20test%20system%20and%20viewed%20the%20key%E2%80%99s%20permissions.%20Sure%20enough%2C%20Interactive%20Users%20have%20read%20access%2C%20explaining%20why%20PsList%20works%20as%20a%26nbsp%3Bstandard%20user%20on%20Windows%20XP%20systems%3A%20%3C%2FFONT%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%20class%3D%22MsoNormal%22%20style%3D%22MARGIN%3A%200in%200in%2010pt%22%3E%3CIMG%20height%3D%22224%22%20mce_src%3D%22http%3A%2F%2Fblogs.technet.com%2Fphotos%2Fmarkrussinovich%2Fimages%2F1449294%2Foriginal.aspx%22%20original-url%3D%22http%3A%2F%2Fblogs.technet.com%2Fphotos%2Fmarkrussinovich%2Fimages%2F1449294%2Foriginal.aspx%22%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F120973i50A86F1AC2774CF2%22%20style%3D%22WIDTH%3A%20530px%3B%20HEIGHT%3A%20224px%22%20width%3D%22530%22%20%2F%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%20class%3D%22MsoNormal%22%20style%3D%22MARGIN%3A%200in%200in%2010pt%22%3E%3CSPAN%20style%3D%22mso-no-proof%3A%20yes%22%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%20class%3D%22MsoNormal%22%20style%3D%22MARGIN%3A%200in%200in%2010pt%22%3E%3CFONT%20face%3D%22Calibri%22%20size%3D%223%22%3E%20I%20then%20pondered%20the%20reason%20for%20the%20change.%20I%20suspected%20the%20new%20permissions%20close%20an%20information%20disclosure%20hole%2C%20but%20after%20some%20thought%20I%20concluded%20that%20they%20aren%E2%80%99t%20closing%20any%20hole.%20%3C%2FFONT%3E%20%3CFONT%20face%3D%22Calibri%22%20size%3D%223%22%3E%20The%20PerfLib%20key%20is%20where%20performance%20providers%20register%20their%20counters%20and%20DLLs%2C%20so%20when%20a%20tool%20like%20PsList%20queries%20a%20counter%20the%20performance%20API%20loads%20the%20associated%20DLL%20into%20the%20querying%20process%20and%20calls%20functions%20in%20the%20DLL%20that%20return%20the%20desired%20data.%20Because%20the%20DLLs%20execute%20in%20the%20context%20of%20the%20process%20into%20which%20they%20load%2C%20they%20can%E2%80%99t%20implement%20security%20that%20can%E2%80%99t%20be%20easily%20circumvented%20by%20the%20process.%20It%E2%80%99s%20therefore%20the%20responsibility%20of%20a%20performance%20data%20source%2C%20which%20might%20be%20the%20kernel%20or%20an%20application%20like%20Internet%20Information%20Server%20(IIS)%2C%20to%20prevent%20unauthorized%20access%20to%20its%20performance%20data.%20%3C%2FFONT%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%20class%3D%22MsoNormal%22%20style%3D%22MARGIN%3A%200in%200in%2010pt%22%3E%3CFONT%20face%3D%22Calibri%22%20size%3D%223%22%3E%20Preventing%20read%20access%20to%20the%20PerfLib%20key%20is%20therefore%20the%20equivalent%20of%20having%20a%20performance%20DLL%20implement%20security.%20While%20locking%20down%20the%20key%20prevents%20the%20performance%20API%20from%20determining%20what%20counters%20are%20available%20and%20what%20DLLs%20provide%20performance%20data%2C%20with%20the%20exception%20of%20add-on%20applications%2C%20the%20core%20registrations%20are%20constant%20from%20system%20to%20system.%20That%20means%20that%20a%20process%20can%20circumvent%20any%20protection%20the%20locked-down%20key%20is%20attempting%20to%20provide%20by%20directly%20loading%20performance%20DLLs%20and%20calling%20their%20data%20functions.%20%3C%2FFONT%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%20class%3D%22MsoNormal%22%20style%3D%22MARGIN%3A%200in%200in%2010pt%22%3E%3CFONT%20face%3D%22Calibri%22%20size%3D%223%22%3E%20To%20make%20a%20long%20story%20short%2C%20I%20filed%20a%20bug%20against%20Windows%20Vista%20Service%20Pack%201%20(SP1)%20and%20Windows%20Server%202008%20to%20have%20Interactive%20Users%20added%20back%20to%20PerfLib%E2%80%99s%20permissions.%20The%20reliability%20and%20diagnostics%20team%20reported%20back%20that%20the%20permissions%20changed%20inadvertently%20during%20the%20release%20of%20Windows%20Server%202003%2C%20but%20I%20convinced%20them%20it%20didn%E2%80%99t%20make%20sense%2C%20so%26nbsp%3Bin%20SP1%20and%20Windows%20Server%202008%20you%20won%E2%80%99t%20need%20to%20edit%20PerfLib%E2%80%99s%20permissions%20to%20be%20able%20to%20run%20tools%20like%20PsList%20as%20a%20standard%20user.%20%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22Calibri%22%20size%3D%223%22%3E%20%3C%2FFONT%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%20class%3D%22MsoNormal%22%20style%3D%22MARGIN%3A%200in%200in%2010pt%22%3E%3C%2FP%3E%3CP%3E%3CFONT%20face%3D%22Calibri%22%20size%3D%223%22%3E%20Another%20case%20closed%20by%20Process%20Monitor!%20%3C%2FFONT%3E%3C%2FP%3E%0A%20%20%3CP%3E%3C%2FP%3E%0A%20%0A%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-723574%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20TechNet%20on%20Jul%2005%2C%202007%20Not%20long%20after%20I%20deployed%20Windows%20Vista%20on%20my%20main%20desktop%20system%20I%20noticed%20that%20a%20process%20became%20unresponsive%20and%20appeared%20to%20be%20consuming%20excessive%20amounts%20of%20CPU.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-723574%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMark%20Russinovich%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft
First published on TechNet on Jul 05, 2007

Not long after I deployed Windows Vista on my main desktop system I noticed that a process became unresponsive and appeared to be consuming excessive amounts of CPU. I had a command prompt handy, so I ran PsList to dump detailed information about the process as one of my troubleshooting steps. Instead of reporting apage full of statistics like I expected, however, PsList printed its banner, an error message, and exited:




PsList obtains information from the system performance counters, which an application accesses using standard Registry functions directed at the virtual HKEY_PERFORMANCE_DATA key, so the message indicated that PsList was unable to query the virtual performance keys. When you point PsList at a remote system and don’t have administrative rights on that system, or the system isn’t running the Remote Registry service, then PsList reports the same error, but I had never seen the message when using PsList to look at a local system. Something was different about Windows Vista and I set out to learn what.


Putting my original troubleshooting mission on hold, I launched Process Monitor and repeated the PsList command with Process Monitor looking on. I didn’t have a firm expectation that it would reveal the cause of the problem, but experience has taught me that Process Monitor (and its predecessors Filemon and Regmon) often solves seemingly unexplainable problems like this. I scanned the trace looking for anomalous error codes, because when they’re present they almost always point to the source of a problem, and found an access denied error:



For some reason, PsList, running as a standard user because I hadn’t elevated the command prompt from which I ran it, was unable to open the PerfLib registry key for read access. I was perplexed because on Windows XP I had been able to run PsList as a standard user. I launched Regedit, navigated to the key, and viewed its permissions. As I suspected, standard users aren’t members of any of the groups the permissions grant access (note the presence of two new performance-related groups, Performance Log Users and Performance Monitor Users):



I quickly confirmed that to be the reason for PsList’s failure by granting the Interactive Users group read access to the key and verifying that PsList subsequently worked. Now I was left with the question of what permissions Windows XP assigns the key. I switched to a Windows XP test system and viewed the key’s permissions. Sure enough, Interactive Users have read access, explaining why PsList works as a standard user on Windows XP systems:




I then pondered the reason for the change. I suspected the new permissions close an information disclosure hole, but after some thought I concluded that they aren’t closing any hole. The PerfLib key is where performance providers register their counters and DLLs, so when a tool like PsList queries a counter the performance API loads the associated DLL into the querying process and calls functions in the DLL that return the desired data. Because the DLLs execute in the context of the process into which they load, they can’t implement security that can’t be easily circumvented by the process. It’s therefore the responsibility of a performance data source, which might be the kernel or an application like Internet Information Server (IIS), to prevent unauthorized access to its performance data.


Preventing read access to the PerfLib key is therefore the equivalent of having a performance DLL implement security. While locking down the key prevents the performance API from determining what counters are available and what DLLs provide performance data, with the exception of add-on applications, the core registrations are constant from system to system. That means that a process can circumvent any protection the locked-down key is attempting to provide by directly loading performance DLLs and calling their data functions.


To make a long story short, I filed a bug against Windows Vista Service Pack 1 (SP1) and Windows Server 2008 to have Interactive Users added back to PerfLib’s permissions. The reliability and diagnostics team reported back that the permissions changed inadvertently during the release of Windows Server 2003, but I convinced them it didn’t make sense, so in SP1 and Windows Server 2008 you won’t need to edit PerfLib’s permissions to be able to run tools like PsList as a standard user.


Another case closed by Process Monitor!