Skip to content
Snippets Groups Projects
  1. Feb 23, 2023
    • Josh Poimboeuf's avatar
      objtool: Fix ORC 'signal' propagation · 00c8f01c
      Josh Poimboeuf authored
      
      There have been some recently reported ORC unwinder warnings like:
      
        WARNING: can't access registers at entry_SYSCALL_64_after_hwframe+0x63/0xcd
        WARNING: stack going in the wrong direction? at __sys_setsockopt+0x2c6/0x5b0 net/socket.c:2271
      
      And a KASAN warning:
      
        BUG: KASAN: stack-out-of-bounds in unwind_next_frame (arch/x86/include/asm/ptrace.h:136 arch/x86/kernel/unwind_orc.c:455)
      
      It turns out the 'signal' bit isn't getting propagated from the unwind
      hints to the ORC entries, making the unwinder confused at times.
      
      Fixes: ffb1b4a4 ("x86/unwind/orc: Add 'signal' field to ORC metadata")
      Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/97eef9db60cd86d376a9a40d49d77bb67a8f6526.1676579666.git.jpoimboe@kernel.org
      00c8f01c
    • Peter Zijlstra's avatar
      objtool: Remove instruction::list · 1c34496e
      Peter Zijlstra authored
      
      Replace the instruction::list by allocating instructions in arrays of
      256 entries and stringing them together by (amortized) find_insn().
      This shrinks instruction by 16 bytes and brings it down to 128.
      
       struct instruction {
      -	struct list_head           list;                 /*     0    16 */
      -	struct hlist_node          hash;                 /*    16    16 */
      -	struct list_head           call_node;            /*    32    16 */
      -	struct section *           sec;                  /*    48     8 */
      -	long unsigned int          offset;               /*    56     8 */
      -	/* --- cacheline 1 boundary (64 bytes) --- */
      -	long unsigned int          immediate;            /*    64     8 */
      -	unsigned int               len;                  /*    72     4 */
      -	u8                         type;                 /*    76     1 */
      -
      -	/* Bitfield combined with previous fields */
      +	struct hlist_node          hash;                 /*     0    16 */
      +	struct list_head           call_node;            /*    16    16 */
      +	struct section *           sec;                  /*    32     8 */
      +	long unsigned int          offset;               /*    40     8 */
      +	long unsigned int          immediate;            /*    48     8 */
      +	u8                         len;                  /*    56     1 */
      +	u8                         prev_len;             /*    57     1 */
      +	u8                         type;                 /*    58     1 */
      +	s8                         instr;                /*    59     1 */
      +	u32                        idx:8;                /*    60: 0  4 */
      +	u32                        dead_end:1;           /*    60: 8  4 */
      +	u32                        ignore:1;             /*    60: 9  4 */
      +	u32                        ignore_alts:1;        /*    60:10  4 */
      +	u32                        hint:1;               /*    60:11  4 */
      +	u32                        save:1;               /*    60:12  4 */
      +	u32                        restore:1;            /*    60:13  4 */
      +	u32                        retpoline_safe:1;     /*    60:14  4 */
      +	u32                        noendbr:1;            /*    60:15  4 */
      +	u32                        entry:1;              /*    60:16  4 */
      +	u32                        visited:4;            /*    60:17  4 */
      +	u32                        no_reloc:1;           /*    60:21  4 */
      
      -	u16                        dead_end:1;           /*    76: 8  2 */
      -	u16                        ignore:1;             /*    76: 9  2 */
      -	u16                        ignore_alts:1;        /*    76:10  2 */
      -	u16                        hint:1;               /*    76:11  2 */
      -	u16                        save:1;               /*    76:12  2 */
      -	u16                        restore:1;            /*    76:13  2 */
      -	u16                        retpoline_safe:1;     /*    76:14  2 */
      -	u16                        noendbr:1;            /*    76:15  2 */
      -	u16                        entry:1;              /*    78: 0  2 */
      -	u16                        visited:4;            /*    78: 1  2 */
      -	u16                        no_reloc:1;           /*    78: 5  2 */
      +	/* XXX 10 bits hole, try to pack */
      
      -	/* XXX 2 bits hole, try to pack */
      -	/* Bitfield combined with next fields */
      -
      -	s8                         instr;                /*    79     1 */
      -	struct alt_group *         alt_group;            /*    80     8 */
      -	struct instruction *       jump_dest;            /*    88     8 */
      -	struct instruction *       first_jump_src;       /*    96     8 */
      +	/* --- cacheline 1 boundary (64 bytes) --- */
      +	struct alt_group *         alt_group;            /*    64     8 */
      +	struct instruction *       jump_dest;            /*    72     8 */
      +	struct instruction *       first_jump_src;       /*    80     8 */
       	union {
      -		struct symbol *    _call_dest;           /*   104     8 */
      -		struct reloc *     _jump_table;          /*   104     8 */
      -	};                                               /*   104     8 */
      -	struct alternative *       alts;                 /*   112     8 */
      -	struct symbol *            sym;                  /*   120     8 */
      -	/* --- cacheline 2 boundary (128 bytes) --- */
      -	struct stack_op *          stack_ops;            /*   128     8 */
      -	struct cfi_state *         cfi;                  /*   136     8 */
      +		struct symbol *    _call_dest;           /*    88     8 */
      +		struct reloc *     _jump_table;          /*    88     8 */
      +	};                                               /*    88     8 */
      +	struct alternative *       alts;                 /*    96     8 */
      +	struct symbol *            sym;                  /*   104     8 */
      +	struct stack_op *          stack_ops;            /*   112     8 */
      +	struct cfi_state *         cfi;                  /*   120     8 */
      
      -	/* size: 144, cachelines: 3, members: 28 */
      -	/* sum members: 142 */
      -	/* sum bitfield members: 14 bits, bit holes: 1, sum bit holes: 2 bits */
      -	/* last cacheline: 16 bytes */
      +	/* size: 128, cachelines: 2, members: 29 */
      +	/* sum members: 124 */
      +	/* sum bitfield members: 22 bits, bit holes: 1, sum bit holes: 10 bits */
       };
      
      pre:	5:38.18 real,   213.25 user,    124.90 sys,     23449040 mem
      post:	5:03.34 real,   210.75 user,    88.80 sys,      20241232 mem
      
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Acked-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
      Tested-by: Nathan Chancellor <nathan@kernel.org> # build only
      Tested-by: Thomas Weißschuh <linux@weissschuh.net> # compile and run
      Link: https://lore.kernel.org/r/20230208172245.851307606@infradead.org
      1c34496e
    • Peter Zijlstra's avatar
      objtool: Fix overlapping alternatives · a706bb08
      Peter Zijlstra authored
      
      Things like ALTERNATIVE_{2,3}() generate multiple alternatives on the
      same place, objtool would override the first orig_alt_group with the
      second (or third), failing to check the CFI among all the different
      variants.
      
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Acked-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
      Tested-by: Nathan Chancellor <nathan@kernel.org> # build only
      Tested-by: Thomas Weißschuh <linux@weissschuh.net> # compile and run
      Link: https://lore.kernel.org/r/20230208172245.711471461@infradead.org
      a706bb08
    • Peter Zijlstra's avatar
      objtool: Union instruction::{call_dest,jump_table} · c6f5dc28
      Peter Zijlstra authored
      
      The instruction call_dest and jump_table members can never be used at
      the same time, their usage depends on type.
      
       struct instruction {
       	struct list_head           list;                 /*     0    16 */
       	struct hlist_node          hash;                 /*    16    16 */
       	struct list_head           call_node;            /*    32    16 */
       	struct section *           sec;                  /*    48     8 */
       	long unsigned int          offset;               /*    56     8 */
       	/* --- cacheline 1 boundary (64 bytes) --- */
       	long unsigned int          immediate;            /*    64     8 */
       	unsigned int               len;                  /*    72     4 */
       	u8                         type;                 /*    76     1 */
      
       	/* Bitfield combined with previous fields */
      
       	u16                        dead_end:1;           /*    76: 8  2 */
       	u16                        ignore:1;             /*    76: 9  2 */
       	u16                        ignore_alts:1;        /*    76:10  2 */
       	u16                        hint:1;               /*    76:11  2 */
       	u16                        save:1;               /*    76:12  2 */
       	u16                        restore:1;            /*    76:13  2 */
       	u16                        retpoline_safe:1;     /*    76:14  2 */
       	u16                        noendbr:1;            /*    76:15  2 */
       	u16                        entry:1;              /*    78: 0  2 */
       	u16                        visited:4;            /*    78: 1  2 */
       	u16                        no_reloc:1;           /*    78: 5  2 */
      
       	/* XXX 2 bits hole, try to pack */
       	/* Bitfield combined with next fields */
      
       	s8                         instr;                /*    79     1 */
       	struct alt_group *         alt_group;            /*    80     8 */
      -	struct symbol *            call_dest;            /*    88     8 */
      -	struct instruction *       jump_dest;            /*    96     8 */
      -	struct instruction *       first_jump_src;       /*   104     8 */
      -	struct reloc *             jump_table;           /*   112     8 */
      -	struct alternative *       alts;                 /*   120     8 */
      +	struct instruction *       jump_dest;            /*    88     8 */
      +	struct instruction *       first_jump_src;       /*    96     8 */
      +	union {
      +		struct symbol *    _call_dest;           /*   104     8 */
      +		struct reloc *     _jump_table;          /*   104     8 */
      +	};                                               /*   104     8 */
      +	struct alternative *       alts;                 /*   112     8 */
      +	struct symbol *            sym;                  /*   120     8 */
       	/* --- cacheline 2 boundary (128 bytes) --- */
      -	struct symbol *            sym;                  /*   128     8 */
      -	struct stack_op *          stack_ops;            /*   136     8 */
      -	struct cfi_state *         cfi;                  /*   144     8 */
      +	struct stack_op *          stack_ops;            /*   128     8 */
      +	struct cfi_state *         cfi;                  /*   136     8 */
      
      -	/* size: 152, cachelines: 3, members: 29 */
      -	/* sum members: 150 */
      +	/* size: 144, cachelines: 3, members: 28 */
      +	/* sum members: 142 */
       	/* sum bitfield members: 14 bits, bit holes: 1, sum bit holes: 2 bits */
      -	/* last cacheline: 24 bytes */
      +	/* last cacheline: 16 bytes */
       };
      
      pre:	5:39.35 real,   215.58 user,    123.69 sys,     23448736 mem
      post:	5:38.18 real,   213.25 user,    124.90 sys,     23449040 mem
      
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Acked-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
      Tested-by: Nathan Chancellor <nathan@kernel.org> # build only
      Tested-by: Thomas Weißschuh <linux@weissschuh.net> # compile and run
      Link: https://lore.kernel.org/r/20230208172245.640914454@infradead.org
      c6f5dc28
    • Peter Zijlstra's avatar
      objtool: Remove instruction::reloc · 0932dbe1
      Peter Zijlstra authored
      
      Instead of caching the reloc for each instruction, only keep a
      negative cache of not having a reloc (by far the most common case).
      
       struct instruction {
       	struct list_head           list;                 /*     0    16 */
       	struct hlist_node          hash;                 /*    16    16 */
       	struct list_head           call_node;            /*    32    16 */
       	struct section *           sec;                  /*    48     8 */
       	long unsigned int          offset;               /*    56     8 */
       	/* --- cacheline 1 boundary (64 bytes) --- */
       	long unsigned int          immediate;            /*    64     8 */
       	unsigned int               len;                  /*    72     4 */
       	u8                         type;                 /*    76     1 */
      
       	/* Bitfield combined with previous fields */
      
       	u16                        dead_end:1;           /*    76: 8  2 */
       	u16                        ignore:1;             /*    76: 9  2 */
       	u16                        ignore_alts:1;        /*    76:10  2 */
       	u16                        hint:1;               /*    76:11  2 */
       	u16                        save:1;               /*    76:12  2 */
       	u16                        restore:1;            /*    76:13  2 */
       	u16                        retpoline_safe:1;     /*    76:14  2 */
       	u16                        noendbr:1;            /*    76:15  2 */
       	u16                        entry:1;              /*    78: 0  2 */
       	u16                        visited:4;            /*    78: 1  2 */
      +	u16                        no_reloc:1;           /*    78: 5  2 */
      
      -	/* XXX 3 bits hole, try to pack */
      +	/* XXX 2 bits hole, try to pack */
       	/* Bitfield combined with next fields */
      
       	s8                         instr;                /*    79     1 */
       	struct alt_group *         alt_group;            /*    80     8 */
       	struct symbol *            call_dest;            /*    88     8 */
       	struct instruction *       jump_dest;            /*    96     8 */
       	struct instruction *       first_jump_src;       /*   104     8 */
       	struct reloc *             jump_table;           /*   112     8 */
      -	struct reloc *             reloc;                /*   120     8 */
      +	struct alternative *       alts;                 /*   120     8 */
       	/* --- cacheline 2 boundary (128 bytes) --- */
      -	struct alternative *       alts;                 /*   128     8 */
      -	struct symbol *            sym;                  /*   136     8 */
      -	struct stack_op *          stack_ops;            /*   144     8 */
      -	struct cfi_state *         cfi;                  /*   152     8 */
      +	struct symbol *            sym;                  /*   128     8 */
      +	struct stack_op *          stack_ops;            /*   136     8 */
      +	struct cfi_state *         cfi;                  /*   144     8 */
      
      -	/* size: 160, cachelines: 3, members: 29 */
      -	/* sum members: 158 */
      -	/* sum bitfield members: 13 bits, bit holes: 1, sum bit holes: 3 bits */
      -	/* last cacheline: 32 bytes */
      +	/* size: 152, cachelines: 3, members: 29 */
      +	/* sum members: 150 */
      +	/* sum bitfield members: 14 bits, bit holes: 1, sum bit holes: 2 bits */
      +	/* last cacheline: 24 bytes */
       };
      
      pre:	5:48.89 real,   220.96 user,    127.55 sys,     24834672 mem
      post:	5:39.35 real,   215.58 user,    123.69 sys,     23448736 mem
      
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Acked-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
      Tested-by: Nathan Chancellor <nathan@kernel.org> # build only
      Tested-by: Thomas Weißschuh <linux@weissschuh.net> # compile and run
      Link: https://lore.kernel.org/r/20230208172245.572145269@infradead.org
      0932dbe1
    • Peter Zijlstra's avatar
      objtool: Shrink instruction::{type,visited} · 8b2de412
      Peter Zijlstra authored
      
      Since we don't have that many types in enum insn_type, force it into a
      u8 and re-arrange member to get rid of the holes, saves another 8
      bytes.
      
       struct instruction {
       	struct list_head           list;                 /*     0    16 */
       	struct hlist_node          hash;                 /*    16    16 */
       	struct list_head           call_node;            /*    32    16 */
       	struct section *           sec;                  /*    48     8 */
       	long unsigned int          offset;               /*    56     8 */
       	/* --- cacheline 1 boundary (64 bytes) --- */
      -	unsigned int               len;                  /*    64     4 */
      -	enum insn_type             type;                 /*    68     4 */
      -	long unsigned int          immediate;            /*    72     8 */
      -	u16                        dead_end:1;           /*    80: 0  2 */
      -	u16                        ignore:1;             /*    80: 1  2 */
      -	u16                        ignore_alts:1;        /*    80: 2  2 */
      -	u16                        hint:1;               /*    80: 3  2 */
      -	u16                        save:1;               /*    80: 4  2 */
      -	u16                        restore:1;            /*    80: 5  2 */
      -	u16                        retpoline_safe:1;     /*    80: 6  2 */
      -	u16                        noendbr:1;            /*    80: 7  2 */
      -	u16                        entry:1;              /*    80: 8  2 */
      +	long unsigned int          immediate;            /*    64     8 */
      +	unsigned int               len;                  /*    72     4 */
      +	u8                         type;                 /*    76     1 */
      
      -	/* XXX 7 bits hole, try to pack */
      +	/* Bitfield combined with previous fields */
      
      -	s8                         instr;                /*    82     1 */
      -	u8                         visited;              /*    83     1 */
      +	u16                        dead_end:1;           /*    76: 8  2 */
      +	u16                        ignore:1;             /*    76: 9  2 */
      +	u16                        ignore_alts:1;        /*    76:10  2 */
      +	u16                        hint:1;               /*    76:11  2 */
      +	u16                        save:1;               /*    76:12  2 */
      +	u16                        restore:1;            /*    76:13  2 */
      +	u16                        retpoline_safe:1;     /*    76:14  2 */
      +	u16                        noendbr:1;            /*    76:15  2 */
      +	u16                        entry:1;              /*    78: 0  2 */
      +	u16                        visited:4;            /*    78: 1  2 */
      
      -	/* XXX 4 bytes hole, try to pack */
      +	/* XXX 3 bits hole, try to pack */
      +	/* Bitfield combined with next fields */
      
      -	struct alt_group *         alt_group;            /*    88     8 */
      -	struct symbol *            call_dest;            /*    96     8 */
      -	struct instruction *       jump_dest;            /*   104     8 */
      -	struct instruction *       first_jump_src;       /*   112     8 */
      -	struct reloc *             jump_table;           /*   120     8 */
      +	s8                         instr;                /*    79     1 */
      +	struct alt_group *         alt_group;            /*    80     8 */
      +	struct symbol *            call_dest;            /*    88     8 */
      +	struct instruction *       jump_dest;            /*    96     8 */
      +	struct instruction *       first_jump_src;       /*   104     8 */
      +	struct reloc *             jump_table;           /*   112     8 */
      +	struct reloc *             reloc;                /*   120     8 */
       	/* --- cacheline 2 boundary (128 bytes) --- */
      -	struct reloc *             reloc;                /*   128     8 */
      -	struct alternative *       alts;                 /*   136     8 */
      -	struct symbol *            sym;                  /*   144     8 */
      -	struct stack_op *          stack_ops;            /*   152     8 */
      -	struct cfi_state *         cfi;                  /*   160     8 */
      +	struct alternative *       alts;                 /*   128     8 */
      +	struct symbol *            sym;                  /*   136     8 */
      +	struct stack_op *          stack_ops;            /*   144     8 */
      +	struct cfi_state *         cfi;                  /*   152     8 */
      
      -	/* size: 168, cachelines: 3, members: 29 */
      -	/* sum members: 162, holes: 1, sum holes: 4 */
      -	/* sum bitfield members: 9 bits, bit holes: 1, sum bit holes: 7 bits */
      -	/* last cacheline: 40 bytes */
      +	/* size: 160, cachelines: 3, members: 29 */
      +	/* sum members: 158 */
      +	/* sum bitfield members: 13 bits, bit holes: 1, sum bit holes: 3 bits */
      +	/* last cacheline: 32 bytes */
       };
      
      pre:	5:48.86 real,   220.30 user,    128.34 sys,     24834672 mem
      post:	5:48.89 real,   220.96 user,    127.55 sys,     24834672 mem
      
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Acked-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
      Tested-by: Nathan Chancellor <nathan@kernel.org> # build only
      Tested-by: Thomas Weißschuh <linux@weissschuh.net> # compile and run
      Link: https://lore.kernel.org/r/20230208172245.501847188@infradead.org
      8b2de412
    • Peter Zijlstra's avatar
      objtool: Make instruction::alts a single-linked list · d5406654
      Peter Zijlstra authored
      
       struct instruction {
       	struct list_head           list;                 /*     0    16 */
       	struct hlist_node          hash;                 /*    16    16 */
       	struct list_head           call_node;            /*    32    16 */
       	struct section *           sec;                  /*    48     8 */
       	long unsigned int          offset;               /*    56     8 */
       	/* --- cacheline 1 boundary (64 bytes) --- */
       	unsigned int               len;                  /*    64     4 */
       	enum insn_type             type;                 /*    68     4 */
       	long unsigned int          immediate;            /*    72     8 */
       	u16                        dead_end:1;           /*    80: 0  2 */
       	u16                        ignore:1;             /*    80: 1  2 */
       	u16                        ignore_alts:1;        /*    80: 2  2 */
       	u16                        hint:1;               /*    80: 3  2 */
       	u16                        save:1;               /*    80: 4  2 */
       	u16                        restore:1;            /*    80: 5  2 */
       	u16                        retpoline_safe:1;     /*    80: 6  2 */
       	u16                        noendbr:1;            /*    80: 7  2 */
       	u16                        entry:1;              /*    80: 8  2 */
      
       	/* XXX 7 bits hole, try to pack */
      
       	s8                         instr;                /*    82     1 */
       	u8                         visited;              /*    83     1 */
      
       	/* XXX 4 bytes hole, try to pack */
      
       	struct alt_group *         alt_group;            /*    88     8 */
       	struct symbol *            call_dest;            /*    96     8 */
       	struct instruction *       jump_dest;            /*   104     8 */
       	struct instruction *       first_jump_src;       /*   112     8 */
       	struct reloc *             jump_table;           /*   120     8 */
       	/* --- cacheline 2 boundary (128 bytes) --- */
       	struct reloc *             reloc;                /*   128     8 */
      -	struct list_head           alts;                 /*   136    16 */
      -	struct symbol *            sym;                  /*   152     8 */
      -	struct stack_op *          stack_ops;            /*   160     8 */
      -	struct cfi_state *         cfi;                  /*   168     8 */
      +	struct alternative *       alts;                 /*   136     8 */
      +	struct symbol *            sym;                  /*   144     8 */
      +	struct stack_op *          stack_ops;            /*   152     8 */
      +	struct cfi_state *         cfi;                  /*   160     8 */
      
      -	/* size: 176, cachelines: 3, members: 29 */
      -	/* sum members: 170, holes: 1, sum holes: 4 */
      +	/* size: 168, cachelines: 3, members: 29 */
      +	/* sum members: 162, holes: 1, sum holes: 4 */
       	/* sum bitfield members: 9 bits, bit holes: 1, sum bit holes: 7 bits */
      -	/* last cacheline: 48 bytes */
      +	/* last cacheline: 40 bytes */
       };
      
      pre:	5:58.50 real,   229.64 user,    128.65 sys,     26221520 mem
      post:	5:48.86 real,   220.30 user,    128.34 sys,     24834672 mem
      
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Acked-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
      Tested-by: Nathan Chancellor <nathan@kernel.org> # build only
      Tested-by: Thomas Weißschuh <linux@weissschuh.net> # compile and run
      Link: https://lore.kernel.org/r/20230208172245.430556498@infradead.org
      d5406654
    • Peter Zijlstra's avatar
      objtool: Make instruction::stack_ops a single-linked list · 3ee88df1
      Peter Zijlstra authored
      
       struct instruction {
       	struct list_head           list;                 /*     0    16 */
       	struct hlist_node          hash;                 /*    16    16 */
       	struct list_head           call_node;            /*    32    16 */
       	struct section *           sec;                  /*    48     8 */
       	long unsigned int          offset;               /*    56     8 */
       	/* --- cacheline 1 boundary (64 bytes) --- */
       	unsigned int               len;                  /*    64     4 */
       	enum insn_type             type;                 /*    68     4 */
       	long unsigned int          immediate;            /*    72     8 */
       	u16                        dead_end:1;           /*    80: 0  2 */
       	u16                        ignore:1;             /*    80: 1  2 */
       	u16                        ignore_alts:1;        /*    80: 2  2 */
       	u16                        hint:1;               /*    80: 3  2 */
       	u16                        save:1;               /*    80: 4  2 */
       	u16                        restore:1;            /*    80: 5  2 */
       	u16                        retpoline_safe:1;     /*    80: 6  2 */
       	u16                        noendbr:1;            /*    80: 7  2 */
       	u16                        entry:1;              /*    80: 8  2 */
      
       	/* XXX 7 bits hole, try to pack */
      
       	s8                         instr;                /*    82     1 */
       	u8                         visited;              /*    83     1 */
      
       	/* XXX 4 bytes hole, try to pack */
      
       	struct alt_group *         alt_group;            /*    88     8 */
       	struct symbol *            call_dest;            /*    96     8 */
       	struct instruction *       jump_dest;            /*   104     8 */
       	struct instruction *       first_jump_src;       /*   112     8 */
       	struct reloc *             jump_table;           /*   120     8 */
       	/* --- cacheline 2 boundary (128 bytes) --- */
       	struct reloc *             reloc;                /*   128     8 */
       	struct list_head           alts;                 /*   136    16 */
       	struct symbol *            sym;                  /*   152     8 */
      -	struct list_head           stack_ops;            /*   160    16 */
      -	struct cfi_state *         cfi;                  /*   176     8 */
      +	struct stack_op *          stack_ops;            /*   160     8 */
      +	struct cfi_state *         cfi;                  /*   168     8 */
      
      -	/* size: 184, cachelines: 3, members: 29 */
      -	/* sum members: 178, holes: 1, sum holes: 4 */
      +	/* size: 176, cachelines: 3, members: 29 */
      +	/* sum members: 170, holes: 1, sum holes: 4 */
       	/* sum bitfield members: 9 bits, bit holes: 1, sum bit holes: 7 bits */
      -	/* last cacheline: 56 bytes */
      +	/* last cacheline: 48 bytes */
       };
      
      pre:	5:58.22 real,   226.69 user,    131.22 sys,     26221520 mem
      post:	5:58.50 real,   229.64 user,    128.65 sys,     26221520 mem
      
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Acked-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
      Tested-by: Nathan Chancellor <nathan@kernel.org> # build only
      Tested-by: Thomas Weißschuh <linux@weissschuh.net> # compile and run
      Link: https://lore.kernel.org/r/20230208172245.362196959@infradead.org
      3ee88df1
    • Peter Zijlstra's avatar
      objtool: Change arch_decode_instruction() signature · 20a55463
      Peter Zijlstra authored
      
      In preparation to changing struct instruction around a bit, avoid
      passing it's members by pointer and instead pass the whole thing.
      
      A cleanup in it's own right too.
      
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Acked-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
      Tested-by: Nathan Chancellor <nathan@kernel.org> # build only
      Tested-by: Thomas Weißschuh <linux@weissschuh.net> # compile and run
      Link: https://lore.kernel.org/r/20230208172245.291087549@infradead.org
      20a55463
  2. Feb 20, 2023
    • Arnd Bergmann's avatar
      objtool: add UACCESS exceptions for __tsan_volatile_read/write · d5d46924
      Arnd Bergmann authored
      A lot of the tsan helpers are already excempt from the UACCESS warnings,
      but some more functions were added that need the same thing:
      
      kernel/kcsan/core.o: warning: objtool: __tsan_volatile_read16+0x0: call to __tsan_unaligned_read16() with UACCESS enabled
      kernel/kcsan/core.o: warning: objtool: __tsan_volatile_write16+0x0: call to __tsan_unaligned_write16() with UACCESS enabled
      vmlinux.o: warning: objtool: __tsan_unaligned_volatile_read16+0x4: call to __tsan_unaligned_read16() with UACCESS enabled
      vmlinux.o: warning: objtool: __tsan_unaligned_volatile_write16+0x4: call to __tsan_unaligned_write16() with UACCESS enabled
      
      As Marco points out, these functions don't even call each other
      explicitly but instead gcc (but not clang) notices the functions
      being identical and turns one symbol into a direct branch to the
      other.
      
      Link: https://lkml.kernel.org/r/20230215130058.3836177-4-arnd@kernel.org
      
      
      Fixes: 75d75b7a ("kcsan: Support distinguishing volatile accesses")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarMarco Elver <elver@google.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Konovalov <andreyknvl@gmail.com>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Josh Poimboeuf <jpoimboe@kernel.org>
      Cc: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
      Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      d5d46924
  3. Feb 13, 2023
  4. Feb 11, 2023
  5. Feb 01, 2023
  6. Jan 31, 2023
  7. Jan 21, 2023
  8. Jan 13, 2023
  9. Jan 09, 2023
  10. Jan 07, 2023
  11. Jan 05, 2023
    • Borislav Petkov (AMD)'s avatar
      x86/alternatives: Add alt_instr.flags · 5d1dd961
      Borislav Petkov (AMD) authored
      
      Add a struct alt_instr.flags field which will contain different flags
      controlling alternatives patching behavior.
      
      The initial idea was to be able to specify it as a separate macro
      parameter but that would mean touching all possible invocations of the
      alternatives macros and thus a lot of churn.
      
      What is more, as PeterZ suggested, being able to say ALT_NOT(feature) is
      very readable and explains exactly what is meant.
      
      So make the feature field a u32 where the patching flags are the upper
      u16 part of the dword quantity while the lower u16 word is the feature.
      
      The highest feature number currently is 0x26a (i.e., word 19) so there
      is plenty of space. If that becomes insufficient, the field can be
      extended to u64 which will then make struct alt_instr of the nice size
      of 16 bytes (14 bytes currently).
      
      There should be no functional changes resulting from this.
      
      Suggested-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Reviewed-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/Y6RCoJEtxxZWwotd@zn.tnic
      5d1dd961
  12. Nov 23, 2022
  13. Nov 18, 2022
  14. Nov 05, 2022
Loading