All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [peterz-queue:x86/ibt 5/8] arch/x86/kernel/traps.c:136:21: error: implicit declaration of function 'X86_MODRB_RM'; did you mean 'X86_MODRM_RM'?
Date: Sun, 17 Nov 2024 12:43:31 +0800	[thread overview]
Message-ID: <202411171237.YTh4fEM8-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/ibt
head:   72c0a686dca37ac0f2ed213b2be9487ae091bb99
commit: 3b8ca79166ffec0c374f9efa2f30946f335c3442 [5/8] x86/traps: Cleanup and robustify decode_bug()
config: x86_64-rhel-8.3 (https://download.01.org/0day-ci/archive/20241117/202411171237.YTh4fEM8-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241117/202411171237.YTh4fEM8-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411171237.YTh4fEM8-lkp@intel.com/

All errors (new ones prefixed by >>):

   arch/x86/kernel/traps.c: In function 'decode_bug':
>> arch/x86/kernel/traps.c:136:21: error: implicit declaration of function 'X86_MODRB_RM'; did you mean 'X86_MODRM_RM'? [-Werror=implicit-function-declaration]
     136 |         case 0: if (X86_MODRB_RM(v) == 5)
         |                     ^~~~~~~~~~~~
         |                     X86_MODRM_RM
   cc1: some warnings being treated as errors


vim +136 arch/x86/kernel/traps.c

    94	
    95	/*
    96	 * Check for UD1 or UD2, accounting for Address Size Override Prefixes.
    97	 * If it's a UD1, further decode to determine its use:
    98	 *
    99	 * UBSan{0}:     67 0f b9 00             ud1    (%eax),%eax
   100	 * UBSan{10}:    67 0f b9 40 10          ud1    0x10(%eax),%eax
   101	 * static_call:  0f b9 cc                ud1    %esp,%ecx
   102	 *
   103	 * Notably UBSAN uses EAX, static_call uses ECX.
   104	 */
   105	__always_inline int decode_bug(unsigned long addr, s32 *imm, int *len)
   106	{
   107		unsigned long start = addr;
   108		u8 v;
   109	
   110		if (addr < TASK_SIZE_MAX)
   111			return BUG_NONE;
   112	
   113		v = *(u8 *)(addr++);
   114		if (v == INSN_ASOP)
   115			v = *(u8 *)(addr++);
   116		if (v != OPCODE_ESCAPE)
   117			return BUG_NONE;
   118	
   119		v = *(u8 *)(addr++);
   120		if (v == SECOND_BYTE_OPCODE_UD2) {
   121			*len = addr - start;
   122			return BUG_UD2;
   123		}
   124	
   125		if (v != SECOND_BYTE_OPCODE_UD1)
   126			return BUG_NONE;
   127	
   128		*imm = 0;
   129		v = *(u8 *)(addr++);		/* ModRM */
   130	
   131		if (X86_MODRM_MOD(v) != 3 && X86_MODRM_RM(v) == 4)
   132			addr++;			/* SIB */
   133	
   134		/* Decode immediate, if present */
   135		switch (X86_MODRM_MOD(v)) {
 > 136		case 0: if (X86_MODRB_RM(v) == 5)
   137				addr += 4; /* RIP + disp32 */
   138			break;
   139	
   140		case 1: *imm = *(s8 *)addr;
   141			addr += 1;
   142			break;
   143	
   144		case 2: *imm = *(s32 *)addr;
   145			addr += 4;
   146			break;
   147	
   148		case 3: break;
   149		}
   150	
   151		/* record instruction length */
   152		*len = addr - start;
   153	
   154		if (X86_MODRM_REG(v) == 0)	/* EAX */
   155			return BUG_UD1_UBSAN;
   156	
   157		return BUG_UD1;
   158	}
   159	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2024-11-17  4:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202411171237.YTh4fEM8-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.