0052-objtool-Don-t-report-end-of-section-error-after-an-e.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From 985d8e62ef5f1b006da5e175858e552c0dbda771 Mon Sep 17 00:00:00 2001
  2. From: Josh Poimboeuf <[email protected]>
  3. Date: Mon, 18 Sep 2017 21:43:30 -0500
  4. Subject: [PATCH 052/231] objtool: Don't report end of section error after an
  5. empty unwind hint
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. CVE-2017-5754
  10. If asm code specifies an UNWIND_HINT_EMPTY hint, don't warn if the
  11. section ends unexpectedly. This can happen with the xen-head.S code
  12. because the hypercall_page is "text" but it's all zeros.
  13. Signed-off-by: Josh Poimboeuf <[email protected]>
  14. Cc: Andy Lutomirski <[email protected]>
  15. Cc: Boris Ostrovsky <[email protected]>
  16. Cc: Jiri Slaby <[email protected]>
  17. Cc: Juergen Gross <[email protected]>
  18. Cc: Linus Torvalds <[email protected]>
  19. Cc: Peter Zijlstra <[email protected]>
  20. Cc: Thomas Gleixner <[email protected]>
  21. Link: http://lkml.kernel.org/r/ddafe199dd8797e40e3c2777373347eba1d65572.1505764066.git.jpoimboe@redhat.com
  22. Signed-off-by: Ingo Molnar <[email protected]>
  23. (cherry picked from commit 00d96180dc38ef872ac471c2d3e14b067cbd895d)
  24. Signed-off-by: Andy Whitcroft <[email protected]>
  25. Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
  26. (cherry picked from commit 9d22f903bba24f2ac86de8a81dc1788f9957aca8)
  27. Signed-off-by: Fabian Grünbichler <[email protected]>
  28. ---
  29. tools/objtool/check.c | 7 +++++--
  30. 1 file changed, 5 insertions(+), 2 deletions(-)
  31. diff --git a/tools/objtool/check.c b/tools/objtool/check.c
  32. index 368275de5f23..0a86fd0ac082 100644
  33. --- a/tools/objtool/check.c
  34. +++ b/tools/objtool/check.c
  35. @@ -1652,11 +1652,14 @@ static int validate_branch(struct objtool_file *file, struct instruction *first,
  36. if (insn->dead_end)
  37. return 0;
  38. - insn = next_insn;
  39. - if (!insn) {
  40. + if (!next_insn) {
  41. + if (state.cfa.base == CFI_UNDEFINED)
  42. + return 0;
  43. WARN("%s: unexpected end of section", sec->name);
  44. return 1;
  45. }
  46. +
  47. + insn = next_insn;
  48. }
  49. return 0;
  50. --
  51. 2.14.2