git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: demerphq <demerphq@gmail.com>
To: Jeff King <peff@peff.net>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Marc Stevens" <marc@marc-stevens.nl>,
	"Git Mailing List" <git@vger.kernel.org>,
	"Michael Kebe" <michael.kebe@gmail.com>
Subject: Re: Git 2.13.0 segfaults on Solaris SPARC due to DC_SHA1=YesPlease being on by default
Date: Thu, 1 Jun 2017 16:03:08 +0200	[thread overview]
Message-ID: <CANgJU+XQ4uk_OZ+bHxJ51qxAxM6Lq9yu-GNSqZ4BNiBU-8Zpqg@mail.gmail.com> (raw)
In-Reply-To: <20170515220939.vkgofpkdtpz7u26v@sigill.intra.peff.net>

On 16 May 2017 at 00:09, Jeff King <peff@peff.net> wrote:
> On Mon, May 15, 2017 at 04:13:58PM +0200, Ævar Arnfjörð Bjarmason wrote:
>
>> On Mon, May 15, 2017 at 3:58 PM, Marc Stevens <marc@marc-stevens.nl> wrote:
>> > Hi Aevar,
>> >
>> > Thank you for notifying us of this issue.
>> > Big endianness is a tricky issue, also since I don't have access or accurate knowledge about all big endian systems.
>> > Our github repo does check correct functioning, including an endianness mistake, with 'make test'.
>> > But I guess this is not included for SHA1DC in Git.
>> >
>> > Anyway, we can easily add the _BIG_ENDIAN macrotest to the git repo and will do so soon.
>> >
>> > I don't think the segfault is caused by buffer overflow, inproper access, or the endianness issue.
>> > But I did notice an unexpected issue: the message block pointer m=0x398ad5 is odd.
>> > Can you confirm whether loading an uint32_t from an odd address triggers a hardware interrupt on your platform?
>> > This is not problem for x86, but maybe for your platform it is?
>> > If it is then we should always copy buffer contents to the sha1context to avoid this issue.
>>
>> I don't have access to the box in question, Michael was testing this
>> code for me. But unaligned access is probably the cause, although
>> according to some info I found online that should give a SIGBUS not a
>> SIGSEGV, but that may have changed:
>
> Yeah, I would have expected SIGBUS there. If we have alignment issues,
> though, I'd expect that ARM systems will experience problems.
>
> Block-sha1 uses a macro which allows unaligned loads on platforms that
> support it, and otherwise does the endian conversion on the fly as we
> load the bytes into a local variable (which presumably happens all
> in-register). That may be faster than doing a mass copy of the buffer.

I agree. It is fairly normal to use that kind of macro and not do a
memcpy with hash functions.

In fact many hash functions ONLY use that kind of macro, as decent
compilers will automagically convert the macro into an unaligned load
on platforms that support fast unaligned loads.

The only reason to expose the direct unaligned load is to make sure
that the hashing code is fast on such platforms even when compiled
under -g.

Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

  reply	other threads:[~2017-06-01 14:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-15 12:49 Git 2.13.0 segfaults on Solaris SPARC due to DC_SHA1=YesPlease being on by default Ævar Arnfjörð Bjarmason
2017-05-15 13:58 ` Marc Stevens
2017-05-15 14:13   ` Ævar Arnfjörð Bjarmason
2017-05-15 22:09     ` Jeff King
2017-06-01 14:03       ` demerphq [this message]
     [not found]     ` <CAKKM46vwM9pxyMxTc4jA0z_8vGKdDGCGg9ziKkFAsqr5ULYJxA@mail.gmail.com>
     [not found]       ` <007001d2cd88$2b916180$82b42480$@marc-stevens.nl>
2017-05-16  5:43         ` Michael Kebe
2017-05-17  5:39           ` [PATCH] sha1dc: fix issues with a big endian platform Junio C Hamano
2017-05-17  6:30             ` Ævar Arnfjörð Bjarmason
2017-05-17  7:09               ` Junio C Hamano
2017-05-17 11:38                 ` [PATCH/RFC 0/3] Use sha1collisiondetection as a submodule Ævar Arnfjörð Bjarmason
2017-05-17 18:52                   ` Stefan Beller
2017-05-17 19:45                     ` Ævar Arnfjörð Bjarmason
2017-05-17 19:57                       ` Stefan Beller
2017-05-18  0:11                     ` Brandon Williams
2017-05-17 11:38                 ` [PATCH/RFC 1/3] sha1dc: update from my fork of upstream Ævar Arnfjörð Bjarmason
2017-05-17 11:38                 ` [PATCH/RFC 2/3] sha1dc: use sha1collisiondetection as a submodule Ævar Arnfjörð Bjarmason
2017-05-17 15:26             ` [PATCH] sha1dc: fix issues with a big endian platform Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANgJU+XQ4uk_OZ+bHxJ51qxAxM6Lq9yu-GNSqZ4BNiBU-8Zpqg@mail.gmail.com \
    --to=demerphq@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=marc@marc-stevens.nl \
    --cc=michael.kebe@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).