Commit Graph

12 Commits

Author SHA1 Message Date
Sean Bruno
910938f079 Repair a overflow condition where a user could submit a string that was
not getting a proper bounds check.

Thanks to CTurt for pointing at this with a big red blinking neon sign.

PR:		206761
Submitted by:	sson
Reviewed by:	cturt@hardenedbsd.org
MFC after:	3 days
2016-04-01 16:16:26 +00:00
Sean Bruno
4e83b32a80 At the suggestion of jhb, replace atomic_set/clear calls with use of
exclusive locks in the enable/disable interpreter path.

Tested with WITNESS/INVARIANTS on and off.

Reviewed by:	sson davide
2015-06-24 15:52:26 +00:00
Sean Bruno
945afa7c25 Make imgact_binmisc_exec() static.
Submitted by:	kib
Reviewed by:	sson
2015-06-22 17:04:24 +00:00
Sean Bruno
602ec83516 Remove uneeded NULL check since malloc the malloc is now M_WAITOK
Submitted by:	mjg
2015-06-19 20:35:17 +00:00
Sean Bruno
e0ae213f63 Must have one of either M_WAITOK or M_NOWAIT, read the man page bruno.
Submitted by:	mjg
2015-06-19 19:57:39 +00:00
Sean Bruno
a7647ec444 Feedback from commit r284535
davide:  imgact_binmisc_clear_entry() needs to use atomic ops to remove
the enable bit.

kib:  M_NOWAIT is not warranted and comment is invalid.
2015-06-19 18:57:36 +00:00
Sean Bruno
5f98711d51 This change replaces the mutex with a sx lock for the interpreter list to
avoid the problem of holding a non-sleep lock during a page fault as
reported by witness. It also uses atomics where possible to avoid having
to acquire the exclusive lock. In addition, it consistently uses
memset()/memcpy() instead of bzero()/bcopy().

Differential Revision:	https://reviews.freebsd.org/D1971
Submitted by:	sson
Reviewed by:	jhb
2015-06-18 02:04:20 +00:00
Sean Bruno
280b716943 Revert 284029, update imgact_binmisctl.c change mtx to reader count, at the
request of the submitter.

Will attempt to use an sx_lock for this fix to WITNESS crashes in a later
revision.

Submitted by:	sson
2015-06-05 18:16:10 +00:00
Sean Bruno
8c8613a14f This change uses a reader count instead of holding the mutex for the
interpreter list to avoid the problem of holding a non-sleep lock during
a page fault as reported by witness.  In addition, it consistently uses
memset()/memcpy() instead of bzero()/bcopy() except in the case where
bcopy() is required (i.e. overlapping copy).

Differential Revision:	https://reviews.freebsd.org/D2123
Submitted by:	sson
MFC after:	2 weeks
Relnotes:	Yes
2015-06-05 16:21:43 +00:00
Sean Bruno
65f20a89f1 Allow multiple image activators to run on the same execution by changing
imgp->interpreted to a bitmask instead of, functionally, a bool. Each
imgactivator now requires its own flag in interpreted to indicate whether
or not it has already examined argv[0].

Change imgp->interpreted to an unsigned char to add one extra bit for
future use.

With this change, one can execute a shell script from a 64bit host native
make and still get the binmisc image activator to fire for the script
interpreter.  Prior to this, execution would fail.

Phabric:	https://reviews.freebsd.org/D696
Reviewed by:	jhb@
MFC after:	4 weeks
2014-09-04 21:31:25 +00:00
Sean Bruno
b888dae4c8 sys/kern/imgact_binmisc.c -- free the right pointer mask vs magic
sys/sys/imagact_binmisc.h -- cleanup white space tabs vs spaces
                          -- remove stray " in comment

Submitted by:	jmallett@
2014-04-08 22:12:01 +00:00
Sean Bruno
6d75644981 Add Stacey Son's binary activation patches that allow remapping of
execution to a emumation program via parsing of ELF header information.

With this kernel module and userland tool, poudriere is able to build
ports packages via the QEMU userland tools (or another emulator program)
in a different architecture chroot, e.g. TARGET=mips TARGET_ARCH=mips

I'm not connecting this to GENERIC for obvious reasons, but this should
allow the kernel module to be built by default and enable the building
of the userland tool (which automatically loads the kernel module).

Submitted by:	sson@
Reviewed by:	jhb@
2014-04-08 20:10:22 +00:00