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

Configure Feed

Select the types of activity you want to include in your feed.

elf: Define note name macros

elf.h had a comment saying:
> Notes used in ET_CORE. Architectures export some of the arch register
> sets using the corresponding note types via the PTRACE_GETREGSET and
> PTRACE_SETREGSET requests.
> The note name for these types is "LINUX", except NT_PRFPREG that is
> named "CORE".

However, NT_PRSTATUS is also named "CORE". It is also unclear what
"these types" refers to.

To fix these problems, define a name for each note type. The added
definitions are macros so the kernel and userspace can directly refer to
them to remove their duplicate definitions of note names.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Acked-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Dave Martin <Dave.Martin@arm.com>
Link: https://lore.kernel.org/r/20250115-elf-v5-1-0f9e55bbb2fc@daynix.com
Signed-off-by: Kees Cook <kees@kernel.org>

authored by

Akihiko Odaki and committed by
Kees Cook
7da8e4ad a64dcfb4

+84 -5
+84 -5
include/uapi/linux/elf.h
··· 368 368 #define ELF_OSABI ELFOSABI_NONE 369 369 #endif 370 370 371 + /* Note definitions: NN_ defines names. NT_ defines types. */ 372 + 373 + #define NN_GNU_PROPERTY_TYPE_0 "GNU" 374 + #define NT_GNU_PROPERTY_TYPE_0 5 375 + 371 376 /* 372 377 * Notes used in ET_CORE. Architectures export some of the arch register sets 373 378 * using the corresponding note types via the PTRACE_GETREGSET and 374 379 * PTRACE_SETREGSET requests. 375 - * The note name for these types is "LINUX", except NT_PRFPREG that is named 376 - * "CORE". 377 380 */ 381 + #define NN_PRSTATUS "CORE" 378 382 #define NT_PRSTATUS 1 383 + #define NN_PRFPREG "CORE" 379 384 #define NT_PRFPREG 2 385 + #define NN_PRPSINFO "CORE" 380 386 #define NT_PRPSINFO 3 387 + #define NN_TASKSTRUCT "CORE" 381 388 #define NT_TASKSTRUCT 4 389 + #define NN_AUXV "CORE" 382 390 #define NT_AUXV 6 383 391 /* 384 392 * Note to userspace developers: size of NT_SIGINFO note may increase 385 393 * in the future to accomodate more fields, don't assume it is fixed! 386 394 */ 395 + #define NN_SIGINFO "CORE" 387 396 #define NT_SIGINFO 0x53494749 397 + #define NN_FILE "CORE" 388 398 #define NT_FILE 0x46494c45 399 + #define NN_PRXFPREG "LINUX" 389 400 #define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/common.h */ 401 + #define NN_PPC_VMX "LINUX" 390 402 #define NT_PPC_VMX 0x100 /* PowerPC Altivec/VMX registers */ 403 + #define NN_PPC_SPE "LINUX" 391 404 #define NT_PPC_SPE 0x101 /* PowerPC SPE/EVR registers */ 405 + #define NN_PPC_VSX "LINUX" 392 406 #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ 407 + #define NN_PPC_TAR "LINUX" 393 408 #define NT_PPC_TAR 0x103 /* Target Address Register */ 409 + #define NN_PPC_PPR "LINUX" 394 410 #define NT_PPC_PPR 0x104 /* Program Priority Register */ 411 + #define NN_PPC_DSCR "LINUX" 395 412 #define NT_PPC_DSCR 0x105 /* Data Stream Control Register */ 413 + #define NN_PPC_EBB "LINUX" 396 414 #define NT_PPC_EBB 0x106 /* Event Based Branch Registers */ 415 + #define NN_PPC_PMU "LINUX" 397 416 #define NT_PPC_PMU 0x107 /* Performance Monitor Registers */ 417 + #define NN_PPC_TM_CGPR "LINUX" 398 418 #define NT_PPC_TM_CGPR 0x108 /* TM checkpointed GPR Registers */ 419 + #define NN_PPC_TM_CFPR "LINUX" 399 420 #define NT_PPC_TM_CFPR 0x109 /* TM checkpointed FPR Registers */ 421 + #define NN_PPC_TM_CVMX "LINUX" 400 422 #define NT_PPC_TM_CVMX 0x10a /* TM checkpointed VMX Registers */ 423 + #define NN_PPC_TM_CVSX "LINUX" 401 424 #define NT_PPC_TM_CVSX 0x10b /* TM checkpointed VSX Registers */ 425 + #define NN_PPC_TM_SPR "LINUX" 402 426 #define NT_PPC_TM_SPR 0x10c /* TM Special Purpose Registers */ 427 + #define NN_PPC_TM_CTAR "LINUX" 403 428 #define NT_PPC_TM_CTAR 0x10d /* TM checkpointed Target Address Register */ 429 + #define NN_PPC_TM_CPPR "LINUX" 404 430 #define NT_PPC_TM_CPPR 0x10e /* TM checkpointed Program Priority Register */ 431 + #define NN_PPC_TM_CDSCR "LINUX" 405 432 #define NT_PPC_TM_CDSCR 0x10f /* TM checkpointed Data Stream Control Register */ 433 + #define NN_PPC_PKEY "LINUX" 406 434 #define NT_PPC_PKEY 0x110 /* Memory Protection Keys registers */ 435 + #define NN_PPC_DEXCR "LINUX" 407 436 #define NT_PPC_DEXCR 0x111 /* PowerPC DEXCR registers */ 437 + #define NN_PPC_HASHKEYR "LINUX" 408 438 #define NT_PPC_HASHKEYR 0x112 /* PowerPC HASHKEYR register */ 439 + #define NN_386_TLS "LINUX" 409 440 #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ 441 + #define NN_386_IOPERM "LINUX" 410 442 #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ 443 + #define NN_X86_XSTATE "LINUX" 411 444 #define NT_X86_XSTATE 0x202 /* x86 extended state using xsave */ 412 445 /* Old binutils treats 0x203 as a CET state */ 446 + #define NN_X86_SHSTK "LINUX" 413 447 #define NT_X86_SHSTK 0x204 /* x86 SHSTK state */ 448 + #define NN_X86_XSAVE_LAYOUT "LINUX" 414 449 #define NT_X86_XSAVE_LAYOUT 0x205 /* XSAVE layout description */ 450 + #define NN_S390_HIGH_GPRS "LINUX" 415 451 #define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */ 452 + #define NN_S390_TIMER "LINUX" 416 453 #define NT_S390_TIMER 0x301 /* s390 timer register */ 454 + #define NN_S390_TODCMP "LINUX" 417 455 #define NT_S390_TODCMP 0x302 /* s390 TOD clock comparator register */ 456 + #define NN_S390_TODPREG "LINUX" 418 457 #define NT_S390_TODPREG 0x303 /* s390 TOD programmable register */ 458 + #define NN_S390_CTRS "LINUX" 419 459 #define NT_S390_CTRS 0x304 /* s390 control registers */ 460 + #define NN_S390_PREFIX "LINUX" 420 461 #define NT_S390_PREFIX 0x305 /* s390 prefix register */ 462 + #define NN_S390_LAST_BREAK "LINUX" 421 463 #define NT_S390_LAST_BREAK 0x306 /* s390 breaking event address */ 464 + #define NN_S390_SYSTEM_CALL "LINUX" 422 465 #define NT_S390_SYSTEM_CALL 0x307 /* s390 system call restart data */ 466 + #define NN_S390_TDB "LINUX" 423 467 #define NT_S390_TDB 0x308 /* s390 transaction diagnostic block */ 468 + #define NN_S390_VXRS_LOW "LINUX" 424 469 #define NT_S390_VXRS_LOW 0x309 /* s390 vector registers 0-15 upper half */ 470 + #define NN_S390_VXRS_HIGH "LINUX" 425 471 #define NT_S390_VXRS_HIGH 0x30a /* s390 vector registers 16-31 */ 472 + #define NN_S390_GS_CB "LINUX" 426 473 #define NT_S390_GS_CB 0x30b /* s390 guarded storage registers */ 474 + #define NN_S390_GS_BC "LINUX" 427 475 #define NT_S390_GS_BC 0x30c /* s390 guarded storage broadcast control block */ 476 + #define NN_S390_RI_CB "LINUX" 428 477 #define NT_S390_RI_CB 0x30d /* s390 runtime instrumentation */ 478 + #define NN_S390_PV_CPU_DATA "LINUX" 429 479 #define NT_S390_PV_CPU_DATA 0x30e /* s390 protvirt cpu dump data */ 480 + #define NN_ARM_VFP "LINUX" 430 481 #define NT_ARM_VFP 0x400 /* ARM VFP/NEON registers */ 482 + #define NN_ARM_TLS "LINUX" 431 483 #define NT_ARM_TLS 0x401 /* ARM TLS register */ 484 + #define NN_ARM_HW_BREAK "LINUX" 432 485 #define NT_ARM_HW_BREAK 0x402 /* ARM hardware breakpoint registers */ 486 + #define NN_ARM_HW_WATCH "LINUX" 433 487 #define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */ 488 + #define NN_ARM_SYSTEM_CALL "LINUX" 434 489 #define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */ 490 + #define NN_ARM_SVE "LINUX" 435 491 #define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension registers */ 492 + #define NN_ARM_PAC_MASK "LINUX" 436 493 #define NT_ARM_PAC_MASK 0x406 /* ARM pointer authentication code masks */ 494 + #define NN_ARM_PACA_KEYS "LINUX" 437 495 #define NT_ARM_PACA_KEYS 0x407 /* ARM pointer authentication address keys */ 496 + #define NN_ARM_PACG_KEYS "LINUX" 438 497 #define NT_ARM_PACG_KEYS 0x408 /* ARM pointer authentication generic key */ 498 + #define NN_ARM_TAGGED_ADDR_CTRL "LINUX" 439 499 #define NT_ARM_TAGGED_ADDR_CTRL 0x409 /* arm64 tagged address control (prctl()) */ 500 + #define NN_ARM_PAC_ENABLED_KEYS "LINUX" 440 501 #define NT_ARM_PAC_ENABLED_KEYS 0x40a /* arm64 ptr auth enabled keys (prctl()) */ 502 + #define NN_ARM_SSVE "LINUX" 441 503 #define NT_ARM_SSVE 0x40b /* ARM Streaming SVE registers */ 504 + #define NN_ARM_ZA "LINUX" 442 505 #define NT_ARM_ZA 0x40c /* ARM SME ZA registers */ 506 + #define NN_ARM_ZT "LINUX" 443 507 #define NT_ARM_ZT 0x40d /* ARM SME ZT registers */ 508 + #define NN_ARM_FPMR "LINUX" 444 509 #define NT_ARM_FPMR 0x40e /* ARM floating point mode register */ 510 + #define NN_ARM_POE "LINUX" 445 511 #define NT_ARM_POE 0x40f /* ARM POE registers */ 512 + #define NN_ARM_GCS "LINUX" 446 513 #define NT_ARM_GCS 0x410 /* ARM GCS state */ 514 + #define NN_ARC_V2 "LINUX" 447 515 #define NT_ARC_V2 0x600 /* ARCv2 accumulator/extra registers */ 516 + #define NN_VMCOREDD "LINUX" 448 517 #define NT_VMCOREDD 0x700 /* Vmcore Device Dump Note */ 518 + #define NN_MIPS_DSP "LINUX" 449 519 #define NT_MIPS_DSP 0x800 /* MIPS DSP ASE registers */ 520 + #define NN_MIPS_FP_MODE "LINUX" 450 521 #define NT_MIPS_FP_MODE 0x801 /* MIPS floating-point mode */ 522 + #define NN_MIPS_MSA "LINUX" 451 523 #define NT_MIPS_MSA 0x802 /* MIPS SIMD registers */ 524 + #define NN_RISCV_CSR "LINUX" 452 525 #define NT_RISCV_CSR 0x900 /* RISC-V Control and Status Registers */ 526 + #define NN_RISCV_VECTOR "LINUX" 453 527 #define NT_RISCV_VECTOR 0x901 /* RISC-V vector registers */ 528 + #define NN_RISCV_TAGGED_ADDR_CTRL "LINUX" 454 529 #define NT_RISCV_TAGGED_ADDR_CTRL 0x902 /* RISC-V tagged address control (prctl()) */ 530 + #define NN_LOONGARCH_CPUCFG "LINUX" 455 531 #define NT_LOONGARCH_CPUCFG 0xa00 /* LoongArch CPU config registers */ 532 + #define NN_LOONGARCH_CSR "LINUX" 456 533 #define NT_LOONGARCH_CSR 0xa01 /* LoongArch control and status registers */ 534 + #define NN_LOONGARCH_LSX "LINUX" 457 535 #define NT_LOONGARCH_LSX 0xa02 /* LoongArch Loongson SIMD Extension registers */ 536 + #define NN_LOONGARCH_LASX "LINUX" 458 537 #define NT_LOONGARCH_LASX 0xa03 /* LoongArch Loongson Advanced SIMD Extension registers */ 538 + #define NN_LOONGARCH_LBT "LINUX" 459 539 #define NT_LOONGARCH_LBT 0xa04 /* LoongArch Loongson Binary Translation registers */ 540 + #define NN_LOONGARCH_HW_BREAK "LINUX" 460 541 #define NT_LOONGARCH_HW_BREAK 0xa05 /* LoongArch hardware breakpoint registers */ 542 + #define NN_LOONGARCH_HW_WATCH "LINUX" 461 543 #define NT_LOONGARCH_HW_WATCH 0xa06 /* LoongArch hardware watchpoint registers */ 462 - 463 - /* Note types with note name "GNU" */ 464 - #define NT_GNU_PROPERTY_TYPE_0 5 465 544 466 545 /* Note header in a PT_NOTE section */ 467 546 typedef struct elf32_note {