Comments (17)
Crashlog_AWeb retrieve_2017-08-15_15-15-57.txt
Crashlog_python_2017-05-18_14-03-28.txt
from amissl.
This is AmiSSL's free() function:
void free(void *p)
{
if(p != NULL)
{
ObtainSemaphore(&__mem_cs);
p = &((ULONG *)p)[-1];
FreePooled(__mem_pool, p, *(ULONG *)p);
ReleaseSemaphore(&__mem_cs);
}
}
Not much to go wrong here, except the FreePooled() call. This is exactly the line the crashlog points to.
Since you reported similar crashes of other applications when freeing memory from pools in AmigaOS4's BugZilla this points to a bug in AmigaOS4's memory pool handling rather than to a bug in AmiSSL.
from amissl.
I would think it is more likely misuse of the OpenSSL init functions - a lot changed in OpenSSL between AmiSSL v3 and v4. Initialization is now less ambiguous and less complicated, but as a result less forgiving. A lot of the top level init functions are now just macros that call OPENSSL_init_ssl() - I'm thinking in particular of SSL_load_error_strings(), which may be the problem here. I remember having similar trouble in IBrowse. Now I just call OPENSSL_init_ssl(OPENSSL_INIT_SSL_DEFAULT | OPENSSL_INIT_ADD_ALL_CIPHERS | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL) once directly after InitAmiSSL().
I only have some old AWeb sources to refer to, but if SSL_load_error_strings() and SSLeay_add_ssl_algorithms() are called multiple times, that could be the problem. Both of those ultimately now call OPENSSL_init_ssl(). It is better to use the new API now.
BTW, I'm using all the latest OS4 beta components and am having no issues like this on my A1XE.
from amissl.
@tboeckel
I'm not sure that these crashes are coming from the same src as my others, they are different in that they conistantly through alert 0x01000009 which is a memeory freed twice error. The crashes I reported against the OS are quite different allways being a DSI on '0x00000000' followed by layer corrupt memeory list errors when the pool is released.
Not dimissing the idea completely, but just expressing my doubts.
from amissl.
@futura
I compiled the AWeb code without any changes, which seemed to work, at least in terms of compiling without any errors / warnings, so I will review the code in the light of your comments and see if that improves thiings
from amissl.
@broadblues If I'm reading the code correctly, am I right in thinking that the main AWeb task opens and initialises AmiSSL, and multiple subtasks (for each connection) each create a SSL context, and calls the OpenSSL init stuff?
If it is still crashing after moving the SSLeay_add_ssl_algorithms() and SSL_load_error_strings() (or new API equivalent), then it may possibly be related to creating multiple SSL contexts on subtasks. I guess that should work fine if it did in AmiSSL v3. None of the OpenSSL test programs would test a case like this, and IBrowse does things differently (single SSL context created by main task, and shared by the subtasks).
from amissl.
AWeb calls Tcpopenssl() which effectively maps to Assl_initamissl() in OS4 for each http process (one for each active connection).
Each http process has it's own 'socketbase' and passes that to Tcpopenssl() so that in turn means InitAmiSSL() gets called once for each process, with the socketbase as the argument. When the task exits Assl_cleanup() and hence CleanupAmiSSL() gets called.
I'm not seeing any way that a call to InitAmiSSL() is matched to the call to CleanipAmiSSL(), by that I mean there no context pointer ar anything, so does that mean the call to CleanupAmiSSL() applies to the whole library instance? Thus possibley causing the memory freed twice type of crash?
from amissl.
I wouldn't have thought so, no. It is correct to pair calls to InitAmiSSL() and CleanupAmiSSL(). Internally, they use the task address as a context pointer.
Are you able to successfully complete at least one connection before it crashes or is it crashing on the first one? At first glance, where it is crashing in OpenSSL doesn't make much sense as it does set the pointers to NULL after freeing the memory, so even if that code is called twice, it shouldn't crash (unless it is not being initialized properly in the first place, but then I would expect all apps to crash). I'll try making a simple test case for this tomorrow.
from amissl.
OK so the calls are matched via the Task pointer, that makes sense.
Crashes only occur on subsequent connections the first connection always works at least so far.
I thought it might be tasks running in paralell that causes the crash, but I limited the connections to 1 at a time and still got a crash.
BTW I have reproduce these crashes on both my SAM and my x1000 whereas the MemeoryPool crashes refered to by Tboeckel above only occur on the SAM.
from amissl.
I'm running out of ideas now - I've attached a simple test program that I knocked up to mimic what AWeb is basically doing, and it will not crash here on my A1XE. Can you try compiling and running it multiple times to see if it crashes on your system.
The only other thing that springs to mind is to check that all the latest include files are being used and that calls to InitAmiSSL() and CleanupAmiSSL() are paired. If AWeb (or any other application for that matter) misses calling CleanupAmiSSL(), it can cause any app using AmiSSL to crash.
from amissl.
Compiled and run that test a number of times, on the x1k no crash, but AWeb was also not crashing, then I ran it 5 times on the SAM and it crashed.
The machine locked up so I couldn't save out the log, but the sashimi output section showing in the console showed it crashed on the Free function again, but in a slightly different way. The crash occured after the SSL_Connect() call in the text program.
from amissl.
I'm fairly sure my includes etc are all updated to amissl4 (I renamed the amissl3 ones before installing)
from amissl.
Would you mind e-mailing the compiled test program to me, or uploading here?
I'll check to see if it crashes here also. Just wondering if it is related to your build environment in some way, because when I build the test program, I have been unable to get it to crash here on my A1XE.
It could be something else trashing memory, as Thomas on the OS4 bugzilla suggests. Equally, I wouldn't completely rule out a bug in AmiSSL, but I would also expect there have been similar reports from YAM users at least.
It is frustrating that as OS4 has developed, is has become more and more developer unfriendly. System lockups are not helpful, opposed to a GR, and debugging tools no longer work. In particular, MemGuard was an invaluable tool, which may have been a help in this instance.
from amissl.
SWorry for delay have now emailed build to you.
from amissl.
@broadblues Try as I might, but I can't get this to crash on my A1XE using the latest beta components. So, I guess that mean it is compiling perfectly fine on your system, so that rules out a compiler issue. I've also tried the debug and non-debug kernels, with and without the "munge" option. Somehow I managed to get Memguard to work (seemed to be working at least) and that triggered no issues either.
What kernel options are you using? Might be worth trying the debug kernel or vice versa. Do you have any older OS4 installs that you can test it on?
The only other thing that springs to mind is stack size - try increasing the stack size, but I don't think this would be an issue otherwise I could trigger it here. Clutching at straws :).
It is not looking like an AmiSSL issue to me, without more evidence.
from amissl.
Just an update to this issue.
I have identified the top level cause of my general memory pool issues on my SAM, that being my AORganiser program, bur only when syncing with google calendar. (which means this culprit could be AO itself, python or my port of the python __ssl.so module (which is using amissl but I'm not suggestiong that's the issue at this point, it's just the bottom of the possibilty stack).
Having eliminated that, I retested AWeb and I find that again it remains rock solid with only one connection, but when setting multiple connections https urls crash eventuallt with the same CRYPTO_free() call.
So I've emlinated the third party memory trash option, it's down to AWeb or AmiSSL.
I guess I'm going to have to work out how to build a debug version for myself and see if I can't get some more clues.
from amissl.
AWeb related issue is fixed in AmiSSL 4.2
from amissl.
Related Issues (20)
- Cannot compile SDL example
- 64bit arguments passing with 68k .library ABI HOT 2
- openssl/asn1.h header redefinitions in Storm C 4 HOT 5
- Update installer to allow installation even while AmiSSL is in use HOT 8
- Optional installation of include? HOT 3
- vbcc proto/inline issues HOT 7
- Random generator init is very slow HOT 11
- OpenSSL speed output order issue when redirected HOT 15
- 68000 version missing HOT 7
- OpenSSL 3.0 / AmiSSL v5 HOT 8
- const const in header files HOT 2
- interfaces/amissl.h:4320:73: error: duplicate βconstβ HOT 1
- libamisslstubs.a missing a few stubs HOT 15
- AmiSSL version defines mismatches HOT 5
- Split Installer
- AMISSL_INLINE_H doesn't fully work with the 5.x SDK's HOT 12
- Big SSL/TLS connect performance regression in AmiSSL 5.x HOT 25
- FTPS stops working with ZitaFTP Server from version 5.4 HOT 13
- Example https Crashes on Vanilla AmigaOS v3.2 Installation on WinUAE HOT 3
- PatchWork Reports InitSemaphore "Structure Is Not Cleared" HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amissl.