From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x112b.google.com (mail-yw1-x112b.google.com [IPv6:2607:f8b0:4864:20::112b]) by sourceware.org (Postfix) with ESMTPS id D0726382EF23 for ; Tue, 18 Jun 2024 20:23:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D0726382EF23 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D0726382EF23 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::112b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718742227; cv=none; b=wpSdhweZ/JneMXkcq2tuBkMy6Sm0TuuCM+0+ia0ugg3kTL110B4pznLaBIbZzkN+qGcd9Xtb5KexATpMF+pdKdc10w3/Qwt3XYlezyTMGC9Z/VoMSly7FCZ0X32BjCkGk33b2hCZBBoLvdhexGeq9O/xLSdreaykDcUgNwHFInI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718742227; c=relaxed/simple; bh=EC7eGTA56/lUXkkoTvConXxcizCnU6Yw8xonPUo2ZbI=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=Swh8yDWtwoTBN7vRM72AmyejdB/0lIsRQ4tn14N2Rw2zR5IFjRxUBsM/unqiHrx1KODYVDqNAG1QVuuYxNbraq740L54MSU6QJHiRtlZ5x0zEwXcv9ZmnnqOeUMo/AyseNNnkXDGac21ZEu3aSriGLVUUJ0iK99da8Mm1+jKFKg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yw1-x112b.google.com with SMTP id 00721157ae682-62fe76c0a61so1991547b3.0 for ; Tue, 18 Jun 2024 13:23:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718742224; x=1719347024; darn=sourceware.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Lg9JzTTFYWj0isYO0lNv3dsNiEt/tYUIUQx4cC16vgo=; b=EDMNF4JVt8aa8xXrOt5DlISX6li0byXkfqhhvRpvlpE5TCayvuqJrly1ouzU/nUqao CD/+bt/53sxNf28GBWNYO3o7maEO6pN0+6ynUw+mabPRRxvq7YjcqyIFZYEYVZEaEWlJ PT0lk+GYUlfH0HVdw920U01HQwZEuWN6jTNsbnU+AVUtkMlai+gGJ3s00kucH6cBwAyr New4eDBqSFPb1d0BWQx+kFY5pXFWqEAZ+45R7x9Td9+YiNsZ8wkLhHe8T4/LMRaO/xsl TtKY7wPPN9QoTzagutl8+CuXQxUqLmXgLyQjFSpvwYtvVPAfW5t+dYERcC7X616S+fS/ NgJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718742224; x=1719347024; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Lg9JzTTFYWj0isYO0lNv3dsNiEt/tYUIUQx4cC16vgo=; b=d51fB89J04JWruLMDY6B3z5R9Q6KLh+Ly4jGNNs6CsOShEfBfTTjcRZ0bCTHovz53w D/QtrrjZzY6EDFtuBbNKBK2njemUFkVmGX3H868ekO342dfUZtM14Cd4MHGSmhTAWySs pmmY8ypg+Sj/ksNliyeSSPTScp8C2yPAXmaAndglWu9fHgS02qL4HIXLAQizSieDtLV1 BcA1HP/XKBdvVpXULPGbq0JO3i6UgEf+mjTk75hYYfda9+W+9h5Gq3DzrUy3cj3syKeg /QaE5zN6rj5RSwur6F1/KC3ICoPXlwkPQoejsaOqhFvAJjBQrGNJjC7jf32fatKHuZmA Q0fw== X-Forwarded-Encrypted: i=1; AJvYcCVSnQhO/e2hpyO/lyhhNtzHHA/pj0FXc1UZ2QLW9ng2jWrgnvadGdEyns/VhJOb6cGMiKFNBEb7JeSFK0RrdG0ytFy11JLFdew= X-Gm-Message-State: AOJu0YzL+wN53JKfBeWXc9Lhe1GwkrERZrINwQRmHNxpaj4aAba9LWVW XzQN84cl27GT+VC+mfc9YeiiOpQ8QidLMHhpnHEjF8EVZP+1O9fyL47obu8T1aSXWc1tOKi0DAT ck0rd7OH84LXawP430TmC+pMpCfDnGpi/RyZMsA== X-Google-Smtp-Source: AGHT+IHtEcRnkMqlcUy3qrB+y22qc6l+865MH5L18ey2MjclkoqsdooDHW29tobp3NyTY6N0grRJ9cuL0AJ6N8JBjkk= X-Received: by 2002:a81:9e07:0:b0:61b:3305:8c54 with SMTP id 00721157ae682-63a884a9940mr8735377b3.15.1718742223135; Tue, 18 Jun 2024 13:23:43 -0700 (PDT) MIME-Version: 1.0 References: <4ec319f4-9cfa-47f5-bb9c-de121f698840@davidnewall.com> In-Reply-To: From: "H.J. Lu" Date: Wed, 19 Jun 2024 04:23:31 +0800 Message-ID: Subject: Re: strlen-avx2.S To: Adhemerval Zanella Netto Cc: David Newall , Libc-help , Noah Goldstein Content-Type: multipart/alternative; boundary="000000000000aba9e2061b2fdb61" X-Spam-Status: No, score=-3012.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,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 server2.sourceware.org List-Id: --000000000000aba9e2061b2fdb61 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable vpxor xmm will clear all upper bits in the register. On Wed, Jun 19, 2024, 2:39=E2=80=AFAM Adhemerval Zanella Netto < adhemerval.zanella@linaro.org> wrote: > > > On 18/06/24 02:33, David Newall wrote: > > Hi All, > > > > I recently upgraded my PC to one with Intel i9-14900HX, and installed > Ubuntu22.04. Since then, remmina (as RDP client) has been periodically > crashing. I've tracked it down to a debug statement, which uses the resu= lt > of strlen(): > > > > REMMINA_PLUGIN_DEBUG("gp=3D%p returning %zu bytes of text in clipboard = to > requesting application", gp, strlen(clipboard->srv_data)); > > > > REMMINA_PLUGIN_DEBUG is defined as: > > > > remmina_plugin_service->_remmina_debug(__func__, fmt, ##__VA_ARGS__) > > > > The core file shows SIGSEG at __strlen_avx2 () at > ../sysdeps/x86_64/multiarch/strlen-avx2.S:74, called from > remmina_rdp_cliprdr_request_data(), so the direct call of strlen (i.e. not > called from _remmina_debug). > > > > Clipboard has a reasonable value as does srv_data, which is a generic > pointer. Cast to char*, gdb shows the first value as '\0', so strlen() > should be 0. > > > > Libc6 is glibc-2.35 (with Canonical's patches), but > sysdeps/x86_64/multiarch/strlen-avx2.S (as strlen) is unchanged up to 2.3= 9. > > > > Disassembling _strlen_avx2 shows this: > > > > Dump of assembler code for function __strlen_avx2: > > 0x0000758b5c19d7e0 <+0>: endbr64 > > 0x0000758b5c19d7e4 <+4>: mov %edi,%eax > > 0x0000758b5c19d7e6 <+6>: mov %rdi,%rdx > > 0x0000758b5c19d7e9 <+9>: vpxor %xmm0,%xmm0,%xmm0 > > 0x0000758b5c19d7ed <+13>: and $0xfff,%eax > > 0x0000758b5c19d7f2 <+18>: cmp $0xfe0,%eax > > 0x0000758b5c19d7f7 <+23>: ja 0x758b5c19d930 <__strlen_avx2+33= 6> > > =3D> 0x0000758b5c19d7fd <+29>: vpcmpeqb (%rdi),%ymm0,%ymm1 > > 0x0000758b5c19d801 <+33>: vpmovmskb %ymm1,%eax > > 0x0000758b5c19d805 <+37>: test %eax,%eax > > 0x0000758b5c19d807 <+39>: je 0x758b5c19d860 <__strlen_avx2+12= 8> > > 0x0000758b5c19d809 <+41>: tzcnt %eax,%eax > > 0x0000758b5c19d80d <+45>: vzeroupper > > 0x0000758b5c19d810 <+48>: ret > > > > I'm focusing on the instruction causing SIGSEG (marked with "=3D>"): > > > > Do I understand it properly, as comparing memory addressed by RDI with > YMM0, saving the result in YMM1? > > > > YMM0 is 0. I see where the lower 128-bits were zeroed (by zeroing > XMM0), but not the upper 128-bits. What clears them? > > > > RDI is 0. Is this expected? Am I right that this is why I'm getting > SIGSEG? > > Hi David, > > Could you check which is the function argument contents, including the > memory > dump of the input pointer? It helps narrow down if it is a possible issue > with > the routine or with the caller. > > PS: I cced the x86 maintainers. > --000000000000aba9e2061b2fdb61--