From patchwork Tue Aug 8 02:55:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 711534 Delivered-To: patch@linaro.org Received: by 2002:a05:6359:d30:b0:129:c516:61db with SMTP id gp48csp1908823rwb; Mon, 7 Aug 2023 19:56:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IElgbzRgrCwlVfe7hIsDepnQFCKU9bNeELOKwyxRI6Rixfr/HZ5FLIzYhkvvTkTYc8KJUrV X-Received: by 2002:a05:622a:4d:b0:40f:e946:a3d6 with SMTP id y13-20020a05622a004d00b0040fe946a3d6mr13170926qtw.31.1691463394373; Mon, 07 Aug 2023 19:56:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691463394; cv=none; d=google.com; s=arc-20160816; b=FozvnAYcCGKTa61l2EafAU4uByb3NzQHUReiqprvuiZgWblYbArAXGARGKbFLPDB2z DM6hQzDj1Jd5w4giLKz0eswuXdrK4JyG8RmXMvVGEt52s+FbEaT8Y2z7mu93NtKj02wg nZl9UwZnOkPsB0ZALAfFwqS4JH66OCc3q670ttuPzKIefphBe0exI/bRhro3qfkGJ1np 5RlhXbYQouLmgq92KLFdu/254MP7FI/Vj6sUN7lh9c3NGNOSWH06ph5SdwhUaNsDj9Zt m7GnYc9EsjKGT54NY+WcnlzaKZrAdwYufLW+DcEJwzu+mnVxoGWdKHiFlyjNG6DlahY/ WgbQ== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=rRyoj2OUdrglSd81krMhVIZ8XhMwBWYK+HGCEaAMaiM=; fh=clzx7HfgsKHKoNkLOhDzVqTKHaXUOyPdFesCTGDftEQ=; b=KIZ48A0t737vdVq8ke7XBfrm+i5gdqybVBiV7g1fE/rBVqsyPJiGq9wBeSCp5p/X3i 84Zy4i0CqkGwdiHqJh10MXEZVmd5tSRodURD+2BaYnNNp2Kun40VKsKPh7u5nK/SzJQM 1Tav5Fognpa6E3x1MJhiqlGeVU1wRGdtK1qFw9xvEgtAQHrrctA6KL+p+8b0tPfpsfoJ QR5ng/RdnopKYSJW2KZgDMtr+sr7tGsLSPiNfVA355vU7MvJv7aPs7zA6j+YeXYDgEim 2BAFsR5SA6RaYLT6ufY2ftviaWskXaLeJIY16ZUK/KIEHx1lNS5sUPlm2teXqhBLJhru Nh4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u1g9XQVB; 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 i25-20020a0cab59000000b0063d6cf4ea68si5469050qvb.504.2023.08.07.19.56.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 Aug 2023 19:56:34 -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=u1g9XQVB; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qTCt1-000702-4T; Mon, 07 Aug 2023 22:55:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qTCsz-0006zk-O7 for qemu-devel@nongnu.org; Mon, 07 Aug 2023 22:55:53 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qTCsy-0003PW-6z for qemu-devel@nongnu.org; Mon, 07 Aug 2023 22:55:53 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-686f090310dso5192563b3a.0 for ; Mon, 07 Aug 2023 19:55:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691463343; x=1692068143; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=rRyoj2OUdrglSd81krMhVIZ8XhMwBWYK+HGCEaAMaiM=; b=u1g9XQVBBzaJS1wkCBDq2n9AqZRIEcCtKDnPtyo6AQXe9dF/fqrTSCEYWppGLHNcfk IB+mWUx5poc/1UZSDm/lTNvPTYcp0Kam2xNJda96jTFpnekS6qSPCUoRXXm6WX1cEUPS Bx2Sw1d02QwRbx8u97L4KfqPpz0Q7/jW5llQqjZpfLNifDrwalP4w77Ii2RjIRZYffpJ J5aHTlnBQbbg5/oTK7mQYrpPlDv30sikV3TgrbgvYLNgS34tcQSCfFyS/E20ZI8FqSEd LlZnDC5TuGQY9DjJqcGiB3DkLMGoF/I9aMfhVj2gg4lSmzzn8yn4nlLTHmN7uaqob57Z y58w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691463343; x=1692068143; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rRyoj2OUdrglSd81krMhVIZ8XhMwBWYK+HGCEaAMaiM=; b=AAqo/8mipFME30Jp8h1ySPc9NHIoPf5jBgvu9Kd9n8+JBpzqsYbzA5kBcUX9sYzZIl SnXPUbY8TxHKSOuP9q6RWoar0mDG8R38a+GRYhbhOlA6xOfbnCsO498N9xiZovbc3qtQ uUZlw0JGzM9/tLWVZ5pOGD351KFXOc/uZUROULYLOYUUylop7mAgbcLkbjD7gSOw88bP dCDysvB1qhDUC7KPODAkcK+tnbUAVP5ObrUlAAdS+9JatlWM2a2iU3yiLfvPOc5mrcav cXlLa22TVnH528yUDHv8Au5YETYPwCMLt3RroOVV6HwaaMk80Uz4T0ZlmH6GwdlJpseR fhiw== X-Gm-Message-State: AOJu0YzvxuzeLvHVyTDc9x09BLvwpaW7U8VUSM212fgUHb9cUcaPCv8V BO7Wsq3f2KhOd/UUX+PRkJ6NCLE1I45YntCjYAA= X-Received: by 2002:a05:6a20:3242:b0:f3:33fb:a62b with SMTP id hm2-20020a056a20324200b000f333fba62bmr11460513pzc.9.1691463343624; Mon, 07 Aug 2023 19:55:43 -0700 (PDT) Received: from stoup.. ([2602:47:d490:6901:e306:567a:e0a1:341]) by smtp.gmail.com with ESMTPSA id t2-20020a656082000000b0056353c0a03esm4900037pgu.37.2023.08.07.19.55.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Aug 2023 19:55:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: mjt@tls.msk.ru, laurent@vivier.eu Subject: [PATCH for-8.1 0/2] linux-user: Fix MAP_SHARED_VALIDATE, MAP_FIXED_NOREPLACE Date: Mon, 7 Aug 2023 19:55:40 -0700 Message-Id: <20230808025542.50392-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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 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-bounces+patch=linaro.org@nongnu.org Fixes LTP mmap17 (MAP_FIXED_NOREPLACE) and mmap20 (MAP_SHARED_VALIDATE), both of which were added to linux-user during the 8.1 cycle, and so would be nice to fix right away. Does not fix mmap18, which will fail depending on the guest memory map. The real kernel avoids placing new maps immediately prior to GROWSDOWN regions (leaving them no room into which to expand) and qemu does not. This is a long-standing problem and will not be fixable for 8.1. Reported-by: Michael Tokarev r~ Richard Henderson (2): linux-user: Split out do_mmap linux-user: Use ARRAY_SIZE with bitmask_transtbl bsd-user/syscall_defs.h | 2 + include/exec/user/thunk.h | 15 ++++-- linux-user/syscall.c | 96 +++++++++++++++++++++++++++++---------- linux-user/thunk.c | 24 +++++----- 4 files changed, 98 insertions(+), 39 deletions(-)