Commit Graph

942 Commits

Author SHA1 Message Date
Seth Jennings
e87b37aafe Merge pull request #102 from jpoimboe/patch-no-reverse
kpatch-build: improve error handling for an already applied patch
2014-04-01 10:30:11 -05:00
Seth Jennings
847842b1c3 Merge pull request #101 from jpoimboe/kpatch-man
man: remove enable/disable from kpatch man page
2014-04-01 10:28:41 -05:00
Josh Poimboeuf
5a999ef68c kpatch-build: create applied-patch only after verifying patch
Create the applied-patch file only after the patch has been verified.

Otherwise if you accidentally supply a patch which had already been
applied to the source, the cleanup trap won't reverse apply it when
exiting the script.
2014-04-01 07:51:21 -05:00
Josh Poimboeuf
7fe5c3fef4 kpatch-build: don't ask to reverse apply patch
If the patch had already been mistakenly applied to the source tree,
don't ask the user if it should be reverse applied.  Instead, just exit
with an error.
2014-04-01 07:49:51 -05:00
Josh Poimboeuf
1e21aefbd4 man: remove enable/disable from kpatch man page
They were already removed from the kpatch script with commit 022e42b.
2014-04-01 07:38:37 -05:00
Josh Poimboeuf
2728a7faae kpatch: remove obsolete comment 2014-04-01 07:38:00 -05:00
Josh Poimboeuf
0f464b8500 kpatch-build: add "no patch file specified" error 2014-04-01 07:16:12 -05:00
Josh Poimboeuf
ece4124a45 kpatch-build: getopts arg parsing cleanup
Cleanup the kpatch-build argument parsing a little bit:
- gracefully handle no args
- allow white space in filenames
- use 'eval set -- $options' to allow use of $1 and $2 variables
2014-03-31 16:02:50 -05:00
Josh Poimboeuf
47b0b2a45c Merge pull request #99 from spartacus06/remove-enable
Remove enable/disable from kpatch script
2014-03-31 12:37:12 -05:00
Seth Jennings
022e42bc1b Remove enable/disable from kpatch script
The extra steps aren't justified right now and make the patch
application and management processes more convoluted.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-31 11:48:34 -05:00
Josh Poimboeuf
3e08618447 Merge pull request #97 from spartacus06/mkdir-install
Ensure install directory exists
2014-03-28 13:20:27 -07:00
Seth Jennings
90646d40a8 fix error message
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-28 13:24:20 -05:00
Seth Jennings
b327876cf2 ensure patch install directory exists
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-28 13:23:31 -05:00
Josh Poimboeuf
e88287d8dd Merge pull request #96 from jpoimboe/gzip-k
man: use older '-c' option
2014-03-27 22:26:44 -07:00
Josh Poimboeuf
e7dbaf0b52 man: use older '-c' option
The gzip '-k' option isn't supported on older versions of gzip, so use
the more portable '-c' option to send the compressed file to stdout.
2014-03-27 22:21:43 -07:00
Josh Poimboeuf
bf58321229 Merge pull request #92 from spartacus06/man-clean
add clean target for man
2014-03-27 19:57:13 -07:00
Seth Jennings
28f98196df add man file deps to .gz targets
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-27 21:36:00 -05:00
Josh Poimboeuf
7523fd3460 Merge pull request #95 from spartacus06/debug-option
add debug option to kpatch-build
2014-03-27 19:33:51 -07:00
Seth Jennings
b65a8fddb4 Merge pull request #91 from jpoimboe/changed-objs
skip scripts/mod files when detecting changed objs
2014-03-27 21:33:13 -05:00
Josh Poimboeuf
fcd8d96b08 Merge pull request #93 from spartacus06/fixes
check for changed sections that are not included
2014-03-27 19:30:25 -07:00
Josh Poimboeuf
e904701b9d use "grep -e" instead of multiple grep invocations 2014-03-27 19:14:41 -07:00
Seth Jennings
3dab7255c0 Merge pull request #94 from jpoimboe/module-symvers
support CONFIG_MODVERSIONS=y
2014-03-27 19:02:40 -05:00
Seth Jennings
2b4afa4695 add debug option to kpatch-build
When debugging kpatch-build failures it can be
beneficial to have the scratch files in /tmp that
kpatch-build was operating on.  These are
removed by default, as they can quickly fill /tmp.
However, for debugging reasons, the option should
exist to keep them around.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-27 18:49:44 -05:00
Josh Poimboeuf
3b489e7d29 support CONFIG_MODVERSIONS=y
When CONFIG_MODVERSIONS is enabled, loading of the patch module fails
with "no symbol version for kpatch_register".  When building the patch
module, we need to point it to the core module's Module.symvers file.

This also works when CONFIG_MODVERSIONS is disabled, since
Module.symvers is created regardless.
2014-03-27 16:36:43 -07:00
Seth Jennings
a72abf3f14 add clean target for man
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-27 17:47:10 -05:00
Seth Jennings
ead06280df check for changed sections that are not included
There are many cases where a section may have
changed due to soure-level change but the inclusion
logic has not selected it for output.  Some of these
cases are real no-go situations like changing data
structures.  Some are just situations that
create-diff-object isn't smart enough to figure out
(yet).

Either way, it should be considered fatal when a
changed section hasn't been selected for output.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-27 17:38:02 -05:00
Josh Poimboeuf
c21550ef63 skip scripts/mod files when detecting changed objs
In some environments, some files in scripts/mod (devicetable-offsets.s
and file2alias.o) are always getting rebuilt, and thus get incorrectly
added to the changed_objs file, resulting in the following error:

 strip:/root/.kpatch/3.10.0-115.el7.x86_64/obj2/scripts/mod/devicetable-offsets.s: File format not recognized
2014-03-27 14:53:11 -07:00
Josh Poimboeuf
1af7536dbb Merge pull request #90 from spartacus06/gitignore
add man .gz files to gitignore
2014-03-27 14:44:29 -07:00
Seth Jennings
15da394a2f add man .gz files to gitignore
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-27 16:29:14 -05:00
Seth Jennings
29e296b16f Merge pull request #89 from jpoimboe/man-install-error
man: don't delete source files when compressing man files
2014-03-27 16:15:29 -05:00
Josh Poimboeuf
1631d52fcf man: don't delete source files when compressing man files
Fix the issue where a "make install" deletes the man source files.
2014-03-27 14:12:44 -07:00
Josh Poimboeuf
334fe44dee Merge pull request #84 from spartacus06/fixes
Refactoring and perf improvements for create-diff-object
2014-03-27 09:01:55 -07:00
Seth Jennings
026362fab6 fix conditional in find_section_by_index()
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-27 10:24:28 -05:00
Seth Jennings
75c2601a6c Merge pull request #88 from jpoimboe/implicit-make-clean
always rebuild core module
2014-03-26 23:32:02 -05:00
Josh Poimboeuf
d4ab5fab2e always rebuild core module
If the kernel updates, make won't detect that the core module needs
rebuilding.  So always rebuild it.
2014-03-26 21:28:37 -07:00
Josh Poimboeuf
e8fb594637 Merge pull request #85 from useidel/master
added man pages and updated SPEC file
2014-03-26 00:18:08 -05:00
Udo Seidel
148ef3b941 fixed typos 2014-03-25 17:12:50 +01:00
Udo Seidel
fd11e9f5d6 added man pages and updated SPEC file 2014-03-25 08:36:20 +01:00
Seth Jennings
634b9cee78 improve find_[symbol|section]_by_index
The indexes are in order when being read from the
table.  Just index directly into the table; a benefit
of using an array for this structure instead of a linked
list.

Removes another hot path during the rela table initialization.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-24 17:56:21 -05:00
Seth Jennings
24894d263c change for_each_symbol to start at 1 (avoid ugh)
remove "ughs" by changing macro to start at symbol
index 1.  new for_each_symbol_zero will start at zero
for rare cases that need it.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-24 17:19:16 -05:00
Seth Jennings
6567762937 refactor rela section scanning
Upon realizing that there is no point in correlating rela entries,
I also realized that tracking the status of rela entries is also
not needed.

Additionally, the rela section correlation path (really misnamed
as it is the rela section _comparison path) is VERY hot.  Particularly
on files like fs/ext4/ext4.o (which create-diff-object currently can't
successfully parse entirely):

Samples: 40K of event 'cycles', Event count (approx.): 36516578362
49.49%  create-diff-obj  create-diff-object  [.] rela_equal
31.85%  create-diff-obj  create-diff-object  [.] kpatch_correlate_relas
16.22%  create-diff-obj  create-diff-object  [.] find_symbol_by_index

The refactor does a few things:
- replaces nested for loops with single for loop when comparing rela entries
- removes status field for rela entires
- compares rela and nonrela sections in the same path
- removes unnecessary setting of status fields as the inclusion tree
  will include them even if the section status isn't set to CHANGED. This is
  even better as unchanged sections won't appear as CHANGED just because
  their partner .text or .rela section is CHANGED.

This drastically reduced runtime for larger objects and cooled the rela
comparison path:

87.64%  create-diff-obj  create-diff-object  [.] find_symbol_by_index
6.98%  create-diff-obj  libc-2.18.so        [.] __GI___strcmp_ssse3
1.33%  create-diff-obj  create-diff-object  [.] find_section_by_index
1.16%  create-diff-obj  create-diff-object  [.] kpatch_correlate_symbols
0.61%  create-diff-obj  create-diff-object  [.] kpatch_create_rela_table
0.52%  create-diff-obj  create-diff-object  [.] kpatch_correlate_sections

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-24 16:29:40 -05:00
Seth Jennings
57a6b12d9d remove rela twin field, never used
Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-24 14:43:40 -05:00
Seth Jennings
1813d54d58 bundle with inclusive logic rather than exclusive
I've created a test designed to exercise the ability
of create-diff-object to parse, compare, and return
"no changed functions" for the entire kernel source
tree one file at a time by passing the same file as
both the original and patched file.

Through this process, I realized that excluding every
special case from being bundled it not feasible.  There
are many sections in the kernel that don't honor
-ffunction|data-sections, not just __ksymtab_strings and
.init.text.

Plus, excluding situations is not the best way.  We are
really only looking for sections that _were_ the result
of -f[function|data]-sections for bundling.

To that end, this commit looks to bundle only symbol/section
pairs that should be bundled ensuringthe .text/.data suffix
and the FUNC/OBJECT symbol name match.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-24 14:14:46 -05:00
Seth Jennings
7656fc6213 Merge pull request #83 from useidel/master
Reworked version of spec file following the discussion of PR 80
2014-03-24 13:57:53 -05:00
Udo Seidel
a95589a816 reworked version of spec file 2014-03-24 17:53:42 +01:00
Josh Poimboeuf
c7b5837d89 Merge pull request #82 from spartacus06/fixes
small fixes
2014-03-24 11:35:27 -05:00
Seth Jennings
eb915722cd do not proceed with output generation if no changed funcs
If there are no changed functions, print notice and exit.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-24 11:27:29 -05:00
Seth Jennings
8c487ad6a8 print "changed function" notice for all changed functions
A local changed function will not appear with a "changed function"
notice if it is a dependency of another changed function and that
function occurs before it in the symbol table.

Rearrange some logic to print the notice regardless of whether or not
the function symbols has already been selected for inclusion.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-24 10:38:32 -05:00
Josh Poimboeuf
8dfa41ed78 Merge pull request #79 from spartacus06/ignore-init-funcs
ignore init functions during bundling
2014-03-21 15:19:54 -05:00
Seth Jennings
a15c6eca61 ignore init functions during bundling
When linking function bundles (.text/.rela/section sym/func sym)
ignore __init functions as they do not honor -ffunction-sections
and violate the one-to-one func/section assumption of the
function bundling.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
2014-03-21 15:11:59 -05:00