Bug 218593

Summary: [patch] binmiscctl should use modfind instead of kldfind
Product: Base System Reporter: Dan Nelson <dnelson_1901>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Some People CC: emaste, sbruno, sson
Priority: --- Keywords: patch
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
use modfind none

Description Dan Nelson 2017-04-12 15:35:04 UTC
Created attachment 181720 [details]
use modfind

kldfind() only matches kernel modules, so if you link imgact_binmisc directly into the kernel, binmiscctl can't find it, tries to load it, and errors out with:

  Can't load imgact_binmisc kernel module: File exists

A quick search of other base commands shows that the correct procedure is to call modfind(), and then try kldload() if that fails.
Comment 1 commit-hook freebsd_committer freebsd_triage 2017-07-28 18:12:50 UTC
A commit references this bug:

Author: sbruno
Date: Fri Jul 28 18:11:54 UTC 2017
New revision: 321658
URL: https://svnweb.freebsd.org/changeset/base/321658

Log:
  binmiscctl should use modfind instead of kldfind

  kldfind() only matches kernel modules, so if you link imgact_binmisc directly
  into the kernel, binmiscctl can't find it, tries to load it, and errors
  out with:
    Can't load imgact_binmisc kernel module: File exists

  A quick search of other base commands shows that the correct procedure is to
  call modfind(), and then try kldload() if that fails.

  PR:		218593
  Submitted by:	Dan Nelson <dnelson_1901@yahoo.com>
  MFC after:	1 week

Changes:
  head/usr.sbin/binmiscctl/binmiscctl.c
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:54:11 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

Do
- Set Status to "Open"