Changeset View
Standalone View
sys/kern/vfs_vnops.c
Show First 20 Lines • Show All 2,353 Lines • ▼ Show 20 Lines | vn_vget_ino_gen(struct vnode *vp, vn_get_ino_t alloc, void *alloc_arg, | ||||
} | } | ||||
return (error); | return (error); | ||||
} | } | ||||
int | int | ||||
vn_rlimit_fsize(const struct vnode *vp, const struct uio *uio, | vn_rlimit_fsize(const struct vnode *vp, const struct uio *uio, | ||||
struct thread *td) | struct thread *td) | ||||
{ | { | ||||
off_t lim; | |||||
if (vp->v_type != VREG || td == NULL) | if (vp->v_type != VREG || td == NULL || | ||||
(td->td_pflags2 & TDP2_ACCT) != 0) | |||||
return (0); | return (0); | ||||
if ((uoff_t)uio->uio_offset + uio->uio_resid > | lim = (td->td_pflags2 & TDP2_KTRWRITE) != 0 ? td->td_ktr_io_lim : | ||||
lim_cur(td, RLIMIT_FSIZE)) { | lim_cur(td, RLIMIT_FSIZE); | ||||
markj: I would use local variables for both sides of the `<=` comparison. This is painful to read… | |||||
if ((uoff_t)uio->uio_offset + uio->uio_resid < lim) | |||||
return (0); | |||||
PROC_LOCK(td->td_proc); | PROC_LOCK(td->td_proc); | ||||
kern_psignal(td->td_proc, SIGXFSZ); | kern_psignal(td->td_proc, SIGXFSZ); | ||||
markjUnsubmitted Not Done Inline ActionsSo if a tracing process has a limit imposed, and tracing exceeds the limit, we will send a default-fatal signal to the traced process. This is not good behaviour for a debugging tool IMO. At this point we should instead disable tracing and ideally log some record to indicate what happened. markj: So if a tracing process has a limit imposed, and tracing exceeds the limit, we will send a… | |||||
kibAuthorUnsubmitted Done Inline ActionsThis is one approach. But the semantic of SIGXFSZ was defined long time ago. You might equally complain that we kill all debuggees on debugger termination, but this is how FreeBSD kernel behaves. I can easily change this place to not send SIGXFSZ, then ktr_writerequest() would automatically stop tracing anyway, but I am not sure that this is right, even if not desirable. kib: This is one approach. But the semantic of SIGXFSZ was defined long time ago. You might… | |||||
markjUnsubmitted Done Inline ActionsWell, that behaviour of ptrace() is quite annoying, in many cases I believe it is unnecessary. If anything, SIGXFSZ should be sent to the tracing process, not the tracee. markj: Well, that behaviour of ptrace() is quite annoying, in many cases I believe it is unnecessary. | |||||
kibAuthorUnsubmitted Done Inline ActionsThere is no tracing process. Ok. I will add a control, default off, to allow/disallow the signal there. kib: There is no tracing process.
Ok. I will add a control, default off, to allow/disallow the… | |||||
PROC_UNLOCK(td->td_proc); | PROC_UNLOCK(td->td_proc); | ||||
return (EFBIG); | return (EFBIG); | ||||
} | |||||
return (0); | |||||
} | } | ||||
int | int | ||||
vn_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, | vn_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, | ||||
struct thread *td) | struct thread *td) | ||||
{ | { | ||||
struct vnode *vp; | struct vnode *vp; | ||||
▲ Show 20 Lines • Show All 1,133 Lines • Show Last 20 Lines |
I would use local variables for both sides of the <= comparison. This is painful to read otherwise.