Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F158052365
D53482.id165572.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D53482.id165572.diff
View Options
diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c
--- a/sys/kern/subr_syscall.c
+++ b/sys/kern/subr_syscall.c
@@ -55,8 +55,8 @@
struct proc *p;
struct syscall_args *sa;
struct sysent *se;
- int error, traced;
- bool sy_thr_static;
+ int error;
+ bool do_set_rv, sy_thr_static, traced;
VM_CNT_INC(v_syscall);
p = td->td_proc;
@@ -98,6 +98,10 @@
PROC_UNLOCK(p);
if ((td->td_dbgflags & TDB_USERWR) != 0) {
+ PROC_LOCK(p);
+ td->td_dbgflags &= ~TDB_USERWR;
+ PROC_UNLOCK(p);
+
/*
* Reread syscall number and arguments if debugger
* modified registers or memory.
@@ -203,12 +207,16 @@
(uintptr_t)td, "pid:%d", td->td_proc->p_pid, "error:%d", error,
"retval0:%#lx", td->td_retval[0], "retval1:%#lx",
td->td_retval[1]);
+ do_set_rv = true;
if (__predict_false(traced)) {
PROC_LOCK(p);
- td->td_dbgflags &= ~(TDB_SCE | TDB_BOUNDARY);
+ if ((td->td_dbgflags & TDB_USERWR) != 0)
+ do_set_rv = false;
+ td->td_dbgflags &= ~(TDB_SCE | TDB_BOUNDARY | TDB_USERWR);
PROC_UNLOCK(p);
}
- (p->p_sysent->sv_set_syscall_retval)(td, error);
+ if (__predict_true(do_set_rv))
+ (p->p_sysent->sv_set_syscall_retval)(td, error);
if (error != 0 && (td->td_pflags2 & TDP2_UEXTERR) != 0)
exterr_copyout(td);
}
@@ -219,7 +227,7 @@
struct proc *p;
struct syscall_args *sa;
ksiginfo_t ksi;
- int traced;
+ bool traced;
KASSERT(td->td_errno != ERELOOKUP,
("ERELOOKUP not consumed syscall %d", td->td_sa.code));
@@ -250,9 +258,9 @@
}
#endif
- traced = 0;
+ traced = false;
if (__predict_false(p->p_flag & P_TRACED)) {
- traced = 1;
+ traced = true;
PROC_LOCK(p);
td->td_dbgflags |= TDB_SCX;
PROC_UNLOCK(p);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, May 28, 11:47 PM (1 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33594730
Default Alt Text
D53482.id165572.diff (1 KB)
Attached To
Mode
D53482: syscalls: if ptrace(PT_SETREG) occured during syscall, do not do set_syscall_retval()
Attached
Detach File
Event Timeline
Log In to Comment