-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Correct macro name for the i386 platform #5540
Conversation
is this something unique to 32 bit x86? should there be an ifdef here? |
As a side note. The coredump thing is not supported on android. Will be nice to review that support right after merging the arm support
|
@crowell I was trying to find a quick answer to your question, but I couldn't. Right now it is in an ifdef, I assume with good reason. |
cc @leberus |
Hi @stacknip , could you paste here the output of $ grep -r PTRACE_GETREGSET /usr/include/ Thanks Btw, your change is compiling, but it's not gonna give the expected results. We can't take NT_PRXFPREG just using PTRACE_GETREGS. As you can see in arch/x86/kernel/ptrace.c
Is using regset. PD: For older kernels running on x86 we could use the same workaround as we use for linux_get_xsave_data, something like:
I could push that change if everybody is happy about that. |
@leberus You are on to something. $grep -r -e "PTRACE_GETREGSET" So it is defined in the file: Though the header included in linux_coredump is sys/ptrace.h. Maybe add that header? You will have to excuse me, I'm not really familiar with the code. I will leave any changes to the code up to you. |
@stacknip Thanks for the output ;) I guess you're using debian, aren't you? Could you tell me the version of your libc6-dev package? Thanks ;) |
@leberus Yes, I'm using Debian Wheezy. $dpkg --get-selection | grep libc6 Gotta run now. |
@stacknip It looks like before debian jessie, ptrace file version shipped with libc6-dev didn't contain that macro. I'll come back with something |
waiting for feedback from @leberus |
With my last commit I've added a macro for i386, so if ptrace headers from userland don't contain PTRACE_GETREGSET, we bypass it. Maybe I'll add the PTRACE_REGSET macro within linux_coredump.h (as it is in ../sys/ptrace.h), or I'll include /usr/include/linux/ptrace.h (but I'm not so amused about it). Anyways, @stacknip: could you try to get the latest code from radare2 and compile it? You shouldn't have any problems anymore. Once this is confirmed, this issue could be closed and the commit should be dropped (this commit will break the functionality about NT_PRXFPREG). |
It builds successfully! :) |
Hi, I'm experiencing a similar issue:
I cannot find what related code was changed during your conversation and cannot understand how to solve this issue. Could you please provide more details? Here's my environment I find necessary to mention:
|
probably in that old kernel there was only PTRACE_GETREG
… On 22 Apr 2020, at 04:36, 孙茂胤 ***@***.***> wrote:
Hi,
I'm experiencing a similar issue:
the output is almost the same as described in the issue comment <#5131 (comment)>
...
CC debug_windbg.c
CC linux_debug.c
CC procfs.c
CC linux_coredump.c
p/native/linux/linux_debug.c: In function 'linux_reg_read':
p/native/linux/linux_debug.c:1111:18: error: storage size of 'xstate' isn't known
p/native/linux/linux_debug.c:1114:24: error: invalid application of 'sizeof' to incomplete type 'struct _xstate'
p/native/linux/linux_debug.c:1115:30: error: 'PTRACE_GETREGSET' undeclared (first use in this function)
p/native/linux/linux_debug.c:1115:30: note: each undeclared identifier is reported only once for each function it appears in
p/native/linux/linux_debug.c:1111:18: warning: unused variable 'xstate' [-Wunused-variable]
gmake[4]: *** [p/native/linux/linux_debug.o] Error 1
gmake[4]: *** Waiting for unfinished jobs....
gmake[3]: *** [foo] Error 2
gmake[2]: *** [debug] Error 2
gmake[1]: *** [all] Error 2
gmake: *** [all] Error 2
grep -r -e "PTRACE_GETREGSET" returns the same as the comment above <#5540 (comment)>
$ grep -r PTRACE_GETREGSET /usr/include/
/usr/include/linux/ptrace.h: * ret = ptrace(PTRACE_GETREGSET/PTRACE_SETREGSET, pid, NT_XXX_TYPE, &iov);
/usr/include/linux/ptrace.h:#define PTRACE_GETREGSET 0x4204
/usr/include/linux/elf.h: * using the corresponding note types via the PTRACE_GETREGSET and
I cannot find what related code was changed during your conversation and cannot understand how to solve this issue. Could you please provide more details?
Here's my environment I find necessary to mention:
$ uname -a
Linux uit-algo-d-21 2.6.32-754.6.3.el6.x86_64 #1 SMP Tue Sep 18 10:29:08 EDT 2018 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 6.10 (Santiago)
Release: 6.10
Codename: Santiago
$ gcc --version
gcc (GCC) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#5540 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAG75FW2F2SK4Z7TBA6HNITRNZJ4FANCNFSM4CMXKH6A>.
|
Fine. After making adjustment for this and also other issues I finally gave up because it wants root password. Thanks anyway for creating this great software! |
Hi @simonmysun ! Are you using For example: $ ./configure --prefix=/home/ret2libc/.local
$ make CS_RELEASE=1
$ make install
$ export PATH=$PATH:/home/ret2libc/.local/bin
$ export LD_LIBRARY_PATH=/home/ret2libc/.local/lib
$ r2 - However, on RHEL6 / CENTOS6 that won't work as you discovered. Those systems ship very old gcc/libs and we are not always able to test whether everything runs well on every system, so we appreciate user contributions. I am working on creating a CI test that we are going to run in the future to make sure radare2 can be at least compiled on such platforms (even though some runtime functions may not work). For a little bit unfortunately you won't be able to run radare2 on such systems, but there is already work ongoing to make sure it will be possible again (see #16712 and tree-sitter/tree-sitter#604 ). Hope it helps :) |
Hi @ret2libc , Thanks for the guidance! I was indeed giving up too early. That's because I was leaving my working environment. So I have successfully compiled it and it works great! To whom it may concern, here are the changes I have made before the compilation in my environment mentioned above:
Many thanks again for this great software! |
Yes, we are already working on this at #16712 . We are also adding centos6 build to our CI so that in can try to keep radare2 compiling on that platform at least.
Ok, nice catch I will have a look! Thanks :) |
Some more info in this issue:
#5131