Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

objtool: Remove INSN_STACK

With the unconditional use of handle_insn_ops(), INSN_STACK has lost
its purpose. Remove it.

Suggested-by: Julien Thierry <jthierry@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lkml.kernel.org/r/20200428191659.854203028@infradead.org

-27
-1
tools/objtool/arch.h
··· 21 21 INSN_RETURN, 22 22 INSN_EXCEPTION_RETURN, 23 23 INSN_CONTEXT_SWITCH, 24 - INSN_STACK, 25 24 INSN_BUG, 26 25 INSN_NOP, 27 26 INSN_STAC,
-23
tools/objtool/arch/x86/decode.c
··· 141 141 if (rex_w && !rex_b && modrm_mod == 3 && modrm_rm == 4) { 142 142 143 143 /* add/sub reg, %rsp */ 144 - *type = INSN_STACK; 145 144 ADD_OP(op) { 146 145 op->src.type = OP_SRC_ADD; 147 146 op->src.reg = op_to_cfi_reg[modrm_reg][rex_r]; ··· 153 154 case 0x50 ... 0x57: 154 155 155 156 /* push reg */ 156 - *type = INSN_STACK; 157 157 ADD_OP(op) { 158 158 op->src.type = OP_SRC_REG; 159 159 op->src.reg = op_to_cfi_reg[op1 & 0x7][rex_b]; ··· 164 166 case 0x58 ... 0x5f: 165 167 166 168 /* pop reg */ 167 - *type = INSN_STACK; 168 169 ADD_OP(op) { 169 170 op->src.type = OP_SRC_POP; 170 171 op->dest.type = OP_DEST_REG; ··· 175 178 case 0x68: 176 179 case 0x6a: 177 180 /* push immediate */ 178 - *type = INSN_STACK; 179 181 ADD_OP(op) { 180 182 op->src.type = OP_SRC_CONST; 181 183 op->dest.type = OP_DEST_PUSH; ··· 192 196 193 197 if (modrm == 0xe4) { 194 198 /* and imm, %rsp */ 195 - *type = INSN_STACK; 196 199 ADD_OP(op) { 197 200 op->src.type = OP_SRC_AND; 198 201 op->src.reg = CFI_SP; ··· 210 215 break; 211 216 212 217 /* add/sub imm, %rsp */ 213 - *type = INSN_STACK; 214 218 ADD_OP(op) { 215 219 op->src.type = OP_SRC_ADD; 216 220 op->src.reg = CFI_SP; ··· 223 229 if (rex_w && !rex_r && modrm_mod == 3 && modrm_reg == 4) { 224 230 225 231 /* mov %rsp, reg */ 226 - *type = INSN_STACK; 227 232 ADD_OP(op) { 228 233 op->src.type = OP_SRC_REG; 229 234 op->src.reg = CFI_SP; ··· 235 242 if (rex_w && !rex_b && modrm_mod == 3 && modrm_rm == 4) { 236 243 237 244 /* mov reg, %rsp */ 238 - *type = INSN_STACK; 239 245 ADD_OP(op) { 240 246 op->src.type = OP_SRC_REG; 241 247 op->src.reg = op_to_cfi_reg[modrm_reg][rex_r]; ··· 250 258 (modrm_mod == 1 || modrm_mod == 2) && modrm_rm == 5) { 251 259 252 260 /* mov reg, disp(%rbp) */ 253 - *type = INSN_STACK; 254 261 ADD_OP(op) { 255 262 op->src.type = OP_SRC_REG; 256 263 op->src.reg = op_to_cfi_reg[modrm_reg][rex_r]; ··· 261 270 } else if (rex_w && !rex_b && modrm_rm == 4 && sib == 0x24) { 262 271 263 272 /* mov reg, disp(%rsp) */ 264 - *type = INSN_STACK; 265 273 ADD_OP(op) { 266 274 op->src.type = OP_SRC_REG; 267 275 op->src.reg = op_to_cfi_reg[modrm_reg][rex_r]; ··· 276 286 if (rex_w && !rex_b && modrm_mod == 1 && modrm_rm == 5) { 277 287 278 288 /* mov disp(%rbp), reg */ 279 - *type = INSN_STACK; 280 289 ADD_OP(op) { 281 290 op->src.type = OP_SRC_REG_INDIRECT; 282 291 op->src.reg = CFI_BP; ··· 288 299 modrm_mod != 3 && modrm_rm == 4) { 289 300 290 301 /* mov disp(%rsp), reg */ 291 - *type = INSN_STACK; 292 302 ADD_OP(op) { 293 303 op->src.type = OP_SRC_REG_INDIRECT; 294 304 op->src.reg = CFI_SP; ··· 302 314 case 0x8d: 303 315 if (sib == 0x24 && rex_w && !rex_b && !rex_x) { 304 316 305 - *type = INSN_STACK; 306 317 ADD_OP(op) { 307 318 if (!insn.displacement.value) { 308 319 /* lea (%rsp), reg */ ··· 319 332 } else if (rex == 0x48 && modrm == 0x65) { 320 333 321 334 /* lea disp(%rbp), %rsp */ 322 - *type = INSN_STACK; 323 335 ADD_OP(op) { 324 336 op->src.type = OP_SRC_ADD; 325 337 op->src.reg = CFI_BP; ··· 336 350 * Restoring rsp back to its original value after a 337 351 * stack realignment. 338 352 */ 339 - *type = INSN_STACK; 340 353 ADD_OP(op) { 341 354 op->src.type = OP_SRC_ADD; 342 355 op->src.reg = CFI_R10; ··· 353 368 * Restoring rsp back to its original value after a 354 369 * stack realignment. 355 370 */ 356 - *type = INSN_STACK; 357 371 ADD_OP(op) { 358 372 op->src.type = OP_SRC_ADD; 359 373 op->src.reg = CFI_R13; ··· 366 382 367 383 case 0x8f: 368 384 /* pop to mem */ 369 - *type = INSN_STACK; 370 385 ADD_OP(op) { 371 386 op->src.type = OP_SRC_POP; 372 387 op->dest.type = OP_DEST_MEM; ··· 378 395 379 396 case 0x9c: 380 397 /* pushf */ 381 - *type = INSN_STACK; 382 398 ADD_OP(op) { 383 399 op->src.type = OP_SRC_CONST; 384 400 op->dest.type = OP_DEST_PUSHF; ··· 386 404 387 405 case 0x9d: 388 406 /* popf */ 389 - *type = INSN_STACK; 390 407 ADD_OP(op) { 391 408 op->src.type = OP_SRC_POPF; 392 409 op->dest.type = OP_DEST_MEM; ··· 424 443 } else if (op2 == 0xa0 || op2 == 0xa8) { 425 444 426 445 /* push fs/gs */ 427 - *type = INSN_STACK; 428 446 ADD_OP(op) { 429 447 op->src.type = OP_SRC_CONST; 430 448 op->dest.type = OP_DEST_PUSH; ··· 432 452 } else if (op2 == 0xa1 || op2 == 0xa9) { 433 453 434 454 /* pop fs/gs */ 435 - *type = INSN_STACK; 436 455 ADD_OP(op) { 437 456 op->src.type = OP_SRC_POP; 438 457 op->dest.type = OP_DEST_MEM; ··· 448 469 * mov bp, sp 449 470 * pop bp 450 471 */ 451 - *type = INSN_STACK; 452 472 ADD_OP(op) 453 473 op->dest.type = OP_DEST_LEAVE; 454 474 ··· 515 537 else if (modrm_reg == 6) { 516 538 517 539 /* push from mem */ 518 - *type = INSN_STACK; 519 540 ADD_OP(op) { 520 541 op->src.type = OP_SRC_CONST; 521 542 op->dest.type = OP_DEST_PUSH;
-3
tools/objtool/check.c
··· 2339 2339 } 2340 2340 return 0; 2341 2341 2342 - case INSN_STACK: 2343 - break; 2344 - 2345 2342 case INSN_STAC: 2346 2343 if (state.uaccess) { 2347 2344 WARN_FUNC("recursive UACCESS enable", sec, insn->offset);