| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: sys_ptrace_common.c,v 1.64 2019/10/07 21:32:51 kamil Exp $ */ | | 1 | /* $NetBSD: sys_ptrace_common.c,v 1.65 2019/10/08 12:29:57 kamil Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Andrew Doran. | | 8 | * by Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -108,27 +108,27 @@ | | | @@ -108,27 +108,27 @@ |
108 | | | 108 | |
109 | /* | | 109 | /* |
110 | * References: | | 110 | * References: |
111 | * (1) Bach's "The Design of the UNIX Operating System", | | 111 | * (1) Bach's "The Design of the UNIX Operating System", |
112 | * (2) sys/miscfs/procfs from UCB's 4.4BSD-Lite distribution, | | 112 | * (2) sys/miscfs/procfs from UCB's 4.4BSD-Lite distribution, |
113 | * (3) the "4.4BSD Programmer's Reference Manual" published | | 113 | * (3) the "4.4BSD Programmer's Reference Manual" published |
114 | * by USENIX and O'Reilly & Associates. | | 114 | * by USENIX and O'Reilly & Associates. |
115 | * The 4.4BSD PRM does a reasonably good job of documenting what the various | | 115 | * The 4.4BSD PRM does a reasonably good job of documenting what the various |
116 | * ptrace() requests should actually do, and its text is quoted several times | | 116 | * ptrace() requests should actually do, and its text is quoted several times |
117 | * in this file. | | 117 | * in this file. |
118 | */ | | 118 | */ |
119 | | | 119 | |
120 | #include <sys/cdefs.h> | | 120 | #include <sys/cdefs.h> |
121 | __KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.64 2019/10/07 21:32:51 kamil Exp $"); | | 121 | __KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.65 2019/10/08 12:29:57 kamil Exp $"); |
122 | | | 122 | |
123 | #ifdef _KERNEL_OPT | | 123 | #ifdef _KERNEL_OPT |
124 | #include "opt_ptrace.h" | | 124 | #include "opt_ptrace.h" |
125 | #include "opt_ktrace.h" | | 125 | #include "opt_ktrace.h" |
126 | #include "opt_pax.h" | | 126 | #include "opt_pax.h" |
127 | #include "opt_compat_netbsd32.h" | | 127 | #include "opt_compat_netbsd32.h" |
128 | #endif | | 128 | #endif |
129 | | | 129 | |
130 | #if defined(__HAVE_COMPAT_NETBSD32) && !defined(COMPAT_NETBSD32) \ | | 130 | #if defined(__HAVE_COMPAT_NETBSD32) && !defined(COMPAT_NETBSD32) \ |
131 | && !defined(_RUMPKERNEL) | | 131 | && !defined(_RUMPKERNEL) |
132 | #define COMPAT_NETBSD32 | | 132 | #define COMPAT_NETBSD32 |
133 | #endif | | 133 | #endif |
134 | | | 134 | |
| @@ -1251,27 +1251,27 @@ do_ptrace(struct ptrace_methods *ptm, st | | | @@ -1251,27 +1251,27 @@ do_ptrace(struct ptrace_methods *ptm, st |
1251 | error = EDEADLK; | | 1251 | error = EDEADLK; |
1252 | LIST_FOREACH(lt2, &t->p_lwps, l_sibling) { | | 1252 | LIST_FOREACH(lt2, &t->p_lwps, l_sibling) { |
1253 | if ((lt2->l_flag & | | 1253 | if ((lt2->l_flag & |
1254 | (LW_WSUSPEND | LW_DBGSUSPEND)) == 0 | | 1254 | (LW_WSUSPEND | LW_DBGSUSPEND)) == 0 |
1255 | ) { | | 1255 | ) { |
1256 | error = 0; | | 1256 | error = 0; |
1257 | break; | | 1257 | break; |
1258 | } | | 1258 | } |
1259 | } | | 1259 | } |
1260 | if (error != 0) | | 1260 | if (error != 0) |
1261 | break; | | 1261 | break; |
1262 | } | | 1262 | } |
1263 | } else { | | 1263 | } else { |
1264 | if (lt->l_flag & (LW_WSUSPEND | LW_WSUSPEND)) { | | 1264 | if (lt->l_flag & (LW_WSUSPEND | LW_DBGSUSPEND)) { |
1265 | error = EDEADLK; | | 1265 | error = EDEADLK; |
1266 | break; | | 1266 | break; |
1267 | } | | 1267 | } |
1268 | } | | 1268 | } |
1269 | | | 1269 | |
1270 | /* | | 1270 | /* |
1271 | * Reject setting program counter to 0x0 if VA0 is disabled. | | 1271 | * Reject setting program counter to 0x0 if VA0 is disabled. |
1272 | * | | 1272 | * |
1273 | * Not all kernels implement this feature to set Program | | 1273 | * Not all kernels implement this feature to set Program |
1274 | * Counter in one go in PT_CONTINUE and similar operations. | | 1274 | * Counter in one go in PT_CONTINUE and similar operations. |
1275 | * This causes portability issues as passing address 0x0 | | 1275 | * This causes portability issues as passing address 0x0 |
1276 | * on these kernels is no-operation, but can cause failure | | 1276 | * on these kernels is no-operation, but can cause failure |
1277 | * in most cases on NetBSD. | | 1277 | * in most cases on NetBSD. |