miekg / pkcs11

pkcs11 wrapper for Go
BSD 3-Clause "New" or "Revised" License
376 stars 133 forks source link

Double free or corruption (!prev): 0x63f00550 #103

Open techninja1008 opened 5 years ago

techninja1008 commented 5 years ago

I believe this relates to the following line: https://github.com/miekg/pkcs11/blob/6120d95c0e9576ccf4a78ba40855809dca31a9ed/pkcs11.go#L1332

I encountered this whilst using ThalesIgnite/crypto11 to add PKCS#11 support to cloudflare/cfssl. This seems to only occur on ARM, as the trace comes from running it on a raspberry pi, and I have been able to get it to work successfully on x86.

Full trace can be found at https://pastebin.com/au1ieLbp

techninja1008 commented 5 years ago

I have confirmed that this indeed only occurs on ARM.

miekg commented 5 years ago

[ Quoting notifications@github.com in "Re: [miekg/pkcs11] Double free or c..." ]

I have confirmed that this indeed only occurs on ARM.

That code doesn't look wrong to me. How can a double free be arch specific? C compiler?

techninja1008 commented 5 years ago

I'm genuinely not sure, however I do know that it's the difference between compiling on Ubuntu 18.04 x86_64 and Raspbian stretch lite (with latest stable release of Go) on a Raspberry Pi 3 (armhf). I'll check later to see which C compiler is being used, but it's going to be from the distribution.

On Sun, Mar 17, 2019, 1:04 PM Miek Gieben notifications@github.com wrote:

[ Quoting notifications@github.com in "Re: [miekg/pkcs11] Double free or c..." ]

I have confirmed that this indeed only occurs on ARM.

That code doesn't look wrong to me. How can a double free be arch specific? C compiler?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/miekg/pkcs11/issues/103#issuecomment-473663745, or mute the thread https://github.com/notifications/unsubscribe-auth/AEA4lbZlyXBGEFNWbFSlbD19hQGTOvs1ks5vXj1tgaJpZM4b4Qz2 .

techninja1008 commented 5 years ago

Would GCC 6.3.0 on ARM vs GCC 7.3.0 on x86_64 do it?

techninja1008 commented 5 years ago

Cross compiling to ARM on an x86_64 host using GCC 7.3.0 still yields the same result. Could it be a GO ARM bug?

miekg commented 5 years ago

[ Quoting notifications@github.com in "Re: [miekg/pkcs11] Double free or c..." ]

Cross compiling to ARM on an x86_64 host using GCC 7.3.0 still yields the same result. Could it be a GO ARM bug?

Maybe? Ive never debugged such a thing. Playing around with golang versions might yields some insights (and is relatively easy to do).

dogusural commented 4 years ago

Is there any update on the problem ? i am having a very similar issue on arm linux .

miekg commented 4 years ago

[ Quoting notifications@github.com in "Re: [miekg/pkcs11] Double free or c..." ]

Is there any update on the problem ? i am having a very similar issue on arm linux .

Is there an PR?