From 25fcd409fb9ad74df9de77880d103de2a04245f8 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 23 Jan 2024 10:56:39 +0000 Subject: [PATCH] 12.38: Annocheck: Skip entry test for i686 binaries --- annocheck/hardened.c | 20 ++++++++++---------- configure | 2 +- configure.ac | 2 +- meson.build | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/annocheck/hardened.c b/annocheck/hardened.c index d7609e5..73e8a50 100644 --- a/annocheck/hardened.c +++ b/annocheck/hardened.c @@ -335,7 +335,7 @@ static test tests [TEST_MAX] = TEST (cf-protection, CF_PROTECTION, "Compiled with -fcf-protection=all (x86_64 only, gcc 8+ only)"), TEST (dynamic-segment, DYNAMIC_SEGMENT, "There is at most one dynamic segment/section"), TEST (dynamic-tags, DYNAMIC_TAGS, "Dynamic tags for BTI (and optionally PAC) present (AArch64 only, Fedora)"), - TEST (entry, ENTRY, "The first instruction is ENDBR (x86 executables only)"), + TEST (entry, ENTRY, "The first instruction is ENDBR (x86_64 executables only)"), TEST (fast, FAST, "-Ofast used/not-used consistently"), TEST (fips, FIPS, "GO binaries use FIPS validated cryptographic libraries"), FTEST (flex-arrays, FLEX_ARRAYS, "Compiled with -fstrict-flex-arrays=[123]"), @@ -5775,7 +5775,7 @@ interesting_seg (annocheck_data * data, do not have to have sections. */ if (! skip_test (TEST_ENTRY) && is_executable () - && is_x86 () + && is_x86_64 () /* If GO is being used then CET is not supported. */ && (! GO_compiler_seen ()) /* Check that the entry point is inside this segment. */ @@ -5819,34 +5819,34 @@ check_seg (annocheck_data * data, memcpy (entry_bytes, seg->data->d_buf + entry_point, sizeof entry_bytes); - if (per_file.e_machine == EM_386) + if (per_file.e_machine == EM_X86_64) { - /* Look for ENDBR32: 0xf3 0x0f 0x1e 0xfb. */ + /* Look for ENDBR64: 0xf3 0x0f 0x1e 0xfa. */ if ( entry_bytes[0] == 0xf3 && entry_bytes[1] == 0x0f && entry_bytes[2] == 0x1e - && entry_bytes[3] == 0xfb) + && entry_bytes[3] == 0xfa) pass (data, TEST_ENTRY, SOURCE_SEGMENT_CONTENTS, NULL); else { - fail (data, TEST_ENTRY, SOURCE_SEGMENT_CONTENTS, "instruction at entry is not ENDBR32"); + fail (data, TEST_ENTRY, SOURCE_SEGMENT_CONTENTS, "instruction at entry is not ENDBR64"); einfo (VERBOSE, "%s: info: entry address: %#lx. Bytes at this address: %x %x %x %x", get_filename (data), (long) per_file.e_entry, entry_bytes[0], entry_bytes[1], entry_bytes[2], entry_bytes[3]); } } - else /* per_file.e_machine == EM_X86_64 */ + else if (per_file.e_machine == EM_386) { - /* Look for ENDBR64: 0xf3 0x0f 0x1e 0xfa. */ + /* Look for ENDBR32: 0xf3 0x0f 0x1e 0xfb. */ if ( entry_bytes[0] == 0xf3 && entry_bytes[1] == 0x0f && entry_bytes[2] == 0x1e - && entry_bytes[3] == 0xfa) + && entry_bytes[3] == 0xfb) pass (data, TEST_ENTRY, SOURCE_SEGMENT_CONTENTS, NULL); else { - fail (data, TEST_ENTRY, SOURCE_SEGMENT_CONTENTS, "instruction at entry is not ENDBR64"); + fail (data, TEST_ENTRY, SOURCE_SEGMENT_CONTENTS, "instruction at entry is not ENDBR32"); einfo (VERBOSE, "%s: info: entry address: %#lx. Bytes at this address: %x %x %x %x", get_filename (data), (long) per_file.e_entry, diff --git a/configure b/configure index e0915de..29950ae 100755 --- a/configure +++ b/configure @@ -2692,7 +2692,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # NB/ When updating the ANNOBIN_VERSION below, remember to # also update VERSION in the PROJECT section of meson.build. -ANNOBIN_VERSION=12.37 +ANNOBIN_VERSION=12.38 # Make sure we can run config.sub. diff --git a/configure.ac b/configure.ac index 3883f57..6c25d3e 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ AC_CONFIG_SRCDIR([annobin-global.h.in]) # NB/ When updating the ANNOBIN_VERSION below, remember to # also update VERSION in the PROJECT section of meson.build. -ANNOBIN_VERSION=12.37 +ANNOBIN_VERSION=12.38 AC_SUBST(ANNOBIN_VERSION) AC_CANONICAL_SYSTEM diff --git a/meson.build b/meson.build index 6b30b5c..d763a25 100644 --- a/meson.build +++ b/meson.build @@ -7,7 +7,7 @@ project( 'annobin', ['c', 'cpp'], - version: '12.37', + version: '12.38', meson_version: '>=0.59' ) -- 2.43.5