Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. TIL about LLVM's ExpandInlineAsm via https://discourse.llvm.org/t/rfc-constant-time-coding-support/87781/37 (@lenary) and I'm more than a little horrified.

TIL about LLVM's ExpandInlineAsm via https://discourse.llvm.org/t/rfc-constant-time-coding-support/87781/37 (@lenary) and I'm more than a little horrified.

Scheduled Pinned Locked Moved Uncategorized
14 Posts 6 Posters 15 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • pervognsen@mastodon.socialP pervognsen@mastodon.social

    TIL about LLVM's ExpandInlineAsm via https://discourse.llvm.org/t/rfc-constant-time-coding-support/87781/37 (@lenary) and I'm more than a little horrified. Is nothing sacred?

    pervognsen@mastodon.socialP This user is from outside of this forum
    pervognsen@mastodon.socialP This user is from outside of this forum
    pervognsen@mastodon.social
    wrote last edited by
    #2

    The ultimate reductio ad absurdum would be if we start putting machine code bytes in inline asm blocks only for compilers to eventually start "helpfully" disassembling them to perform intrinsic substitutions.

    P siguza@infosec.spaceS 2 Replies Last reply
    0
    • pervognsen@mastodon.socialP pervognsen@mastodon.social

      TIL about LLVM's ExpandInlineAsm via https://discourse.llvm.org/t/rfc-constant-time-coding-support/87781/37 (@lenary) and I'm more than a little horrified. Is nothing sacred?

      lenary@types.plL This user is from outside of this forum
      lenary@types.plL This user is from outside of this forum
      lenary@types.pl
      wrote last edited by
      #3

      @pervognsen Nothing was sacred. It's now more sacred than it was. Though I think AMDGPU? wants to read (but not modify) the string for scheduling hints/annotations.

      pervognsen@mastodon.socialP 1 Reply Last reply
      0
      • lenary@types.plL lenary@types.pl

        @pervognsen Nothing was sacred. It's now more sacred than it was. Though I think AMDGPU? wants to read (but not modify) the string for scheduling hints/annotations.

        pervognsen@mastodon.socialP This user is from outside of this forum
        pervognsen@mastodon.socialP This user is from outside of this forum
        pervognsen@mastodon.social
        wrote last edited by
        #4

        @lenary Yeah, found the comments on that in the proposed LangRef changes. It's good that this is at least getting nailed down.

        lenary@types.plL 1 Reply Last reply
        0
        • pervognsen@mastodon.socialP pervognsen@mastodon.social

          The ultimate reductio ad absurdum would be if we start putting machine code bytes in inline asm blocks only for compilers to eventually start "helpfully" disassembling them to perform intrinsic substitutions.

          P This user is from outside of this forum
          P This user is from outside of this forum
          pkhuong@discuss.systems
          wrote last edited by
          #5

          @pervognsen can't be too far… i've already had to do that when clang cleverly detected that my inline asm wasn't supported by the -march on the build line… sometimes I just don't want *the compiler* to use fancy stuff, even though it's available.

          1 Reply Last reply
          0
          • pervognsen@mastodon.socialP pervognsen@mastodon.social

            TIL about LLVM's ExpandInlineAsm via https://discourse.llvm.org/t/rfc-constant-time-coding-support/87781/37 (@lenary) and I'm more than a little horrified. Is nothing sacred?

            zwarich@hachyderm.ioZ This user is from outside of this forum
            zwarich@hachyderm.ioZ This user is from outside of this forum
            zwarich@hachyderm.io
            wrote last edited by
            #6

            @pervognsen @lenary There must be some cursed linker out there that inspects machine code bytes to make decisions rather than purely using relocations.

            joe@f.duriansoftware.comJ lenary@types.plL 2 Replies Last reply
            0
            • zwarich@hachyderm.ioZ zwarich@hachyderm.io

              @pervognsen @lenary There must be some cursed linker out there that inspects machine code bytes to make decisions rather than purely using relocations.

              joe@f.duriansoftware.comJ This user is from outside of this forum
              joe@f.duriansoftware.comJ This user is from outside of this forum
              joe@f.duriansoftware.com
              wrote last edited by
              #7

              @zwarich @pervognsen @lenary how about a rosetta-like jit that doesn't change ISAs but just messes with the instructions executed by the host architecture

              zwarich@hachyderm.ioZ 1 Reply Last reply
              0
              • joe@f.duriansoftware.comJ joe@f.duriansoftware.com

                @zwarich @pervognsen @lenary how about a rosetta-like jit that doesn't change ISAs but just messes with the instructions executed by the host architecture

                zwarich@hachyderm.ioZ This user is from outside of this forum
                zwarich@hachyderm.ioZ This user is from outside of this forum
                zwarich@hachyderm.io
                wrote last edited by
                #8

                @joe @pervognsen @lenary This is related to my craziest idea for a technically “memory safe” language. You’re allowed to do arbitrary native code execution from unsafe memory accesses, but it kicks you into a dynamically binary translated environment with runtime checks that only lets you return to executing “normal” code if all of your modifications to memory were type-safe.

                1 Reply Last reply
                0
                • zwarich@hachyderm.ioZ zwarich@hachyderm.io

                  @pervognsen @lenary There must be some cursed linker out there that inspects machine code bytes to make decisions rather than purely using relocations.

                  lenary@types.plL This user is from outside of this forum
                  lenary@types.plL This user is from outside of this forum
                  lenary@types.pl
                  wrote last edited by
                  #9

                  @zwarich @pervognsen let me introduce you to RISC-V Linker Relaxations, which both inspect and modify machine code bytes to change the sequence to better ones (they still use relocations)

                  zwarich@hachyderm.ioZ 1 Reply Last reply
                  0
                  • lenary@types.plL lenary@types.pl

                    @zwarich @pervognsen let me introduce you to RISC-V Linker Relaxations, which both inspect and modify machine code bytes to change the sequence to better ones (they still use relocations)

                    zwarich@hachyderm.ioZ This user is from outside of this forum
                    zwarich@hachyderm.ioZ This user is from outside of this forum
                    zwarich@hachyderm.io
                    wrote last edited by
                    #10

                    @lenary @pervognsen AArch64 linkers do similar things (e.g. NOPing out parts of multibyte sequences that compress when the displacement is small). Maybe RISC-V has some more interesting variants of this, though.

                    lenary@types.plL 1 Reply Last reply
                    0
                    • pervognsen@mastodon.socialP pervognsen@mastodon.social

                      @lenary Yeah, found the comments on that in the proposed LangRef changes. It's good that this is at least getting nailed down.

                      lenary@types.plL This user is from outside of this forum
                      lenary@types.plL This user is from outside of this forum
                      lenary@types.pl
                      wrote last edited by
                      #11

                      @pervognsen I don't have data to back this up but I presume this exact inline asm string in the x86 callback was in a core header/library somewhere, called from a hot loop, and this made a specific benchmark faster on a machine that had a better core than the header presumed.

                      1 Reply Last reply
                      0
                      • zwarich@hachyderm.ioZ zwarich@hachyderm.io

                        @lenary @pervognsen AArch64 linkers do similar things (e.g. NOPing out parts of multibyte sequences that compress when the displacement is small). Maybe RISC-V has some more interesting variants of this, though.

                        lenary@types.plL This user is from outside of this forum
                        lenary@types.plL This user is from outside of this forum
                        lenary@types.pl
                        wrote last edited by
                        #12

                        @zwarich @pervognsen nop-ing is fine compared to relaxation. AArch64 doesn't have variable-width instructions, and doesn't delete instructions during relaxation (shuffling everything afterwards)

                        lenary@types.plL 1 Reply Last reply
                        0
                        • lenary@types.plL lenary@types.pl

                          @zwarich @pervognsen nop-ing is fine compared to relaxation. AArch64 doesn't have variable-width instructions, and doesn't delete instructions during relaxation (shuffling everything afterwards)

                          lenary@types.plL This user is from outside of this forum
                          lenary@types.plL This user is from outside of this forum
                          lenary@types.pl
                          wrote last edited by
                          #13

                          @zwarich @pervognsen risc-v will do things like rewrite registers in instructions, delete instructions, rewrite them with a smaller variant, etc etc etc. Now remember that alignment needs to be preserved and enjoy your headache.

                          1 Reply Last reply
                          0
                          • pervognsen@mastodon.socialP pervognsen@mastodon.social

                            The ultimate reductio ad absurdum would be if we start putting machine code bytes in inline asm blocks only for compilers to eventually start "helpfully" disassembling them to perform intrinsic substitutions.

                            siguza@infosec.spaceS This user is from outside of this forum
                            siguza@infosec.spaceS This user is from outside of this forum
                            siguza@infosec.space
                            wrote last edited by
                            #14

                            @pervognsen I was literally about to ask "what if I did .4byte ...?" 😭

                            1 Reply Last reply
                            1
                            0
                            • R relay@relay.infosec.exchange shared this topic
                            Reply
                            • Reply as topic
                            Log in to reply
                            • Oldest to Newest
                            • Newest to Oldest
                            • Most Votes


                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • World
                            • Users
                            • Groups