svn commit: r347970 - stable/12/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Sun May 19 09:24:52 UTC 2019
Author: kib
Date: Sun May 19 09:24:51 2019
New Revision: 347970
URL: https://svnweb.freebsd.org/changeset/base/347970
Log:
MFC r347690, r347946:
imgact_elf.c: Add comment explaining the malloc/VOP_UNLOCK() dance
from r347148.
Modified:
stable/12/sys/kern/imgact_elf.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/kern/imgact_elf.c
==============================================================================
--- stable/12/sys/kern/imgact_elf.c Sun May 19 09:23:20 2019 (r347969)
+++ stable/12/sys/kern/imgact_elf.c Sun May 19 09:24:51 2019 (r347970)
@@ -958,12 +958,22 @@ __elfN(get_interp)(struct image_params *imgp, const El
interp_name_len = phdr->p_filesz;
if (phdr->p_offset > PAGE_SIZE ||
interp_name_len > PAGE_SIZE - phdr->p_offset) {
+ /*
+ * The vnode lock might be needed by the pagedaemon to
+ * clean pages owned by the vnode. Do not allow sleep
+ * waiting for memory with the vnode locked, instead
+ * try non-sleepable allocation first, and if it
+ * fails, go to the slow path were we drop the lock
+ * and do M_WAITOK. A text reference prevents
+ * modifications to the vnode content.
+ */
interp = malloc(interp_name_len + 1, M_TEMP, M_NOWAIT);
if (interp == NULL) {
VOP_UNLOCK(imgp->vp, 0);
interp = malloc(interp_name_len + 1, M_TEMP, M_WAITOK);
vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY);
}
+
error = vn_rdwr(UIO_READ, imgp->vp, interp,
interp_name_len, phdr->p_offset,
UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred,
More information about the svn-src-stable-12
mailing list