Page MenuHomeFreeBSD

Collection of fixes for exec/v_writecount handling.
ClosedPublic

Authored by kib on Sat, Sep 7, 12:33 PM.

Details

Summary

[Each will be a separate commit]

  1. Remove unwanted code from the object deallocate. We track text mappings explicitly, there is no removal of the text refs on the object deallocate any more, so tmpfs objects should not be treated specially. Doing so causes excessive deref.
  2. In vm_object_coalesce(), avoid extending any OBJ_NOSPLIT objects, not only tmpfs backing.
  3. When loading ELF interpreter, initialize whole image_params with zero, otherwise we could mishandle imgp->textset.
  4. In do_execve(), switch to shared text vnode lock consistently.
  5. In do_execve(), clear imgp->textset when restarting for interpreter.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kib created this revision.Sat, Sep 7, 12:33 PM
markj added inline comments.Sat, Sep 7, 1:32 PM
sys/ufs/ufs/ufs_quota.c
620 ↗(On Diff #61784)

Can you explain why this is needed? What happens when the text references are released following the quotaon()?

kib added inline comments.Sat, Sep 7, 2:32 PM
sys/ufs/ufs/ufs_quota.c
620 ↗(On Diff #61784)

This is not about text refs, but to properly handle writers. The condition can be read as !WRITERS_EXIST(vp). If there are writers, we must attach dquot to the vnode, as if it happened during open for write.

Previously, !WRITERS_EXIST() was expressed as v_writecount == 0, but now it is <= 0.

markj accepted this revision.Sat, Sep 7, 2:42 PM
This revision is now accepted and ready to land.Sat, Sep 7, 2:42 PM

What scenario would ever have v_writecount be less than zero?

kib added a comment.Mon, Sep 9, 7:18 AM

What scenario would ever have v_writecount be less than zero?

I removed VV_TEXT and made v_writecount count either writers for positive values, or text mappings for negative. Much more details are available at https://www.freebsd.org/news/status/report-2019-04-2019-06.html#Locking-changes-for-vnodes-during-execve(2)