Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1585758
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] objtool: improve detection of BUG() and other dead ends |
| Date | 2017-02-21 22:50 +0100 |
| Message-ID | <tdqtP-8mV-1@gated-at.bofh.it> (permalink) |
| References | <tdqk9-8jw-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Feb 21, 2017 at 03:35:32PM -0600, Josh Poimboeuf wrote: > The BUG() macro's use of __builtin_unreachable() via the unreachable() > macro tells gcc that the instruction is a dead end, and that it's safe > to assume the current code path will not execute past the previous > instruction. > > On x86, the BUG() macro is implemented with the 'ud2' instruction. When > objtool's branch analysis sees that instruction, it knows the current > code path has come to a dead end. > > Peter Zijlstra has been working on a patch to change the WARN macros to > use 'ud2'. That patch will break objtool's assumption that 'ud2' is > always a dead end. > > Generally it's best for objtool to avoid making those kinds of > assumptions anyway. The more ignorant it is of kernel code internals, > the better. > > So create a more generic way for objtool to detect dead ends by adding > an annotation to the unreachable() macro. The annotation stores a > pointer to the end of the unreachable code path in an '__unreachable' > section. Objtool can read that section to find the dead ends. > Tested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] objtool: improve detection of BUG() and other dead ends Josh Poimboeuf <jpoimboe@redhat.com> - 2017-02-21 22:40 +0100 Re: [PATCH] objtool: improve detection of BUG() and other dead ends Peter Zijlstra <peterz@infradead.org> - 2017-02-21 22:50 +0100 [tip:core/urgent] objtool: Improve detection of BUG() and other dead ends tip-bot for Josh Poimboeuf <tipbot@zytor.com> - 2017-02-24 10:20 +0100
csiph-web