Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp662407iob; Wed, 4 May 2022 05:36:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3utKG7VReMaGuHVxR2KxkVactUZm3FsEZMapryFLsIScLkBd52R/AURhVE+enr935J9m5 X-Received: by 2002:a05:6402:268f:b0:427:d90e:86a1 with SMTP id w15-20020a056402268f00b00427d90e86a1mr10569937edd.143.1651667789017; Wed, 04 May 2022 05:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651667789; cv=none; d=google.com; s=arc-20160816; b=EdBhQJIAWguD5oSBQnDvINPgG/UEe2ULNy5RBJIxoP/+5c9a2ebnE6168tfl5sOuvZ O2gYKPDMylWILC/O6+7PpO3umeU/N/kB64qW55ttsAj5abDOIOHskSlsanICQ/sWso9R 656eZmpHvvSCYMIpIqNj0qab1888r0FZj0rfTyypQ5+AdUsDiNNRbqVY29A6pkKNPRvI bGVv3JNlKVVWEH/nR3y9HCyYXS96JdDphc8V5WVmVPBjAhKotFaIAbdfLcae8nz7lAsF vzGLFkxB56EFQzIJxcC3zTECQ+P6pydf0cqjfkE9wNJXeW66XvZen9JNxg+trnQFzWsm xPhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=7QxTQmRrU2TPE1t9O7hHsX1uS6rLbGna3bwCr6dOHKs=; b=NhdfWo1hQRqlJjk/WPHXPn3RYKy1MTmOy9P0Je9XrPWDsubOsID8SGlMS3e5YUAQgD 9c1P4DIcOgQibYxVOCSNxEx0rAowKmfL8Vzw/ELYnyGJ7U8PDPnlp9zWlZUMJru4Yeqx jz3zp6P7wzRjM6t70luoOyaVMO7olnFVRpALVS07KHQXFOeJCiqfENTF2cgKRquG2T7d 9Iyn7WA2BjI7mhtJVET8vYVDqccbMqCt8qcHxmCywoh4pjpN27QbWn+3QPArS/PWVmKy CSSfwqnRe9LvQ0+9FQwt3oWJeHiHf0tfGXkQj7BXlg/eXAbvEEykal+GX/6LoP4Y2o2Z 7McQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=LgiOdaZg; 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=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id su16-20020a17090703d000b006f384307fc0si14955889ejb.343.2022.05.04.05.35.37; Wed, 04 May 2022 05:36:29 -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=@zx2c4.com header.s=20210105 header.b=LgiOdaZg; 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=NONE dis=NONE) header.from=zx2c4.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347607AbiEDKBL (ORCPT + 99 others); Wed, 4 May 2022 06:01:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232653AbiEDKBK (ORCPT ); Wed, 4 May 2022 06:01:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9261426AFB; Wed, 4 May 2022 02:57:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3625E61A95; Wed, 4 May 2022 09:57:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F749C385A5; Wed, 4 May 2022 09:57:33 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="LgiOdaZg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1651658252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7QxTQmRrU2TPE1t9O7hHsX1uS6rLbGna3bwCr6dOHKs=; b=LgiOdaZgjat5AfzZ+JngxczZs4gg59ImR+qNyDKmwNLroONljXjLYnSgEmdveQcEw2eBOM T3mCyB6rnxs4w/diOMepTIbhU25q5no41388p6Hx6UWUNz6a8ifQ3kKTHUONn7+2u3VRIx mrfhEjCpmlNf0MfkShTqF8vlmqkMFlA= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id ebcdca06 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Wed, 4 May 2022 09:57:31 +0000 (UTC) Date: Wed, 4 May 2022 11:57:29 +0200 From: "Jason A. Donenfeld" To: Stafford Horne Cc: Mikulas Patocka , Linus Torvalds , Andy Shevchenko , device-mapper development , Linux Kernel Mailing List , Linux Crypto Mailing List , Herbert Xu , "David S. Miller" , Mike Snitzer , Mimi Zohar , Milan Broz Subject: Re: [PATCH v2] hex2bin: make the function hex_to_bin constant-time Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,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 Wed, May 04, 2022 at 11:42:27AM +0200, Jason A. Donenfeld wrote: > So more likely is that this patch just helps unmask a real issue > elsewhere -- linker, compiler, or register restoration after preemption. > I don't think there's anything to do with regards to the patch of this > thread, as it's clearly fine. The problem even goes away if I just add a nop... diff --git a/lib/hexdump.c b/lib/hexdump.c index 06833d404398..ace74f9b3d5a 100644 --- a/lib/hexdump.c +++ b/lib/hexdump.c @@ -46,6 +46,7 @@ EXPORT_SYMBOL(hex_asc_upper); int hex_to_bin(unsigned char ch) { unsigned char cu = ch & 0xdf; + __asm__("l.nop 0"); return -1 + ((ch - '0' + 1) & (unsigned)((ch - '9' - 1) & ('0' - 1 - ch)) >> 8) + ((cu - 'A' + 11) & (unsigned)((cu - 'F' - 1) & ('A' - 1 - cu)) >> 8);