Project

General

Profile

Actions

Bug #13958

closed

kpti_trampolines.s fails to assemble with binutils 2.37

Added by Andy Fiddaman about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
kernel
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:
External Bug:

Description

../../i86pc/ml/kpti_trampolines.s:276: Warning: no instruction mnemonic suffix given and no register operands; using default for `sysexit'
../../i86pc/ml/kpti_trampolines.s:278: Warning: no instruction mnemonic suffix given and no register operands; using default for `sysexit'

This is due to the updated GNU assembler adding a warning when implicitly assuming sysexitl instead of sysexitq when seeing the plain sysexit.

Actions #1

Updated by Andy Fiddaman about 2 years ago

As of GNU binutils 2.37, the assembler has split the 'sysexit' instruction
into 'sysexitl' and 'sysexitq'. Using a plain 'sysexit' as kpti_trampolines.s
does is interpreted as 'sysexitl' but comes with a warning about the
assumption being made. By default, the assembler wrapper - aw -
treats all errors as fatal.

The plain 'sysexit' in this file cannot be changed to 'sysexitl' since older
versions of GNU binutils do not understand that.

Actions #2

Updated by Andy Fiddaman about 2 years ago

  • Gerrit CR set to 1609
Actions #3

Updated by Andy Fiddaman about 2 years ago

I tested building this change on an OmniOS system with binutils 2.36.1 and then with binutils 2.37. Both succeeded and wsdiff showed no differences between these and a build without the change.
Disassembling the updated function shows the expected instructions:

build:ig_13958_kpti.s:ig_13958_kpti.s% dis -F tr_sysexit proto/root_i386-nd/platform/i86pc/kernel/amd64/unix
disassembly for proto/root_i386-nd/platform/i86pc/kernel/amd64/unix

tr_sysexit()
    tr_sysexit:      9c                 pushfq
    tr_sysexit+0x1:  48 83 3c 25 00 00  cmpq   $0x1,0xfffffffffbc00000  <kpti_enable>
                     c0 fb 01
    tr_sysexit+0xa:  75 3c              jne    +0x3c    <tr_sysexit+0x48>
    tr_sysexit+0xc:  9d                 popfq
    tr_sysexit+0xd:  65 4c 89 2c 25 58  movq   %r13,%gs:0x1e58
                     1e 00 00
    tr_sysexit+0x16: 65 4c 8b 2c 25 b0  movq   %gs:0x1eb0,%r13
                     1e 00 00
    tr_sysexit+0x1f: 41 0f 22 dd        movq   %r13,%cr3
    tr_sysexit+0x23: 65 4c 8b 2c 25 58  movq   %gs:0x1e58,%r13
                     1e 00 00
    tr_sysexit+0x2c: 65 48 c7 04 25 58  movq   $0x0,%gs:0x1e58
                     1e 00 00 00 00 00
                     00
    tr_sysexit+0x39: 65 48 c7 04 25 50  movq   $0x0,%gs:0x1e50
                     1e 00 00 00 00 00
                     00
    tr_sysexit+0x46: eb 01              jmp    +0x1     <tr_sysexit+0x49>
    tr_sysexit+0x48: 9d                 popfq
    tr_sysexit+0x49: 0f 01 f8           swapgs
    tr_sysexit+0x4c: fb                 sti
    tr_sysexit+0x4d: 0f 35              sysexit
Actions #4

Updated by Electric Monk about 2 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit 72c7ebd9d162dc4cbe1844d12b6b120771c46960

commit  72c7ebd9d162dc4cbe1844d12b6b120771c46960
Author: Andy Fiddaman <omnios@citrus-it.co.uk>
Date:   2021-07-22T22:54:32.000Z

    13958 kpti_trampolines.s fails to assemble with binutils 2.37
    Reviewed by: Robert Mustacchi <rm@fingolfin.org>
    Reviewed by: Toomas Soome <tsoome@me.com>
    Reviewed by: Alex Wilson <alex@cooperi.net>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF