-
Notifications
You must be signed in to change notification settings - Fork 69
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
Tests fail with gcc stack protection #17
Comments
That would be greatly appreciated. In particular the |
Here is my initial RCA:
CLANG Result:
Basically |
I narrowed down the problem to this:
But in case of gcc:
Any idea how to proceed? Although we create bos then five_ptr and then only pos in fn, five_ptr still goes beyond the two [EDIT]: |
This looks like variable reordering for stack protection. Can you give me your platform/os/gc versions? |
Hey @ganesh-k13, I looked into this. One option seems to be to use |
@mkirchner sure, thanks a lot for the info, I'll look into this one. |
I think this line is wrong. Line 522 in 0fc3a84
because
the express of @mkirchner, is your mean is the following?
|
Hi @ssrlive, value of the variable is not important, we only need it to get the location. Basic assumption is like this:
So that code(logically at least) is right as far as I know, @mkirchner thoughts on this? |
We assume that all variables on the stack are the same size. But in fact they are not always the same size. |
@ssrlive , you are absolutely right about the value to be incorrect, in fact take a look at my trace in clang comment:
So since we go in steps of |
so, the searching logic must be changed. |
so, why the gcc compiler can not run the right result? |
maybe GCC forbidden read memory across stack frames? |
@ssrlive please read 4th comment, I have explained the reason why gcc is failing but not clang |
Hi @ganesh-k13 , I'm debug on Win64, it' very strange that the |
Win64 exe always failed at this line. Line 238 in be9f1e4
because |
maybe it is a better selection to use void *tos = __builtin_frame_address(1); with gcc. I haven't found a similar implementation under Windows. Obviously |
Given the code in the editor window, if your C compiler does not reshuffle the order of variable declarations, Also, |
Using "Calling this function with a nonzero argument can have unpredictable effects, including crashing the calling program. As a result, calls that are considered unsafe are diagnosed when the -Wframe-address option is in effect. Such calls should only be made in debugging situations."
Not sure that I can follow why |
I means, if tos is point to parent stack frame, therefore we needn't mind the var order any more. |
I have researched it again. I think I have find out the solve under windows. see below image. We can use the we can use
|
* Fixed gcc bug in TC 5: test_gc_mark_stack | Issue: #17 * Added bos variable for verbosity * Fixed gcc bug in TC 6 : test_gc_basic_alloc_free | Tested * Fixed gcc bug in TC 7 : test_gc_allocation_map_cleanup | Tested * Fixed gcc bug in TC 8 : test_gc_static_allocation | Tested * Fixed gcc bug in TC 10 : test_gc_pause_resume | Tested * Fixed gcc bug in TC 11 : test_gc_strdup | Fixed TC 8 | Removed setjmp during sweep * Added gcc action * Fixed gcc bug in TC 11 : test_gc_strdup by adding indirection to remove stray registers * Fixed bos issues in some cases | Use stack address directly when reffering to deeper frames as it is more below
Hey @ssrlive , thanks for continuing to look into this! Given that this ticket is about GCC and @ganesh-k13 added GCC support in #22 , I am going to close this and fork off a separate MSVC discussion in #27 . Hope that's ok with you. Fixed in #22. |
Hi, as discussed previously, I wanted to see if
gcc
works. But I was getting this error and a few warnings:I was hoping I can look into this if it is an actual issue and not some local system problem with some dependencies.
The text was updated successfully, but these errors were encountered: