Radare2: pdb download fails on Linux

Created on 13 Feb 2018  路  25Comments  路  Source: radareorg/radare2

When I run idpd. I think it may be trying to save it to the arbitrary windows directory -- which isn't even possible because I'm cross-disassembling on Linux.

[0x100401000]> idpd
curl exited with error 1
Falling back to uncompressed pdb
curl exited with error 1
PDB "d:\dbs\sh\s17o\1116_092427_2\cmd\27\obj\x64retail\sql\ntdbms\optimization\postprofiling\sqllang\sqllang.vcxproj\optimized\sqllang.pdb" download failed

which is weird because I believe the pdb is there. I believe all you're supposed to do is insert the GUID from the pe32 and the name of the file. So it would be,

http://msdl.microsoft.com/download/symbols/sqllang.pdb/40D5A1EFAD844ABFA5A689F2E49153E12/sqllang.pdb

Information from the pe32 (shows the guid detected)

[0x100401000]> i
blksz    0x0
block    0x100
fd       3
file     ./lib/sqlservr/Content/binn/sqllang.dll
format   pe64
iorw     false
mode     -r-x
size     0x27440a0
humansz  39.3M
type     DLL (Dynamic Link Library)
arch     x86
binsz    41173152
bintype  pe
bits     64
canary   false
class    PE32+
cmp.csum 0x0274b24b
compiled Thu Nov 16 14:55:33 2017
crypto   false
dbg_file d:\dbs\sh\s17o\1116_092427_2\cmd\27\obj\x64retail\sql\ntdbms\optimization\postprofiling\sqllang\sqllang.vcxproj\optimized\sqllang.pdb
endian   little
havecode true
hdr.csum 0x0274b24b
guid     40D5A1EFAD844ABFA5A689F2E49153E12
linenum  false
lsyms    false
machine  AMD 64
maxopsz  16
minopsz  1
nx       true
os       windows
overlay  true
pcalign  0
pic      true
relocs   false
signed   true
static   false
stripped true
subsys   Windows GUI
va       true
r2 -v
radare2 2.4.0-git 17262 @ linux-x86-64 git.2.2.0-455-g1414625ae
commit: 1414625ae02b95f53986abab260735b9d45d7048 build: 2018-02-12__17:21:56

-V
2.2.0-455-g1414625ae  r2
2.2.0-455-g1414625ae  r_anal
2.2.0-455-g1414625ae  r_lib
2.2.0-455-g1414625ae  r_egg
2.2.0-455-g1414625ae  r_asm
2.2.0-455-g1414625ae  r_bin
2.2.0-455-g1414625ae  r_cons
2.2.0-455-g1414625ae  r_flag
2.2.0-455-g1414625ae  r_core
2.2.0-455-g1414625ae  r_crypto
2.2.0-455-g1414625ae  r_bp
2.2.0-455-g1414625ae  r_debug
2.2.0-455-g1414625ae  r_hash
2.2.0-455-g1414625ae  r_fs
2.2.0-455-g1414625ae  r_io
2.2.0-455-g1414625ae  r_magic
2.2.0-455-g1414625ae  r_parse
2.2.0-455-g1414625ae  r_reg
2.2.0-455-g1414625ae  r_sign
2.2.0-455-g1414625ae  r_search
2.2.0-455-g1414625ae  r_syscall
2.2.0-455-g1414625ae  r_util
Windows debug-info

All 25 comments

i think https://github.com/radare/radare2/pull/9389 have fixed this. can you confirmed?

@EvanCarroll can you please retry with latest master?

Just did. No joy.

radare2 ./lib/sqlservr/Content/binn/sqllang.dll
 -- phrack, better than java in the browser -- jvoisin
[0x100412a10]> idpd
curl exited with error 1
Falling back to uncompressed pdb
curl exited with error 1
PDB "d:\dbs\sh\s17o\1116_092427_2\cmd\27\obj\x64retail\sql\ntdbms\optimization\postprofiling\sqllang\sqllang.vcxproj\optimized\sqllang.pdb" download failed

-v shows,

radare2 2.4.0-git 17266 @ linux-x86-64 git.2.2.0-459-g28c84c23e
commit: 28c84c23efef44277ae9605a86f8dcec4c82f898 build: 2018-02-13__22:48:50

Strange, cannot reproduce on Linux with some random Windows DLLs, Check the contents of your ~/.config/radare2/pdb

I have three dirs in that directory. Are they safe to delete?

d:\dbs\sh\s17o\1116_092427_2\cmd\13\obj\x64retail\sql\ntdbms\optimization\postprofiling\sqlservr\sqlservr.vcxproj\optimized\sqlservr.pdb
d:\dbs\sh\s17o\1116_092427_2\cmd\27\obj\x64retail\sql\ntdbms\optimization\postprofiling\sqllang\sqllang.vcxproj\optimized\sqllang.pdb
sqlpal.pdb

I delete the whole pdb directory and tried again. same result.

Oh, I see, it uses the Windows path as a filename, which is obviously wrong.

~Ah I believe I broke this. Looking.~

Perhaps it should just save as GUID as in the pe32 header, like the URL server itself?

What version of sqllang.dll are you using? Can you zip it up/drop it into this issue temporarily? Trying to set up a repro.

Sure, it's from the Linux distribution of SQL Server. Packaged in the sfp

sqllang.dll.zip

Great, thanks. I can repro here on Windows too, looks like current assumption around PDB RSDS header having just a filename is incorrect. Standby for fix.

Fixed in https://github.com/radare/radare2/pull/9395, awaiting review/merge.
@XVilka Don't think 'regression' tag is appropriate; there's no indication full paths were ever supported

Hey @EvanCarroll good news, looks like it was merged into master. Can you try it again for us?

[0x100412a10]> idpd
curl exited with error 1
Falling back to uncompressed pdb

PDB "sqllang.pdb" download success

Not sure we want that error, but it seems to have worked.

ls ~/.config/radare2/pdb/sqllang.pdb/40D5A1EFAD844ABFA5A689F2E49153E12/
sqllang.pd_

If the issue is fixed, close the issue

Yep, it's fixed thanks again!

@EvanCarroll Just heads up: idpd shells out and calls curl twice -- first it tries to download the compressed pdb (e.g. sqllang.pd_) then falls back onto the uncompressed copy (e.g. sqllang.pdb), hence the initial error.

If that's true, should it be saving the file as sqllang.pd_ or sqllang.pdb? It's falling back to the uncompressed version but saving it as sqllang.pd_

@EvanCarroll It should be downloading and storing it in the symbol store as sqllang.pdb. I fixed a bug around this not working properly (https://github.com/radare/radare2/pull/9396) around the same time as this bug -- make sure your codebase is up-to-date! (admittedly, untested on Linux/macOS)

@riverar Using Linux, I just updated the code base again. Same thing. Just to be clear it's downloading into

~/.config/radare2/pdb/sqllang.pdb/

But the file is sqllang.pd_

/home/ecarroll/.config/radare2/pdb/sqllang.pdb/40D5A1EFAD844ABFA5A689F2E49153E12/sqllang.pd_

@EvanCarroll OK, thanks for your patience and sorry for the headaches. Will fire up a linux dev environment right now and get this fixed for you.

no, rush @riverar thanks for being prompt but I'm just learning. I can't do anything without getting the pdb actually being parsable anyway. =) I didn't even know what a pdb was until last week.

@EvanCarroll verified working here; make sure you install/have cabextract on your linux box

I have cabextract here

$ cabextract -v
cabextract version 1.6

not sure what to say..

[0x100412a10]> idpd
curl exited with error 1
Falling back to uncompressed pdb
PDB "sqllang.pdb" download success

[0x100412a10]> idp
File 'sqllang.pdb' not found in file directory or symbol store

It's there though..

/home/ecarroll/.config/radare2/pdb/sqllang.pdb/40D5A1EFAD844ABFA5A689F2E49153E12/sqllang.pd_

And, I can run

[0x100412a10]> idp /home/ecarroll/.config/radare2/pdb/sqllang.pdb/40D5A1EFAD844ABFA5A689F2E49153E12/sqllang.pd_

Are you using the dll I provided above? I'm not even sure it's cab, registers as

MSVC program database ver 7.00, 1024*64723 bytes

If I try to extract it

$ cabextract /home/ecarroll/.config/radare2/pdb/sqllang.pdb/40D5A1EFAD844ABFA5A689F2E49153E12/sqllang.pd_
/home/ecarroll/.config/radare2/pdb/sqllang.pdb/40D5A1EFAD844ABFA5A689F2E49153E12/sqllang.pd_: no valid cabinets found

All done, errors in processing 1 file(s)

@EvanCarroll Sorry, yep, I can reproduce.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NotAFile picture NotAFile  路  6Comments

S01den picture S01den  路  4Comments

XVilka picture XVilka  路  6Comments

XVilka picture XVilka  路  3Comments

YugoCode picture YugoCode  路  6Comments