create-diff-object: better reachability error message

If a patch changes a single function which is in a special section that
we don't support, create-diff-object reports "no changed functions were
found".  Give a clearer error message in that case, by checking
reachability errors before unchanged errors and by printing all
reachability errors errors instead of the first one it encounters.

Fixes #150.
Merge pull request #151 from jpoimboe/cdo-error-order

create-diff-object: better reachability error message
update docs for Ubuntu support

Signed-off-by: Seth Jennings <sjenning@redhat.com>
Merge pull request #155 from spartacus06/ubuntu-doc

update docs for Ubuntu support
create-diff-object: support for __jump_table

Almost a line-for-line copy/paste of the smp locks function.  The only
differences are the section name, and an offset increment of 8 instead
of 4.

Fixes #157.
kmod/core: fail more gracefully in kpatch_unregister

In kpatch_unregister(), if kpatch_remove_patch succeeds but one of the
subsequent ftrace unregistering calls fails, it returns an error and
fails to module_put() the patch module, even though the patch has been
removed.  This causes the patch module to get stuck in a weird place
where its patch has been unregistered but the patch module can't ever be
removed.

These errors aren't serious and wouldn't cause any real problems if they
did somehow fail, so instead just WARN if they fail.
kmod/core: NMI synchronization improvements

This is an attempt to both simplify and improve the correctness of the
NMI synchronization code.

There's a race in kpatch_ftrace_handler() between the kpatch_get_func()
and kpatch_finish_status() calls which could result in func being NULL.
The retry was supposed to fix this.  However, this race would still be a
problem in the repatching case (if the function had already been
previously patched), in which case func would not be NULL, but could
instead point to the previously patched version of the function.  In
this case it wouldn't retry and it would be possible for the previous
version of the function to run.

The fix is to use a memory barrier between accesses of the func hash and
the status variable, and then just call kpatch_get_func() *after*
accessing the status variable.  For OP_PATCH, if status is SUCCESS, then
func is guaranteed to point to the new function.  If status is FAILURE,
func might point to the new function, in which case we can use
get_prev_func to get the previous version of the function.

I also made some pretty big changes to try to simplify the design so
that there are less moving parts and so that it's hopefully easier to
understand.  I moved the OP field into the kpatch_func struct.  This
allows us to merge the two global state variables (status + op) into a
single global state variable (state), which helps make the code quite a
bit simpler.  I turned it into a proper state machine and documented the
meaning of each state in the comments.

Moving the OP field to the kpatch_func struct also paves the way for an
upcoming pull request which will allow patch modules to be atomically
replaced ("kpatch load --replace <module>").
Merge pull request #158 from jpoimboe/cdo-jump-table

create-diff-object: support for __jump_table
kmod/core: make func->op an enum
kmod/core: make WARN messages more informative
Revert "create-diff-object: support for __jump_table"

This reverts commit 5852ddb6a22c282979b1a15604572f1add198bf2.

The __jump_table section is more complex than the initial analysis
determined.  The __jump_table has three relocs per entry that must
be pulled in together and one of the relocs is to symbols contained
in the __tracepoints section whose rela section references the
__tracepoint_strings section.  So it's more complex and should just
fail rather than appear that it is being handled properly.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
Merge pull request #161 from spartacus06/revert-jump-table

Revert "create-diff-object: support for __jump_table"
Merge pull request #159 from jpoimboe/nmi-redesign

kmod/core: NMI synchronization improvements
readme: kpatch is an infrastructure, not a tool
readme: taint clarifications
kmod/core: checkpatch and sparse fixes

- checkpatch doesn't like the FSF address since it's subject to change
- checkpatch doesn't like strings split by line
- whitespace fix
- sparse suggested to change some variables and functions to static
kmod/core: update a few comments

- update the file description comment to be a little more accurate and
  concise
- s/trampoline/ftrace handler/
Merge pull request #162 from jpoimboe/lkml

a few style fixes