svn commit: r266272 - in stable/10: sys/conf sys/kern sys/modules sys/modules/imgact_binmisc sys/sys usr.sbin usr.sbin/binmiscctl
Sean Bruno
sbruno at FreeBSD.org
Fri May 16 21:56:35 UTC 2014
Author: sbruno
Date: Fri May 16 21:56:33 2014
New Revision: 266272
URL: http://svnweb.freebsd.org/changeset/base/266272
Log:
MFC r264269, r264282, r264280, r264291, r264276, r264314
Merge sson's binmiscctl and image activator features to stable/10
Submitted by: sson at freebsd.org
Added:
stable/10/sys/kern/imgact_binmisc.c
- copied, changed from r264269, head/sys/kern/imgact_binmisc.c
stable/10/sys/modules/imgact_binmisc/
- copied from r264269, head/sys/modules/imgact_binmisc/
stable/10/sys/sys/imgact_binmisc.h
- copied, changed from r264269, head/sys/sys/imgact_binmisc.h
stable/10/usr.sbin/binmiscctl/
- copied from r264269, head/usr.sbin/binmiscctl/
Modified:
stable/10/sys/conf/NOTES
stable/10/sys/conf/files.amd64
stable/10/sys/conf/files.i386
stable/10/sys/conf/options.amd64
stable/10/sys/conf/options.i386
stable/10/sys/modules/Makefile
stable/10/usr.sbin/Makefile
stable/10/usr.sbin/binmiscctl/binmiscctl.8
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/conf/NOTES
==============================================================================
--- stable/10/sys/conf/NOTES Fri May 16 21:20:13 2014 (r266271)
+++ stable/10/sys/conf/NOTES Fri May 16 21:56:33 2014 (r266272)
@@ -2973,3 +2973,6 @@ options RANDOM_YARROW # Yarrow RNG
##options RANDOM_FORTUNA # Fortuna RNG - not yet implemented
options RANDOM_DEBUG # Debugging messages
options RANDOM_RWFILE # Read and write entropy cache
+
+# Module to enable execution of application via emulators like QEMU
+options IMAGACT_BINMISC
Modified: stable/10/sys/conf/files.amd64
==============================================================================
--- stable/10/sys/conf/files.amd64 Fri May 16 21:20:13 2014 (r266271)
+++ stable/10/sys/conf/files.amd64 Fri May 16 21:56:33 2014 (r266272)
@@ -450,6 +450,7 @@ dev/virtio/balloon/virtio_balloon.c opti
dev/virtio/scsi/virtio_scsi.c optional virtio_scsi
isa/syscons_isa.c optional sc
isa/vga_isa.c optional vga
+kern/imgact_binmisc.c optional imagact_binmisc
kern/kern_clocksource.c standard
kern/link_elf_obj.c standard
#
Modified: stable/10/sys/conf/files.i386
==============================================================================
--- stable/10/sys/conf/files.i386 Fri May 16 21:20:13 2014 (r266271)
+++ stable/10/sys/conf/files.i386 Fri May 16 21:56:33 2014 (r266272)
@@ -533,6 +533,7 @@ isa/syscons_isa.c optional sc
isa/vga_isa.c optional vga
kern/kern_clocksource.c standard
kern/imgact_aout.c optional compat_aout
+kern/imgact_binmisc.c optional imagact_binmisc
kern/imgact_gzip.c optional gzip
libkern/divdi3.c standard
libkern/ffsl.c standard
Modified: stable/10/sys/conf/options.amd64
==============================================================================
--- stable/10/sys/conf/options.amd64 Fri May 16 21:20:13 2014 (r266271)
+++ stable/10/sys/conf/options.amd64 Fri May 16 21:56:33 2014 (r266272)
@@ -21,6 +21,7 @@ COMPAT_FREEBSD32 opt_compat.h
COMPAT_LINUX32 opt_compat.h
#COMPAT_SVR4 opt_dontuse.h
#DEBUG_SVR4 opt_svr4.h
+IMAGACT_BINMISC opt_dontuse.h
LINPROCFS opt_dontuse.h
LINSYSFS opt_dontuse.h
NDISAPI opt_dontuse.h
Modified: stable/10/sys/conf/options.i386
==============================================================================
--- stable/10/sys/conf/options.i386 Fri May 16 21:20:13 2014 (r266271)
+++ stable/10/sys/conf/options.i386 Fri May 16 21:56:33 2014 (r266272)
@@ -26,6 +26,7 @@ IBCS2 opt_dontuse.h
COMPAT_LINUX opt_dontuse.h
COMPAT_SVR4 opt_dontuse.h
DEBUG_SVR4 opt_svr4.h
+IMAGACT_BINMISC opt_binmisc.h
LINPROCFS opt_dontuse.h
LINSYSFS opt_dontuse.h
NDISAPI opt_dontuse.h
Copied and modified: stable/10/sys/kern/imgact_binmisc.c (from r264269, head/sys/kern/imgact_binmisc.c)
==============================================================================
--- head/sys/kern/imgact_binmisc.c Tue Apr 8 20:10:22 2014 (r264269, copy source)
+++ stable/10/sys/kern/imgact_binmisc.c Fri May 16 21:56:33 2014 (r266272)
@@ -182,7 +182,7 @@ imgact_binmisc_destroy_entry(imgact_binm
{
if (!ibe)
return;
- if (ibe->ibe_mask)
+ if (ibe->ibe_magic)
free(ibe->ibe_magic, M_BINMISC);
if (ibe->ibe_mask)
free(ibe->ibe_mask, M_BINMISC);
Modified: stable/10/sys/modules/Makefile
==============================================================================
--- stable/10/sys/modules/Makefile Fri May 16 21:20:13 2014 (r266271)
+++ stable/10/sys/modules/Makefile Fri May 16 21:56:33 2014 (r266272)
@@ -151,6 +151,7 @@ SUBDIR= \
if_vlan \
${_igb} \
${_iir} \
+ ${_imgact_binmisc} \
${_io} \
${_ipoib} \
${_ipdivert} \
@@ -377,6 +378,7 @@ SUBDIR= \
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
_filemon= filemon
+_imgact_binmisc= imgact_binmisc
_vmware= vmware
.endif
Copied and modified: stable/10/sys/sys/imgact_binmisc.h (from r264269, head/sys/sys/imgact_binmisc.h)
==============================================================================
--- head/sys/sys/imgact_binmisc.h Tue Apr 8 20:10:22 2014 (r264269, copy source)
+++ stable/10/sys/sys/imgact_binmisc.h Fri May 16 21:56:33 2014 (r266272)
@@ -40,7 +40,7 @@
#define IBE_VERSION 1 /* struct ximgact_binmisc_entry version. */
#define IBE_NAME_MAX 32 /* Max size for entry name. */
#define IBE_MAGIC_MAX 256 /* Max size for header magic and mask. */
-#define IBE_ARG_LEN_MAX 256 /* Max space for optional interpreter command-
+#define IBE_ARG_LEN_MAX 256 /* Max space for optional interpreter command-
line argruments seperated by white space */
#define IBE_INTERP_LEN_MAX (MAXPATHLEN + IBE_ARG_LEN_MAX)
#define IBE_MAX_ENTRIES 64 /* Max number of interpreter entries. */
@@ -70,7 +70,7 @@ typedef struct ximgact_binmisc_entry {
/*
* sysctl() command names.
*/
-#define IBE_SYSCTL_NAME "kern.binmisc"
+#define IBE_SYSCTL_NAME "kern.binmisc"
#define IBE_SYSCTL_NAME_ADD IBE_SYSCTL_NAME ".add"
#define IBE_SYSCTL_NAME_REMOVE IBE_SYSCTL_NAME ".remove"
@@ -82,7 +82,7 @@ typedef struct ximgact_binmisc_entry {
#define KMOD_NAME "imgact_binmisc"
/*
- * Examples of manipulating he interpreter table using sysctlbyname(3):
+ * Examples of manipulating the interpreter table using sysctlbyname(3):
*
* #include <sys/imgact_binmisc.h>
*
@@ -127,7 +127,7 @@ typedef struct ximgact_binmisc_entry {
* xbe.xbe_version = IBE_VERSION;
* strlcpy(xbe.xbe_name, "llvm_bc", IBE_NAME_MAX);
* error = sysctlbyname(IBE_SYSCTL_NAME_DISABLE, NULL, NULL, &xbe, sizeof(xbe));
- * // OR sysctlbyname(IBE_SYSCTL_NAME_ENABLE", NULL, NULL, &xbe, sizeof(xbe));
+ * // OR sysctlbyname(IBE_SYSCTL_NAME_ENABLE, NULL, NULL, &xbe, sizeof(xbe));
* // OR sysctlbyname(IBE_SYSCTL_NAME_REMOVE, NULL, NULL, &xbe, sizeof(xbe));
*
* // Lookup image activator "llvm_bc"
Modified: stable/10/usr.sbin/Makefile
==============================================================================
--- stable/10/usr.sbin/Makefile Fri May 16 21:20:13 2014 (r266271)
+++ stable/10/usr.sbin/Makefile Fri May 16 21:56:33 2014 (r266272)
@@ -5,6 +5,7 @@
SUBDIR= adduser \
arp \
+ binmiscctl \
bootparamd \
bsdconfig \
bsdinstall \
Modified: stable/10/usr.sbin/binmiscctl/binmiscctl.8
==============================================================================
--- head/usr.sbin/binmiscctl/binmiscctl.8 Tue Apr 8 20:10:22 2014 (r264269)
+++ stable/10/usr.sbin/binmiscctl/binmiscctl.8 Fri May 16 21:56:33 2014 (r266272)
@@ -27,8 +27,8 @@
.\"
.\" Support for miscellaneous binary image activators
.\"
-.Dd May 14, 2013
-.Dt 8
+.Dd April 10, 2014
+.Dt BINMISCCTL 8
.Os
.Sh NAME
.Nm binmiscctl
@@ -37,15 +37,15 @@
.Nm
.Cm add
.Ar name
-.Cm --interpreter
+.Cm --interpreter
.Ar path
-.Cm --magic
+.Cm --magic
.Ar magic
.Cm --size
.Ar size
-.Op --mask Ar mask
-.Op --offset Ar offset
-.Op --set-enabled
+.Op Cm --mask Ar mask
+.Op Cm --offset Ar offset
+.Op Cm --set-enabled
.Nm
.Cm remove
.Ar name
@@ -65,9 +65,11 @@ The
.Nm
utility
is the management utility for configuring miscellaneous binaries image
-activators in the kernel. It allows the adding, deleting, disabling,
-enabling, and looking up interpreters. Also, all the interpreters can
-be listed as well.
+activators in the kernel.
+It allows adding, deleting, disabling,
+enabling, and looking up interpreters.
+Also, all the interpreters can
+be listed.
.Pp
The first argument on the command line indicates the operation to be
performed.
@@ -76,24 +78,25 @@ Operation must be one of the following:
.It Xo
.Cm add
.Ar name
-.Cm --interpreter
+.Cm --interpreter
.Ar path
.Cm --magic
.Ar magic
.Cm --size
.Ar size
-.Op --mask Ar mask
-.Op --offset Ar offset
-.Op --set-enabled
+.Op Cm --mask Ar mask
+.Op Cm --offset Ar offset
+.Op Cm --set-enabled
.Xc
-Add a new activator entry in the kernel. You must specify an
+Add a new activator entry in the kernel.
+You must specify a
unique
.Ar name,
-interpreter path and its arguments
+interpreter path and its arguments
.Ar path,
header
.Ar magic
-bytes that uniquely identifies a suitable binary for the activator,
+bytes that uniquely identify a suitable binary for the activator,
and the
.Ar size
of the
@@ -103,27 +106,30 @@ in bytes.
Optionally you may specify a
.Ar mask
to do a bitwise AND with the header bytes.
-
This effectively allows you to ignore fields in the binary header that
-do not uniquely indentfy binary file's type.
+do not uniquely indentify the binary file's type.
.Pp
An
.Ar offset
may be specified for the magic bytes using the
-.Ar --offset
-argument. By default the
+.Cm --offset
+option.
+By default the
.Ar offset
is zero.
.Pp
-To set the activator entry enabled the
-.Ar --set-enabled
-option is used. The activator default state is disabled.
+To enable the activator entry the
+.Cm --set-enabled
+option is used.
+The activator default state is disabled.
.Pp
The interpreter
.Ar path
-may also arguments for the interpreter including
+may also contain arguments for the interpreter including
.Ar #a
-which gets replaced by the old argv0 value in the interpreter string.
+which gets replaced by the old
+.Dv argv0
+value in the interpreter string.
.It Cm remove Ar name
Remove the activator entry identified with
.Ar name .
@@ -134,53 +140,57 @@ Disable the activator entry identified w
Enable the activator entry identified with
.Ar name .
.It Cm lookup Ar name
-Lookup and print out the activator entry identified with
+Look up and print out the activator entry identified with
.Ar name .
.It Cm list
Take a snapshot and print all the activator entries currently configured.
.El
.Sh EXAMPLES
-.Dl binmiscctl add llvmbc --interpreter ''/usr/bin/lli --fake-argv0=#a''
---magic ''BC\\xc0\\xde''
---size 4 --set-enabled
+.Bl
+# binmiscctl add llvmbc --interpreter ''/usr/bin/lli --fake-argv0=#a'' \\
+ --magic ''BC\\xc0\\xde'' --size 4 --set-enabled
+.El
.Pp
-Add an image activator to run the the llvm interpreter (lli) on bitcode
+Add an image activator to run the LLVM interpreter (lli) on bitcode
compiled files.
.Ar #a
-gets replaced with the old argv0 value so that 'lli' can fake its argv0.
+gets replaced with the old
+.Dv argv0
+value so that 'lli' can fake its
+.Dv argv0 .
Set its state to enabled.
.Pp
-.Dl binmiscctl disable llvmbc
+.Dl # binmiscctl disable llvmbc
.Pp
Set the state of the
.Ar llvmbc
image activator to disabled.
.Pp
-.Dl binmiscctl enable llvmbc
+.Dl # binmiscctl enable llvmbc
.Pp
Set the state of the
.Ar llvmbc
image activator to enabled.
.Pp
-.Dl binmiscctl remove llvmbc
+.Dl # binmiscctl remove llvmbc
.Pp
Delete the
.Ar llvmbc
image activator.
.Pp
-.Dl binmiscctl lookup llvmbc
+.Dl # binmiscctl lookup llvmbc
.Pp
-Lookup and list the record for the
+Look up and list the record for the
.Ar llvmbc
image activator.
.Sh SEE ALSO
+.Xr lli 1 ,
.Xr execve 2
-.Xr lli 1
.Sh HISTORY
The
.Cm binmiscctl
command was added in
-.Fx 10.0 .
+.Fx 10.1 .
It was developed to support the imgact_binmisc kernel module.
.Sh AUTHORS
Stacey D Son
More information about the svn-src-stable-10
mailing list