From patchwork Mon Jul 11 13:57:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589376 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3306365mab; Mon, 11 Jul 2022 07:38:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vDwMTi6B8tydEekZ5NlH8YN+Nr49ojGF71oFmlxfQlexJT2J6MayrU+c+YUYtOz/dTn0uz X-Received: by 2002:a05:620a:4507:b0:6af:348b:85fe with SMTP id t7-20020a05620a450700b006af348b85femr11813336qkp.629.1657550285103; Mon, 11 Jul 2022 07:38:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657550285; cv=none; d=google.com; s=arc-20160816; b=B4OvikfFxJB5cxvY5FhbNfM0+AYTcsDHHN8Kw6k/VyqqiOXKmIKptqNuTSeMWC/4ev T1Rfndw1RFc7amT/gKw0woYcTFNNjdf0xUANX1BqesgU/l+SPhqPiYjExZyZaasg3mwu fHT/iZD/90C3MKEpPSQtxAgScy2HIo/OoUisBvHNSzK0e9K4br1QI40dxCpSTzgFbszv rjtujk5cI5qN2Ik29rn4Y2XLD5tTXUbJvZ1Rmrj8DPLM9EPz8QqWStsJwD1s0ToZ/zAi 8+3eaeSb9nMV7k9JK7CpWIGMFdjOwyD5TgYrv9Ludad6neBlFh8DN0r5Ph7tlTdgGQyP CeYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender: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; bh=m/AOR0tE++/JatDV791mjXVdOhyKmyy8clrV8yxXoMI=; b=LASAOzLUUnqKIxDYh7wJ17QJOnVOA5wU3Yc5Fw8k9k97map12RMHMmjaw83vaVhStd urwxQqZhZHh7PNAkKYKKtUyLoQiIQ2NP6+9BS/rlRnKcoBLW77Dfm2IcfCNpPe86di+N BjWyXbrE7D/TBwSfWnaV7KpZNrNRUIScapZvmuGl2G4KBwH3xQ5WWGpbkngj8lCvp2dR ajABwc64jeFKTkCYDYr24ql4E4n1HxoeWSrwatELAGiAVS0Ap02eLosad+Ci/kRvZ9Lh B45RGS8pamQtDBE9Ira5Jw7CqgBw9UxlM4UNIghB3zrhF0l+XaAwBcTkXHGyezvhW6ju KDaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Aybkf3lu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bk42-20020a05620a1a2a00b006b593bdb677si637453qkb.728.2022.07.11.07.38.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:38:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Aybkf3lu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuY0-0003e1-Ja for patch@linaro.org; Mon, 11 Jul 2022 10:38:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43100) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oAtvj-0006hL-Pp for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:31 -0400 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:42549) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oAtvd-0002nQ-5k for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:31 -0400 Received: by mail-wr1-x434.google.com with SMTP id bu1so5948297wrb.9 for ; Mon, 11 Jul 2022 06:58:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=m/AOR0tE++/JatDV791mjXVdOhyKmyy8clrV8yxXoMI=; b=Aybkf3luW4WNSsT6/FZwKEyDSC8u7GPbuN1BxsiyFz39s39Uy4jEjJwlddwujMDSzf sD8ajcvDDhSPYP9jSktlecCKN2fXr0ZWsg+ikJCmAZQAT57oUGN53D3OxI/4a/Q4aiCk s/C0F/EZoDE4i6J08ysxBM9J8Yq0KKA8AJXr61MEcVFJ1QBVFfejhWGs0ZuG8MJw2aSj LKV+f6LF/OZ6HIl1qbHpvrYJpJGPNVlwG9a9IFlhN81fVclkYU/y/gnJ7S6nWVjV6jDV 2AKfI2wMUSs+Z8zKBQ1R8HvqH78vGc4bHtvKvVlCuYPvMod9AbTeKfrzTwWSGwXI5uIC ZMwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m/AOR0tE++/JatDV791mjXVdOhyKmyy8clrV8yxXoMI=; b=VeWv8V78wUnvVZplTx21n06Jbu2XaYkgH7btVJAUpav/jXscYgEThQMRTluePaM9m7 p1R687k7sbKoH8UPaTN9VQckUvs2aPfnXY5L8+idZ7wY7N2LZi+4xout0morBa1vVRIN gknO5va4nSk8+M8DLxaB1hen8RT5kaxv/FRn9456bojKs9ce7ThHl4ASXJpue+fiWa/z MB6shVVE5G6KLBnPXEL0NYKVEHRoST2uyyf1RjBr0B6f1tK3qriJaWeLKvMpKkez2kou lN2oc41AmaM19e2oloYiXBQxuA4fmz37022tz0wx81quPRmY6HUspfffl/K306SycA+M 6UPQ== X-Gm-Message-State: AJIora8baP7hZ/9J81DXByjnLRn+Bj4MDdTr4lu5x/gdBln9drJJQfWd SAj5RoHYzaN/ERSVbtG2Bu8dgCRKgnHt4g== X-Received: by 2002:a5d:5151:0:b0:21d:730b:c64a with SMTP id u17-20020a5d5151000000b0021d730bc64amr17337911wrt.392.1657547903092; Mon, 11 Jul 2022 06:58:23 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id q123-20020a1c4381000000b00397402ae674sm7595596wma.11.2022.07.11.06.58.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:22 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 37/45] linux-user/aarch64: Do not allow duplicate or short sve records Date: Mon, 11 Jul 2022 14:57:42 +0100 Message-Id: <20220711135750.765803-38-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220711135750.765803-1-peter.maydell@linaro.org> References: <20220711135750.765803-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson In parse_user_sigframe, the kernel rejects duplicate sve records, or records that are smaller than the header. We were silently allowing these cases to pass, dropping the record. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-38-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- linux-user/aarch64/signal.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index 8b352abb97c..8fbe98d72f2 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -318,10 +318,13 @@ static int target_restore_sigframe(CPUARMState *env, break; case TARGET_SVE_MAGIC: + if (sve || size < sizeof(struct target_sve_context)) { + goto err; + } if (cpu_isar_feature(aa64_sve, env_archcpu(env))) { vq = sve_vq(env); sve_size = QEMU_ALIGN_UP(TARGET_SVE_SIG_CONTEXT_SIZE(vq), 16); - if (!sve && size == sve_size) { + if (size == sve_size) { sve = (struct target_sve_context *)ctx; break; }