Skip to contentSkip to conversation

fs/reiserfs/prints.o: warning: objtool: __reiserfs_error()+0x80: unreachable instruction

PATCH Arnd Bergmann 2 participants 3 messages Aug 8, 2019 – Aug 9, 2019 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 201908090321.bRMBBE6A%[email protected]

#1 lore raw
Quoted 11 lines · kbuild test robot
tree:   https://kernel.googlesource.com/pub/scm/linux/kernel/git/arnd/playground.git randconfig-5.3-rc2
head:   bfe9aede7372c8310a9bf31963460c9dd11d1f82
commit: 97919a3ec80e9841c4bbac14a80e8b9d482666d4 [32/347] [SUBMITTED 20190718] reiserfs: fix code unwinding with clang
config: x86_64-lkp (attached as .config)
compiler: gcc-7 (Debian 7.4.0-10) 7.4.0
reproduce:
        git checkout 97919a3ec80e9841c4bbac14a80e8b9d482666d4
        # save the attached .config to linux build tree
        make ARCH=x86_64
Quoted 17 lines

If you fix the issue, kindly add following tag

All warnings (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

fs/reiserfs/namei.o: warning: objtool: entry_points_to_object()+0x117: unreachable instruction

--

Quoted 10 lines
Quoted 10 lines

fs/reiserfs/do_balan.o: warning: objtool: get_FEB()+0x55: unreachable instruction fs/reiserfs/prints.o: warning: objtool: __reiserfs_error()+0x80: unreachable instruction fs/reiserfs/lbalance.o: warning: objtool: leaf_move_items()+0x210: unreachable instruction fs/reiserfs/fix_node.o: warning: objtool: create_virtual_node()+0x295: unreachable instruction fs/reiserfs/inode.o: warning: objtool: reiserfs_update_sd_size()+0x26b: unreachable instruction fs/reiserfs/ibalance.o: warning: objtool: balance_internal()+0x30d: unreachable instruction fs/reiserfs/stree.o: warning: objtool: reiserfs_cut_from_item()+0x239: unreachable instruction fs/reiserfs/tail_conversion.o: warning: objtool: direct2indirect()+0x29c: unreachable instruction fs/reiserfs/item_ops.o: warning: objtool: direntry_check_left()+0x5d: unreachable instruction fs/reiserfs/journal.o: warning: objtool: flush_commit_list()+0x552: unreachable instruction

Great fun. The patch I did was my workaround for a related problem with clang, see below.

Josh, is this warning above something you are interested in? I don't think it happens in mainline, but it could happen anywhere. I think the patch below can be dropped once clang is fixed, but I have so far been unable to build a new compiler for testing.

Arnd

commit 97919a3ec80e9841c4bbac14a80e8b9d482666d4

Author: Arnd Bergmann <[email protected]>
Date:   Fri Jul 12 16:19:52 2019 +0200

[SUBMITTED 20190718] reiserfs: fix code unwinding with clang

Building reiserfs with clang leads to objtool warnings about a part of the unreachable code that may confuse the ORC unwinder:

fs/reiserfs/ibalance.o: warning: objtool:
balance_internal()+0xe8f: stack state mismatch: cfa1=7+240 cfa2=7+248
fs/reiserfs/ibalance.o: warning: objtool:
internal_move_pointers_items()+0x36f: stack state mismatch: cfa1=7+152 cfa2=7+144
fs/reiserfs/lbalance.o: warning: objtool:
leaf_cut_from_buffer()+0x58b: stack state mismatch: cfa1=7+128 cfa2=7+112
fs/reiserfs/lbalance.o: warning: objtool:
leaf_copy_boundary_item()+0x7a9: stack state mismatch: cfa1=7+104 cfa2=7+96
fs/reiserfs/lbalance.o: warning: objtool:
leaf_copy_items_entirely()+0x3d2: stack state mismatch: cfa1=7+120 cfa2=7+128

    fs/reiserfs/do_balan.o: warning: objtool: replace_key()+0x158:
stack state mismatch: cfa1=7+40 cfa2=7+56
    fs/reiserfs/do_balan.o: warning: objtool: balance_leaf()+0x2791:

stack state mismatch: cfa1=7+176 cfa2=7+192

Reword this to use the regular BUG() call directly from the original code location, since objtool finds the generated object code more reasonable.

This will likely get fixed in a future clang release, but in the meantime the workaround helps us build cleanly with existing releases.

fs/reiserfs/prints.c +0 -0
index 9fed1c05f1f4..da996eaaebac 100644
@@ -387,7 +387,6 @@ void __reiserfs_panic(struct super_block *sb,

const char *id,
else
printk(KERN_WARNING "REISERFS panic: %s%s%s: %s\n",
id ? id : "", id ? " " : "", function, error_buf);
- BUG();
}

void __reiserfs_error(struct super_block *sb, const char *id,
@@ -397,8 +396,10 @@ void __reiserfs_error(struct super_block *sb, const char *id,

        BUG_ON(sb == NULL);

- if (reiserfs_error_panic(sb))

+       if (reiserfs_error_panic(sb)) {
                __reiserfs_panic(sb, id, function, error_buf);

+ BUG();
+ }

if (id && id[0])
printk(KERN_CRIT "REISERFS error (device %s): %s %s: %s\n",

fs/reiserfs/reiserfs.h +2 -3
index e5ca9ed79e54..f5bd17ee21f6 100644
@@ -3185,10 +3185,9 @@ void unfix_nodes(struct tree_balance *);
 
 /* prints.c */
 void __reiserfs_panic(struct super_block *s, const char *id,
-                     const char *function, const char *fmt, ...)
-    __attribute__ ((noreturn));
+                     const char *function, const char *fmt, ...);
 #define reiserfs_panic(s, id, fmt, args...) \
-       __reiserfs_panic(s, id, __func__, fmt, ##args)
+       do { __reiserfs_panic(s, id, __func__, fmt, ##args); BUG(); } while (0)
 void __reiserfs_error(struct super_block *s, const char *id,
                      const char *function, const char *fmt, ...);
 #define reiserfs_error(s, id, fmt, args...) \
#2 lore raw
Quoted 30 lines · Arnd Bergmann
Quoted 11 lines · kbuild test robot
tree:   https://kernel.googlesource.com/pub/scm/linux/kernel/git/arnd/playground.git randconfig-5.3-rc2
head:   bfe9aede7372c8310a9bf31963460c9dd11d1f82
commit: 97919a3ec80e9841c4bbac14a80e8b9d482666d4 [32/347] [SUBMITTED 20190718] reiserfs: fix code unwinding with clang
config: x86_64-lkp (attached as .config)
compiler: gcc-7 (Debian 7.4.0-10) 7.4.0
reproduce:
        git checkout 97919a3ec80e9841c4bbac14a80e8b9d482666d4
        # save the attached .config to linux build tree
        make ARCH=x86_64
Quoted 17 lines

If you fix the issue, kindly add following tag

All warnings (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

fs/reiserfs/namei.o: warning: objtool: entry_points_to_object()+0x117: unreachable instruction

--

Quoted 10 lines
Quoted 10 lines

fs/reiserfs/do_balan.o: warning: objtool: get_FEB()+0x55: unreachable instruction fs/reiserfs/prints.o: warning: objtool: __reiserfs_error()+0x80: unreachable instruction fs/reiserfs/lbalance.o: warning: objtool: leaf_move_items()+0x210: unreachable instruction fs/reiserfs/fix_node.o: warning: objtool: create_virtual_node()+0x295: unreachable instruction fs/reiserfs/inode.o: warning: objtool: reiserfs_update_sd_size()+0x26b: unreachable instruction fs/reiserfs/ibalance.o: warning: objtool: balance_internal()+0x30d: unreachable instruction fs/reiserfs/stree.o: warning: objtool: reiserfs_cut_from_item()+0x239: unreachable instruction fs/reiserfs/tail_conversion.o: warning: objtool: direct2indirect()+0x29c: unreachable instruction fs/reiserfs/item_ops.o: warning: objtool: direntry_check_left()+0x5d: unreachable instruction fs/reiserfs/journal.o: warning: objtool: flush_commit_list()+0x552: unreachable instruction

Quoted 7 lines

Great fun. The patch I did was my workaround for a related problem with clang, see below.

Josh, is this warning above something you are interested in? I don't think it happens in mainline, but it could happen anywhere. I think the patch below can be dropped once clang is fixed, but I have so far been unable to build a new compiler for testing.

From a brief glance I think you need to remove __reiserfs_panic from objtool's global_noreturns[] array.

Signature · 1 line
Josh
#3 lore raw
Quoted 10 lines · Josh Poimboeuf
Quoted 6 lines · Arnd Bergmann

On Thu, Aug 8, 2019 at 9:06 PM kbuild test robot <[email protected]> wrote:

Josh, is this warning above something you are interested in? I don't think it happens in mainline, but it could happen anywhere. I think the patch below can be dropped once clang is fixed, but I have so far been unable to build a new compiler for testing.

From a brief glance I think you need to remove __reiserfs_panic from objtool's global_noreturns[] array.

Right, makes sense. Added to my private patch now.

Arnd