delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2026/02/26/05:51:51

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 61QApoPp1038463
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 61QApoPp1038463
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=PqTwXwWr
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DD12E4BAD14A
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1772103109;
bh=VkpSofDZ00DO2S99AXSjXR4ciDbXgXa9lXIpqWYcLZU=;
h=Subject:In-Reply-To:Date:References:To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
From;
b=PqTwXwWrDGm/sTvDtLAWvf81Ukul/zy5aHH+x/Ub4bLkddk6+/7egrWvGnht9aG/1
iLCBoyw5DCFkW6WQEmjQ6349e4tN4ShFt+6VcBzhdVh6GLyVyvyRVI65DuDH4jg5YK
R2erny31FLrGBloM8GxqcRRcYQVGpBlBibRtT0+8=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3ADF54BA23E8
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3ADF54BA23E8
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772103028; cv=none;
b=vbJubtxKeEUzKXJ9S/niiUery/lrYHF7kco98ZoHih+AGf6UIOMhbZTBDbu1z2vdEUY7w6LMdoY7lq0NgbOBLqPb+kmGUVICgGiRO9+U2nD0ldApMkj6S7kovaZYpW5sC+yCfyISW/Gfq8V+nluMmd+fD8hK5Usvjh7dMKy75MA=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1772103028; c=relaxed/simple;
bh=6mG3RzzBPdjrTAL8C12we+ykzsOCmVycI65sGsLTcng=;
h=DKIM-Signature:Mime-Version:Subject:From:Date:Message-Id:To;
b=V0/MCnuwbZXdPCv1HJDwJvQoeK94RzIqe9PIJWjMJsbfL1YqjzLqApBJdSj9BwU9pi84J6bTr+wP9YF3Tyued9ATHV+DZyW6yo7ho5Xvf7QWwlvhhq3vMjD0BzQp4URJ6ewwpc3PeE+PldUDRtFhv7qCkFZPw6WSVYjLpdDEIh4=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3ADF54BA23E8
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1772103027; x=1772707827;
h=to:references:message-id:content-transfer-encoding:cc:date
:in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=Bb9O+aizlVZgCM1YG71SqbwcIPkaCZvClciuSZ3kfoY=;
b=hxwjttmUjYuZuTxs6glUv9pEz2WiavUwBRjgRubye7AkIGRzDDysLY99ZZVBZ/qJap
X4ZmPZeMedxzMinlPKj2ECpzxbbtATFVYi2dvKGbYa7dBX2CyCZ6MeP/rc8YCTEzsHbR
ZrnZ34he8LNx8GGG4iGSvVIl5dMtFWNDS2D2IcyT5kYsX5iFoR2Rt0V8CHJKekK8WHQg
j2q7rYIKUPI1Ve2Y8S3UBdSq6E7gT0gFG+Bh3sZsQRghuI8JaV17iDNQzJjo4MmAV2Ri
HxnUqCXtVNVtcsiPdPwGQEZZZNmGff2M2vhE+hN8XMwL7hGtovUhqW8sUJYHNTHQlRhI
bmRg==
X-Forwarded-Encrypted: i=1;
AJvYcCVEMj0vvpEwDMA+pDTF7Bu6bMqblLEYzyHER76NlA4XDDyQuYm1qF17BGf4fFLBNxQwu+rnNZU=@cygwin.com
X-Gm-Message-State: AOJu0YwwQb0Wqcv7Uaor4BYvc3zvsPwUrdZPsZc2hD5prn8VAEUqLilm
dQU5gw1lQU5mvVJ/V1/b6umk0a/jfJ+mm576/kRqNnu7p4DXUlLkA5d6pPlOzv7H2XI=
X-Gm-Gg: ATEYQzzXyc67t8PcQSFmdeaK6i9yh6fzumFgtuc/NPaAtR1hGNBuOEaJ3lTwMIE3OHU
o8XqWjwZqiBJ6jrSoyYxUMSY14h30pKq/e/tkV9ovRWwdeQL2O1ARgE9ZZDJlkQH1wJqZ4gdnsE
FqtFGmffv6kQOCZk7hT/ps7r4gzJo6+xzQpBZAGZVLr7Q+v0qmRUR42eUFEjIUvfGBeEeHDyngs
XFu2szshic8lsYTVXqtkEA1quxZSBkIq9qLz/Zk1igqyJqwvsaKxsCGUn8l5Fpf4OduJIS+b1ML
BtxBt9qHU03PdJWhCaxSbVHX/ndG+nKYLGXT6KIYpzB3yicgJfkeC6FCwkV6CRNcuWWIio+aMWs
rARFQVUuDuui7o/l1Lcmw7nOcvaxbJPdRUvL/43wR7QUGBLMQ3AFeapWKqAK0MBf5IMogtdDvS0
lOOpUYxnQNwTeGYzufkaxM2Z+mn8D8QWg2hX9xXjOYqXUSpIUbtRQ0vnbtHiTlrpWXNQ==
X-Received: by 2002:a17:907:7251:b0:b93:657e:ac52 with SMTP id
a640c23a62f3a-b93657eadcamr41976666b.54.1772103027019;
Thu, 26 Feb 2026 02:50:27 -0800 (PST)
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81.1.4\))
Subject: Re: Memmove causing program crashes, giving SIGTRAP in GDB(?)
X-Priority: 3
In-Reply-To: <1901597260.1508573.1772100378936@connect.xfinity.com>
Date: Thu, 26 Feb 2026 11:50:26 +0100
Message-Id: <0C965DD0-856E-41FF-B5A4-15E472292A32@unified-streaming.com>
References: <547312365 DOT 1464244 DOT 1771958282029 AT connect DOT xfinity DOT com>
<aZ7PrbisVR1R4A7v AT dimstar DOT local DOT net>
<1670201592 DOT 1489273 DOT 1772043520008 AT connect DOT xfinity DOT com>
<e91d8b5b-2690-4271-aa74-e6226440e33d AT SystematicSW DOT ab DOT ca>
<1044918836 DOT 1507810 DOT 1772086967212 AT connect DOT xfinity DOT com>
<1579472684 DOT 1508349 DOT 1772092747339 AT connect DOT xfinity DOT com>
<aaABFf5iEowV1l7I AT xps13> <1148572549 DOT 1808180 DOT 1772097444036 AT mail DOT yahoo DOT com>
<1901597260 DOT 1508573 DOT 1772100378936 AT connect DOT xfinity DOT com>
To: KENNON J CONRAD <kennonconrad AT comcast DOT net>
X-Mailer: Apple Mail (2.3826.700.81.1.4)
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Dimitry Andric via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Dimitry Andric <dimitry AT unified-streaming DOT com>
Cc: KENNON J CONRAD via Cygwin <cygwin AT cygwin DOT com>
Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>

Most memcpy/memmove implementations consist of an initial part that copies/moves any number of leading unaligned bytes, if necessary, followed by a main loop that copies/movies the bulk as words (32 or 64 bit depending on the architecture), and finally a part that copies/moves any number of tailing unaligned bytes.

The implementation you showed in assembly does just that. The main loop will use instructions that are supposed to only be used on aligned memory, but since the leader and trailer are handled separately, you should never run into an alignment exception at that point. My guess is that there is some sort of buffer overrun instead. If the overrun stays within a memory page, you won't notice it, but unrelated data will have been clobbered. However, if the overrun goes over a page boundary, you will get a page fault.

-Dimitry

> On 26 Feb 2026, at 11:06, KENNON J CONRAD via Cygwin <cygwin AT cygwin DOT com> wrote:
> 
> Yes, movsq requires addess alignment.  Memmove however is not supposed to require alignment as it should work for chars, ints, etc.  It should handle alignment requirements before calling movsq.  That is something I want to verify.
> 
>> On 02/26/2026 1:17 AM PST matthew patton <pattonme AT yahoo DOT com> wrote:
>> 
>> 
>> On Wed, Feb 25, 2026 at 11:59:07PM -0800, KENNON J CONRAD via Cygwin wrote:
>>> Okay, so now I learned about setting the frame and disassemble and see the memmove code:
>>> 
>>> Dump of assembler code for function memmove:
>> [snip]
>>> => 0x00007ff96ba812a9 <+137>:    rep movsq %ds:(%rsi),%es:(%rdi)
>> [snip]
>>> End of assembler dump.
>> 
>> movsq requires address alignment of 8 bytes.
>> What are the pointer addresses of the arguments to memmove()?
>> A SIGTRAP may result if the addresses are not 8-byte aligned.
>> 
>> 
>> 767 * 2 / 8 and 2633 * 2 / 8 would seem to violate that rule.
> 
> -- 
> Problem reports:      https://cygwin.com/problems.html
> FAQ:                  https://cygwin.com/faq/
> Documentation:        https://cygwin.com/docs.html
> Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019