Re: [RFC PATCH] ptrace: make ptrace() fail if the tracee changed its pid unexpectedly

2020-12-19 Thread Pedro Alves
gi?id=26754 I've went through GDB's code looking for potential issues with the change and whether it would affect GDBs already in the wild. Tricky corner cases abound, but I think we're good. Feel free to add my ack: Acked-by: Pedro Alves Thanks, Pedro Alves

Re: [PATCH v3 2/3] x86/signal: Rewire the restart_block() syscall to have a constant nr

2016-06-22 Thread Pedro Alves
On 06/21/2016 05:32 PM, Andy Lutomirski wrote: > On Jun 21, 2016 5:40 AM, "Pedro Alves" wrote: > I didn't try that particular experiment. But, from that email: > >> After that, GDB can control the stopped inferior. To call function "func1()" >&g

Re: [PATCH v3 2/3] x86/signal: Rewire the restart_block() syscall to have a constant nr

2016-06-21 Thread Pedro Alves
198) exited with code 01] (gdb) q Is this expected? This is the same testcase as before: https://sourceware.org/ml/gdb/2014-05/msg4.html Thanks, Pedro Alves

Re: [PATCH v2] x86/ptrace: Stop setting TS_COMPAT in ptrace code

2016-06-20 Thread Pedro Alves
y problem: seccomp is currently entirely insecure if a >> malicious ptracer is attached.) As a minimal fix, this patch adds a >> new flag TS_I386_REGS_POKED that handles the ptrace special case. >> >> Cc: Pedro Alves >> Cc: Oleg Nesterov >> Cc: Kees Cook >>

Re: [PATCH] x86/ptrace: Remove questionable TS_COMPAT usage in ptrace

2016-06-20 Thread Pedro Alves
t. 0xf7fd9d49 in __kernel_vsyscall () (gdb) p func1() $1 = 4 (gdb) c Continuing. Unknown error 512 [Inferior 1 (process 20252) exited with code 01] (gdb) That was a 64-bit gdb. Note it doesn't fail with fedora 23's gdb, because of a fedora-local workaround. Thanks, Pedro Alves

Re: [PATCH] x86/ptrace: Remove questionable TS_COMPAT usage in ptrace

2016-06-20 Thread Pedro Alves
https://www.sourceware.org/ml/gdb-patches/2015-11/msg00076.html https://www.sourceware.org/ml/gdb-patches/2015-11/msg00077.html Guess that makes fs_base/gs_base user-writable, if the kernel allows it. Thanks, Pedro Alves

Re: [PATCH] x86/ptrace: Remove questionable TS_COMPAT usage in ptrace

2016-06-18 Thread Pedro Alves
On 06/18/2016 02:55 PM, Pedro Alves wrote: > This hunk being mentioned in this thread a couple years ago too: > > https://www.sourceware.org/ml/gdb/2014-04/msg00095.html > > Please don't break this use case ( and fix the one reported in > that thread :-) ). BTW, there w

Re: [PATCH] x86/ptrace: Remove questionable TS_COMPAT usage in ptrace

2016-06-18 Thread Pedro Alves
ior, with: (gdb) print foo() Some background here: http://linux-kernel.vger.kernel.narkive.com/fqrh4xKK/patch-x86-ptrace-sign-extend-eax-with-orig-eax-0 This hunk being mentioned in this thread a couple years ago too: https://www.sourceware.org/ml/gdb/2014-04/msg00095.html Please don't break this use case ( and fix the one reported in that thread :-) ). Thanks, Pedro Alves

Re: ptrace() hangs on attempt to seize/attach stopped & frozen task

2015-11-19 Thread Pedro Alves
had sufficient time to be sure that a full test run passes cleanly too. :-P :-) >> But maybe not, if we're sure that >> that when that happens, waitpid returns for the initial >> PTRACE_ATTACH-induced SIGSTOP. > > Yes. Just you can't assume that watpid(WNO

Re: ptrace() hangs on attempt to seize/attach stopped & frozen task

2015-11-19 Thread Pedro Alves
This queuing of a SIGSTOP + PTRACE_CONT was necessary because otherwise when gdb attaches to a job stopped process, gdb would hang in the waitpid after PTRACE_ATTACH, waiting for the initial SIGSTOP which would never arrive. If the proposed change makes it so that a new intermediate state can be ob

Re: [PATCH 1/2] wait/ptrace: always assume __WALL if the child is traced

2015-10-28 Thread Pedro Alves
On 10/28/2015 04:11 PM, Oleg Nesterov wrote: > On 10/26, Pedro Alves wrote: >> >> On 10/25/2015 03:54 PM, Oleg Nesterov wrote: >>> >>> In any case, the real question is whether we should change the kernel to >>> fix the problem, or ask the distros to fi

Re: [PATCH 1/2] wait/ptrace: always assume __WALL if the child is traced

2015-10-26 Thread Pedro Alves
el error out on PTRACE_TRACEME issued from a non-leader thread? Then between PTRACE_TRACEME and the parent's waitpid, __WALL or !__WALL should make no difference. (Also, in the original test case, if the child gets/raises a signal or execs before exiting, the bash/init/whatever process won

Re: [PATCH 0/2] wait/ptrace: always assume __WALL if the child is traced

2015-10-22 Thread Pedro Alves
int *status, int options) = NULL; + + if (waitpid2 == NULL) +waitpid2 = dlsym (RTLD_NEXT, "waitpid"); + + options |= __WALL; + return waitpid2 (pid, status, options); +} ~~ and got no regressions. So seems like all would be well from GDB's perspectiv

Re: [PATCH v5 02/10] x86: Compile-time asm code validation

2015-06-12 Thread Pedro Alves
On 06/12/2015 03:10 PM, Josh Poimboeuf wrote: > On Fri, Jun 12, 2015 at 12:18:16PM +0100, Pedro Alves wrote: >> On 06/11/2015 03:10 PM, Josh Poimboeuf wrote: >> >>> C would definitely make more sense when analyzing object code. In fact, >>> asmvalidate is written

Re: [PATCH v5 02/10] x86: Compile-time asm code validation

2015-06-12 Thread Pedro Alves
list the following jump. And then if it's possible run a CFI generator as a separate step over the source, it sounds like it should also be possible to have the assembler do it instead too (again with some new high level directive to trigger/help it). Thanks, Pedro Alves -- To unsubscribe f

Re: install_special_mapping && vm_pgoff (Was: vvar, gup && coredump)

2015-03-16 Thread Pedro Alves
l this is sorted. Pedro Alves -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: vvar, gup && coredump

2015-03-12 Thread Pedro Alves
wever, in vvar case, sounds like there's nowhere to read it from offline? In that case, it could be justified to dump it. Thanks, Pedro Alves -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo in

Re: [PATCH 1/1] ptrace/x86: fix the TIF_FORCED_TF logic in handle_signal()

2014-11-05 Thread Pedro Alves
On 11/04/2014 11:55 PM, Oleg Nesterov wrote: > On 11/03, Pedro Alves wrote: >> >> Thanks a lot Oleg. > > thanks for the detailed report ;) > >> Question - shouldn't ptrace tests be put in >> tools/testing/selftests/ptrace/ in the kernel tree nowadays? &g

Re: [PATCH 1/1] ptrace/x86: fix the TIF_FORCED_TF logic in handle_signal()

2014-11-03 Thread Pedro Alves
Thanks a lot Oleg. Question - shouldn't ptrace tests be put in tools/testing/selftests/ptrace/ in the kernel tree nowadays? Thanks, Pedro Alves On 11/03/2014 08:13 PM, Oleg Nesterov wrote: > When the TIF_SINGLESTEP tracee dequeues a signal, handle_signal() > clears TIF_FO

Re: [PATCH] elf, coredump: Extract only the active register set during core dump

2014-05-27 Thread Pedro Alves
size. > > Signed-off-by: Anshuman Khandual > --- > NOTE: > Pedro Alves has mentioned that producing smaller note sections in the core > dump may break some existing consumers. I request suggestions, reviews and > test reports on different architectures to prove that this patch does

Re: [PATCH V2 2/3] powerpc, ptrace: Enable support for transactional memory register sets

2014-05-20 Thread Pedro Alves
On 05/20/2014 09:14 AM, Anshuman Khandual wrote: > On 05/19/2014 08:13 PM, Pedro Alves wrote: >> On 05/19/2014 12:46 PM, Anshuman Khandual wrote: >> >>>>> I couldn't actually find any arch that currently returns -ENODEV in >>>>> the &quo

Re: [PATCH V2 2/3] powerpc, ptrace: Enable support for transactional memory register sets

2014-05-19 Thread Pedro Alves
et) > +{ > + if (!cpu_has_feature(CPU_FTR_TM)) > + return -ENODEV; ... unfortunately this will do the wrong thing. Thanks, -- Pedro Alves -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [RFC/PATCH] Implement new PTRACE_EVENT_SYSCALL_{ENTER,EXIT}

2014-05-16 Thread Pedro Alves
On 05/15/2014 03:36 PM, Denys Vlasenko wrote: > On 05/14/2014 08:49 PM, Pedro Alves wrote: >> I realized now that I responded to this. Sorry about that. >> >> On 01/19/2014 03:29 PM, Oleg Nesterov wrote: >>> On 01/19, Sergio Durigan Junior wrote: >>>

Re: [PATCH V2 2/3] powerpc, ptrace: Enable support for transactional memory register sets

2014-05-15 Thread Pedro Alves
On 05/15/2014 09:25 AM, Anshuman Khandual wrote: > On 05/14/2014 04:45 PM, Pedro Alves wrote: >> On 05/14/14 06:46, Anshuman Khandual wrote: >>> On 05/13/2014 10:43 PM, Pedro Alves wrote: >>>> On 05/05/14 08:54, Anshuman Khandual wrote: >>>>> This patc

Re: [RFC/PATCH] Implement new PTRACE_EVENT_SYSCALL_{ENTER,EXIT}

2014-05-14 Thread Pedro Alves
t;clone". - PTRACE_EVENT_FORK is reported. - The debugger does ptrace(PTRACE_CONT). What should be reported? What is reported now? -- Pedro Alves -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH V2 2/3] powerpc, ptrace: Enable support for transactional memory register sets

2014-05-14 Thread Pedro Alves
ng something to HWCAP too? > > Yes but it's in HWCAP2 That's fine. -- Pedro Alves -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH V2 2/3] powerpc, ptrace: Enable support for transactional memory register sets

2014-05-14 Thread Pedro Alves
On 05/14/14 06:46, Anshuman Khandual wrote: > On 05/13/2014 10:43 PM, Pedro Alves wrote: >> On 05/05/14 08:54, Anshuman Khandual wrote: >>> This patch enables get and set of transactional memory related register >>> sets through PTRACE_GETREGSET/PTRACE_SETREGSET interfa

[PATCH v2] ptrace: Clarify PTRACE_GETREGSET/PTRACE_SETREGSET, documentation in uapi header

2014-05-14 Thread Pedro Alves
On 05/14/14 08:10, Anshuman Khandual wrote: > On 05/13/2014 11:39 PM, Pedro Alves wrote: >> On 05/05/14 05:10, Anshuman Khandual wrote: >>> On 05/01/2014 07:43 PM, Pedro Alves wrote: >> OK, then this is what I suggest instead: ... >>> Shall I resend the patch w

Re: [PATCH] ptrace: Fix PTRACE_GETREGSET/PTRACE_SETREGSET in code documentation

2014-05-13 Thread Pedro Alves
On 05/05/14 05:10, Anshuman Khandual wrote: > On 05/01/2014 07:43 PM, Pedro Alves wrote: >> On 04/28/2014 12:00 PM, Anshuman Khandual wrote: >>> The current documentation is bit misleading and does not explicitly >>> specify that iov.len need to be initialized failin

Re: [PATCH V2 2/3] powerpc, ptrace: Enable support for transactional memory register sets

2014-05-13 Thread Pedro Alves
no longer exists in the @redhat.com domain. -- Pedro Alves On 05/05/14 08:54, Anshuman Khandual wrote: > This patch enables get and set of transactional memory related register > sets through PTRACE_GETREGSET/PTRACE_SETREGSET interface by implementing > four new powerpc specific reg

Re: [PATCH V2 2/3] powerpc, ptrace: Enable support for transactional memory register sets

2014-05-13 Thread Pedro Alves
t, what does the kernel return when the ptracer requests these registers and the program is not in a transaction? Specifically I'm wondering whether this follows the same semantics as the s390 port. -- Pedro Alves -- To unsubscribe from this list: send the line "unsubscribe lin

Re: [PATCH] ptrace: Fix PTRACE_GETREGSET/PTRACE_SETREGSET in code documentation

2014-05-01 Thread Pedro Alves
ust ignore the ptrace request and never read from/write into > the user specified buffer. You're saying that if iov.len is larger than the NT_XXX_TYPE regset, then the kernel returns _success_, but actually doesn't fill the buffer? That sounds like a bug to me. -- Pedro Alves --

Re: [PATCH 2/3] powerpc, ptrace: Add new ptrace request macros for transactional memory

2014-05-01 Thread Pedro Alves
On 04/28/2014 11:30 AM, Anshuman Khandual wrote: > On 04/26/2014 05:12 AM, Pedro Alves wrote: >> On 04/02/2014 08:02 AM, Anshuman Khandual wrote: >>> This patch adds following new sets of ptrace request macros for >>> transactional >>> memory expandin

Re: [PATCH] Fix get ERESTARTSYS with m32 in x86_64 when debug by GDB

2014-04-30 Thread Pedro Alves
break; > > which gets used for 32-bit compat ptrace(2). Perhaps the same logic > should be added to putreg() if the child is a 32-bit process? Sounds like the right fix to me. -- Pedro Alves -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH 25/28] nios2: ptrace support

2014-04-25 Thread Pedro Alves
Does this support PTRACE_GETREGSET / PTRACE_SETREGSET ? IMO, the kernel shouldn't accept ports without those anymore. And IMHO, we shouldn't even allow new ports having PTRACE_GETREGS. http://sourceware.org/ml/archer/2010-q3/msg00193.html -- Pedro Alves -- To unsubscribe from this

Re: [PATCH 2/3] powerpc, ptrace: Add new ptrace request macros for transactional memory

2014-04-25 Thread Pedro Alves
d VMX registers */ > PTRACE_GETTM_CVMXREGS > PTRACE_SETTM_CVMXREGS Urgh, we're _still_ adding specialized register specific calls? Why aren't these exported as new register sets, accessible through PTRACE_GETREGSET / PTRACE_SETREGSET? That's supposed to be the Modern Way to do thin

Re: [RFC/PATCH] Implement new PTRACE_EVENT_SYSCALL_{ENTER,EXIT}

2014-01-09 Thread Pedro Alves
report an event. +10^6. With PTRACE_SYSCALL/sysgood, we don't have a way to trace syscalls when single-stepping, which isn't much of a problem for strace, but of course is for GDB. That is one of the things the new API should definitely sort out. -- Pedro Alves -- To unsubscribe

Re: [PATCH] ptrace: make PTRACE_DETACH work on non-stopped tracees.

2013-06-19 Thread Pedro Alves
On 06/19/2013 05:09 PM, Jan Kratochvil wrote: > On Wed, 19 Jun 2013 17:15:36 +0200, Denys Vlasenko wrote: >> CCing Jan to hear his comments from gdb side. PTRACE_DETACH takes a signal number in the data parameter. What happens to if the tracer passes a non-zero signal? -- Pedro Alv

Re: [PATCH] ptrace: add ability to retrieve signals without removing them from a queue

2013-02-15 Thread Pedro Alves
dded later" comment instead of actually requesting it. But if we had it, we could make e.g., gdb inspect the signal queues, and then be able to tweak a realtime signal before it is delivered. -- Pedro Alves -- To unsubscribe from this list: send the line "unsubscribe linux-kernel

Re: [PATCH] ptrace: add ability to retrieve signals without removing them from a queue

2013-02-15 Thread Pedro Alves
On 02/15/2013 07:43 PM, Oleg Nesterov wrote: > On 02/15, Pedro Alves wrote: >> >> Not sure I'm reading the patch right, but it looks like GDB would >> be able to use this as alternative to PTRACE_GET_SIGINFO variant > > No, it is different. PTRACE_GETSIGINFO re

Re: [PATCH] ptrace: add ability to retrieve signals without removing them from a queue

2013-02-15 Thread Pedro Alves
INT_RESTORE. We'd miss the poke variant, but that looks like something that could be always be added later. -- Pedro Alves -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: Redefinition of struct in6_addr in and

2013-01-18 Thread Pedro Alves
d have only one macro for all structs/enums (you could split into __IPV6_IN6_ADDR_DEFINED, __IPV6_SOCKADDR_IN6_DEFINED, etc.) but to have the kernel and libc agree on guard macros, instead of having the kernel do #ifdef __GLIBC__ and glibc doing #ifdef _NETINET_IN_H. But as Carlos says, th

Re: Redefinition of struct in6_addr in and

2013-01-18 Thread Pedro Alves
ngle macro/symbol both the kernel and libc (any libc that needs this) define? Something like both the kernel and userland doing: #ifndef __IPV6_BITS_DEFINED #define __IPV6_BITS_DEFINED ... define in6_addr, sockaddr_in6, ipv6_mreq, whatnot #endif So whichever the application includes first, wi

Re: PTRACE_SYSCALL && vsyscall (Was: arch_check_bp_in_kernelspace: fix the range check)

2013-01-08 Thread Pedro Alves
gt; will look as a "normal" syscall. Like vsyscall_seccomp() does. > > But this needs much more changes. I'd just like to add, that if any new syscall related option is to be added, can we please just go all the way and add PTRACE_EVENT_SYSCALL_ENTER|PTRACE_EVENT_SYSCALL_E

Re: PT_EXITKILL (Was: pdeath_signal)

2012-11-08 Thread Pedro Alves
On 11/08/2012 12:44 PM, Oleg Nesterov wrote: > On 11/08, Pedro Alves wrote: >> If this isn't inherited by the ptrace child's children, a fork child can >> end up detached if the tracer dies before it had a chance of setting >> the PTRACE_O_EXITKILL on the new

Re: PT_EXITKILL (Was: pdeath_signal)

2012-11-08 Thread Pedro Alves
ace between PTRACE_ME/PTRACE_ATTACH and setting PTRACE_SETOPTIONS). (For completeness, Windows' age old equivalent, DebugSetProcessKillOnExit, it a tracer option, not tracee option, though that's not as flexible.) -- Pedro Alves -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH 2/2] coredump: add a new elf note with siginfo fields of the signal

2012-09-17 Thread Pedro Alves
biarch) because of this, for "(gdb) print $_siginfo". I wish we had a PTRACE_GETSIGINFO variant that returned the siginfo_t in layout of the program, not the kernel's.. > Note also that compat_binfmt_elf must deliver the 32-bit version > of siginfo_t, i.e. as copy_siginfo_

Re: [PATCH v3 01/17] hashtable: introduce a small and naive hashtable

2012-09-06 Thread Pedro Alves
ing itself. On the other hand, if > the > internal loop has actually ended, then node will be NULL, and the outer loop > will keep running. > > Is there anything I've missed? Looks right to me, from a cursory look at hlist_for_each_entry. That's exactly what I meant

Re: [PATCH v3 01/17] hashtable: introduce a small and naive hashtable

2012-09-04 Thread Pedro Alves
. It's the comma that separates function parameters that doesn't guarantee ordering. -- Pedro Alves -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH v3 01/17] hashtable: introduce a small and naive hashtable

2012-09-04 Thread Pedro Alves
On 09/04/2012 09:59 PM, Steven Rostedt wrote: > On Tue, 2012-09-04 at 18:21 +0100, Pedro Alves wrote: >> On 09/04/2012 06:17 PM, Steven Rostedt wrote: >>> On Tue, 2012-09-04 at 17:40 +0100, Pedro Alves wrote: >>> >>>> BTW, you can also go a step fu

Re: [PATCH v3 01/17] hashtable: introduce a small and naive hashtable

2012-09-04 Thread Pedro Alves
On 09/04/2012 06:17 PM, Steven Rostedt wrote: > On Tue, 2012-09-04 at 17:40 +0100, Pedro Alves wrote: > >> BTW, you can also go a step further and remove the need to close with double >> }}, >> with something like: >> >> #d

Re: [PATCH v3 01/17] hashtable: introduce a small and naive hashtable

2012-09-04 Thread Pedro Alves
On 09/04/2012 05:30 PM, Pedro Alves wrote: > On 09/04/2012 04:35 PM, Steven Rostedt wrote: >> On Tue, 2012-08-28 at 19:00 -0400, Mathieu Desnoyers wrote: >> >>> Looking again at: >>> >>> +#define hash_for_each_size(name, bits, bkt, node, obj, member)

Re: [PATCH v3 01/17] hashtable: introduce a small and naive hashtable

2012-09-04 Thread Pedro Alves
\ for (_i = 0; _i < pg->index; _i++) {\ rec = &pg->records[_i]; (other variants possible) IOW, the outer loop only iterates if the inner loop completes. If there's a break in the inner loop, t