From patchwork Fri Nov 3 12:24:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 740660 Delivered-To: patch@linaro.org Received: by 2002:a5d:538f:0:b0:32d:baff:b0ca with SMTP id d15csp1335250wrv; Fri, 3 Nov 2023 05:25:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE/dX+4lGEJz8rRErRdh0YAWtHplso+rCMZXHGtn+3BwcdJqOEpWWYfTFRtLdChDXJy8eB9 X-Received: by 2002:a05:6870:12d0:b0:1e9:b599:1aab with SMTP id 16-20020a05687012d000b001e9b5991aabmr20671511oam.58.1699014313531; Fri, 03 Nov 2023 05:25:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1699014313; cv=pass; d=google.com; s=arc-20160816; b=G/VmQBVA/XijT98OAcMGWRRww/Cc3yc+i2VFb4Fa5i6GBCFYpZXDH2+hxMbh5ciL9p aYjvwmi2oY76NRWE+M9uGGfjJ/XHqZVbMTMLYtzuX5iF3Y4haGsCXVyKdEFZ90H4/V2A 1jJD0jGroT43Xw6WmVcW00KdvMi3t7SH0fqE2uG9Jr+AXxFv2ubAbGPsGk58/Jkxbfnu yBaTgePQbN5Fzv4Wipzn7Z2FbMtGwHhhyAGVNPygvmwgQC/1xXSSUTb7nokONziN7i0N qU7uIJPlC857Rvj7yeAovF+mL4gLj8+zbKz4r2rD/nhaIP9hTLnnbW/dHv5Utn0Xovjs vgog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=6jWpJtYgU4AupWiGBpR3CkeP70iQINh300sZdk4guoA=; fh=01HD8dtuIqmy9rV/eMJuvD8dAGq4TXBqBjIxWaMzNQI=; b=HdSz9T8ktuiYpylTW0LGi9wiXIPSNoshRMHpY/YPRvrVVvLusBe/ab4poks/DbAUQU JcKq7aOXCo58vzblKCG5+xlJn2p/ywRWnvXmLjQRNG6WRhZ947vacET62fr8gf/wcv5X g90VtliRYJAr7mXYA1ZVzDewbjuGMSbpE5yAhCn4Jg2Bj6rxKzumEBHuTOUHKzuQBACk YtN2pyQmgqT4AIHMsDSWK4+OXvvb2gX9p5A7ZuwP75Y5ntGcaGRMWiiGBehf7m3xc7Mo uXTdlhCG78VyXGhI5+Z5qEgXADnSHfA7CtrnO7/Vs3jDxfH8Bkx72frfGHbhC208PHnI iAtA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Doipox+/"; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id z5-20020a05622a028500b0041979aaf3ecsi1394222qtw.663.2023.11.03.05.25.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 05:25:13 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Doipox+/"; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 94BFB3858438 for ; Fri, 3 Nov 2023 12:25:07 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by sourceware.org (Postfix) with ESMTPS id C6FF0385842E for ; Fri, 3 Nov 2023 12:24:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C6FF0385842E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C6FF0385842E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::731 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699014285; cv=none; b=iC9S42eAOC/NN4G7MTgat+hF7kLl24g1kDCjMI+p+dc/wFyoiWEXM3kB6azWZ/bBLzpFXkdTXdblpebhsQfAZGccDilDXV/JQtRGTx4MtoK473kaXYQfULO8bJUvWnWhgXoRsG777swbQXtDVuCoYh0duSXmyApj2Lz1mqcQfw8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699014285; c=relaxed/simple; bh=X2wiZ3laELaKsR0jgcmuy/E0a1j+Y6CXbQpJCpc45wA=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=nMTia3kMHu3OuU/+96827WCwJUUKMFi/IxFJwIUifz+x0W322HmYj3XlbtXSBnwvopzQi2uLW466v03uyc/zwXc7TXK45ALDvX5/5YtdrESbgS6Rq1r9clwHWInY56uwXGflKcp0BGxeQz5b6YdUCOQzik2xf08XQ6MPgFwdgbw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-qk1-x731.google.com with SMTP id af79cd13be357-77a453eb01cso115134585a.0 for ; Fri, 03 Nov 2023 05:24:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699014275; x=1699619075; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=6jWpJtYgU4AupWiGBpR3CkeP70iQINh300sZdk4guoA=; b=Doipox+/yoOv8wHW4S6MqWwfe62yt+cLtJZTB8BeJ381LbwaJCJOyTZeXlXgeEcOoh ij7gN6bw4+vcoD9r8NfQ9+gfTbntsfM2yMB2Jot2pXnOYYGCYsUjN33vdXyk0vit2GFd YWPLZKPm51H/04s/qF3aCZd5Jwzu89Fb6/U+QfzSbqY5yHgpJJaJTE/S9osFcSr5guRm 5H8vCU58WkZyDG7nEFW7SgxAez+LN4iKnEGYVYRCD2+cnXLCPDfSfJxj1gwRXsHD4u/U Pqzra2rL1Ih9eZsdwcxpGydaJ5Azuqpi9UeSGLZUxj/oYWp/MPlQj8q8OK691ngZ30Re Q7zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699014275; x=1699619075; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6jWpJtYgU4AupWiGBpR3CkeP70iQINh300sZdk4guoA=; b=K69DBUqd7vUzrNasfll0qpoyFEGreqIxqnVcmMnSvdkBH/7+Ki5HPqpnCIxwh9u4oV jRGY+iBSnQDdwF6jFGOtdY+clQRAuQPiSxSUr+fQ+O146fVOJoSfUtsrW3bZacndn6c2 Hkxdumi4cqTPPoaoC0k/0JhO8upiSbJ/3Xdqo7ozXSTqv5YkaUotwk0ocUI50kzfzbKF FAm1POY7i1Ghis2oKk/0bxxS50EaDtgCpSuGOnkOH6xlmppDfdI7BuofWpslQr9a8X7Z v+aqgo1jio8OxbZmhdMNVwzb21BySMZkk/xBQQ+EWQiRIMW+KX+qeiB2ZHo8sgmYuI7e 87wQ== X-Gm-Message-State: AOJu0YwenkOoZBV/v170RgqNgqwo1Z6uEltNSkVC4SWN+bWnXksBz3mi dwfzJFWTXTKJTmmkZmKM+TxwZ4ztFt2cVKNNKPGkiA== X-Received: by 2002:a05:620a:2a01:b0:778:8b8a:37e with SMTP id o1-20020a05620a2a0100b007788b8a037emr25457419qkp.21.1699014275434; Fri, 03 Nov 2023 05:24:35 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c0:a715:dd81:f992:f726:338a]) by smtp.gmail.com with ESMTPSA id e15-20020a05620a12cf00b0076eee688a95sm693833qkl.0.2023.11.03.05.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 05:24:34 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org, Bruno Haible Subject: [PATCH 7/7] hppa: Fix undefined behaviour in feclearexcept (BZ 30983) Date: Fri, 3 Nov 2023 09:24:16 -0300 Message-Id: <20231103122416.2724355-8-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231103122416.2724355-1-adhemerval.zanella@linaro.org> References: <20231103122416.2724355-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org From: Bruno Haible The expression (excepts & FE_ALL_EXCEPT) << 27 produces a signed integer overflow when 'excepts' is specified as FE_INVALID (= 0x10), because - excepts is of type 'int', - FE_ALL_EXCEPT is of type 'int', - thus (excepts & FE_ALL_EXCEPT) is (int) 0x10, - 'int' is 32 bits wide. The patched code produces the same instruction sequence as previosuly. --- sysdeps/hppa/fpu/fclrexcpt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sysdeps/hppa/fpu/fclrexcpt.c b/sysdeps/hppa/fpu/fclrexcpt.c index 055fb04ccc..46caf39ec1 100644 --- a/sysdeps/hppa/fpu/fclrexcpt.c +++ b/sysdeps/hppa/fpu/fclrexcpt.c @@ -26,7 +26,7 @@ feclearexcept (int excepts) /* Get the current status word. */ __asm__ ("fstd %%fr0,0(%1)" : "=m" (s.l) : "r" (&s.l) : "%r0"); /* Clear all the relevant bits. */ - s.sw[0] &= ~((excepts & FE_ALL_EXCEPT) << 27); + s.sw[0] &= ~(((unsigned int) excepts & FE_ALL_EXCEPT) << 27); __asm__ ("fldd 0(%0),%%fr0" : : "r" (&s.l), "m" (s.l) : "%r0"); /* Success. */