Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-2.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id AF47D2027C for ; Sat, 3 Jun 2017 00:13:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751170AbdFCANW (ORCPT ); Fri, 2 Jun 2017 20:13:22 -0400 Received: from mail-pg0-f44.google.com ([74.125.83.44]:34673 "EHLO mail-pg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750971AbdFCANV (ORCPT ); Fri, 2 Jun 2017 20:13:21 -0400 Received: by mail-pg0-f44.google.com with SMTP id t185so1811813pgd.1 for ; Fri, 02 Jun 2017 17:13:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=pzeG29a5LmF1Ueh9qWGDlTAS89MCkxgRpnSffiafIy8=; b=kFt4HwDpqSHsEBnZpV7qNA+jKbfaDcfa2bF3aeab85EmnO+RWCgE6EHcBb8BRLdG02 IqwpRWYLuyFMdkhre15XB+JD3FnBd4B4pLCbYylbvCMuP8o4lwn534Gcis7yVIE2sJsL hcPrs/pWjMer5eukRWaLLy8/1LiC0hIw3SEslQbxD/fy6tOkZ6FqpXzVz+5tD8mp0uW1 XGAUYhZ/o5EtZ155kQS2GXoZp+NsGUMQ0AuQtbIL8tEra/BdkS7joplk7ZxmEnv7BaWj IPQiBf0cM9/87GtKttq/DUtTGiyaX1zkyt3B/BBBZDN2LWMWjWpTN9q+DfO90cV/htVo mHIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=pzeG29a5LmF1Ueh9qWGDlTAS89MCkxgRpnSffiafIy8=; b=XXLu+NfsBAp+IA/ZaAzHrI+UOtryXQpn3RmNWyvhi+HThksXVOzmH1K2dma4ipeVRe eXSGsEW9HeEvcu4f6soz/IWbxNOfh7LWrzvHZ7paXwHRF61lqyeu3SrWiLKBrHiVeyVA MUMFI+o6IU9ufjvk93s1IWYx5qTjSVivrG9SM+zWlnQJHv3nC+kf3lUCYYeWd0/hiCBU tCfH8OzCUx/qgz0C4HTuyQOe+/TT0EFS0aHzzwvKAsXD0zQRw4xsHhUFPjNhXFC4xByF BPaZC1OA4/S5W6x5AKY0loE1cF/SfB4C2j7vB50W3v+0iK4yk+2XAyfEwLAhifB0Z/4J L/Lw== X-Gm-Message-State: AODbwcAtkbmP3cXZJ/d/Ga3MyYSPceGZvCIDASLljo9mfmyVTWKAXVyP CXgQXq2bvslzZg== X-Received: by 10.98.209.22 with SMTP id z22mr9068369pfg.95.1496448800659; Fri, 02 Jun 2017 17:13:20 -0700 (PDT) Received: from localhost ([2620:0:1000:8622:49ac:b4b9:21bb:8989]) by smtp.gmail.com with ESMTPSA id r68sm41523324pfd.91.2017.06.02.17.13.19 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 02 Jun 2017 17:13:19 -0700 (PDT) From: Junio C Hamano To: Linus Torvalds Cc: demerphq , =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Martin =?utf-8?Q?=C3=85gren?= , Andreas Schwab , Lars Schneider , Git Mailing List , Marc Stevens , "Liam R. Howlett" Subject: Re: Unaligned accesses in sha1dc References: <5100A096-EBAC-4B01-A94D-69D31093148D@gmail.com> Date: Sat, 03 Jun 2017 09:13:19 +0900 In-Reply-To: (Linus Torvalds's message of "Fri, 2 Jun 2017 14:53:59 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Linus Torvalds writes: > Dereferencing an unaligned pointer may be "undefined" in some > technical meaning, but it sure as hell isn't undefined in reality, and > compilers that willfully do stupid things should not be catered to > overly. Reality is a lot more important. Thanks for succinctly putting it this way. I think you said the above number of times, and I was looking for one of them to include a reference to in the response I was preparing, but this message made it unnecessary ;-) > And I think gcc can be tweaked to use "movbe" on x86 with the right > magic incantation (ie not just __builtin_bswap32(), but also the > switch to enable the new instructions). So having code to detect gcc > and using __builtin_bswap32() would indeed be a good thing.