Commit Graph

242827 Commits

Author SHA1 Message Date
martin
f3944df18c Effectively disable aslr for non-topdown-VA binaries (unless they are
compat32, which we deal with properly). It would be possible to get
those working too, but it is not worth the code complexity.

This makes binaries compiled with -mcmodel=medlow (and ancient binaries)
work again on sparc64, smoothing the upgrade path.

ok: christos
2016-05-24 17:30:01 +00:00
salazar
7eb37e612b Lua 5.3.2: update doc/3RDPARTY and add entry to doc/CHANGES 2016-05-24 17:11:14 +00:00
christos
63ea08216d Fix armv3 segv compiling mDNS.c, from:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62254
    https://gcc.gnu.org/ml/gcc-patches/2016-02/msg01095.html
2016-05-24 15:42:17 +00:00
christos
0a374fd7e5 From Ingo Schwarze:
Reduce obfuscation of errno handling. There is only one purpose
non-local errno handling is needed for:  Inside el_wgets(), several
functions call down indirectly to el_wgetc(), many of them via the
dispatch table.  When el_wgetc() fails, it does properly report
failure, but then various cleanup is done which may clobber errno.
But when returning due to failure, el_wgets() wants to have errno
set to the reason of the original read failure, not to the reason
of some subsequent failure of some cleanup operation.  So el_wgetc()
needs to save errno, and if it's non-zero, el_wgets() needs to
restore it on failure.

This core logic is currently obscured by the fact that el_errno
is set and inspected at some additional places where it isn't needed.
Besides, since el_wgetc() and and el_wgets() are both in read.c,
el_errno does not need to be in struct editline, it can and should
be local to read.c in struct el_read_t.

Let's look at what can be simplified.

 1. keymacro_get() abuses el_errno instead of having a proper
    error return code.  Adding that error return code is easy
    because node_trav() already detects the condition and an
    adequate code is already defined.  Returning it, testing
    for it in read_getcmd(), and returning with error from there
    removes the need to inspect el_errno from el_wgets() after
    calling read_getcmd().
    Note that resetting lastchar and cursor and clearing buffer[0]
    is irrelevant.  The code returns from el_wgets() right afterwards.
    Outside el_wgets(), these variables are no longer relevant.
    When el_wgets() is called the next time, it will call ch_reset()
    anyway, resetting the two pointers.  And as long as lastchar
    points to the beginning of the buffer, the contents of the
    buffer won't be used for anything.

 2. read_getcmd() doesn't need to set el_errno again after el_wgetc()
    failure since el_wgetc() already did so.  While here, remove
    the silly "if EOF or error" comments from the el_wgetc()
    return value tests.  It's a public interface documented in a
    manual, so people working on the implementation can obviously
    be expected to know how it works.  It's a case of

      count++;  /* Increment count. */

 3. In the two code paths of el_wgets() that lead up to "goto noedit",
    there is no need to save the errno because nothing that might
    change it happens before returning.

For clarity, since el_wgets() is the function restoring the errno,
also move initializing it to the same function.

Finally, note that restoring errno when the saved value is zero is
wrong.  No library code is ever allowed to clear a previously set
value of errno.  Only application programs are allowed to do that,
and even they usually don't need to do so, except when using certain
ill-designed interfaces like strtol(3).

I tested that the behaviour remains sane in the following cases,
all during execution of el_wgets(3) and with a signal handler
for USR1 installed without SA_RESTART.

 * Enter some text and maybe move around a bit.
   Then send a USR1 signal.
   The signal gets processed, then read_char() resumes reading.
   Send another USR1 signal.
   Now el_wgets() sets errno=EINTR and returns -1.

 * Press Ctrl-V to activate ed-quoted-insert.
   Then send a USR1 signal.
   The signal gets processed, then read_char() resumes reading.
   Send another USR1 signal.
   ed_quoted_insert() returns ed_end_of_file(), i.e. CC_EOF,
   and el_wgets() returns 0.

 * Press a key starting a keyboard macro.
   Then send a USR1 signal.
   The signal gets processed, then read_char() resumes reading.
   Send another USR1 signal.
   Now el_wgets() sets errno=EINTR and returns -1.

 * Press : to enter builtin command mode.
   Start typing a command.
   Then send a USR1 signal.
   The signal gets processed, then read_char() resumes reading.
   Send another USR1 signal.
   Now c_gets() returns -1, ed_command() beeps and returns CC_REFRESH,
   and el_wgets() resumes operation as it should.

I also tested with "el_set(el, EL_EDITMODE, 0)", and it returns
the right value and sets errno correctly.
2016-05-24 15:00:45 +00:00
martin
87669b78b9 Update comment explaining why PAX_MPROTECT is disabled here 2016-05-24 13:57:26 +00:00
skrll
fa15d5d3a4 More mknative re-runs 2016-05-24 13:00:00 +00:00
skrll
1afd582e81 More mknative re-run. 2016-05-24 10:46:13 +00:00
hannken
6fc7edbd65 Disable PAX mprotect to make just-in-time-compile tests work again.
Ok: Christos Zoulas
2016-05-24 10:16:34 +00:00
reinoud
42866dd28d Cleanup VAT writout. To prevent issues with the sequential writing strategy
trying to write on blocks that are lost due to the synchronisation, don't just
bluntly do synchronize device caches, but split out on strategies.
2016-05-24 09:55:57 +00:00
skrll
6e3cf83f8e Re-tun mknative for earm gdb 2016-05-24 09:16:56 +00:00
abhinav
743e3b4551 md5 is a hashing algorithm, don't say it is used for encryption.
Ok by wiz@
2016-05-24 06:15:43 +00:00
wiz
70ceaf5cff Fix typo. From Michael Scherer in PR 51162. 2016-05-24 05:46:57 +00:00
christos
2a2068fd64 Read and load the aux vector from a core file 2016-05-24 00:50:53 +00:00
christos
9d95ecedc7 Add a note for the auxv array so we can find our load location from a
core file of a PIE binary.
2016-05-24 00:49:55 +00:00
knakahara
8eb180f2ef Update TODO: evcnt 2016-05-23 23:36:02 +00:00
martin
ffb79a8f7b New Rawrite32 release 2016-05-23 18:36:05 +00:00
jmcneill
84e0ecfe04 IST_MPSAFE is not a valid flag for fdtbus_intr_establish; use
FDT_INTR_MPSAFE instead.
2016-05-23 18:21:14 +00:00
tls
1331d5da97 Fix a longstanding problem with accept filters noticed by Timo Buhrmester:
sockets sitting in the accept filter can consume the entire listen queue,
such that the application is never able to handle any connections.  Handle
this by simply passing through the oldest queued cxn when the queue is full.

This is fair because the longer a cxn lingers in the queue (stays connected
but does not meet the requirements of the filter for passage) the more likely
it is to be passed through, at which point the application can dispose of it.

Works because none of our accept filters actually allocate private state
per-cxn.  If they did, we'd have to fix the API bug that there is presently
no way to tell an accf to finish/deallocate for a single cxn (accf_destroy
kills off the entire filter instance for a given listen socket).
2016-05-23 13:54:34 +00:00
salazar
fb99257dd1 fix spelling mistakes 2016-05-23 11:41:06 +00:00
knakahara
20d828a769 fix: ethernet controllers which use wiseman_txdesc_t (earlier than 82575) hang
possibly.
2016-05-23 04:07:29 +00:00
knakahara
f47c3fc3cf GENERIC kernel (disabled NET_MPSAFE kernel) also needs txq_lock to avoid race
between tx processing and tx interrupt handler.
2016-05-23 03:30:40 +00:00
chs
72af35a796 remove unused variables. 2016-05-23 01:45:41 +00:00
christos
16467be6f9 documentation improvements (Ingo Schwarze) 2016-05-22 23:54:20 +00:00
rjs
afd529313e Use const for arguments to sctp_is_same_scope(). 2016-05-22 23:04:27 +00:00
rjs
b65559a564 Remove rtcache reference to route before freeing the containing struct. 2016-05-22 22:18:41 +00:00
christos
bb64d9f1ce Stop the read module from poking the el_chared.c_macro data structure
currently belonging to the chared module.  The read module does so
from three of its functions, while no other module uses the macro
data, not even the chared module itself.  That's quite logical
because macros are a feature of input handling, all of which is
done by the read module, and none by the chared module.  So move
the data into the read modules's own opaque data structure, struct
el_read_t.

That simplifies internal interfaces in several respects: The
semi-public chared.h has one fewer struct, one fewer #define, and
one fewer member in struct el_chared_t; all three move to one single
C file, read.c, and are now module-local.  And the internal interface
function ch_reset() needs one fewer argument, making the code of many
functions in various modules more readable.

The price is one additional internal interface function, read_end(),
10 lines long including comments, called publicly from exactly one
place: el_end() in el.c.  That's hardly an increase in complexity
since most other modules already have their *_end() function, read.c
was the odd one out not having one.

From Ingo Schwarze
2016-05-22 19:44:26 +00:00
joerg
6e49b77769 obj->phdr must be the absolute address, not the virtual offset from the
main binary. Historically, this has been the same. For PIE though,
relocbase can be pretty much anywhere. Fixes PR toolchain/51159.
2016-05-22 19:28:39 +00:00
abhinav
e92872065a Add options to whatis and apropos to accept custom man.conf.
makemandb(8), man(1) already use -C as an option to take man.conf path,
	so use the same option for whatis(1) and apropos(1) for consitency.
	apropos was using -C/-c to disable/enable context of the search
	matches, change that to -M/-m respectively.
2016-05-22 19:26:04 +00:00
christos
b039ee7763 reduce #ifdef mess caused by PaX 2016-05-22 14:26:09 +00:00
maxv
7123eade7b Save L4's physical address earlier. Also, PDE_SIZE has nothing to do
here, we are just zeroing out the upper 32bits of the 64bit pointer.
2016-05-22 10:11:55 +00:00
maxv
eeda8f022a Revert my previous change. I missed an entry on NXR. 2016-05-22 09:10:37 +00:00
skrll
4d638b24f1 More comments 2016-05-22 08:02:23 +00:00
skrll
d7866a502f Add a comment and reformat some others 2016-05-22 07:52:09 +00:00
abhinav
a9a3a72028 Remove a trailing white space after .Nm (mandoc -Tlint was complaining about it) 2016-05-22 05:03:17 +00:00
riastradh
8338092962 Test for PR kern/51135 is no longer failing. 2016-05-22 04:34:44 +00:00
christos
2b0df44082 Account for the VA hole differently (simpler) 2016-05-22 01:09:09 +00:00
christos
2bd2f7a2de Mention MPROTECT issues 2016-05-21 21:07:43 +00:00
christos
8ed051d1e1 put back _PATH_WHATIS, it is used. 2016-05-21 20:54:34 +00:00
christos
28b1bdeb54 switch evbarm to gdb-7.10.1 2016-05-21 19:56:52 +00:00
christos
ab6e20171f Switch evbarm to gcc-5.3 and turn on PIE. 2016-05-21 18:34:52 +00:00
christos
bfab48c6b3 Add various security options; enables PaX ASLR/MPROTECT 2016-05-21 18:31:13 +00:00
abhinav
aa0cdec039 Remove unused include and unused constant. Ok from christos@. 2016-05-21 17:21:40 +00:00
christos
e9c2e28b8a Fix the prototype used by EL_GETCFN, mention the associated typedef
name, document the return values, expand the list of affected
functions, warn against using EL_GETCFN, and clarify some wording
and notation. (Ingo Schwarze)
2016-05-21 17:06:44 +00:00
christos
06c5bf7f1c PIE in the face! 2016-05-21 16:23:10 +00:00
riastradh
b93e5db80e Use rnd_getmore as intended. No more essay needed here.
Workaround for buffering got pushed into rnd_getmore, closer to the
actual cause of the problem.
2016-05-21 15:33:40 +00:00
riastradh
77ebf39786 Ask on-demand entropy sources to produce enough data to fill buffer.
Remainder of fix for PR kern/51135: if there is an entropy source
that can produce arbitrarily much data, as in rump, then nothing
should ever block indefinitely waiting for data.
2016-05-21 15:27:15 +00:00
riastradh
2b38f13330 Actually get as many bytes as requested from rumpuser_random.
rumpuser_random is limited to 32 bytes at a time -- which would be
reasonable, except that there are too many buffers in the way between
entropy sources and users of the entropy pool.

Partial fix for PR kern/51135.
2016-05-21 14:59:45 +00:00
salazar
7093afb253 fix double require bug 2016-05-21 12:39:32 +00:00
pgoyette
b823c93930 Add entry for recent merge of nick-nhusb branch. Basically just a copy
of the commit log message, but this is easier for releng to find when
they start collecting info for 8.0

If anyone else wants to edit this entry, please feel free.
2016-05-21 07:22:28 +00:00
maxv
c4cd7f0720 There is an issue in the way the direct map is set up on amd64.
When allocating memory, the kernel allocates physical pages and virtual
addresses for these pages. In order to optimize allocations smaller
than PAGE_SIZE, uvm_km_kmem_alloc can allocate a single physical page
and take its virtual address in the direct map in high virtual memory.
This direct map is set up at boot time, its PTEs do not change, and
therefore they don't need to be kentered. These high virtual PTEs being
constant, the permissions of the areas they point to are fixed at boot
time and cannot change.

The problem is that at boot time, they are created with RWX permissions.
Therefore, allocations smaller than PAGE_SIZE in the kernel heap are all
executable: mbufs, pnbufs, small kmem allocations, etc.

Fix this by setting the NOX bit in the direct map pages at boot time. We
also set the NOX bit in the temporary tmpva, since it does not need to
be executable either.

This also makes the U-area non executable on amd64.
2016-05-21 07:15:56 +00:00