Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F170945411
D59113.id184762.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D59113.id184762.diff
View Options
diff --git a/lib/libsys/ptrace.2 b/lib/libsys/ptrace.2
--- a/lib/libsys/ptrace.2
+++ b/lib/libsys/ptrace.2
@@ -1105,6 +1105,17 @@
The child process is currently being debugged by a process other
than its parent process.
.El
+.It Dv PT_GET_ABI_NAME
+Returns the string designating the Application Binary Interface (ABI)
+of the traced process.
+Among other details, ABI defines the interpretation of the system calls
+numbers and arguments.
+.Pp
+The buffer where the name is returned is pointed to by the
+.Fa addr
+argument, the length of the buffer is passed in the
+.Fa data
+argument.
.El
.Sh PT_COREDUMP and PT_SC_REMOTE usage
The process must be stopped before dumping or initiating a remote system call.
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -1033,6 +1033,7 @@
struct ptrace_sc_ret psr;
int ptevents;
struct ptrace_child *children;
+ char sv_name[32];
} r;
union {
struct ptrace_io_desc32 piod;
@@ -1168,6 +1169,9 @@
else
addr = &r.children;
break;
+ case PT_GET_ABI_NAME:
+ data = sizeof(r.sv_name);
+ break;
case PTINTERNAL_FIRST ... PTINTERNAL_LAST:
error = EINVAL;
break;
@@ -1242,6 +1246,10 @@
free(r.children, M_TEMP);
}
break;
+ case PT_GET_ABI_NAME:
+ error = udata <= strlen(r.sv_name) ? ENOMEM :
+ copyout(&r.sv_name, uaddr, strlen(r.sv_name) + 1);
+ break;
}
return (error);
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -743,10 +743,11 @@
struct ptrace_sc_ret psr;
int ptevents;
struct ptrace_child *children;
+ char sv_name[32];
} r;
syscallarg_t pscr_args[nitems(td->td_sa.args)];
void *addr;
- int error;
+ int error, data;
error = 0;
addr = &r;
@@ -820,6 +821,10 @@
else
addr = &r.children;
break;
+ case PT_GET_ABI_NAME:
+ data = udata;
+ udata = sizeof(r.sv_name);
+ break;
case PTINTERNAL_FIRST ... PTINTERNAL_LAST:
error = EINVAL;
break;
@@ -879,6 +884,10 @@
free(r.children, M_TEMP);
}
break;
+ case PT_GET_ABI_NAME:
+ error = data <= strlen(r.sv_name) ? ENOMEM :
+ copyout(&r.sv_name, uaddr, strlen(r.sv_name) + 1);
+ break;
}
return (error);
@@ -2030,6 +2039,10 @@
PROC_LOCK(p);
break;
+ case PT_GET_ABI_NAME:
+ strlcpy(addr, p->p_sysent->sv_name, data);
+ break;
+
default:
#ifdef __HAVE_PTRACE_MACHDEP
if (req >= PT_FIRSTMACH) {
diff --git a/sys/sys/ptrace.h b/sys/sys/ptrace.h
--- a/sys/sys/ptrace.h
+++ b/sys/sys/ptrace.h
@@ -87,6 +87,7 @@
#define PT_SC_REMOTE 44 /* Execute a syscall */
#define PT_SET_SC_RET 45 /* Set (fake) syscall results */
#define PT_GET_CHILDREN 46 /* Report children */
+#define PT_GET_ABI_NAME 47 /* Report ABI name */
#define PT_FIRSTMACH 64 /* for machine-specific requests */
#define PT_LASTMACH 127
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 8, 6:59 PM (6 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38531520
Default Alt Text
D59113.id184762.diff (2 KB)
Attached To
Mode
D59113: ptrace(PT_GET_ABI_NAME)
Attached
Detach File
Event Timeline
Log In to Comment