Commit Graph

252521 Commits

Author SHA1 Message Date
wiz 2714e00feb Standardize NAME section.
Remove unneeded troff macros.

XXX: this is still MLINKed as names that are not in Nm.
2017-07-29 22:47:55 +00:00
riastradh 76d4b81251 Clarify compile-time and run-time arithmetic safety assertions.
This is an experiment with a handful of macros for writing the
checks, most of which are compile-time:

MUL_OK(t, a, b)         Does a*b avoid overflow in type t?
ADD_OK(t, a, b)         Does a + b avoid overflow in type t?
TOOMANY(t, x, b, m)     Are there more than m b-element blocks in x in type t?
                        (I.e., does ceiling(x/b) > m?)

Addenda that might make sense but are not needed here:

MUL(t, a, b, &p)        Set p = a*b and return 0, or return ERANGE if overflow.
ADD(t, a, b, &s)        Set s = a+b and return 0, or return ERANGE if overflow.

Example:

	uint32_t a = ..., b = ..., y = ..., z = ..., x, w;

        /* input validation */
        error = MUL(size_t, a, b, &x);
        if (error)
                fail;
        if (TOOMANY(uint32_t, x, BLKSIZ, MAX_NBLK))
                fail;
        y = HOWMANY(x, BLKSIZ);
        if (z > Z_MAX)
                fail;
        ...
        /* internal computation */
        __CTASSERT(MUL_OK(uint32_t, Z_MAX, MAX_NBLK));
        w = z*y;

Obvious shortcomings:

1. Nothing checks your ctassert matches your subsequent arithmetic.
   (Maybe we could have BOUNDED_MUL(t, x, xmax, y, ymax) with a
   ctassert inside.)

2. Nothing flows the bounds needed by the arithmetic you use back
   into candidate definitions of X_MAX/Y_MAX.

But at least the reviewer's job is only to make sure that (a) the
MUL_OK matches the *, and (b) the bounds in the assertion match the
bounds on the inputs -- in particular, the reviewer need not derive
the bounds from the context, only confirm they are supported by the
paths to it.

This is not meant to be a general-purpose proof assistant, or even a
special-purpose one like gfverif <http://gfverif.cryptojedi.org/>.
Rather, it is an experiment in adding a modicum of compile-time
verification with a simple C API change.

This also is not intended to serve as trapping arithmetic on
overflow.  The goal here is to enable writing the program with
explicit checks on input and compile-time annotations on computation
to gain confident that overflow won't happen in the computation.
2017-07-29 21:04:07 +00:00
kre 3dd9fc4cd5 If i386/svr4_machdep.h is no longer to be installed in /usr/include
it should no longer be listed in the sets lists as installed.
Mark it obsolete (hopefully unbreak builds.)
2017-07-29 19:39:58 +00:00
maxv 5f6e25a19d Remove TCP_COMPAT_42 from the config files. Pass 3. 2017-07-29 18:08:56 +00:00
maxv 75dc141655 Remove unused. 2017-07-29 13:05:15 +00:00
maxv 96902e11a8 Remove undocumented hack. 2017-07-29 12:34:34 +00:00
maxv f1654d53d9 Remove TCP_COMPAT_42 from the config files. Pass 2. 2017-07-29 12:28:27 +00:00
maxv 9f48c0d28b Remove references to i386. 2017-07-29 12:15:12 +00:00
maxv 0c75c4b202 Unlink svr4_machdep.h. 2017-07-29 12:07:45 +00:00
maxv ec919cac1c Remove i386. By the way, it looks like several architectures are missing
here.
2017-07-29 12:03:37 +00:00
maxv fc0b0df059 Remove svr4 from the config files. 2017-07-29 12:00:56 +00:00
maxv f8c5f9a01a Drop support for svr4 on i386. This feature is not maintained, not
reliable, and of a limited use case. Most svr4 applications got time to be
ported to linux, and we do have a functional, maintained linux emulation.

Reduces the number of entry points into the kernel, the number of
places that need special care (cpu context).

Note that compat_svr4 is still available on sparc.
2017-07-29 11:54:14 +00:00
maxv 02de58a76a Remove exec_aout support in compat_freebsd. The only reason we still have
compat_freebsd is because of tw_cli, and it is an elf32 binary (could test,
manuel sent it to me).
2017-07-29 10:39:48 +00:00
nat 6a19d790db Audio vchan auto config works again due to the use of a null_filter.
Tested and confirmed working by isaki@.
2017-07-29 07:30:39 +00:00
maxv 3641bf3325 Remove DEBUG_HPUX (does not exist). 2017-07-29 07:19:47 +00:00
maxv 7db846e6fd Remove IBCS2_DEBUG (does not exist). 2017-07-29 07:16:14 +00:00
isaki 9cc1f3a273 "bits" sounds better than "name" for argument name.
I feel expression (name / NBBY) a little strange.
2017-07-29 06:45:35 +00:00
isaki b97a46112d Use do .. while (0) for macros. 2017-07-29 06:36:21 +00:00
isaki 01946fe853 Fix a resource leak on error handling in audio_alloc_ring(). 2017-07-29 06:33:45 +00:00
isaki 85f3ef89d9 Fix error handling of ring buffers allocation in audioattach().
NULL dereference, dead code, reference to uninitialized variable,
and mutex leak.
XXX In the current implementation, if audio_alloc_ring() returns error,
    it is not guaranteed that ringbuf->s.start will be NULL.
2017-07-29 06:30:56 +00:00
maxv 9eb1871ea8 Remove the remaining parts of compat_oldboot. 2017-07-29 06:29:31 +00:00
maxv ebdd118f49 Only compat_43 needs compat_osock. Note that the use of vec_compat_ifioctl
is racy.
2017-07-29 06:12:50 +00:00
isaki 1538623e70 0 -> NULL in audioattach() 2017-07-29 06:00:47 +00:00
maxv 224c135571 Disable COMPAT_386BSD_MBRPART on Xen - not enabled in GENERIC. 2017-07-29 05:59:08 +00:00
isaki f8b6ae2e9b const-ify. 2017-07-29 05:55:58 +00:00
maxv f133a773cb Remove TCP_COMPAT_42. 2017-07-29 05:46:29 +00:00
maxv b75506ad03 Forgot to commit this file yesterday. 2017-07-29 05:08:48 +00:00
riastradh 37bfd4eb93 Kill needless nested extern of vec_compat_cvtcmd/ioctl.
Already declared in if_43.h.
2017-07-29 04:08:47 +00:00
riastradh cf25436d17 Declare mountcompatnames in sys/vfs_syscalls.h to kill nested extern. 2017-07-29 04:02:49 +00:00
macallan 6702d52449 make comment match code... 2017-07-29 03:32:00 +00:00
macallan 1ce862853f - use hardware to draw bitmap fonts
- while there enable font loading etc.
2017-07-29 03:29:49 +00:00
isaki 523325e08b Improve audio_set_vchan_defaults().
- Correct confused input/output parameters.
- Remove sc->{sc_channels, sc_precision, sc_frequency}.  They are
  the same as sc->sc_vchan_params.{channels, precision, sample_rate}.
The input parameter of audio_set_vchan_defaults() is now only
sc->sc_vchan_params.

Fix PR kern/52437
2017-07-29 03:05:51 +00:00
riastradh d82060bc36 Put suser check in the right function: settimeofday, not gettimeofday.
While here, remove wrong comment.

Noted by kre@.
2017-07-29 02:31:22 +00:00
riastradh 887101f256 Avoid memory leak in sonic_get.
If this is the first time around, top is null and nothing else will
free m.

From Ilja Van Sprundel.
2017-07-29 02:21:30 +00:00
riastradh 6b620c120e Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.

From Ilja Van Sprundel.
2017-07-29 02:17:44 +00:00
riastradh c3e23e5d48 Null out sbuf->m on failure to avoid double-free later.
From Ilja Van Sprundel.

Also null out sbuf->map out of paranoia.
2017-07-29 01:54:56 +00:00
riastradh e7c3d2d5fd Check for MCLGET failure in et_newbuf.
From Ilja Van Sprundel.
2017-07-29 01:47:48 +00:00
riastradh a28f9ef83b Null out sc_rx_mbuf[i] after m_freem to avoid double-free later.
From Ilja Van Sprundel.

Also null out sc_tx_mbuf[i] after m_freem, out of paranoia.

XXX Not entirely clear to how tx mbufs are freed, but no way to test
this since it's ews4800mips- and hp700-only, so not keen to make any
more elaborate changes...
2017-07-29 01:45:22 +00:00
riastradh 84e595647c Plug mbuf leak on MCLGET failure in sonic_rxintr.
From Ilja Van Sprundel.
2017-07-29 01:34:49 +00:00
riastradh 1192538bb2 Check for MCLGET failure in dme_alloc_receive_buffer.
From Ilja Van Sprundel.
2017-07-29 01:31:20 +00:00
riastradh 1fe00a14a7 Check for M_EXT in m->m_flags, whether m is NULL, after MCLGET.
From Ilja Van Sprundel.
2017-07-29 01:19:29 +00:00
riastradh 787a001e33 Only let the superuser set the compat_linux timezone.
Not really keen to invent a new kauth cookie for this useless purpose.

From Ilja Van Sprundel.
2017-07-29 01:14:59 +00:00
riastradh 33f11e8b80 Little happy on the commit trigger. Actually use the out label. 2017-07-29 01:14:00 +00:00
riastradh 9fc613c20d Don't drop vnode ref until we're done with mount in ibcs2_stat(v)fs.
Nothing else guarantees the mount will stick around.

From Ilja Van Sprundel.
2017-07-29 01:05:54 +00:00
wiz 6fb9c37bed expat-2.2.2 security fix release out. 2017-07-28 22:53:32 +00:00
maya 8340d18be5 Apply upstream patch:
Incorrect codegen from rdseed intrinsic use (CVE-2017-11671)

We should not expand call arguments in between flags reg setting and
flags reg using instructions, as it may expand with flags reg
clobbering insn (ADD in this case).

Attached patch moves expansion out of the link. Also, change
zero-extension to non-flags reg clobbering sequence in case we perform
zero-extension with and.

2017-03-25  Uros Bizjak
2017-07-28 22:24:27 +00:00
maya 317c1f1a2e Apply upstream patch:
Incorrect codegen from rdseed intrinsic use (CVE-2017-11671)

We should not expand call arguments in between flags reg setting and
flags reg using instructions, as it may expand with flags reg
clobbering insn (ADD in this case).

Attached patch moves expansion out of the link. Also, change
zero-extension to non-flags reg clobbering sequence in case we perform
zero-extension with and.

2017-03-25  Uros Bizjak  <ubizjak@gmail.com>
2017-07-28 22:23:05 +00:00
wiz bfb900cd99 binutils-2.29 out. 2017-07-28 19:31:59 +00:00
maxv 65a2f89e39 Remove TCP_COMPAT_42 from the config files. Pass 1. 2017-07-28 19:26:15 +00:00
maxv 0e2173f7a6 Remove TCP_COMPAT_42. This feature is a workaround for a bug in the TCP
stack of BSD4.2. Having such features just does not make any sense, and
looking at the code, I'm not sure it actually works.
2017-07-28 19:16:41 +00:00