<story><title>Try to make sudo less vulnerable to Rowhammer attacks</title><url>https://github.com/sudo-project/sudo/commit/7873f8334c8d31031f8cfa83bd97ac6029309e4f</url></story><parent_chain><item><author>jareklupinski</author><text>i enjoyed this part:&lt;p&gt;&lt;pre&gt;&lt;code&gt;  #define AUTH_SUCCESS  0x52a2925 &amp;#x2F;\* 0101001010100010100100100101 *&amp;#x2F;
  #define AUTH_FAILURE  0xad5d6da &amp;#x2F;* 1010110101011101011011011010 *&amp;#x2F;
  #define AUTH_INTR  0x69d61fc8 &amp;#x2F;* 1101001110101100001111111001000 *&amp;#x2F;
  #define AUTH_ERROR  0x1629e037 &amp;#x2F;* 0010110001010011110000000110111 *&amp;#x2F;
  #define AUTH_NONINTERACTIVE 0x1fc8d3ac &amp;#x2F;* 11111110010001101001110101100 \*&amp;#x2F;
&lt;/code&gt;&lt;/pre&gt;
going to see how i can work this into a project :)</text></item></parent_chain><comment><author>lifthrasiir</author><text>I&amp;#x27;m not sure how those values are derived. Yes, the Hamming distances between them should be maximized, but the current values don&amp;#x27;t seem to be optimized for that:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    SUCC FAIL INTR  ERR NONI
       0   28   20   11   16 AUTH_SUCCESS
      28    0   12   19   14 AUTH_FAILURE
      20   12    0   31   16 AUTH_INTR
      11   19   31    0   15 AUTH_ERROR
      16   14   16   15    0 AUTH_NONINTERACTIVE
&lt;/code&gt;&lt;/pre&gt;
Sure, AUTH_SUCCESS and AUTH_FAILURE have a Hamming distance of 28, but it takes only 11 or 16 bit flips to go from AUTH_ERROR or AUTH_NONINTERACTIVE to AUTH_SUCCESS. (AUTH_ERROR can only happen from an internal error, so I believe AUTH_NONINTERACTIVE is easier to trigger.)&lt;p&gt;A quick Python search was able to find some alternatives:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    0x0f7b74c5 0x810d2b99 0x63a64616 0xcab4a865 0xbe705abb
    ...maximizes all distances (17--19)

    0x28d803a4 0x352ef6d3 0xdb61dce1 0xb3edf85c 0xe62f7508
    ...maximizes a distance from the first and others (21--22), disregarding other pairs (14--21)
&lt;/code&gt;&lt;/pre&gt;
It seems that fixing one element to be a bitwise negation of the first element is not a good search tactic in my short testing. Also as notpushkin noted, if you really want to disregard other pairs you should just make one pair with the maximal distance and derive every other code from them (say, -1 0 1 2 3 would work for this purpose).&lt;p&gt;By the way, finding a binary code with maximal Hamming distance is an open problem [1] [2].&lt;p&gt;[1] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.win.tue.nl&amp;#x2F;%7Eaeb&amp;#x2F;codes&amp;#x2F;binary-1.html&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.win.tue.nl&amp;#x2F;%7Eaeb&amp;#x2F;codes&amp;#x2F;binary-1.html&lt;/a&gt;&lt;p&gt;[2] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;math.stackexchange.com&amp;#x2F;questions&amp;#x2F;4288902&amp;#x2F;generation-of-max-hamming-distance-alphabet-24-10&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;math.stackexchange.com&amp;#x2F;questions&amp;#x2F;4288902&amp;#x2F;generation-...&lt;/a&gt;</text></comment>
<story><title>Try to make sudo less vulnerable to Rowhammer attacks</title><url>https://github.com/sudo-project/sudo/commit/7873f8334c8d31031f8cfa83bd97ac6029309e4f</url></story><parent_chain><item><author>jareklupinski</author><text>i enjoyed this part:&lt;p&gt;&lt;pre&gt;&lt;code&gt;  #define AUTH_SUCCESS  0x52a2925 &amp;#x2F;\* 0101001010100010100100100101 *&amp;#x2F;
  #define AUTH_FAILURE  0xad5d6da &amp;#x2F;* 1010110101011101011011011010 *&amp;#x2F;
  #define AUTH_INTR  0x69d61fc8 &amp;#x2F;* 1101001110101100001111111001000 *&amp;#x2F;
  #define AUTH_ERROR  0x1629e037 &amp;#x2F;* 0010110001010011110000000110111 *&amp;#x2F;
  #define AUTH_NONINTERACTIVE 0x1fc8d3ac &amp;#x2F;* 11111110010001101001110101100 \*&amp;#x2F;
&lt;/code&gt;&lt;/pre&gt;
going to see how i can work this into a project :)</text></item></parent_chain><comment><author>trebligdivad</author><text>That&amp;#x27;s the section that made me post this snippet; crazy isn&amp;#x27;t it?!</text></comment>