From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-xe2d.google.com (mail-vs1-xe2d.google.com [IPv6:2607:f8b0:4864:20::e2d]) by sourceware.org (Postfix) with ESMTPS id 6EBBC3858C2C; Fri, 29 Apr 2022 22:06:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6EBBC3858C2C Received: by mail-vs1-xe2d.google.com with SMTP id a127so8834721vsa.3; Fri, 29 Apr 2022 15:06:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FAo/BHRhC19Om5OrXHAXPtoYuKf9qDPWO9RczyH283g=; b=HfXdIMt0iQ8mJMXcvq7qItTgNir0/j6IGnbdlRipr3lNiIff3jrnazv8N7kFZFQ7HJ +UqHpO7oMpfTZwwyFJMFwvH7pQ9l2b6cuSEnH/PGoMdzviFcZ19X8JuUc4Ux9+O07y4W 38M1svnJRlXho4TTCucnE6vsAnQh45lwMzYD+8vGEvdIkRe6W1fcEVEuMa/RbEO0Y5/N MlJNlx7Cbr8tbAc+oZh/Mldwtt0Lu6xommGMF29RAsSeNAZDsH2PX2Z8PbXlA4UBZXZv wMLjvCTVL24Ofq4HW5RTQ0QHEZDuQ4c0OltsO9N3gY5QS5wXDm/FS2pREd4lysQhbds/ NR0w== X-Gm-Message-State: AOAM531Q+Ut8VLfxmUzjA77sPsMqVVOd+0fpzXiZLHltcprodfVE9nq5 994LH3sXm9ISGNGl2I+6QXKJ2j2It35M9aYpi7JE5VI6Q4o= X-Google-Smtp-Source: ABdhPJzEfXnqI4TxYqjS8LHQpfuKh7WkAr98vmvJOzDd9gL+6wynmxQKXdrbFofs1hNhvca8gteSLGy5EJyqWfRwEv0= X-Received: by 2002:a05:6102:3f0f:b0:32a:46dd:a908 with SMTP id k15-20020a0561023f0f00b0032a46dda908mr476932vsv.48.1651269989694; Fri, 29 Apr 2022 15:06:29 -0700 (PDT) MIME-Version: 1.0 References: <20220109122946.2754917-1-goldstein.w.n@gmail.com> <20220110213540.1258344-1-goldstein.w.n@gmail.com> <20220110213540.1258344-2-goldstein.w.n@gmail.com> In-Reply-To: From: Sunil Pandey Date: Fri, 29 Apr 2022 15:05:53 -0700 Message-ID: Subject: Re: [PATCH v3 2/7] x86: Fix __wcsncmp_evex in strcmp-evex.S [BZ# 28755] To: "H.J. Lu" Cc: Noah Goldstein , GNU C Library , Libc-stable Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, HK_RANDOM_ENVFROM, HK_RANDOM_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-stable@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-stable mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2022 22:06:32 -0000 On Wed, Jan 26, 2022 at 2:06 PM H.J. Lu via Libc-alpha wrote: > > On Mon, Jan 10, 2022 at 6:15 PM H.J. Lu wrote: > > > > On Mon, Jan 10, 2022 at 1:36 PM Noah Goldstein via Libc-alpha > > wrote: > > > > > > Fixes [BZ# 28755] for wcsncmp by redirecting length >= 2^56 to > > > __wcscmp_evex. For x86_64 this covers the entire address range so any > > > length larger could not possibly be used to bound `s1` or `s2`. > > > > > > test-strcmp, test-strncmp, test-wcscmp, and test-wcsncmp all pass. > > > > > > Signed-off-by: Noah Goldstein > > > --- > > > sysdeps/x86_64/multiarch/strcmp-evex.S | 10 ++++++++++ > > > 1 file changed, 10 insertions(+) > > > > > > diff --git a/sysdeps/x86_64/multiarch/strcmp-evex.S b/sysdeps/x86_64/multiarch/strcmp-evex.S > > > index 1d971f3889..0cd939d5af 100644 > > > --- a/sysdeps/x86_64/multiarch/strcmp-evex.S > > > +++ b/sysdeps/x86_64/multiarch/strcmp-evex.S > > > @@ -104,6 +104,16 @@ ENTRY (STRCMP) > > > je L(char0) > > > jb L(zero) > > > # ifdef USE_AS_WCSCMP > > > +# ifndef __ILP32__ > > > + movq %rdx, %rcx > > > + /* Check if length could overflow when multiplied by > > > + sizeof(wchar_t). Checking top 8 bits will cover all potential > > > + overflow cases as well as redirect cases where its impossible to > > > + length to bound a valid memory region. In these cases just use > > > + 'wcscmp'. */ > > > + shrq $56, %rcx > > > + jnz __wcscmp_evex > > > +# endif > > > /* Convert units: from wide to byte char. */ > > > shl $2, %RDX_LP > > > # endif > > > -- > > > 2.25.1 > > > > > > > LGTM. > > > > Reviewed-by: H.J. Lu > > > > Thanks. > > > > -- > > H.J. > > I am backporting this to 2.34 branch. > > -- > H.J. I would like to backport this patch to release branches. Any comments or objections? --Sunil