Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1155184iob; Wed, 4 May 2022 16:07:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz9Csi+efxRxb6LBZDz+3r39auMtmcAE7OLUIOdfEyXWS9R67HhotCobJ9XdjVST8n+vbL X-Received: by 2002:a17:906:7315:b0:6f4:c84f:9eab with SMTP id di21-20020a170906731500b006f4c84f9eabmr4561904ejc.759.1651705647283; Wed, 04 May 2022 16:07:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651705647; cv=none; d=google.com; s=arc-20160816; b=r8g0nRpbhsnf45J4re0Kr2TiOVw6WK/SNIgX1MllTaKe3jAC5zZBShhHODikfS9Chl +xx1wnPvjc69uAeMGTLm8yBHNeuZtTJKXkHLgBc1B4w56dvepZ2JPI8nEfkCGc8gblgE 1x0XPzXVU7SBshpolDwOrZ0gFpf0TkELFQaOXeA73A+P59joC/adniGDmJoaxGzk4uKo bRL2qah2lTx5PvLCEEhNwXbS2YepBxiDqsyUXpwAvl0r+WaTuouUuCIUHPZFjvVn2/6n lt4mhckoTeUqDnxwvxutz/M0lUc9+Rpz1HHugojSqL0J04pP4/LrSTXogTk4b/QlNvH/ h66Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=PP0v6E0J74PSlvWpBHKPKv2X563T4tZp8Opf3sME7AY=; b=hMRxvNHKq7UI5ggElYgdegNkadpjc0U/xp7H6jFTEtH5A3ds2XNl70AmCQDw3zrIjj bZKhXCeCmXouhFdlIcFk2Fkw8PeiPKuXQxr2+skZZLK5ABbJ7ntTEahtAAOLdb8jlD7T 9XzCN6NJMaoKQ1FbGxw6rF9LbTB4k12tDIKW05dS2f67jd6KmXl4CPQejz8A5XC3RHys o7IhxfQftz+6fv/Dz0Viz5OA87Q8BMruj53jcTaBpZVTPyzZoTIB53iP6MnUurbk7qKV oGYsrHhKF6ufJatsGAlcilumHwFE3GoVFmJvwSbMZG3Obp9N60w5lJNYaVgvi2ze3JZ/ WYKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oxnb5SWd; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k9-20020a170906158900b006f44d992450si272472ejd.11.2022.05.04.16.06.54; Wed, 04 May 2022 16:07:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oxnb5SWd; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377780AbiEDUBl (ORCPT + 99 others); Wed, 4 May 2022 16:01:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377805AbiEDUBk (ORCPT ); Wed, 4 May 2022 16:01:40 -0400 Received: from mail-vk1-xa33.google.com (mail-vk1-xa33.google.com [IPv6:2607:f8b0:4864:20::a33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 865724EDC7; Wed, 4 May 2022 12:58:03 -0700 (PDT) Received: by mail-vk1-xa33.google.com with SMTP id e144so1114737vke.9; Wed, 04 May 2022 12:58:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=PP0v6E0J74PSlvWpBHKPKv2X563T4tZp8Opf3sME7AY=; b=oxnb5SWdx6otZKup6ob7ZQ7YzSgDp2BKAWcG96ihZJAx8xLXAGpWaAc3r9qU+/9YZc wHTVsiAw5efPwu/XvSO1x2/1aq2b27UQsZN9m4bErqnYEKZ9qkQn0P2BwcFZ95t58e9j 7/XyzLBwYoKjaEIlIs80l0zsTlj/oWVVg6cmIvAXISaK2JCV9YOFlik7mzUqJpUhNtjR r9fTWhzJDK184xF9Io+Xoc+9QJ4UGo3OZJGk58Q8/erNhxodCEDQyqQx2voyJcfb0jAi BVi+Jm1L7zMyQKDTFzrbqcovgT/kxpyas1j3tGFBX8edgYLiW0HtsmQrZGnV2wyc+N9g GeOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=PP0v6E0J74PSlvWpBHKPKv2X563T4tZp8Opf3sME7AY=; b=LUXRLm/I8RONzudQwjBgvG118TOxBpIDqbkIHiVBNvWtyL0oepLyZkjwHI9A6if9To XHgfBfnAIb9hywXUuZ/+sToivMwzPpkAVbBXnzSAnCg5BJ9kGo7uLOircRCoTH8lm2+t wbi3ApXK7ipB9oCxvrjdmsYUOe9XvGykjB/b4+QTOsTtPvFi3IJXM5lA2ub1WNo33NS2 I22vnQyP8y2T9Zwb90kcGnV6P46uyQp3roqBXMTEO4hxpeJOK74kDB6mSlM1k8ivYua5 P8qH7Xs0H+/mASiY3ILu/ZVCsxpZpuMwjDw+CFEmbHvg/mqtCcVulrlRDuljUBCFTVcx 7q7g== X-Gm-Message-State: AOAM5324Ca5lcdewW8isgK2ZrDB7uKsIzPqMVt+btX3xV7d9tbQjaS1S 6TQUC9ArzGxScJm4n4nz7yto+ubeJmTf0iTEUKw= X-Received: by 2002:ac5:c856:0:b0:34e:d0b4:7a10 with SMTP id g22-20020ac5c856000000b0034ed0b47a10mr5639395vkm.39.1651694282561; Wed, 04 May 2022 12:58:02 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Stafford Horne Date: Thu, 5 May 2022 04:57:50 +0900 Message-ID: Subject: Re: [PATCH v2] hex2bin: make the function hex_to_bin constant-time To: "Jason A. Donenfeld" Cc: Linus Torvalds , Andy Shevchenko , Mikulas Patocka , Andy Shevchenko , device-mapper development , Linux Kernel Mailing List , Linux Crypto Mailing List , Herbert Xu , "David S. Miller" , Mike Snitzer , Mimi Zohar , Milan Broz Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Thu, May 5, 2022 at 4:43 AM Jason A. Donenfeld wrote: > > Hi Linus, > > On Wed, May 4, 2022 at 8:00 PM Linus Torvalds > wrote: > > > > On Wed, May 4, 2022 at 3:15 AM Jason A. Donenfeld wro= te: > > > > > > > Alignment? Compiler bug? HW issue? > > > > > > Probably one of those, yea. Removing the instruction addresses, the o= nly > > > difference between the two compiles is: https://xn--4db.cc/Rrn8usaX/d= iff#line-440 > > > > Well, that address doesn't work for me at all. It turns into =D7=90.cc. > > > > I'd love to see the compiler problem, since I find those fascinating > > (mainly because they scare the hell out of me), but those web > > addresses you use are not working for me. > > =D7=90.cc is correct. If you can't load it, your browser or something in > your stack is broken. Choosing a non-ASCII domain like that clearly a > bad decision because people with broken stacks can't load it? Yea, > maybe. But maybe it's like the arch/alpha/ reordering of dependent > loads applied to the web... A bit of stretch. I have uploaded a diff I created here: https://gist.github.com/54334556f2907104cd12374872a0597c It shows the same output. > > It most definitely looks like an OpenRISC compiler bug - that code > > doesn't look like it does anything remotely undefined (and with the > > "unsigned char", nothing implementation-defined either). > > I'm not so certain it's in the compiler anymore, actually. The bug > exhibits itself even when that code isn't actually called. Adding nops > to unrelated code also makes the problem go away. And removing these > nops [1] makes the problem go away too. So maybe it's looking more > like a linker bug (or linker script bug) related to alignment. Or > whatever is jumping between contexts in the preemption code and > restoring registers and such is assuming certain things about code > layout that doesn't always hold. More fiddling is necessary still. Bisecting definitely came to this patch which is strange. Then reverting e5be15767e7e ("hex2bin: make the function hex_to_bin constant-time") did also fix the problem for me. But it could be any small patch that changes layout could make this go away= . I have things to try: - more close look at the produced asembly diff - newer compiler (I fixed a few bugs in gcc 12 for openrisc, and this testing came up in gcc 11) - trying on FPGA's I'll report as I find things. -Stafford