News for hackers. Stuff that matters.
Re:What Spectre and Meltdown Mean for WebKit by earenndil on Tuesday January 09, 2018 @02:46AM (#16104320)
Consider something like this:

    struct __internal_variable {
        uint64_t type;
        void *data;
    }
    
    uint64_t __last_type = [number of builtin types];
    
    whenever you create a new type: increment __last_type and associate that type with the number;

    uint64_t typeof(__internal_variable var) {
        return var.type;
    }
    
    function[__last_type] typechecks;
    functions[] = void function(uint64_t type) { failure; }
    functions[int] = void function(uint64_t type) { success; }

    functions[typeof(myvar)]()
If typeof(myvar) is int, then the function that returns success will be called, otherwise failure, no branches involved! Yes, it's a kludge, but it kind of works.

---

Of course, you don't actually need this trick. If you put enough effort into it, you can essentially compile anything to c, after which you can just compile it with the movfuscator[1]

1: https://github.com/xoreaxeaxeax/movfuscator

Re:What Spectre and Meltdown Mean for WebKit by gpderetta on Tuesday January 09, 2018 @03:52AM (#16104590)
That's basically a jump table. Still vulnerable to spectre (variant 2) without mitigations, btw.
Re:What Spectre and Meltdown Mean for WebKit by fpoling on Tuesday January 09, 2018 @04:21AM (#16104720)
It is even worse then switch/match statements. The jump tables can be used to train CPU to jump to a wide variety of addresses than switch/match statements so mounting a speculative execution attack is simpler.
Re:What Spectre and Meltdown Mean for WebKit by gpderetta on Tuesday January 09, 2018 @04:26AM (#16104742)
true. Then again switch statements (and I assume match statements in language that have them) are often compiled down to a jump table...