From patchwork Thu Jun 2 21:48:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 578176 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp976908max; Thu, 2 Jun 2022 15:49:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRLbU/aeNcaDVu7M1HGjmSF91sfR8uHbAVsPuW8+OgAhuMb5MKYibDsDIaYMG2s78B0V0N X-Received: by 2002:a05:622a:148e:b0:304:d543:ffd3 with SMTP id t14-20020a05622a148e00b00304d543ffd3mr3245684qtx.64.1654210188517; Thu, 02 Jun 2022 15:49:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654210188; cv=none; d=google.com; s=arc-20160816; b=mYHK6+DD/uRIUoDnWY6eSbp41EdgY4eSvjq6pHl76tBeuNX02yPJxRQKUD9o2AYOWJ Cd9zyrVODTnZHGwkYbDcUsHRsEETJqAytRX4VCxmZC0zFjTEBrfIaCH+kSbjTvTWV4tx U6fs8iQlOisjQGqzsqfjJ9LP3SgPIdA6FWBIfCZtwxn2tdCj2UKsFBRnfybAlv/KD3Bs 5TEQ5VA8sigamjFuOSz9cvyriHrv1ZP3hTkmAPs3PKv9CgmYbDqJq8jQiWGtuipnKknS QMZn6z3NiNaS88Fts0nf+MbW/Cj1UbYc9Wd6dp2xw/xx2ol+BxHOUpZXAPrNmRYaUDDx r8yg== 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:cc:to :from:dkim-signature; bh=aHd4rex5KLokg6+1+Y3fFNXszj9You6Kl613kNttCcU=; b=dJsUu3JYuI4nLdKrX80BOMwNWeZSuFxuOgsEhsE9YfyaUmoUNjvsefiiDIj/lk/wqa UvuHSrDael5IW3lu0vzuzZnGZ/am2NJlH5ALjDsX76iRPC8FNYzUoQxHQAx8uhgSFulh cVrmyDtgGiMn55qaRV5QZiXb8rFSkDPsBLgXn4dftJFbxpg6pIqgaawPSQXrSkiV534Y 8ff//k/3rNG/kCyRU9zAi0z+PvXYlwZFIHZyIUKiTpCPJXZDKdWdsAQF4BOj/7OEuorC 6RVdYjzz6tr1YkNirCnYX4mxF/vjJmcXrjnM+LmJNPqsCg3Sq+1IUJbdArxXf644V2c8 nJ7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jFrq7X3n; 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 ey20-20020a05622a4c1400b002feb26af429si2621304qtb.565.2022.06.02.15.49.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 02 Jun 2022 15:49:48 -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=jFrq7X3n; 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]:51854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nwtdU-00057T-4O for patch@linaro.org; Thu, 02 Jun 2022 18:49:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38842) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nwskQ-0001ii-49 for qemu-devel@nongnu.org; Thu, 02 Jun 2022 17:52:59 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:46793) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nwskM-0000vY-EN for qemu-devel@nongnu.org; Thu, 02 Jun 2022 17:52:53 -0400 Received: by mail-pj1-x102a.google.com with SMTP id v5-20020a17090a7c0500b001df84fa82f8so5860855pjf.5 for ; Thu, 02 Jun 2022 14:52:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aHd4rex5KLokg6+1+Y3fFNXszj9You6Kl613kNttCcU=; b=jFrq7X3n2vOjm1EoiPKRlOOc5WkVJw6gGEw0kWR/bZ5oYbkfVb2Fhr26iBhmYMG7rw FbLbzu+lw4gXzax1v740DlIF4uhnBMyCb5qdKQAsW6OyViogpkwI5oIdDytGAxjEiQlF wPBxVBHOyqNsLAdxYE9H5R0qiBvqreCRL6SsGexL7pJp+pGKMb1f3PbPqZjSYL2lHjqP E9VB4J0qtGOxNFPVOOKd47CajEPQDuMmXef8rpu563KRJck+Fyw3JhQu9263eOCf32Bp 9T3ppDmwjyndHiRY1XxfGz4SUfeeZ8XwuhkEf8rAuN/XEGBZFFODYbvTtnoLwryqVPQF 675g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aHd4rex5KLokg6+1+Y3fFNXszj9You6Kl613kNttCcU=; b=4FcnO0VZgkLP6a4oBG/4Ydf3OfHMJLl1HQ9IOU3mu9NMsqVvEf85v5Wthtd4cpBaTe gezTdby4XpD/ucKN0OrSMt26257AOX5TAzdm0vS1SG6VxP7cITTUEiK6+G1V1Aj5qEJR YajANcB4SEbf9pBh8tu69kEsRc/vMMGfp/liLnDzxhD239q27VhgBELzNOScecD6f1xE Hlg+HkenpNuHrXNdypQ/UteyrJewe4jRU3FnMrnB5kZhdAyI9OX+Wtc0Bv+pZPGfNgPO UEUHB3/EjAGMnNAW7Chs2X1NNA7DpVa/qH2xBNwfbOnl2Mn7zfLW96yB0+5cQ0FLhYwT 31GQ== X-Gm-Message-State: AOAM533QOFrPSg4iyQK0rP6ESIMn0GiQcY5v8xBvtOdw2ZzCzvNXXCtT MQgf8wNT25IVBrV4I78foIqJrNI1CI+osw== X-Received: by 2002:a17:90a:a384:b0:1dc:a407:b5ac with SMTP id x4-20020a17090aa38400b001dca407b5acmr7499555pjp.11.1654206769627; Thu, 02 Jun 2022 14:52:49 -0700 (PDT) Received: from stoup.. (174-21-71-225.tukw.qwest.net. [174.21.71.225]) by smtp.gmail.com with ESMTPSA id e14-20020a170902ed8e00b0015edfccfdb5sm4039605plj.50.2022.06.02.14.52.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 14:52:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 63/71] linux-user/aarch64: Do not allow duplicate or short sve records Date: Thu, 2 Jun 2022 14:48:45 -0700 Message-Id: <20220602214853.496211-64-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220602214853.496211-1-richard.henderson@linaro.org> References: <20220602214853.496211-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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=unavailable 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" 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. Signed-off-by: Richard Henderson --- 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 e9ff280d2a..590f2258b2 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_cached(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; }