Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win32-dir 0.5.1 crash on Windows #29

Closed
jay4git opened this issue Nov 30, 2020 · 5 comments
Closed

win32-dir 0.5.1 crash on Windows #29

jay4git opened this issue Nov 30, 2020 · 5 comments

Comments

@jay4git
Copy link

jay4git commented Nov 30, 2020

Description

win32-dir 0.5.1 with ffi 1.13.1 crashes on Windows when dir.rb is loaded and it calls SHGetFileInfo():

-- Control frame information -----------------------------------------------
c:0027 p:---- s:0147 e:000146 CFUNC :SHGetFileInfo
c:0026 p:0223 s:0138 e:000137 BLOCK C:/tst_ffi_1_13_1.16.0/lib/ruby/gems/2.5.0/gems/win32-dir-0.5.1/lib/win32/dir.rb:93 [FINISH]
c:0025 p:---- s:0128 e:000127 CFUNC :each
c:0024 p:0288 s:0124 e:000123 CLASS C:/tst_ffi_1_13_1/lib/ruby/gems/2.5.0/gems/win32-dir-0.5.1/lib/win32/dir.rb:74
c:0023 p:0028 s:0120 e:000119 TOP C:/tst_ffi_1_13_1/lib/ruby/gems/2.5.0/gems/win32-dir-0.5.1/lib/win32/dir.rb:5 [FINISH]
c:0022 p:---- s:0117 e:000116 CFUNC :require
c:0021 p:0091 s:0112 e:000111 RESCUE C:/tst_ffi_1_13_1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135
c:0020 p:0378 s:0108 e:000107 METHOD C:/tst_ffi_1_13_1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39
c:0019 p:0006 s:0096 e:000095 EVAL (irb):1 [FINISH]
c:0018 p:---- s:0093 e:000092 CFUNC :eval
c:0017 p:0021 s:0085 e:000084 METHOD C:/tst_ffi_1_13_1/lib/ruby/2.5.0/irb/workspace.rb:85
c:0016 p:0021 s:0077 e:000075 METHOD C:/tst_ffi_1_13_1/lib/ruby/2.5.0/irb/context.rb:380
c:0015 p:0017 s:0070 e:000069 BLOCK C:/tst_ffi_1_13_1/lib/ruby/2.5.0/irb.rb:491
c:0014 p:0025 s:0060 e:000059 METHOD C:/tst_ffi_1_13_1/lib/ruby/2.5.0/irb.rb:623
c:0013 p:0008 s:0054 e:000053 BLOCK C:/tst_ffi_1_13_1/lib/ruby/2.5.0/irb.rb:488
c:0012 p:0100 s:0049 e:000048 BLOCK C:/tst_ffi_1_13_1/lib/ruby/2.5.0/irb/ruby-lex.rb:246 [FINISH]
c:0011 p:---- s:0045 e:000044 CFUNC :loop
c:0010 p:0006 s:0041 e:000040 BLOCK C:/tst_ffi_1_13_1/lib/ruby/2.5.0/irb/ruby-lex.rb:232 [FINISH]
c:0009 p:---- s:0038 e:000037 CFUNC :catch
c:0008 p:0012 s:0033 e:000032 METHOD C:/tst_ffi_1_13_1/lib/ruby/2.5.0/irb/ruby-lex.rb:231
c:0007 p:0031 s:0029 E:001630 METHOD C:/tst_ffi_1_13_1/lib/ruby/2.5.0/irb.rb:487
c:0006 p:0005 s:0025 e:000024 BLOCK C:/tst_ffi_1_13_1/lib/ruby/2.5.0/irb.rb:428 [FINISH]
c:0005 p:---- s:0022 e:000021 CFUNC :catch
c:0004 p:0064 s:0017 E:001158 METHOD C:/tst_ffi_1_13_1/lib/ruby/2.5.0/irb.rb:427
c:0003 p:0102 s:0012 e:000011 METHOD C:/tst_ffi_1_13_1/lib/ruby/2.5.0/irb.rb:383
c:0002 p:0019 s:0006 e:000005 EVAL C:/tst_ffi_1_13_1/bin/irb.cmd:21 [FINISH]
c:0001 p:0000 s:0003 E:000bd0 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------

C:\tst_ffi_1_13_1\bin\ruby.exe(__scrt_common_main_seh'::1'::filt$0+0x16) [0x00007FF7A1521B8C] D:\agent_work\9\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:304
C:\Windows\SYSTEM32\VCRUNTIME140.dll(_C_specific_handler+0xa0) [0x00007FFFD8FDE390]
C:\Windows\SYSTEM32\ntdll.dll(_chkstk+0x11f) [0x00007FFFE733479F]
C:\Windows\SYSTEM32\ntdll.dll(RtlWalkFrameChain+0x14bf) [0x00007FFFE7294BEF]
C:\Windows\SYSTEM32\ntdll.dll(KiUserExceptionDispatcher+0x2e) [0x00007FFFE733350E]
C:\Windows\System32\SHELL32.dll(SHBindToFolderIDListParentEx+0x6e) [0x00007FFFE461E5DE]
C:\Windows\System32\SHELL32.dll(PathResolve+0x4ac2) [0x00007FFFE46B0752]
C:\Windows\System32\SHELL32.dll(SHGetFileInfoW+0x2cb) [0x00007FFFE460B9AB]
C:\Windows\System32\SHELL32.dll(SHGetFileInfoA+0x78) [0x00007FFFE45D07E8]
C:\tst_ffi_1_13_1\bin\libffi.dll(ffi_prep_go_closure+0x1c1) [0x00007FFFCD4A4391]
C:\tst_ffi_1_13_1\bin\libffi.dll(ffi_prep_raw_closure+0x17d) [0x00007FFFCD4A416D]
C:\tst_ffi_1_13_1\bin\libffi.dll(ffi_call+0x12) [0x00007FFFCD4A41B2]
C:\tst_ffi_1_13_1\lib\ruby\gems\2.5.0\gems\ffi-1.13.1\lib\ffi_c.so(rbffi_CallFunction+0x20a) [0x00007FFFCD4B7636] c:\tst_ffi_1_13_1\lib\ruby\gems\2.5.0\gems\ffi-1.13.1\ext\ffi_c\Call.c:410
C:\tst_ffi_1_13_1\lib\ruby\gems\2.5.0\gems\ffi-1.13.1\lib\ffi_c.so(attached_method_invoke+0x26) [0x00007FFFCD4BACBE] c:\tst_ffi_1_13_1\lib\ruby\gems\2.5.0\gems\ffi-1.13.1\ext\ffi_c\MethodHandle.c:178
C:\tst_ffi_1_13_1\bin\libffi.dll(ffi_prep_go_closure+0x14c) [0x00007FFFCD4A431C]

Is there a fix for this crash?

Gem Version

win32-dir 0.5.1

Windows Version

Windows 2019

Replication Case

In Ruby irb, type: the following
require 'win32/dir'

@mwrock
Copy link
Member

mwrock commented Nov 30, 2020

I am unable to preproduce locally (latest windows 10 RTM build). My guess is that this is related either to ruby version (I am on 2.7) and/or the ASLR crash discussed in #28. It is also possible that the ASLR related crash is also related to ruby version since I am on the default High-Entropy ASLR setting (on) and do not crash.

So it would be interesting to see if the change in #28 fixes your crash.

@jay4git
Copy link
Author

jay4git commented Nov 30, 2020

I am unable to preproduce locally (latest windows 10 RTM build). My guess is that this is related either to ruby version (I am on 2.7) and/or the ASLR crash discussed in #28. It is also possible that the ASLR related crash is also related to ruby version since I am on the default High-Entropy ASLR setting (on) and do not crash.

So it would be interesting to see if the change in #28 fixes your crash.

Yes, the fix of #28 does resolve the crash. Thanks very much for the help.
Is there a plan to incorporate this fix in the next patch of win32-dir and if so, when will it be available?
Thanks again.

@tas50
Copy link
Contributor

tas50 commented Nov 30, 2020

We're in the process of releasing now.

@jay4git
Copy link
Author

jay4git commented Nov 30, 2020

We're in the process of releasing now.

Thanks very much.

@tas50
Copy link
Contributor

tas50 commented Nov 30, 2020

0.7.2 is up now

@tas50 tas50 closed this as completed Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants