ShaderCache: 15.11.1 Crimson, Windows 8.1 -- Strange behavior.

Discussion in 'Videocards - AMD Radeon Drivers Section' started by A2Razor, Dec 11, 2015.

  1. A2Razor

    A2Razor Master Guru

    Messages:
    542
    Likes Received:
    108
    GPU:
    6800XT, XFX Merc319
    A bit concerning. I noticed all these folders that I couldn't quite put my finger on. Suspecting initially malware, corruption, or otherwise. Then I realized that they all contained AMD's DxCache folder, and a single cache file that appears to have a handle open for 'explorer.exe'.

    --Take a gander below at these folders that I noticed.


    Anyone else have similar on their systems? I was running ShaderCache globally set to 0x3200. Think I better stop doing that...

    I suspect that in a certain context of launch, AMD's drivers aren't properly getting the path to %USERPROFILE%\AppData\Local\. The variable that gets filled with this part of the path is probably uninitialized (contains garbage).

    [possibly when a program is run from SYSTEM]

    EDIT: Yeah, the more that I think of it, this makes sense. This is what happens when ShaderCache is used from the SYSTEM user.

    Code:
    C:\AMD\DxCache
    C:\Users\x\AppData\Local\AMD\DxCache
    C:\Windows\System32\ ž“µw\AMD\DxCache
    C:\Windows\System32\860c6adae7240544d81c8..bin\AMD\DxCache
    C:\Windows\System32\@¢Våg\AMD\DxCache
    C:\Windows\System32\¡8¸~\AMD\DxCache
    C:\Windows\System32\*\AMD\DxCache
    C:\Windows\System32\*ž™;6\AMD\DxCache
    C:\Windows\System32\°vñè\AMD\DxCache
    C:\Windows\System32\°ž&…B\AMD\DxCache
    C:\Windows\System32\à¡ÕÌ–\AMD\DxCache
    C:\Windows\System32\ÀžÅÛy\AMD\DxCache
    C:\Windows\System32\ð*]£¯\AMD\DxCache
    C:\Windows\System32\ÿÿÿÿÿÿÿÿ\AMD\DxCache
     
    Last edited: Dec 11, 2015
  2. A2Razor

    A2Razor Master Guru

    Messages:
    542
    Likes Received:
    108
    GPU:
    6800XT, XFX Merc319
    Update: Confirmed in hooking and breaking on the cache writes via API Monitor, also reproducible. This only happens with "SYSTEM" run processes. I'm not sure I'd call it a direct bug (since there is no official option in Crimson to enable ShaderCache globally), but I'll definitely file a report to AMD about it.
     
  3. Cave Waverider

    Cave Waverider Maha Guru

    Messages:
    1,403
    Likes Received:
    261
    GPU:
    RTX 3090 ROG Strix
    Hm, do you have a Windows user/login name with exotic characters, perhaps?
     
  4. A2Razor

    A2Razor Master Guru

    Messages:
    542
    Likes Received:
    108
    GPU:
    6800XT, XFX Merc319
    The user account is "x". Basically that second directory in the list looking for folders named DxCache.


    I haven't put any thought in to how AMD is determining the folder location. Though I guess if they were reading environmental variables from SYSTEM, they'd get a path such as C:\Windows\system32\config\systemprofile. Whatever method they are isn't returning anything (probably has an error), and their code likely doesn't check for success before using the buffer it's to fill. The file-open before the write is what I was hooking and looking at the contents of.

    It gets offset from system32, as that's the working directory at the time. (eg, no drive letter in the file path and so it's done as relative)
     

  5. crz

    crz Member Guru

    Messages:
    186
    Likes Received:
    0
    GPU:
    GeForce GTX 1070 ARMOR 8G
    This has been discussed here: Malware with Crimson? Or False-Positive? - AMDJoe and the conclusion was the same, the cache gets created under the credentials of the process that accesses DX11 and therefore if the process runs under SYSTEM credentials the user folders are redirected to C:\Windows\System32
     
  6. A2Razor

    A2Razor Master Guru

    Messages:
    542
    Likes Received:
    108
    GPU:
    6800XT, XFX Merc319
    Well I'll be. Never would've guessed by the tag of that topic that it'd be the same thing. (given I never had a malware positive with MBAM, SAS, BD, etc)


    Thanks for the link to it.


    EDIT:

    I'll mention that my conclusion is slightly different (if AMD reps read on here). The drivers aren't actually getting a user-profile directory it seems. The path used by ShaderCache seems to be the concatenation of two variables. One is the path to where 'AppData\Local' is to be for the user, and the other is the remainder (eg, AMD\DxCache\... ). However, whatever approach AMD is using to fill that in results in it being uninitialized and that's why the path looks virus-like (somewhat random [whatever is in memory] ).

    In one case, there indeed was a ".bin" in the folder name. I guess that could easily trip a scanner.


    Anyway, the reason that I noticed this was because ShaderCache (enabled globally) was interfering with new versions of ClockBlocker (old cached content). I went to flush the cache before shutting it off entirely, and saw all those 'random named' directories. That set off a huge red-flag and alarmed me.
     
    Last edited: Dec 11, 2015
  7. theoneofgod

    theoneofgod Ancient Guru

    Messages:
    4,652
    Likes Received:
    271
    GPU:
    RX 580 8GB
    I can only imagine AMD didn't anticipate that we would set it on globally.
     
    Last edited: Dec 11, 2015
  8. A2Razor

    A2Razor Master Guru

    Messages:
    542
    Likes Received:
    108
    GPU:
    6800XT, XFX Merc319
    Indeed, this is why I was torn on calling it a bug, and in my report even mention that it's not "really" a bug. But it's still something that should be fixed, also suggesting that it be added into the Crimson CP as an option to globally enable.
     
  9. theoneofgod

    theoneofgod Ancient Guru

    Messages:
    4,652
    Likes Received:
    271
    GPU:
    RX 580 8GB
    I know. If they changed their current method of whitelisting a handful of games that should have shaders cached, to blacklisting those that shouldn't, that would make more sense.
     
  10. A2Razor

    A2Razor Master Guru

    Messages:
    542
    Likes Received:
    108
    GPU:
    6800XT, XFX Merc319
    Yep, overall AMD just needs to view the (perhaps dumb) things that we do (like enabling options that they didn't intend to be enabled) as an indication of the direction the software needs to go. It's what the customer wants.


    ShaderCache is one of the big things that I imagine people desire (reduced load times and load-stutters). Right up there among power-management, pre-render limit, and triple buffer enforcement [all of those should be configurable per application or globally]. I expect these are among some of the biggest things that people want.

    --Any hint of the ability to set things in registry and people are all over them.


    But yes in this case you're absolutely right on that it should be an exclusion.. An 'optimization' doesn't make sense to have defaulted off.
     
    Last edited: Dec 11, 2015

  11. Tugrul_512bit

    Tugrul_512bit Member Guru

    Messages:
    114
    Likes Received:
    0
    GPU:
    msi_r7870hawk_asus_r7_240
    Why is this cache caches only shaders? Why only on disc/ram? It could be faster if cached on gpu memory and not only shaders but also other frequently readed files such as world maps and savegames. It would boost loading times by at least %100 more.
     
  12. PrMinisterGR

    PrMinisterGR Ancient Guru

    Messages:
    8,073
    Likes Received:
    907
    GPU:
    Inno3D RTX 3090
    It doesn't cache on GPU memory. If what you say was done, then you remove memory management from the hands of the developers. This is bad.
     

Share This Page