From patchwork Mon Oct 18 19:00:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542841 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=0mKHfUQ+; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY5rF1Qmvz9sR4 for ; Tue, 19 Oct 2021 06:03:41 +1100 (AEDT) Received: from localhost ([::1]:49870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcXv8-00010f-UM for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:03:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtC-0007wV-By for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:38 -0400 Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]:36577) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtA-0001Uw-8C for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:38 -0400 Received: by mail-io1-xd2f.google.com with SMTP id e144so17542949iof.3 for ; Mon, 18 Oct 2021 12:01:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oK8OdzI3+mMf4vVbNx2oZhOXbhyBiMQd575mcLOjFB0=; b=0mKHfUQ+Q2LtYIbbeJopvIkXAxbJ44XQiIhbWvBieRDJGLZbMXtdjR5lijORYwFuBo LU3RQgQeK1MPsllWYeUcDgK3sD0ASLuysX+lbVtJ/LB1IbZEyoWuVpTeNUrqqkOrJos6 TfkOi8Mj1gDY/tqSZxcFBDga4SJ0boBG18igKnUMGd0m501dZE1wQxcZJRpt0Ah4B4Iq B8i32tVXrUsvVdqk9iTbX5TchYiWCWcR/lAL0bznKkf8ybX5jIKMvnXtGsYYRiXQIaWZ Bq00byeWgUIAx+8CMe4yiGQB2sXKuGjBqUEEGESmmM/PYue1Mtqw8W/6bd4tdAu9uPtf ndBA== 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=oK8OdzI3+mMf4vVbNx2oZhOXbhyBiMQd575mcLOjFB0=; b=36t2uegnXCkO49ohGxIFVbdInVggQfJSx7kyY+1E50Oja4CA7gm27drgElxoxel2G7 vj99Dt0tuo9dURF31xCTMg9t5gQKgKFj80DH+6ptJbbnYxNXoexeVdxVTE4TJQAGaSzI 8M/zl3MaOSnitGerHAoXYl4FS9quLWa/8noOrj+QApcMxQTShXzKsS+A7D3hdaLNYD36 Xkt+EUmQ0FpxHUO8e60qoNDksUZI2+12EbxMoGmREcx19cAeWxddb/U0AFrDtgg2g/Ra J/vIgKIkO06HstrqXh7dUuR0pCcbpKCQ5JvxKQTgcSWozbSE37jVGP+8w6+EN3i91riy l94w== X-Gm-Message-State: AOAM530W/jCO+CsdFEtOaVHIKVzdFQfPEt71mgUZMaPmp2pELYf5V1t/ DqE46VgPY6TeImfrp+1nxRSsJRL2OLLNcg== X-Google-Smtp-Source: ABdhPJxKWMHWAGajQwHBe10tQT929i8JDyTbCL5NSqzZf46UPKLBjlWSqGAGLjpGH1InVH0IyVa1mg== X-Received: by 2002:a02:c761:: with SMTP id k1mr1126353jao.74.1634583694629; Mon, 18 Oct 2021 12:01:34 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:01:34 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 01/23] bsd-user/mmap.c: Always zero MAP_ANONYMOUS memory in mmap_frag() Date: Mon, 18 Oct 2021 13:00:53 -0600 Message-Id: <20211018190115.5365-2-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d2f; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2f.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , =?utf-8?q?Mika=C3=ABl_Ura?= =?utf-8?q?nkar?= , Laurent Vivier , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mikaël Urankar Similar to the equivalent linux-user commit e6deac9cf99 When mapping MAP_ANONYMOUS memory fragments, still need notice about to set it zero, or it will cause issues. Signed-off-by: Mikaël Urankar Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/mmap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index b40ab9045f..fc3c1480f5 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -180,10 +180,12 @@ static int mmap_frag(abi_ulong real_start, if (prot_new != (prot1 | PROT_WRITE)) mprotect(host_start, qemu_host_page_size, prot_new); } else { - /* just update the protection */ if (prot_new != prot1) { mprotect(host_start, qemu_host_page_size, prot_new); } + if (prot_new & PROT_WRITE) { + memset(g2h_untagged(start), 0, end - start); + } } return 0; } From patchwork Mon Oct 18 19:00:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542845 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=PVCO8Okv; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY5wF0zdlz9sR4 for ; Tue, 19 Oct 2021 06:07:09 +1100 (AEDT) Received: from localhost ([::1]:58422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcXyU-0006n7-Pq for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:07:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtI-0007xq-Km for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:46 -0400 Received: from mail-io1-xd36.google.com ([2607:f8b0:4864:20::d36]:40510) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtB-0001WT-9U for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:44 -0400 Received: by mail-io1-xd36.google.com with SMTP id x1so17492804iof.7 for ; Mon, 18 Oct 2021 12:01:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/esxzvTZAXy1d5qeSy++Yncrcqbi68O1hcQTBHEcYg0=; b=PVCO8OkvLDKWSXFwCLGJXWA30nPG5nAfz+ySEcwnbnXQJj+RUd6/W3DDS1O/ZOJCvS 4GwuQCK1C1eleMzxi2rfMNILhoiCL+qlKvNBTEHdsdYwmorQB4nxEoKcoUIWEXMvqJ76 DUA2ToK5EjLEtzfqyLVrxZHUabYwAInczDomC36osOi3fN6++wrbZod6hUt3HM5esMfG imaIOmRA7ryjGHWU4iWZEOPTu43BDmbkgIigbeGmtMteo02Uo22FBrAB/PM87B49+4Te +vQD00nyd0msir61XtlWd3IBjQ5F0YmtRpBq7U+7+Vd8kb/ua4RPc1Dw0Oh58oTK/r5H em/A== 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=/esxzvTZAXy1d5qeSy++Yncrcqbi68O1hcQTBHEcYg0=; b=w52rqjtt6k0dbYVaPxorlKH51trpcndOz9VY7fqUIKiAAoVvioClVZ8rxVg774QJJK J5iLnxzQKWt9cbtTTRrNXYOcUqNeSmn2YL9K82uMTeCaWy9qBswi7A6yVn8YMn1mokrx dnWfduaOiSGzZetqy2ncZT2S3ICBzN7MVH+9b87GUo9rEfQhppMkajcnFJjK3R3UxJbu Wx6dudpXIkRH217Vuj12xR7M021d0rmhBKibtkJ4vmWHtaApqA7+1M59V9zikC+ntWci RchL20zYCOWNJY5MB9dK2KdXXdDAwuzmzLgrANnKsekBbJ++SAbI01NTu9RqbYGEQdPb vUkQ== X-Gm-Message-State: AOAM530VoeMCVCiUZY7YQAgTcvuzQk/pGqWQWS8cHPgsLi1yMfCHdzae 4fMMtzbdI1NInyqcJrvPiWlNYSDy3q3s2Q== X-Google-Smtp-Source: ABdhPJxbqf0UzyXXQn2ZpJOUL/zrS0c3yW9rgzbBHiAGSolsm3iauxBwCXc+Crx4fT9hfKyTI3HjQw== X-Received: by 2002:a05:6638:1505:: with SMTP id b5mr1113692jat.99.1634583695984; Mon, 18 Oct 2021 12:01:35 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:01:35 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 02/23] bsd-user/mmap.c: check pread's return value to fix warnings with _FORTIFY_SOURCE Date: Mon, 18 Oct 2021 13:00:54 -0600 Message-Id: <20211018190115.5365-3-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d36; envelope-from=imp@bsdimp.com; helo=mail-io1-xd36.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Warner Losh , =?utf-8?q?Mika=C3=ABl_Urankar?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mikaël Urankar Simmilar to the equivalent linux-user: commit fb7e378cf9c, which added checking to pread's return value. Update to current qemu standards with {} around the if statement. Signed-off-by: Mikaël Urankar Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/mmap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index fc3c1480f5..4f4fa3ab46 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -174,7 +174,9 @@ static int mmap_frag(abi_ulong real_start, mprotect(host_start, qemu_host_page_size, prot1 | PROT_WRITE); /* read the corresponding file data */ - pread(fd, g2h_untagged(start), end - start, offset); + if (pread(fd, g2h_untagged(start), end - start, offset) == -1) { + return -1; + } /* put final protection */ if (prot_new != (prot1 | PROT_WRITE)) @@ -593,7 +595,9 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, -1, 0); if (retaddr == -1) goto fail; - pread(fd, g2h_untagged(start), len, offset); + if (pread(fd, g2h_untagged(start), len, offset) == -1) { + goto fail; + } if (!(prot & PROT_WRITE)) { ret = target_mprotect(start, len, prot); if (ret != 0) { From patchwork Mon Oct 18 19:00:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542839 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=uwYzOWik; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY5qt0zJMz9sR4 for ; Tue, 19 Oct 2021 06:03:20 +1100 (AEDT) Received: from localhost ([::1]:47982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcXun-00080G-Ff for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:03:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtG-0007x4-Fz for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:42 -0400 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]:42868) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtC-0001WY-Jf for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:42 -0400 Received: by mail-io1-xd2c.google.com with SMTP id z69so14381848iof.9 for ; Mon, 18 Oct 2021 12:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PY6MV6MerQjsFge0//XqvVk7s3rubPiFJX6U1DaTO60=; b=uwYzOWik1tmM5QEz2va0KD+1AA8NNuZ6VgZs2PmiwnsjQ/K7uxTzNv3jbbzxBmkfWU 9QRjrI9+h01EKFdKbOQsewrLWz6kKgEw+svW7flXNd8U2T3Ld5G6ZieY7GsTXuk4HDv5 IvafB4NfPc6a2Q0BmeuVB5vuYjRtHMRK8h0EzoiQdFmnSLSq038Q5O/U5cakjUolcTtf hSGVFV0EvJOFYBb3yq4KmPmj5ZLgfPgkytYMMxONP08M44fo0cuubWH+h02StAC+G+XU wTCgF1GFhdvJ4IqZLTasEKSb3rWfxvP9V8bB8MWefgIIH354vGuLMd0/Msk/A3UuUKza KjcA== 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=PY6MV6MerQjsFge0//XqvVk7s3rubPiFJX6U1DaTO60=; b=uv0BYIBFPBtIODZkvTXO33N1kykBlm4U7c6ZzI4qEMi3zal+SMxQ2Wx6Z8sfOIzIEA H2dpXEGX0rqPitc+14CWHUGU9+C5W7pTtGkMnZ5VLIq1K7ZzKvr7giFGljGGtCJn7HSu gr1DvVaPmUqDj0UvZQreevd0rDlnVzhAJUEGXdV+tMQ8hIjEuplLdBANBxkXhHlpOqQL VTyuDCXZVLKdNoGCX+rgGWJFe0q864Sgf9jmwb7c0myNoFdEUiO29DAxh5C05lBx9JFm KqusIeasEZ8xTmufbNkd8ZqNfEakegDm92MkJWkMLZY2mBQObOKuHR5Gf1Fe96ne2FoO wHOA== X-Gm-Message-State: AOAM530kO45K9gdQ2U/0rwNvnSda9tL2EUph9mInSYQKPw5xFNNxqmcB QL9HyfF/J53pUjqogl21AydNkskNbs0= X-Google-Smtp-Source: ABdhPJwEQtUKGXvFNk8fNui4/x6gxxjD3ui3cH+6NeB0ZNNhw8dVWqdtp85uZS0Eb0LTa5asV4wBmA== X-Received: by 2002:a05:6638:2484:: with SMTP id x4mr1097031jat.79.1634583697350; Mon, 18 Oct 2021 12:01:37 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:01:36 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 03/23] bsd-user/mmap.c: MAP_ symbols are defined, so no need for ifdefs Date: Mon, 18 Oct 2021 13:00:55 -0600 Message-Id: <20211018190115.5365-4-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d2c; envelope-from=imp@bsdimp.com; helo=mail-io1-xd2c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , Warner Losh , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" All these MAP_ symbols are always defined on supported FreeBSD versions (12.2 and newer), so remove the #ifdefs since they aren't needed. Signed-off-by: Warner Losh Reviewed-by: Philippe Mathieu-Daudé Acked-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/mmap.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 4f4fa3ab46..6f33aec58b 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -286,13 +286,9 @@ static abi_ulong mmap_find_vma_aligned(abi_ulong start, abi_ulong size, wrapped = repeat = 0; prev = 0; flags = MAP_ANONYMOUS | MAP_PRIVATE; -#ifdef MAP_ALIGNED if (alignment != 0) { flags |= MAP_ALIGNED(alignment); } -#else - /* XXX TODO */ -#endif for (;; prev = ptr) { /* @@ -407,22 +403,18 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, printf("MAP_ALIGNED(%u) ", (flags & MAP_ALIGNMENT_MASK) >> MAP_ALIGNMENT_SHIFT); } -#if MAP_GUARD if (flags & MAP_GUARD) { printf("MAP_GUARD "); } -#endif if (flags & MAP_FIXED) { printf("MAP_FIXED "); } if (flags & MAP_ANONYMOUS) { printf("MAP_ANON "); } -#ifdef MAP_EXCL if (flags & MAP_EXCL) { printf("MAP_EXCL "); } -#endif if (flags & MAP_PRIVATE) { printf("MAP_PRIVATE "); } @@ -432,11 +424,9 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, if (flags & MAP_NOCORE) { printf("MAP_NOCORE "); } -#ifdef MAP_STACK if (flags & MAP_STACK) { printf("MAP_STACK "); } -#endif printf("fd=%d offset=0x%llx\n", fd, offset); } #endif @@ -445,7 +435,6 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, errno = EINVAL; goto fail; } -#ifdef MAP_STACK if (flags & MAP_STACK) { if ((fd != -1) || ((prot & (PROT_READ | PROT_WRITE)) != (PROT_READ | PROT_WRITE))) { @@ -453,8 +442,6 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, goto fail; } } -#endif /* MAP_STACK */ -#ifdef MAP_GUARD if ((flags & MAP_GUARD) && (prot != PROT_NONE || fd != -1 || offset != 0 || (flags & (MAP_SHARED | MAP_PRIVATE | /* MAP_PREFAULT | */ /* MAP_PREFAULT not in mman.h */ @@ -462,7 +449,6 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, errno = EINVAL; goto fail; } -#endif if (offset & ~TARGET_PAGE_MASK) { errno = EINVAL; From patchwork Mon Oct 18 19:00:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542840 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=cx1zDtiO; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY5qt11sPz9sRR for ; Tue, 19 Oct 2021 06:03:20 +1100 (AEDT) Received: from localhost ([::1]:47968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcXun-0007zV-7Q for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:03:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtG-0007x3-7e for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:42 -0400 Received: from mail-io1-xd32.google.com ([2607:f8b0:4864:20::d32]:38801) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtE-0001Wi-1i for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:41 -0400 Received: by mail-io1-xd32.google.com with SMTP id d125so17524789iof.5 for ; Mon, 18 Oct 2021 12:01:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RLjwrAOhbaeXdkBQmG2ODKBch/v6AHtkj1VQlFfA1Pk=; b=cx1zDtiOPrsgzkblYxrC/N+IhoifRU4rG+5Av6shtwIPpradxWRZtEnjJi2Ob1W1RK DS2mk8IYC8GcNgys9xUtrTB+HUr/aGra//Tp6Gj/lfHt+0HHAJybtFMAHaSKUbM0qNiC TXQa1iuWzeoLmwNsQxnkEqSBUrucvAOSDA4ciR9KJLHSmzAKuX9E9mt2MhbUejW3dPh/ y378c0Mbygfc5KAUshyy9eEdYmXXtQ1M8SzR4MthREE0wXUH/ySf47VhiXscNNGjFgI8 b9z0HETG5KcNCpM6CQdZYuukxjBVZbt2Ki0kVXNbMauRjVxdAM7NBcEOhZRJivFdK3E3 33JQ== 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=RLjwrAOhbaeXdkBQmG2ODKBch/v6AHtkj1VQlFfA1Pk=; b=sIMPSOAPQgd1wyMhaCuU1oqNDfNYrdgy2zaXBb78a38PFzuO3aRLl+aLDh2HL213NV ufBJSMzZapEFsaxEhi+z42B/ddQkPkvoYPCsO/EGGHoZxiRtAlSE1aM9X/aUyE8NwnKe li6gKejqwjaj+x4U4ryQ+XLQi5T/Vi4auwP4PWgBI1qT4eljaVurc41BMrP5DfrPBOK1 faQ1OHRih9oPKiaqXSkDYYdp2EpFH6ePH2krylTjZ47ksTeT5R9KWOn4BwXRBMd18FVh 0zuJOYUwE8Szw/Ai3rK2PBMb7V4nBLuavrVzW2vdSPx/0Tx0psxwTru4pjC16aQbe8yj LEcA== X-Gm-Message-State: AOAM53298GvbwKLS4OcQiAv2M3h2AoPjC9qlojctGC/hTz7z4OPHVUZm dPIaQ/iXEa2kuBgBdCjG758J/UcpJVaPjw== X-Google-Smtp-Source: ABdhPJydhlJ3gZoNyytNS/Hv/aUcZ2d0IegbVf7CKwJjHr+uXpEw9tZsOAPVS+OsK7PQkUBi9DMsPQ== X-Received: by 2002:a6b:2c95:: with SMTP id s143mr15354420ios.36.1634583698253; Mon, 18 Oct 2021 12:01:38 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:01:37 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 04/23] bsd-user/mmap.c: mmap return ENOMEM on overflow Date: Mon, 18 Oct 2021 13:00:56 -0600 Message-Id: <20211018190115.5365-5-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d32; envelope-from=imp@bsdimp.com; helo=mail-io1-xd32.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , Warner Losh , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" mmap should return ENOMEM on len overflow rather than EINVAL. Return EINVAL when len == 0 and ENOMEM when the rounded to a page length is 0. Found by make check-tcg. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/mmap.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 6f33aec58b..f0be3b12cf 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -455,11 +455,18 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, goto fail; } - len = TARGET_PAGE_ALIGN(len); if (len == 0) { errno = EINVAL; goto fail; } + + /* Check for overflows */ + len = TARGET_PAGE_ALIGN(len); + if (len == 0) { + errno = ENOMEM; + goto fail; + } + real_start = start & qemu_host_page_mask; host_offset = offset & qemu_host_page_mask; From patchwork Mon Oct 18 19:00:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542843 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=a6aTvsgk; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY5vd3SJWz9sR4 for ; Tue, 19 Oct 2021 06:06:37 +1100 (AEDT) Received: from localhost ([::1]:56484 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcXxz-0005O6-7q for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:06:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtI-0007xr-Qt for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:46 -0400 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]:37750) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtE-0001Yu-Sp for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:44 -0400 Received: by mail-il1-x134.google.com with SMTP id x1so15976572ilv.4 for ; Mon, 18 Oct 2021 12:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n6tmE54VM8mlyUNU6p5wy5fgl7zVk2jzyumM2Xh8/fM=; b=a6aTvsgk2cZeWY/nCGkk/a5quA6aDqksBAsEJcyCAlXjENpxIiFuf4+WHVL4azr09O Z86VGBmh+bfcIDrdO45eWa7w7ao2z4B/LgjpjXR/eINBtlTG2OpaJz0f2Rx2HX3dV8Iz EjqChi0zyUGrPIgqnluUxpRbErlE4gXy1ZEYkn6thFr71CuKQavCYgcSH98T2rjHiz/0 jlSmY167j5F9zMulhSdIVrNmHf+1ggdqSJlsDj7XKx0ixDcJKEbbGWIuauXqHGnPk0ah yBD+sVH+rOq9+MP6tX/YtrGLYT0TCEBzXDpyuTJsKK5xwdaNS0Bl3lmg+eP3YdqSXb98 zMuw== 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=n6tmE54VM8mlyUNU6p5wy5fgl7zVk2jzyumM2Xh8/fM=; b=Zl17CVwcTeKQyecZAbtCCJA27VL+dM/WNgJRk6HiGkt1FjYtOm8wMzOGpTy/y75Ntr ZhDkLYEpNt42aOEyjUHCQkYGrm8C/ZdTap3nFJ/QGqpBjSOxRF0JF6YJxQwT2qrWOKKv 0PhkHZhStky+ASY6MY+gI7eymbWNxTkmDtBfkDb4zr/sljZ44l5Fd+rzFDIgQFKfJKf3 JyA+3n6wVmeSKnDWsxT5UOXbP50k/AI8a7NLrMw1AlSRr1YlRZND2yk8Y1QPod1y0Dy9 Y4Wgq991NblGpSVCSij7ScmTcSOrehZjD/ScszG3DoloKg1Z/k/9MFTx2MgzMPiaw1E7 f/jQ== X-Gm-Message-State: AOAM530zplMHcXoUlgEciBS0YFzm4cHlMsX9sarglkuU3wXpBMHihBBJ 0mp4yqTOyU/ve0TVe9EPHsCcnHlq1H4YrQ== X-Google-Smtp-Source: ABdhPJwUNJDKVQ3yILh3OEMtYa/OAXg02e9fJORrHK5c83BpII/pcWGK43fFrVVda6K3N6BKfy60ig== X-Received: by 2002:a05:6e02:15c4:: with SMTP id q4mr15330206ilu.18.1634583699619; Mon, 18 Oct 2021 12:01:39 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:01:39 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 05/23] bsd-user/mmap.c: mmap prefer MAP_ANON for BSD Date: Mon, 18 Oct 2021 13:00:57 -0600 Message-Id: <20211018190115.5365-6-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::134; envelope-from=imp@bsdimp.com; helo=mail-il1-x134.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , Warner Losh , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" MAP_ANON and MAP_ANONYMOUS are identical. Prefer MAP_ANON for BSD since the file is now a confusing mix of the two. Signed-off-by: Warner Losh Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/mmap.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index f0be3b12cf..301108ed25 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -285,7 +285,7 @@ static abi_ulong mmap_find_vma_aligned(abi_ulong start, abi_ulong size, addr = start; wrapped = repeat = 0; prev = 0; - flags = MAP_ANONYMOUS | MAP_PRIVATE; + flags = MAP_ANON | MAP_PRIVATE; if (alignment != 0) { flags |= MAP_ALIGNED(alignment); } @@ -409,7 +409,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, if (flags & MAP_FIXED) { printf("MAP_FIXED "); } - if (flags & MAP_ANONYMOUS) { + if (flags & MAP_ANON) { printf("MAP_ANON "); } if (flags & MAP_EXCL) { @@ -431,7 +431,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, } #endif - if ((flags & MAP_ANONYMOUS) && fd != -1) { + if ((flags & MAP_ANON) && fd != -1) { errno = EINVAL; goto fail; } @@ -533,7 +533,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, * qemu_real_host_page_size */ p = mmap(g2h_untagged(start), host_len, prot, - flags | MAP_FIXED | ((fd != -1) ? MAP_ANONYMOUS : 0), -1, 0); + flags | MAP_FIXED | ((fd != -1) ? MAP_ANON : 0), -1, 0); if (p == MAP_FAILED) goto fail; /* update start so that it points to the file position at 'offset' */ @@ -696,8 +696,7 @@ static void mmap_reserve(abi_ulong start, abi_ulong size) } if (real_start != real_end) { mmap(g2h_untagged(real_start), real_end - real_start, PROT_NONE, - MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE, - -1, 0); + MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0); } } From patchwork Mon Oct 18 19:00:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542848 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=Vsc73SFB; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY5yq0DQHz9sR4 for ; Tue, 19 Oct 2021 06:09:23 +1100 (AEDT) Received: from localhost ([::1]:36772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcY0e-0002kt-P1 for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:09:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43360) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtJ-0007xx-Hv for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:46 -0400 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]:36382) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtG-0001ZL-Bn for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:45 -0400 Received: by mail-il1-x12a.google.com with SMTP id h10so15989152ilq.3 for ; Mon, 18 Oct 2021 12:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3+hkcIrPIEq/hVOR/fQcllD286AqVcvMxGgF/eXAbnk=; b=Vsc73SFBaBcCxRMOLsP3z8gVzjPGDKpoTQiPkGP2E7+T3hEO78yb1IbF/VlPLb49M8 9whdpbM8/WT+e9vHcC5yfHKfMeVy6qF+NiblgTsFurQLM6YRMUJcyttVnD1FpqAGKR+T eDzimNP0o6DafAzsKC7wqdGRKarS7Ao+HO9nhyubh6ivCGmgYUqjuO8ErWAdzZoqJga0 q6Uab9THf5wjQXuoZE6LdM4oRKFlWxzWrySfGwwGOrS7/dj/RCMRQhfu4IYj1eE7nFXb b/xIaGvfKkc/Mm2jQzT+lXr5v2X3/LHQ0gS+hNhpdtktsObUzrJwzS3yJ3o/+rBKjQEI UOlg== 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=3+hkcIrPIEq/hVOR/fQcllD286AqVcvMxGgF/eXAbnk=; b=rTeDM6B+2AFPLONZUqhHf8o8pvpnh65uwnjM6NGFKTLNWVdhliqeIekWdzKPqvnQ0+ 0AePFihkucNIRYUKlRkeqnUbJ4Tott5YIkcxqoHz4menHbL15sz3K3pt9NQIyJ5kmHTq hhm9vFAim+shOrkzubW7R/BS55zgpBjKSCPei1SpIUjp6jo+p2C0L6+h1PAtGTJiArWU YP80YAQbPqzlAbF+28PsOhdxGyGczMN+Gee4n00VoeJzEbPx10gHVBA4csMZnu3QSTEV jkvLwPnJAmvMBIi3tpirihhS35Gdq9pV49i3F8VrV77TwjYTujSUYLiy3O3t0zN/Ldvp 19jg== X-Gm-Message-State: AOAM533PvEB8lqCMRNVMtlkeMXwJqzZ7weDqvuNUy9UYyvxFNLKzeMbY WwPjtyJRxTGtzMP6tT+vf94UmFwlt4Jl9w== X-Google-Smtp-Source: ABdhPJydlWhf6fFlZIkTpplsdSYZfI1CigXGFlLr1nubBi8EPVdRNW04dcvWycaV1abmJIyStaU84w== X-Received: by 2002:a05:6e02:1c48:: with SMTP id d8mr15581498ilg.114.1634583701071; Mon, 18 Oct 2021 12:01:41 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:01:40 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 06/23] bsd-user/mmap.c: Convert to qemu_log logging for mmap debugging Date: Mon, 18 Oct 2021 13:00:58 -0600 Message-Id: <20211018190115.5365-7-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12a; envelope-from=imp@bsdimp.com; helo=mail-il1-x12a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , Warner Losh , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Convert DEBUG_MMAP to qemu_log CPU_LOG_PAGE. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/mmap.c | 53 +++++++++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 301108ed25..face98573f 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -21,8 +21,6 @@ #include "qemu.h" #include "qemu-common.h" -//#define DEBUG_MMAP - static pthread_mutex_t mmap_mutex = PTHREAD_MUTEX_INITIALIZER; static __thread int mmap_lock_count; @@ -67,14 +65,11 @@ int target_mprotect(abi_ulong start, abi_ulong len, int prot) abi_ulong end, host_start, host_end, addr; int prot1, ret; -#ifdef DEBUG_MMAP - printf("mprotect: start=0x" TARGET_ABI_FMT_lx - "len=0x" TARGET_ABI_FMT_lx " prot=%c%c%c\n", start, len, - prot & PROT_READ ? 'r' : '-', - prot & PROT_WRITE ? 'w' : '-', - prot & PROT_EXEC ? 'x' : '-'); -#endif - + qemu_log_mask(CPU_LOG_PAGE, "mprotect: start=0x" TARGET_ABI_FMT_lx + " len=0x" TARGET_ABI_FMT_lx " prot=%c%c%c\n", start, len, + prot & PROT_READ ? 'r' : '-', + prot & PROT_WRITE ? 'w' : '-', + prot & PROT_EXEC ? 'x' : '-'); if ((start & ~TARGET_PAGE_MASK) != 0) return -EINVAL; len = TARGET_PAGE_ALIGN(len); @@ -391,45 +386,43 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, abi_ulong ret, end, real_start, real_end, retaddr, host_offset, host_len; mmap_lock(); -#ifdef DEBUG_MMAP - { - printf("mmap: start=0x" TARGET_ABI_FMT_lx - " len=0x" TARGET_ABI_FMT_lx " prot=%c%c%c flags=", - start, len, - prot & PROT_READ ? 'r' : '-', - prot & PROT_WRITE ? 'w' : '-', - prot & PROT_EXEC ? 'x' : '-'); + if (qemu_loglevel_mask(CPU_LOG_PAGE)) { + qemu_log("mmap: start=0x" TARGET_ABI_FMT_lx + " len=0x" TARGET_ABI_FMT_lx " prot=%c%c%c flags=", + start, len, + prot & PROT_READ ? 'r' : '-', + prot & PROT_WRITE ? 'w' : '-', + prot & PROT_EXEC ? 'x' : '-'); if (flags & MAP_ALIGNMENT_MASK) { - printf("MAP_ALIGNED(%u) ", (flags & MAP_ALIGNMENT_MASK) - >> MAP_ALIGNMENT_SHIFT); + qemu_log("MAP_ALIGNED(%u) ", + (flags & MAP_ALIGNMENT_MASK) >> MAP_ALIGNMENT_SHIFT); } if (flags & MAP_GUARD) { - printf("MAP_GUARD "); + qemu_log("MAP_GUARD "); } if (flags & MAP_FIXED) { - printf("MAP_FIXED "); + qemu_log("MAP_FIXED "); } if (flags & MAP_ANON) { - printf("MAP_ANON "); + qemu_log("MAP_ANON "); } if (flags & MAP_EXCL) { - printf("MAP_EXCL "); + qemu_log("MAP_EXCL "); } if (flags & MAP_PRIVATE) { - printf("MAP_PRIVATE "); + qemu_log("MAP_PRIVATE "); } if (flags & MAP_SHARED) { - printf("MAP_SHARED "); + qemu_log("MAP_SHARED "); } if (flags & MAP_NOCORE) { - printf("MAP_NOCORE "); + qemu_log("MAP_NOCORE "); } if (flags & MAP_STACK) { - printf("MAP_STACK "); + qemu_log("MAP_STACK "); } - printf("fd=%d offset=0x%llx\n", fd, offset); + qemu_log("fd=%d offset=0x%lx\n", fd, offset); } -#endif if ((flags & MAP_ANON) && fd != -1) { errno = EINVAL; From patchwork Mon Oct 18 19:00:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542851 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=0YOE2pez; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY60Q0HhKz9sR4 for ; Tue, 19 Oct 2021 06:10:46 +1100 (AEDT) Received: from localhost ([::1]:38662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcY1z-0003zz-OP for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:10:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtL-0007z4-1k for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:48 -0400 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]:34745) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtI-0001Zy-BJ for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:46 -0400 Received: by mail-il1-x132.google.com with SMTP id g2so15997576ild.1 for ; Mon, 18 Oct 2021 12:01:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=64uP86lLO6D5epKoICdnCmOVA/U9XxsL32Tuch8fnPI=; b=0YOE2pezWZKQrglheK2JyPphX7Repp2NkjkzkF116maZ6Bwn3v231LVFGRZWK/YNrD BwfXKTAS5/nCBCR8anjvS9LE3zIZbIGiCkcLUnQ3WTJTzuUU/4MMM+VtLMEpYP3wC2ot 1bk/jtXc4ZCscU8omA9Wp4JO8UxprsvoSTCCqjnpFEDCYc51FRbFDVQ3+ES/g4r5JIHg u1lsghkS8xZK5Qelb1BKuQV5Wdfjs2WXxNkspg84PF3TUsiUBYsovLZdNvN98SCKC6GG lNb7jRVmKaHi03Z9Zr1Y3w8OIp87sC6PrPno8dU1/3BSia7nn268iAuveeiCjlyjQhkZ jrmg== 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=64uP86lLO6D5epKoICdnCmOVA/U9XxsL32Tuch8fnPI=; b=bAncqqDjwGe7IhYXyWzs5D8g/YgtFLEf8K08Jli3H/g23Nx/vcrC2T+QGej9hC9A8d tMo8zt8buUYVSlMuI46EFIWwDiZglhoLIJ14q/xSBxFDQKrgu0zkLeE8gMKIlic/DOoP 4thKx3PYr81ecl1NtJfMWDBLgIxQB4BaC/Q3WDHspOS1F+pT9XVhCYpKgeOKIJUp9zqS wBBlV3nEZ3YYmbNUc67dq1+9P53sl7LEyweqmFW2Uzh2A46Mg1QVqZQJid7nODC8AVDH WqhYe1zH7s98tz9fr+b8WPP6IGaiVvJ3A4WM/kgbCJ/Cf876xzlPn4tXxENCYqtQuCQn cHkA== X-Gm-Message-State: AOAM5324Rq+PiFH0gpfzrD+m26wC2JuBTHV3JP8bgG0yDkjIJ7rp7ANr e9cGqB7nbfg1hozJz23EUb38BunZEkWnEw== X-Google-Smtp-Source: ABdhPJwjKJaplhZBsplQBVnfwaEDJbcgyLCJa7HaGuLCXRIhc8wFlkEzBXwGuyd8htb/6X4+H2yjzw== X-Received: by 2002:a05:6e02:120f:: with SMTP id a15mr7893991ilq.109.1634583702247; Mon, 18 Oct 2021 12:01:42 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:01:41 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 07/23] bsd-user/mmap.c: Don't mmap fd == -1 independently from MAP_ANON flag Date: Mon, 18 Oct 2021 13:00:59 -0600 Message-Id: <20211018190115.5365-8-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::132; envelope-from=imp@bsdimp.com; helo=mail-il1-x132.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Guy Yur , Laurent Vivier , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Switch checks for !(flags & MAP_ANONYMOUS) with checks for fd != -1. MAP_STACK and MAP_GUARD both require fd == -1 and don't require mapping the fd either. Add analysis from Guy Yur detailing the different cases for MAP_GUARD and MAP_STACK. Signed-off-by: Guy Yur [ partially merged before, finishing the job and documenting origin] Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/mmap.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index face98573f..4ecd949a10 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -127,7 +127,27 @@ error: return ret; } -/* map an incomplete host page */ +/* + * map an incomplete host page + * + * mmap_frag can be called with a valid fd, if flags doesn't contain one of + * MAP_ANON, MAP_STACK, MAP_GUARD. If we need to map a page in those cases, we + * pass fd == -1. However, if flags contains MAP_GUARD then MAP_ANON cannot be + * added. + * + * * If fd is valid (not -1) we want to map the pages with MAP_ANON. + * * If flags contains MAP_GUARD we don't want to add MAP_ANON because it + * will be rejected. See kern_mmap's enforcing of constraints for MAP_GUARD + * in sys/vm/vm_mmap.c. + * * If flags contains MAP_ANON it doesn't matter if we add it or not. + * * If flags contains MAP_STACK, mmap adds MAP_ANON when called so doesn't + * matter if we add it or not either. See enforcing of constraints for + * MAP_STACK in kern_mmap. + * + * Don't add MAP_ANON for the flags that use fd == -1 without specifying the + * flags directly, with the assumption that future flags that require fd == -1 + * will also not require MAP_ANON. + */ static int mmap_frag(abi_ulong real_start, abi_ulong start, abi_ulong end, int prot, int flags, int fd, abi_ulong offset) @@ -147,9 +167,9 @@ static int mmap_frag(abi_ulong real_start, } if (prot1 == 0) { - /* no page was there, so we allocate one */ + /* no page was there, so we allocate one. See also above. */ void *p = mmap(host_start, qemu_host_page_size, prot, - flags | MAP_ANON, -1, 0); + flags | ((fd != -1) ? MAP_ANON : 0), -1, 0); if (p == MAP_FAILED) return -1; prot1 = prot; @@ -157,7 +177,7 @@ static int mmap_frag(abi_ulong real_start, prot1 &= PAGE_BITS; prot_new = prot | prot1; - if (!(flags & MAP_ANON)) { + if (fd != -1) { /* msync() won't work here, so we return an error if write is possible while it is a shared mapping */ if ((flags & TARGET_BSD_MAP_FLAGMASK) == MAP_SHARED && @@ -565,7 +585,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, * worst case: we cannot map the file because the offset is not * aligned, so we read it */ - if (!(flags & MAP_ANON) && + if (fd != -1 && (offset & ~qemu_host_page_mask) != (start & ~qemu_host_page_mask)) { /* * msync() won't work here, so we return an error if write is From patchwork Mon Oct 18 19:01:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542844 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=rlxpALaJ; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY5vd48kFz9sRR for ; Tue, 19 Oct 2021 06:06:37 +1100 (AEDT) Received: from localhost ([::1]:56538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcXxz-0005Ps-BU for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:06:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtK-0007y5-Cm for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:46 -0400 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]:37743) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtI-0001bm-Uk for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:46 -0400 Received: by mail-il1-x12c.google.com with SMTP id x1so15976791ilv.4 for ; Mon, 18 Oct 2021 12:01:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mTIN4b3FESvsd1eFe8zoLs4gxknToUOMeY0gNeMUPFs=; b=rlxpALaJKUyzevqVo2CiRro7kgJg/tl5px7a60DzbgeiCshY//h983INAmq0q+SEJ0 b42cAska3N9CRSQhRtdKf2kpD1HlTh5RNce0cvdH40sZnG63xh4o9iEX7Ybu0TCxUAUx yuqt6OAidl/WzHP5olA6jS8MZ4Dn4zMhFXaAmdeT+6aHDyyx8BXjGdK9kAPJFfc5QZh9 dnyM3MYF+CmN422Q6PfqT1T/cPiNEH9Jp21OADHVImWakjG9kWEW9gT87HnBsRBYteOH O6BIUavKjttsSdhyGPtkxaYjcitnJUF6VyZafOE3j2yUKpa4rFar4LB8F/LNu1N8kc3K 4k6Q== 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=mTIN4b3FESvsd1eFe8zoLs4gxknToUOMeY0gNeMUPFs=; b=JL002VT+ls1WmauiMWDMUqM8GFiMdqgP5HnnBURt/jqfOcwa9jbCPmmhV/Be/Qknyp 6jusma0gIBtUQHvhNGcvkRk4huE9RKDt54Y93vT5Fn4Gge40p6IijwPIT7bb6oCATdTl p8e70mhoLJquFQyVyE+InkOOQKnKtNh+cMd0S+yLwusk3m0fswl7pt+UGCCEN4ls7bKM 2jn1n2r5acjEKgt3HRkNEt4Cwei4b8fv3LHwezFFUvtSgpLvQuWQKj7Id3n3wEnUVZ4T EhfkhqX3tTWOFm4FO3leuEznnpk8zoAYAZBIhAVb++B5UCAVwXSoLIbZXdN0EHjUotW8 2x7A== X-Gm-Message-State: AOAM5319QED99CAx9ZMLdwQOeXgzoRnNjOPN4hW434qCnlUjKoN0RC3s YcGu0MpekKXGD4yYUotsTK9qdJHvR+mJpw== X-Google-Smtp-Source: ABdhPJzq/DprL8sI6kkN8uvKTL64zmkxhnLJF0uFyt8JzsLgqamkMRl31tFGB0gO9Sy3cwaRnYaHqA== X-Received: by 2002:a92:c241:: with SMTP id k1mr15714676ilo.258.1634583703672; Mon, 18 Oct 2021 12:01:43 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:01:43 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 08/23] bsd-user/mmap.c: Implement MAP_EXCL, required by jemalloc in head Date: Mon, 18 Oct 2021 13:01:00 -0600 Message-Id: <20211018190115.5365-9-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12c; envelope-from=imp@bsdimp.com; helo=mail-il1-x12c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Kyle Evans jemalloc requires a working MAP_EXCL. Ensure that no page is double mapped when specified. In addition, use guest_range_valid_untagged to test for valid ranges of pages rather than an incomplete inlined version of the test that might be wrong. Signed-off-by: Kyle Evans Signed-off-by: Warner Losh Reviewed-by: Richard Henderson --- bsd-user/mmap.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 4ecd949a10..5b6ed5eed1 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -574,12 +574,10 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, * It can fail only on 64-bit host with 32-bit target. * On any other target/host host mmap() handles this error correctly. */ -#if TARGET_ABI_BITS == 32 && HOST_LONG_BITS == 64 - if ((unsigned long)start + len - 1 > (abi_ulong) -1) { + if (!guest_range_valid_untagged(start, len)) { errno = EINVAL; goto fail; } -#endif /* * worst case: we cannot map the file because the offset is not @@ -614,6 +612,12 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, goto the_end; } + /* Reject the mapping if any page within the range is mapped */ + if ((flags & MAP_EXCL) && page_check_range(start, len, 0) < 0) { + errno = EINVAL; + goto fail; + } + /* handle the start of the mapping */ if (start > real_start) { if (real_end == real_start + qemu_host_page_size) { From patchwork Mon Oct 18 19:01:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542849 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=MgE3d1m5; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY5yq6ffxz9sRR for ; Tue, 19 Oct 2021 06:09:23 +1100 (AEDT) Received: from localhost ([::1]:36814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcY0f-0002mc-OV for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:09:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtN-0007zX-Mh for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:50 -0400 Received: from mail-il1-x134.google.com ([2607:f8b0:4864:20::134]:38712) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtM-0001eF-46 for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:49 -0400 Received: by mail-il1-x134.google.com with SMTP id h27so10217715ila.5 for ; Mon, 18 Oct 2021 12:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9sPvBFZ/l7G/BxNY+/vUQPWPx/ls2ZmbDpMNIy8JAO0=; b=MgE3d1m5NNxniAj+ir5O6wR6FmlBWE980ILqOh1c1HNf956SoupLs2GuACYRVsT4VE xm2HJVFGTAShXX8Pc9dOnYTY4EvxZhPvhCvgzC2HMto/p3qYeo2f5eeABtVGnROYnPu8 dk5MxTDOWWvsxADxpLUb1P7/Vz5vRQvWMrcapxsdG9ylzL67zXJOC0xhmnVRiBF+HXTA YGpQKCW1229MQKQHfudn0apYtpo5msUowQi+qu+HqSmqjdhHsDgp3ogfGIsGzwrM2jYC 24iWWhI96br10KU2tTZzpf2QcyOgl/qpLtFdwNOQFpytv1GfJDT+jJqMQ9ASwoaFm7/s +pFw== 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=9sPvBFZ/l7G/BxNY+/vUQPWPx/ls2ZmbDpMNIy8JAO0=; b=XzJm8/NsvSKmxzdd/ErwgOBPRuEiJm0S3wPr8RNl27vEChFUz/4vxgX/S59fZ7uaxL 3YeYeRn00xX8wSXWOyl8MdEVwNiGaw3JA77HOsMwLn83RGo4WC6iv+rSJPRUHuDhiInu plHN6estaDbEdS6bvwfnlp5rVRoE6KX1VTQ5qnRnEU81T+1TBb6liSvzgp6bP+PVLUeh IdiG/dJ7VnPXapNbOGrKUJjFWTuREoMnhUjWg6HfDK3VAAqytiQx66m30ZPM8OEqdPls L8HR4YV5Jr+2hBr2V/CYp+5HqgHo4K2t4RKV4MHp9UXiRtxD8+MYxTmNb7/sjcEaYMOg 1zjQ== X-Gm-Message-State: AOAM532ogtLJOO1RHP/YeuJmU8ZEKYzP1suFf2D6R7IYyc9N1AB6cLEt yfPt+ybIALjYKTOhgj1QWERTDDsnTXvA4Q== X-Google-Smtp-Source: ABdhPJxx9BYXhGUbv+AeE/5J6rSySwFbLsfZaMp+scEb26XNBm1Wrn02DUHpwptPM4ueswO/yLTWlg== X-Received: by 2002:a05:6e02:144a:: with SMTP id p10mr15568130ilo.313.1634583705979; Mon, 18 Oct 2021 12:01:45 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:01:44 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 09/23] bsd-user/mmap.c: assert that target_mprotect cannot fail Date: Mon, 18 Oct 2021 13:01:01 -0600 Message-Id: <20211018190115.5365-10-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::134; envelope-from=imp@bsdimp.com; helo=mail-il1-x134.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Warner Losh , =?utf-8?q?Mika=C3=ABl_Urankar?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Similar to the equivalent linux-user change 86abac06c14. All error conditions that target_mprotect checks are also checked by target_mmap. EACCESS cannot happen because we are just removing PROT_WRITE. ENOMEM should not happen because we are modifying a whole VMA (and we have bigger problems anyway if it happens). Fixes a Coverity false positive, where Coverity complains about target_mprotect's return value being passed to tb_invalidate_phys_range. Signed-off-by: Mikaël Urankar Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/mmap.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 5b6ed5eed1..13cb32dba1 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -604,10 +604,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, } if (!(prot & PROT_WRITE)) { ret = target_mprotect(start, len, prot); - if (ret != 0) { - start = ret; - goto the_end; - } + assert(ret == 0); } goto the_end; } From patchwork Mon Oct 18 19:01:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542852 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=o2zOtUvi; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY61R0kHlz9sR4 for ; Tue, 19 Oct 2021 06:11:39 +1100 (AEDT) Received: from localhost ([::1]:41648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcY2q-00064t-Pw for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:11:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtP-00080I-5H for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:52 -0400 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]:39444) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtN-0001fZ-5F for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:50 -0400 Received: by mail-il1-x12c.google.com with SMTP id w11so15963307ilv.6 for ; Mon, 18 Oct 2021 12:01:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g/r2gH9ObhuBG8UYqMNl21ZIK0oU8t5H0kqWj19D/1o=; b=o2zOtUviB1fCfdTmco3fi+/U+2wEh8r4c4vPhMn7GAqK/vxpbtHtrnL+Tb47eTLabS EK+dUIVSq7eyk0eZxRpM56tUSycQUnkqAeF2RqR4RnnEvDSrrsLSegXLi8luzMLfrdDU n8kdx/lZlOCU8KkuWrrZ8Ayg/ZRkaHnaKjoV+6tN/IaqPmHHRj1Db3zQUitROteu306i vOfv1KCln5EyELrYtEv+9BWBqIEtBAOU9cvzpeGfXL+GCOaBSTA475KMkPnJh6j14GdP pl6OXF+LCdY2dWF3VydAdLe2LTxV1dWwPoxdaW/AxDFDPp9IggK2ja6b8Dkpuab9sxnG e9Yw== 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=g/r2gH9ObhuBG8UYqMNl21ZIK0oU8t5H0kqWj19D/1o=; b=g9j7X/lrrFQ4vwdtPdpMWCNvpibIR5RpHBczNslhKpGzQkwSheiEpQkVz4zgdhJ4QI AxPS8DYiVlRkf9zJ3THA8SdIcpGQB/pVFH2Y6uqIwhyMpys/ijiRl08PO1CKTjWzMbeW ZSMAjZczgh5O4SdSRYrhL7rpjv2TLNgYT0psTz8cCp9/h9DzNPb/ri7i7KREwvAEt9xi 3ljAYQ2gkZkdGIuxqjEJzbCglBp4EFq8QGSe0KH9BcivS8icHxZhOAyhQl+42l/jISjn lm2synF/EsOFm4tfSns81zXspNmkFvK0BRLHuQNSPG9Bt86oZqigCPYkWvIJv3fVorZz 7D1w== X-Gm-Message-State: AOAM532LQ25lf5CQE7nsK6lSXoYJfkg0MWA6obN5oixDzuElbanxXeC8 wMTq1kLTnFunceQQcDVOpgcAjNkWq0hGXw== X-Google-Smtp-Source: ABdhPJy2Z82SZgu/kmN563QSmST3riglhw+v3AKCe6H9EtDPsfSfxlY7IVg8GV3ZroxGo9iPLpmncA== X-Received: by 2002:a05:6e02:1ba8:: with SMTP id n8mr14671133ili.74.1634583707854; Mon, 18 Oct 2021 12:01:47 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:01:47 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 10/23] meson: *-user: only descend into *-user when configured Date: Mon, 18 Oct 2021 13:01:02 -0600 Message-Id: <20211018190115.5365-11-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12c; envelope-from=imp@bsdimp.com; helo=mail-il1-x12c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Laurent Vivier , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Paolo Bonzini , Warner Losh , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" To increase flexibility, only descend into *-user when that is configured. This allows *-user to selectively include directories based on the host OS which may not exist on all hosts. Adopt Paolo's suggestion of checking the configuration in the directories that know about the configuration. Message-Id: <20210926220103.1721355-2-f4bug@amsat.org> Message-Id: <20210926220103.1721355-3-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daudé Signed-off-by: Warner Losh Acked-by: Paolo Bonzini Reviewed-by: Kyle Evans --- bsd-user/meson.build | 4 ++++ linux-user/meson.build | 4 ++++ meson.build | 12 ++++++++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/bsd-user/meson.build b/bsd-user/meson.build index 0369549340..5378f56f71 100644 --- a/bsd-user/meson.build +++ b/bsd-user/meson.build @@ -1,3 +1,7 @@ +if not have_bsd_user + subdir_done() +endif + bsd_user_ss.add(files( 'bsdload.c', 'elfload.c', diff --git a/linux-user/meson.build b/linux-user/meson.build index 9549f81682..bf62c13e37 100644 --- a/linux-user/meson.build +++ b/linux-user/meson.build @@ -1,3 +1,7 @@ +if not have_linux_user + subdir_done() +endif + linux_user_ss.add(files( 'elfload.c', 'exit.c', diff --git a/meson.build b/meson.build index 6b7487b725..5e7946776d 100644 --- a/meson.build +++ b/meson.build @@ -40,12 +40,15 @@ config_host_data = configuration_data() genh = [] target_dirs = config_host['TARGET_DIRS'].split() -have_user = false +have_linux_user = false +have_bsd_user = false have_system = false foreach target : target_dirs - have_user = have_user or target.endswith('-user') + have_linux_user = have_linux_user or target.endswith('linux-user') + have_bsd_user = have_bsd_user or target.endswith('bsd-user') have_system = have_system or target.endswith('-softmmu') endforeach +have_user = have_linux_user or have_bsd_user have_tools = 'CONFIG_TOOLS' in config_host have_block = have_system or have_tools @@ -2595,10 +2598,11 @@ subdir('bsd-user') subdir('linux-user') subdir('ebpf') -bsd_user_ss.add(files('gdbstub.c')) +common_ss.add(libbpf) + specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss) -linux_user_ss.add(files('gdbstub.c', 'thunk.c')) +linux_user_ss.add(files('thunk.c')) specific_ss.add_all(when: 'CONFIG_LINUX_USER', if_true: linux_user_ss) # needed for fuzzing binaries From patchwork Mon Oct 18 19:01:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542846 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=kZGZ/guA; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY5xh1Fx5z9sR4 for ; Tue, 19 Oct 2021 06:08:22 +1100 (AEDT) Received: from localhost ([::1]:33132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcXzf-0000K1-Dj for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:08:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtQ-00080K-9T for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:52 -0400 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]:40925) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtN-0001gG-Vh for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:51 -0400 Received: by mail-il1-x12c.google.com with SMTP id k3so5597405ilo.7 for ; Mon, 18 Oct 2021 12:01:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ak526YkqxWQ0k6zUzWsBpTYOajinFPk8HM2YsPPgGjk=; b=kZGZ/guA0KuzOrUQSAIIfXwE9uwMjGtIKFpsQ7fO4d+SwJCRkAO6/KVxyvwO6+4UAD MYEaVWGYYZ7+LXNYBgF7kf/bDhralRdI/vPJdnbEMGa/d5bk9W+liEF1XUloemB8VMAw +ZM6falqI9BSPmtQ0mHwW30XSJtXwXLSEqRoN1IdoQ7p4pRErCE0wcbCUU0NnOjQJPh2 wB6yXV1QdkjmOY6YZXBgmemTqGj/ZK9Q5awkDuLox3IzgAar2yqZm2hdDiFUTp+FRA7G pHlAVKCB05cxWFjVKtPHM3hrLDRp/wUb6xjE+VPExMjZD04hsCQHfbkj5hntSAPPjhJA tbnQ== 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=Ak526YkqxWQ0k6zUzWsBpTYOajinFPk8HM2YsPPgGjk=; b=VCvpT0nV/UisQx+q6US+GgkCaRube91WGyn5c1lxknQxn3vqZ3ZVp+odrXxrag8+ki deLpe2hOOG0srstV5vrzmwLX4c+b8G0SUuc5oPZLE3MueFuj9rsrv9LAaxOqmB7SQLJy qA0Og5MPhSftr+0jPHCjGTtbsHKDVzH38WZEEWaV8/AGrBfe4leWnXiOC95FPywcWi74 /TZui9fJRN+oJPQ9DAc0JbCl1shH6Ms04WGIfq7bujbSq4wFOoHOSmuaQPeRtm3N0Sok uB+H9LNw76o+6j0w5mPENaQUchLJsJdb6WEnVS/LW+g3aFQMpXeVRB2vuB6/eeAzRwYO L1jg== X-Gm-Message-State: AOAM531ZrMrdbtIs7xc6h5etpj3WlVi+EIRrHG7kWYzaR3NIGqhmz2c4 JnC0mOzpd2z58AsJ1oEK+39rolNoA7hdPg== X-Google-Smtp-Source: ABdhPJzRsd3Si7zuOFPPFi2Iwpe9jHYoyJxL4UqENbirZEbhBtA+LPzycGknDmLFRMIWoVtsFCbd2A== X-Received: by 2002:a92:c545:: with SMTP id a5mr15665496ilj.172.1634583708670; Mon, 18 Oct 2021 12:01:48 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:01:48 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 11/23] bsd-user/target_os-user.h: Remove support for FreeBSD older than 12.0 Date: Mon, 18 Oct 2021 13:01:03 -0600 Message-Id: <20211018190115.5365-12-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12c; envelope-from=imp@bsdimp.com; helo=mail-il1-x12c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/freebsd/target_os_user.h | 100 +----------------------------- 1 file changed, 1 insertion(+), 99 deletions(-) diff --git a/bsd-user/freebsd/target_os_user.h b/bsd-user/freebsd/target_os_user.h index 95b1fa9f99..19892c5071 100644 --- a/bsd-user/freebsd/target_os_user.h +++ b/bsd-user/freebsd/target_os_user.h @@ -61,15 +61,7 @@ struct target_sockaddr_storage { /* * from sys/user.h */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 1200031 #define TARGET_KI_NSPARE_INT 2 -#elif defined(__FreeBSD_version) && __FreeBSD_version >= 1100000 -#define TARGET_KI_NSPARE_INT 4 -#elif defined(__FreeBSD_version) && __FreeBSD_version >= 1000000 -#define TARGET_KI_NSPARE_INT 7 -#else -#define TARGET_KI_NSPARE_INT 9 -#endif /* ! __FreeBSD_version >= 1000000 */ #define TARGET_KI_NSPARE_LONG 12 #define TARGET_KI_NSPARE_PTR 6 @@ -116,11 +108,7 @@ struct target_kinfo_proc { int32_t ki_tsid; /* Terminal session ID */ int16_t ki_jobc; /* job control counter */ int16_t ki_spare_short1; /* unused (just here for alignment) */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 1200031 int32_t ki_tdev__freebsd11; /* controlling tty dev */ -#else - int32_t ki_tdev; /* controlling tty dev */ -#endif target_sigset_t ki_siglist; /* Signals arrived but not delivered */ target_sigset_t ki_sigmask; /* Current signal mask */ target_sigset_t ki_sigignore; /* Signals being ignored */ @@ -164,45 +152,24 @@ struct target_kinfo_proc { int8_t ki_nice; /* Process "nice" value */ char ki_lock; /* Process lock (prevent swap) count */ char ki_rqindex; /* Run queue index */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 1100000 u_char ki_oncpu_old; /* Which cpu we are on (legacy) */ u_char ki_lastcpu_old; /* Last cpu we were on (legacy) */ -#else - u_char ki_oncpu; /* Which cpu we are on */ - u_char ki_lastcpu; /* Last cpu we were on */ -#endif /* ! __FreeBSD_version >= 1100000 */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 900000 char ki_tdname[TARGET_TDNAMLEN + 1]; /* thread name */ -#else - char ki_ocomm[TARGET_TDNAMLEN + 1]; /* thread name */ -#endif /* ! __FreeBSD_version >= 900000 */ char ki_wmesg[TARGET_WMESGLEN + 1]; /* wchan message */ char ki_login[TARGET_LOGNAMELEN + 1]; /* setlogin name */ char ki_lockname[TARGET_LOCKNAMELEN + 1]; /* lock name */ char ki_comm[TARGET_COMMLEN + 1]; /* command name */ char ki_emul[TARGET_KI_EMULNAMELEN + 1]; /* emulation name */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 900000 char ki_loginclass[TARGET_LOGINCLASSLEN + 1]; /* login class */ -#endif /* ! __FreeBSD_version >= 900000 */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 900000 char ki_sparestrings[50]; /* spare string space */ -#else - char ki_sparestrings[68]; /* spare string space */ -#endif /* ! __FreeBSD_version >= 900000 */ int32_t ki_spareints[TARGET_KI_NSPARE_INT]; /* spare room for growth */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 1200031 - uint64_t ki_tdev; /* controlling tty dev */ -#endif -#if defined(__FreeBSD_version) && __FreeBSD_version >= 1100000 + uint64_t ki_tdev; /* controlling tty dev */ int32_t ki_oncpu; /* Which cpu we are on */ int32_t ki_lastcpu; /* Last cpu we were on */ int32_t ki_tracer; /* Pid of tracing process */ -#endif /* __FreeBSD_version >= 1100000 */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 900000 int32_t ki_flag2; /* P2_* flags */ int32_t ki_fibnum; /* Default FIB number */ -#endif /* ! __FreeBSD_version >= 900000 */ uint32_t ki_cr_flags; /* Credential flags */ int32_t ki_jid; /* Process jail ID */ int32_t ki_numthreads; /* XXXKSE number of threads in total */ @@ -234,18 +201,8 @@ struct target_kinfo_file { int32_t kf_flags; /* Flags. */ int32_t kf_pad0; /* Round to 64 bit alignment. */ int64_t kf_offset; /* Seek location. */ -#if defined(__FreeBSD_version) && __FreeBSD_version < 1200031 - int32_t kf_vnode_type; /* Vnode type. */ - int32_t kf_sock_domain; /* Socket domain. */ - int32_t kf_sock_type; /* Socket type. */ - int32_t kf_sock_protocol; /* Socket protocol. */ - struct target_sockaddr_storage kf_sa_local; /* Socket address. */ - struct target_sockaddr_storage kf_sa_peer; /* Peer address. */ -#endif -#if defined(__FreeBSD_version) && __FreeBSD_version >= 900000 union { struct { -#if defined(__FreeBSD_version) && __FreeBSD_version >= 1200031 uint32_t kf_spareint; /* Socket domain. */ int kf_sock_domain0; @@ -257,7 +214,6 @@ struct target_kinfo_file { struct sockaddr_storage kf_sa_local; /* Peer address. */ struct sockaddr_storage kf_sa_peer; -#endif /* Address of so_pcb. */ uint64_t kf_sock_pcb; /* Address of inp_ppcb. */ @@ -272,7 +228,6 @@ struct target_kinfo_file { uint32_t kf_sock_pad0; } kf_sock; struct { -#if defined(__FreeBSD_version) && __FreeBSD_version >= 1200031 /* Vnode type. */ int kf_file_type; /* Space for future use */ @@ -290,16 +245,6 @@ struct target_kinfo_file { uint32_t kf_file_fsid_freebsd11; /* File device, FreeBSD 11 compat. */ uint32_t kf_file_rdev_freebsd11; -#else - /* Global file id. */ - uint64_t kf_file_fileid; - /* File size. */ - uint64_t kf_file_size; - /* Vnode filesystem id. */ - uint32_t kf_file_fsid; - /* File device. */ - uint32_t kf_file_rdev; -#endif /* File mode. */ uint16_t kf_file_mode; /* Round to 64 bit alignment. */ @@ -307,18 +252,14 @@ struct target_kinfo_file { uint32_t kf_file_pad1; } kf_file; struct { -#if defined(__FreeBSD_version) && __FreeBSD_version >= 1200031 uint32_t kf_spareint[4]; uint64_t kf_spareint64[32]; -#endif uint32_t kf_sem_value; uint16_t kf_sem_mode; } kf_sem; struct { -#if defined(__FreeBSD_version) && __FreeBSD_version >= 1200031 uint32_t kf_spareint[4]; uint64_t kf_spareint64[32]; -#endif uint64_t kf_pipe_addr; uint64_t kf_pipe_peer; uint32_t kf_pipe_buffer_cnt; @@ -326,7 +267,6 @@ struct target_kinfo_file { uint32_t kf_pipe_pad0[3]; } kf_pipe; struct { -#if defined(__FreeBSD_version) && __FreeBSD_version >= 1200031 uint32_t kf_spareint[4]; uint64_t kf_spareint64[32]; uint32_t kf_pts_dev_freebsd11; @@ -334,34 +274,18 @@ struct target_kinfo_file { uint64_t kf_pts_dev; /* Round to 64 bit alignment. */ uint32_t kf_pts_pad1[4]; -#else - uint32_t kf_pts_dev; - /* Round to 64 bit alignment. */ - uint32_t kf_pts_pad0[7]; -#endif } kf_pts; struct { -#if defined(__FreeBSD_version) && __FreeBSD_version >= 1200031 uint32_t kf_spareint[4]; uint64_t kf_spareint64[32]; -#endif int32_t kf_pid; } kf_proc; } kf_un; uint16_t kf_status; /* Status flags. */ uint16_t kf_pad1; /* Round to 32 bit alignment. */ int32_t _kf_ispare0; /* Space for more stuff. */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 1000000 target_cap_rights_t kf_cap_rights; /* Capability rights. */ uint64_t _kf_cap_spare; /* Space for future cap_rights_t. */ -#else /* ! __FreeBSD_version >= 1000000 */ - uint64_t kf_cap_rights; - int _kf_ispare[4]; -#endif /* ! __FreeBSD_version >= 1000000 */ - -#else /* ! __FreeBSD_version >= 900000 */ - int _kf_ispare[16]; -#endif /* ! __FreeBSD_version >= 900000 */ /* Truncated before copyout in sysctl */ char kf_path[PATH_MAX]; /* Path to file, if any. */ }; @@ -372,34 +296,19 @@ struct target_kinfo_vmentry { uint64_t kve_start; /* Starting address. */ uint64_t kve_end; /* Finishing address. */ uint64_t kve_offset; /* Mapping offset in object */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 900000 uint64_t kve_vn_fileid; /* inode number if vnode */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 1200031 uint32_t kve_vn_fsid_freebsd11; /* dev_t of vnode location */ -#else - uint32_t kve_vn_fsid; /* dev_t of vnode location */ -#endif -#else /* ! __FreeBSD_version >= 900000 */ - uint64_t kve_fileid; /* inode number if vnode */ - uint32_t kve_fsid; /* dev_t of vnode location */ -#endif /* ! __FreeBSD_version >= 900000 */ int32_t kve_flags; /* Flags on map entry. */ int32_t kve_resident; /* Number of resident pages. */ int32_t kve_private_resident; /* Number of private pages. */ int32_t kve_protection; /* Protection bitmask. */ int32_t kve_ref_count; /* VM obj ref count. */ int32_t kve_shadow_count; /* VM obj shadow count. */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 900000 int32_t kve_vn_type; /* Vnode type. */ uint64_t kve_vn_size; /* File size. */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 1200031 uint32_t kve_vn_rdev_freebsd11; /* Device id if device. */ -#else - uint32_t kve_vn_rdev; /* Device id if device. */ -#endif uint16_t kve_vn_mode; /* File mode. */ uint16_t kve_status; /* Status flags. */ -#if defined(__FreeBSD_version) && __FreeBSD_version >= 1200031 #if (__FreeBSD_version >= 1300501 && __FreeBSD_version < 1400000) || \ __FreeBSD_version >= 1400009 union { @@ -413,13 +322,6 @@ struct target_kinfo_vmentry { #endif uint64_t kve_vn_rdev; /* Device id if device. */ int _kve_ispare[8]; /* Space for more stuff. */ -#else - int32_t _kve_ispare[12]; /* Space for more stuff. */ -#endif -#else /* ! __FreeBSD_version >= 900000 */ - int _kve_pad0; - int32_t _kve_ispare[16]; /* Space for more stuff. */ -#endif /* ! __FreeBSD_version >= 900000 */ /* Truncated before copyout in sysctl */ char kve_path[PATH_MAX]; /* Path to VM obj, if any. */ }; From patchwork Mon Oct 18 19:01:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542855 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=4/mPdsFq; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY63x44dBz9sR4 for ; Tue, 19 Oct 2021 06:13:49 +1100 (AEDT) Received: from localhost ([::1]:49320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcY4x-0002mM-CW for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:13:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtR-00083e-Ei for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:53 -0400 Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d]:44985) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtP-0001iW-HQ for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:52 -0400 Received: by mail-il1-x12d.google.com with SMTP id j8so15935255ila.11 for ; Mon, 18 Oct 2021 12:01:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AiUs/VfZosBnQlunZsNdKJI8UF+bB22/U8lGhyrKVwU=; b=4/mPdsFqGHatN1w73N+iPLH81J8bjQlExaAmO4nuJpw3sVPeUeKaOCYbriZnvj2F/d cHmhh8MBR7Iw+jSpwWft9Kr1GrrMED0XrHwAaTqByNfsuS2wz8ULuFEfRqi6G38y5Eey 2ZoCKStlbufRfvVWjVrRQTx//k01vEo3s12V88pntlXuy9NQBZS9awCGL2wedCmIMGua N/HpY/gfjnBZC54ewrtSDHRfjExeY7OeVW+7xwCPYdENCm2ceeD1o2km8ZcuRHZcKzm1 ryx/V8euNR5BcKYXnRtI/ZoOwFvmNxnZ46gcGZy+iu3dJdcKe+YIMbBBIH0iYyel6sDg r5EA== 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=AiUs/VfZosBnQlunZsNdKJI8UF+bB22/U8lGhyrKVwU=; b=O8A5uaHa94YK6D+lzJrZeKqOD0Cy6YWR+z3pGHFiQ9gHZzikgrI0oD0EkCvFmFxbgy ZLB24JpmAMcCneoIfx5GSsX5sZ0zG6Jxz5AwHzgFpopJPts8B9PGy0QsffR2KPjoIEhm o9U/M7WMdYgLbuq+zXWkZRo5TkmEa9hAaHAPMKQUa6YlcSoi41W4gHMk+5vmkkTyeA+M 79llMKv71+UdSHLLgwkOk1B7lBcGrs7dAEGfiZNEATrgwMUGbEk96+ZUFMRyua7zEn8V 3vRCKwCh1FhmCgzXr4BLCSCDh2lygK5ESfkt/1cExOKv/k3CWBiOflEqzvt0zYAp/oQt ol3Q== X-Gm-Message-State: AOAM532Y39DUUbqmRbnNxjNLfW7ktb8rSWYvZcGLeSztRrersZ0breC4 41I7jO/kc/te77vGxLVyKTqmjiY2ac/mLQ== X-Google-Smtp-Source: ABdhPJyd49AfGJhMymTSfq++65DqH/jRdpvZzqy6h3+kWniOsERwiwG7wrr4VBU2ZM6CLkatgq/UmQ== X-Received: by 2002:a05:6e02:bc9:: with SMTP id c9mr15649319ilu.309.1634583710195; Mon, 18 Oct 2021 12:01:50 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:01:49 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 12/23] bsd-user/strace.list: Remove support for FreeBSD versions older than 12.0 Date: Mon, 18 Oct 2021 13:01:04 -0600 Message-Id: <20211018190115.5365-13-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12d; envelope-from=imp@bsdimp.com; helo=mail-il1-x12d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/freebsd/strace.list | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/bsd-user/freebsd/strace.list b/bsd-user/freebsd/strace.list index b01b5f36e8..275d2dbe27 100644 --- a/bsd-user/freebsd/strace.list +++ b/bsd-user/freebsd/strace.list @@ -33,10 +33,6 @@ { TARGET_FREEBSD_NR___syscall, "__syscall", NULL, NULL, NULL }, { TARGET_FREEBSD_NR___sysctl, "__sysctl", NULL, print_sysctl, NULL }, { TARGET_FREEBSD_NR__umtx_op, "_umtx_op", "%s(%#x, %d, %d, %#x, %#x)", NULL, NULL }, -#if defined(__FreeBSD_version) && __FreeBSD_version < 1000000 -{ TARGET_FREEBSD_NR__umtx_lock, "__umtx_lock", NULL, NULL, NULL }, -{ TARGET_FREEBSD_NR__umtx_unlock, "__umtx_unlock", NULL, NULL, NULL }, -#endif { TARGET_FREEBSD_NR_accept, "accept", "%s(%d,%#x,%#x)", NULL, NULL }, { TARGET_FREEBSD_NR_accept4, "accept4", "%s(%d,%d,%#x,%#x)", NULL, NULL }, { TARGET_FREEBSD_NR_access, "access", "%s(\"%s\",%#o)", NULL, NULL }, @@ -49,10 +45,6 @@ { TARGET_FREEBSD_NR_cap_fcntls_get, "cap_fcntls_get", NULL, NULL, NULL }, { TARGET_FREEBSD_NR_cap_fcntls_limit, "cap_fcntls_limit", NULL, NULL, NULL }, { TARGET_FREEBSD_NR_cap_getmode, "cap_getmode", NULL, NULL, NULL }, -#if defined(__FreeBSD_version) && __FreeBSD_version < 1000000 -{ TARGET_FREEBSD_NR_cap_getrights, "cap_getrights", NULL, NULL, NULL }, -{ TARGET_FREEBSD_NR_cap_new, "cap_new", NULL, NULL, NULL }, -#endif { TARGET_FREEBSD_NR_cap_ioctls_get, "cap_ioctls_get", NULL, NULL, NULL }, { TARGET_FREEBSD_NR_cap_ioctls_limit, "cap_ioctls_limit", NULL, NULL, NULL }, { TARGET_FREEBSD_NR_cap_rights_limit, "cap_rights_limit", NULL, NULL, NULL }, @@ -146,9 +138,6 @@ { TARGET_FREEBSD_NR_freebsd11_kevent, "freebsd11_kevent", NULL, NULL, NULL }, { TARGET_FREEBSD_NR_kevent, "kevent", NULL, NULL, NULL }, { TARGET_FREEBSD_NR_kill, "kill", NULL, NULL, NULL }, -#if defined(__FreeBSD_version) && __FreeBSD_version < 1000000 -{ TARGET_FREEBSD_NR_killpg, "killpg", NULL, NULL, NULL }, -#endif { TARGET_FREEBSD_NR_kqueue, "kqueue", NULL, NULL, NULL }, { TARGET_FREEBSD_NR_ktrace, "ktrace", NULL, NULL, NULL }, { TARGET_FREEBSD_NR_lchown, "lchown", NULL, NULL, NULL }, From patchwork Mon Oct 18 19:01:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542858 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=MUYqkrBl; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY68f02Gdz9sR4 for ; Tue, 19 Oct 2021 06:17:54 +1100 (AEDT) Received: from localhost ([::1]:55636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcY8t-00076A-OS for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:17:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43454) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtT-0008Ap-EA for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:55 -0400 Received: from mail-il1-x131.google.com ([2607:f8b0:4864:20::131]:42944) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtR-0001lB-Hz for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:54 -0400 Received: by mail-il1-x131.google.com with SMTP id y17so15965319ilb.9 for ; Mon, 18 Oct 2021 12:01:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CIQatE8dg36Pa6PMFl/HPTB8wrbRocW2ZkkMxKhIlVw=; b=MUYqkrBlcONTIzoCC/o99WrtyePRFtkZVRtE7obuSTK9t0s0SRJeXPvX0K5dg4ZGa5 LPGN4jYzjK30WPzTWDcq2SJuV23BFEVV8Q+ScRfob42Q2Z39C7WRapH7yPMmLXM2/+3E RMwL38FnNV3zZNpK2laVbFH2+GVoDUx1FNdhrS+mjgHF9ZSf2FDRoKCcBIK2nJQHmaA3 6ruyqN7+CqPUj9NyocGw/bwJDWSSPav42FP/JV+uDknLAi2bds8U2vLTxSKWjeGYIWA0 6c4mJfqvXQK4yEQjAkGhlaXjtlpauIZ6pguF2fFHWSqtd6jJIWqLvkaRW5jkDd3psdif i+DA== 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=CIQatE8dg36Pa6PMFl/HPTB8wrbRocW2ZkkMxKhIlVw=; b=kvNBqn7g0qCyQSzFnQZ5IwTp45LZnX7RkgRUnGzxkUoFAA9zRIstXTQrYoHa8HCv8R sO0DjbL0rUv4XFTuj9SSDjbxiHuxJeqF+ZnstSZ0idFVm+X7bhbkbYzsmuF5Y8M7w8SS wHEgSan+5oWRPxNZ4TAzR6TSznj8fKv1ExJcfaU0Ep4AVXvh8oIuPk6ceKIRsaBANHRt SOZGszIzrS9axsVsUlSyKdW006Fiap23WGIY4o8JdmENmZnHPJmMcDx7WuBSJL2LpmM6 3kQJovttDjdtNmXhF3BN6gdGrGgSaGYWLfUEoTKcK02wT9tU2dHE08POdQKgxuSO1aeF bCtw== X-Gm-Message-State: AOAM533dgMjmNl87gTDxw8dznaxXiRNicFOtyObtuDLBZ7XIX7OyqNO8 hktZctrXRQ0/QYdqd5tjBYm6l+JDK5w7JQ== X-Google-Smtp-Source: ABdhPJxOvXp8qfkCuvBbGIsSpraho5+nYjPOKt1Pd1Jyr/kIOB6BPckrc52wGsJ+UNumkN3r3NVG9g== X-Received: by 2002:a92:cd8e:: with SMTP id r14mr14661672ilb.291.1634583711808; Mon, 18 Oct 2021 12:01:51 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:01:50 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 13/23] bsd-user: TARGET_RESET define is unused, remove it Date: Mon, 18 Oct 2021 13:01:05 -0600 Message-Id: <20211018190115.5365-14-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::131; envelope-from=imp@bsdimp.com; helo=mail-il1-x131.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , Warner Losh , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/i386/target_arch_cpu.h | 2 -- bsd-user/x86_64/target_arch_cpu.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/bsd-user/i386/target_arch_cpu.h b/bsd-user/i386/target_arch_cpu.h index 978e8066af..b28602adbb 100644 --- a/bsd-user/i386/target_arch_cpu.h +++ b/bsd-user/i386/target_arch_cpu.h @@ -23,8 +23,6 @@ #define TARGET_DEFAULT_CPU_MODEL "qemu32" -#define TARGET_CPU_RESET(cpu) - static inline void target_cpu_init(CPUX86State *env, struct target_pt_regs *regs) { diff --git a/bsd-user/x86_64/target_arch_cpu.h b/bsd-user/x86_64/target_arch_cpu.h index 5f5ee602f9..5172b230f0 100644 --- a/bsd-user/x86_64/target_arch_cpu.h +++ b/bsd-user/x86_64/target_arch_cpu.h @@ -23,8 +23,6 @@ #define TARGET_DEFAULT_CPU_MODEL "qemu64" -#define TARGET_CPU_RESET(cpu) - static inline void target_cpu_init(CPUX86State *env, struct target_pt_regs *regs) { From patchwork Mon Oct 18 19:01:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542853 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=7D2OA1QO; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY63H5rKmz9sR4 for ; Tue, 19 Oct 2021 06:13:15 +1100 (AEDT) Received: from localhost ([::1]:46940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcY4O-0001BT-5A for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:13:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtV-0008Gx-FW for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:57 -0400 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]:44993) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtT-0001nJ-HW for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:57 -0400 Received: by mail-il1-x135.google.com with SMTP id j8so15935413ila.11 for ; Mon, 18 Oct 2021 12:01:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vJYc+d0t5Q+xLUHUW/ZgWS+rpFy2RSrgUaVL6ybl14c=; b=7D2OA1QOLLNvtaKRmytGEV2eNTARWOsPhKcqWF+ETH9pwwFigRGv6byF8HVX+zjkXY R3rWlqvV8EGdl3tJBSX7yUWSvIR76YD0jFSSHlWvfrUYOZW9skCcRg4qz/BOuHRLyVtZ GX3BWWiyIIYWV7/KdNIQgEqXTc/NTa6RfzSIJeGsBiJ9grfLcqBAXBGtc0frRElrkvHT GwmblB+sc9dv9bxskrs+VL0Hqbi0O5Q6CN4llc4LfBko89OxSVovRNbvvEsWSC8oNF4M x5ZEowgBYJjgIpQIJbtE9URaDEYsQop1R4S4MsByRsA+TnL7qVrV/T4mr+mYbkjHtuDs ZQOA== 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=vJYc+d0t5Q+xLUHUW/ZgWS+rpFy2RSrgUaVL6ybl14c=; b=dNTGgrQMGRFOa7PeJdmJVSlzDgR/9ddyygkqecAHwmet3tBkFIGcG47qNf11rIvOoR WpprCoc5LEk37s6DaTT9AxEq8Jw50UTK50ZmNksKDHCSGfoUmhaxMGcWE7wzDtr0ZlB3 9SEZdbfKWi8KpDotQy4aQ4LSqt3CVNzrAL1Ke2DcCM67JmV9FSbutIAv5wlRWKpO+zIi BzaFQE+Ls1e2+WJy3/62PvWpMajPrfZc2kwcFXOT59WeKbtjNKEGT2pDyGjRz1jlaZ+K MEMDKTnUqp3B1OoiSeo1cwytI5Fw7tcol2N9VJWEpdTzkyK1zYI/BF9bsQnlzZmcskHB ly4Q== X-Gm-Message-State: AOAM532bwv0aqQVv8AxyVx2FDBLoU2yTudfIsJ8aA+bUq94CWaJvQYCT YHBvXIvwrnhWwsNDsuNECkdpSCfkw0zEdw== X-Google-Smtp-Source: ABdhPJy1zuxEL4kHS/Y8Xjrave3PZkXgPsANYdCZrvGE0DSBUwhpNt8sDR7/H0spKv/MCPnGS6u4pA== X-Received: by 2002:a92:cf50:: with SMTP id c16mr8309640ilr.145.1634583714061; Mon, 18 Oct 2021 12:01:54 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:01:52 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 14/23] bsd-user: export get_errno and is_error from syscall.c Date: Mon, 18 Oct 2021 13:01:06 -0600 Message-Id: <20211018190115.5365-15-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::135; envelope-from=imp@bsdimp.com; helo=mail-il1-x135.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , Warner Losh , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Make get_errno and is_error global so files other than syscall.c can use them. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/qemu.h | 4 ++++ bsd-user/syscall.c | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 522d6c4031..3b8475394c 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -235,6 +235,10 @@ extern unsigned long target_dflssiz; extern unsigned long target_maxssiz; extern unsigned long target_sgrowsiz; +/* syscall.c */ +abi_long get_errno(abi_long ret); +bool is_error(abi_long ret); + /* user access */ #define VERIFY_READ PAGE_READ diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c index 372836d44d..2fd2ba8330 100644 --- a/bsd-user/syscall.c +++ b/bsd-user/syscall.c @@ -33,18 +33,18 @@ static abi_ulong target_brk; static abi_ulong target_original_brk; -static inline abi_long get_errno(abi_long ret) +abi_long get_errno(abi_long ret) { - if (ret == -1) + if (ret == -1) { /* XXX need to translate host -> target errnos here */ return -(errno); - else - return ret; + } + return ret; } #define target_to_host_bitmask(x, tbl) (x) -static inline int is_error(abi_long ret) +bool is_error(abi_long ret) { return (abi_ulong)ret >= (abi_ulong)(-4096); } From patchwork Mon Oct 18 19:01:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542854 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=eoi3R+Ru; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY63Z49Kgz9sR4 for ; Tue, 19 Oct 2021 06:13:29 +1100 (AEDT) Received: from localhost ([::1]:47696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcY4b-0001gR-SF for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:13:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43488) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtX-0008Mc-Ee for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:02:01 -0400 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]:43730) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtV-0001rb-Ir for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:01:59 -0400 Received: by mail-il1-x129.google.com with SMTP id a8so15941508ilj.10 for ; Mon, 18 Oct 2021 12:01:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gBuwZiJ9BJDMY4BHAGpRW/Ll8SJFKvYBNDg389aCn34=; b=eoi3R+RuM77VhxdANFk7Uv7rRU6+OhXQfHo/VMLpBVJCCRuXtc9rq3Qjeo45tHp47I 50a8hWy8eebvgVA51kmS4OiLsVbKX1wJvGva6uKOSqxCtY/em9IoQDgsP5VVvJqHkYJ+ jnUx2g1gsvwWIgyJgwBomggGqxKxx44qyfzSkJu3CuwFxrrfMGWgPvZvXYHrEGvQT8rf cf9dKkZXR9URjwnmrOwIw+GW83p3/e4YmWliHwl6CcM6hZCLj7gwdyGL4X1vN7P7tHEj HcnsXQIJrPmjUBoRl2eZMDPVDdqy3nDKMI9jVde37V99dPR++OHIr4L0vY/QuIhr+wwJ 2dYg== 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=gBuwZiJ9BJDMY4BHAGpRW/Ll8SJFKvYBNDg389aCn34=; b=owfduA9MjpOL3Nspd9iKSH/Eu8xXUlrD5b+ZmgmH0lpHP9lOtetdYom/1avkgsOlF2 v47ZVrd8zhp3cZ8aJLWDmWABkZtXP+abJtkNxe6rnEcH9N9GtN/VzoHEO0y47tC7hvEQ 0K8tuzgZMsfb4rGyVqYGS37TpzPzSbjQ5NqtFJBtRkywEOIL1+uJqpwgR6ctagHWHRbF cOKAuxc1WqI56WFwJACeZjvJHLg3x81fMSsQKy7P/cIKG8wNlHnanURFiQ2rDDnInkhc ZOyel/vIEOeFpTzyQuD7ZwX69sUFkgCeMVuqanTzPbJfg+Avl8I4LJiVs05h9S5oJ1Om gDQw== X-Gm-Message-State: AOAM533ju4JufprZVfWk4QGSnDgYSEOMLskI7g2Yn2mk7ajYbp3d9+RG 16asYxDB6BDntI7OCNOZb1LpToctY8N9Qw== X-Google-Smtp-Source: ABdhPJwVFP+0l1r0qNje/Vv4aZQmgLh8b23Aq1v0JQixRSPkSdosceSO6PET6pieN6+mLG6TPEzXSw== X-Received: by 2002:a92:6902:: with SMTP id e2mr8172908ilc.199.1634583716126; Mon, 18 Oct 2021 12:01:56 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:01:54 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 15/23] bsd-user/errno_defs.h: Add internal error numbers Date: Mon, 18 Oct 2021 13:01:07 -0600 Message-Id: <20211018190115.5365-16-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::129; envelope-from=imp@bsdimp.com; helo=mail-il1-x129.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Stacey Son , Laurent Vivier , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Stacey Son To emulate signals and interrupted system calls, we need to have the same mechanisms we have in the kernel, including these errno values. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/errno_defs.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bsd-user/errno_defs.h b/bsd-user/errno_defs.h index 1efa502a12..832671354f 100644 --- a/bsd-user/errno_defs.h +++ b/bsd-user/errno_defs.h @@ -1,6 +1,3 @@ -/* $OpenBSD: errno.h,v 1.20 2007/09/03 14:37:52 millert Exp $ */ -/* $NetBSD: errno.h,v 1.10 1996/01/20 01:33:53 jtc Exp $ */ - /* * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. @@ -37,6 +34,9 @@ * @(#)errno.h 8.5 (Berkeley) 1/21/94 */ +#ifndef _ERRNO_DEFS_H_ +#define _ERRNO_DEFS_H_ + #define TARGET_EPERM 1 /* Operation not permitted */ #define TARGET_ENOENT 2 /* No such file or directory */ #define TARGET_ESRCH 3 /* No such process */ @@ -147,3 +147,10 @@ #define TARGET_EIDRM 89 /* Identifier removed */ #define TARGET_ENOMSG 90 /* No message of desired type */ #define TARGET_ELAST 90 /* Must be equal largest errno */ + +/* Internal errors: */ +#define TARGET_EJUSTRETURN 254 /* Just return without modifing regs */ +#define TARGET_ERESTART 255 /* Restart syscall */ +#define TARGET_ERESTARTSYS TARGET_ERESTART /* Linux compat */ + +#endif /* ! _ERRNO_DEFS_H_ */ From patchwork Mon Oct 18 19:01:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542857 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=DT8hHgyx; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY67H33SYz9sR4 for ; Tue, 19 Oct 2021 06:16:43 +1100 (AEDT) Received: from localhost ([::1]:54156 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcY7j-00066G-KF for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:16:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtc-0008Ow-BB for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:02:05 -0400 Received: from mail-il1-x12e.google.com ([2607:f8b0:4864:20::12e]:37746) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtZ-0001uY-El for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:02:04 -0400 Received: by mail-il1-x12e.google.com with SMTP id x1so15977364ilv.4 for ; Mon, 18 Oct 2021 12:01:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vE4GJOojXPt/WEFBXi9UzAgsNYJONi1/f2Ovar658Qo=; b=DT8hHgyxNuwjenwdKHh3q/panOSZ14kmyR9K3yF8rFjTDVdYAp2ZEczA1TuZkHnJC2 704Y1nEt5d9O3hrNsdK9Ff5HEDIPjfCY1e6QVyxjePphdJPJHExYY6GXQzInm9M6FwTA NsEpNyKnCnRv8CE740JJx4M1AYET8b4CQ0JeDraL7+WpPKYH26FPKG5ebfdouNUAtVO8 ODosmZeS/7b3urs+L5AsPsW6MFusFf8fNG7oTVAPRUtVAkxDvl0N5vkuCYJB7mIiqbx6 nzuasSqUt5o76ElKM3dvJKx68XQP2RNg7FsmPRhXZtkuW8SED+QIYKcnocucNerqcOzt eZqw== 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=vE4GJOojXPt/WEFBXi9UzAgsNYJONi1/f2Ovar658Qo=; b=re3aHOly7QGVprEVcPytsBcVQ35SCO42gA2ATvRiApd9il1PTRxSYEVhHIDdcmVMcf fXEKe0XdUurbfqFH+8Q+lnzpDCQmAqiyFtO1k5Ca2OvVbD1abVw4hMw8SmgiUr1fuJ4H Shglc1wZehdNa1u6g0BysMqZgGwHe5udOvknWkqikJ8gHinc5VPknckwgOoO+ybwlNyr 7BnYAqpJPeB1LJn+OYnMALTCVBaPehMRyZTBbHoSAK2rhVGPuEAW6ke7/hJrm61+M/7s Qk0uMIVz2TpSCeM3mdNa5aLGpNnERxNyE3KuqZClQ05QMfXJIGiyGVwVWN9/Y/1jCZUs cKRg== X-Gm-Message-State: AOAM531KP4WmpbqpyLMeK0pjL52Fjb85gkJAvvtwa8/eQ7suva9jK9sa xy38SpZbSQTL/WFC1XvIwE17nBBLSPc8fQ== X-Google-Smtp-Source: ABdhPJzvTcQ7fCI4I/zE4ccr7x355Gfu77j7LLN63lC833ZutG0bFHNd73h6zqdT2+Du2ClvAV1ckQ== X-Received: by 2002:a05:6e02:1808:: with SMTP id a8mr15967139ilv.247.1634583718445; Mon, 18 Oct 2021 12:01:58 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:01:56 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 16/23] bsd-user: move TARGET_MC_GET_CLEAR_RET to target_os_signal.h Date: Mon, 18 Oct 2021 13:01:08 -0600 Message-Id: <20211018190115.5365-17-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12e; envelope-from=imp@bsdimp.com; helo=mail-il1-x12e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , Warner Losh , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Move TARGET_MC_GET_CLEAR_RET to freebsd/target_os_signal.h since it's architecture agnostic on FreeBSD. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/freebsd/target_os_signal.h | 3 +++ bsd-user/i386/target_arch_signal.h | 2 -- bsd-user/x86_64/target_arch_signal.h | 2 -- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bsd-user/freebsd/target_os_signal.h b/bsd-user/freebsd/target_os_signal.h index 3ed454e086..1a4c5faf19 100644 --- a/bsd-user/freebsd/target_os_signal.h +++ b/bsd-user/freebsd/target_os_signal.h @@ -1,6 +1,9 @@ #ifndef _TARGET_OS_SIGNAL_H_ #define _TARGET_OS_SIGNAL_H_ +/* FreeBSD's sys/ucontext.h defines this */ +#define TARGET_MC_GET_CLEAR_RET 0x0001 + #include "target_os_siginfo.h" #include "target_arch_signal.h" diff --git a/bsd-user/i386/target_arch_signal.h b/bsd-user/i386/target_arch_signal.h index 9812c6b034..a90750d602 100644 --- a/bsd-user/i386/target_arch_signal.h +++ b/bsd-user/i386/target_arch_signal.h @@ -27,8 +27,6 @@ #define TARGET_MINSIGSTKSZ (512 * 4) /* min sig stack size */ #define TARGET_SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended size */ -#define TARGET_MC_GET_CLEAR_RET 0x0001 - struct target_sigcontext { /* to be added */ }; diff --git a/bsd-user/x86_64/target_arch_signal.h b/bsd-user/x86_64/target_arch_signal.h index 4c1ff0e5ba..4bb753b08b 100644 --- a/bsd-user/x86_64/target_arch_signal.h +++ b/bsd-user/x86_64/target_arch_signal.h @@ -27,8 +27,6 @@ #define TARGET_MINSIGSTKSZ (512 * 4) /* min sig stack size */ #define TARGET_SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended size */ -#define TARGET_MC_GET_CLEAR_RET 0x0001 - struct target_sigcontext { /* to be added */ }; From patchwork Mon Oct 18 19:01:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542861 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=t6SXIc/K; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY6Dg6Slwz9sR4 for ; Tue, 19 Oct 2021 06:21:23 +1100 (AEDT) Received: from localhost ([::1]:34018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcYCH-0003AS-Kp for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:21:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtb-0008Ot-Ml for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:02:05 -0400 Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]:46078) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtZ-0001vN-FP for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:02:03 -0400 Received: by mail-il1-x136.google.com with SMTP id i11so15937636ila.12 for ; Mon, 18 Oct 2021 12:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=laLU0XX8CdBP2//L0jChpwkHQR7NdHyxMB0d78r5Vqk=; b=t6SXIc/Km8JHggmPMcVrtyKEnpRjgrU9dZpvjuZrcq854mVo7qY5djsGa7ZmQiIWas 1k/1fxNLXS9Ajfmfk2L3PAVcoCWUtA+OX1NqUMEWORMuIMMtK+zRIAjbg9EwQ5hHR6ZM zU8BkWa98A+A4UyfxfOnrJQLK+FxkqrhFo3LCaxnO/CNaKfAX4ak6I9TKLM4XozaaboR rgaVNCBQSIdOfvoIWGoBk06FfdvFmPWDQZ4pasf3phShpoU6vwYkL8tThZOxHfv5NQQO ouF0joN/DiC30wDXfEhSlhcTYdywQf1+giV546YzH8INNMQxMAm0o4ZhgMkZMITHO9ZD kqJw== 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=laLU0XX8CdBP2//L0jChpwkHQR7NdHyxMB0d78r5Vqk=; b=DHcQkv2OnrWHzOXbLuDMfmGCM/XvZmMGlPAaBAiernacEmjaD3fDsCNRQmZ1ZUd/m7 3veO8Pyti0ubdnvja9i+CLv+yxCGz/pxLPep/EiIkatgeJaZSJPeQTkaaAvu8UHCy4Fq PDyqAcSLI+2YP8hcmgVSbRq3BoydHr4d2uWx+Pmh9RYWMVWwHjzxGeP6eeju5g6Dg48A lL/6BG4tU4+GZ/sqNvzdLLX/34OoWCsRsMytUzxkI2pA+7oruA2CfkvRKH+/mDuWLbpL Mw2Gms/0+hHTLBejASHF8ij0HuBjEDnawGnush7iSA8GZrS5UDS1yuBXG8y7kwocceFG jx8Q== X-Gm-Message-State: AOAM531T34Eo/VEAMaIxYOy3WAMY/ZCQPZkzoWt4QiQy8CPftAxNYMG+ dM/9TipkHGRw9xeFPhxFl1KpXpG4FSFPpA== X-Google-Smtp-Source: ABdhPJxq66kAh4NsMlA/K+9VdJloEkKGA67LniFINeUk3ke+RCzZHIxCW1Lp3Aj6n6qpDPt0DDz5rg== X-Received: by 2002:a05:6e02:8a3:: with SMTP id a3mr14874311ilt.88.1634583719652; Mon, 18 Oct 2021 12:01:59 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:01:58 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 17/23] bsd-user/target_os_elf.h: Remove fallback ELF_HWCAP and reorder Date: Mon, 18 Oct 2021 13:01:09 -0600 Message-Id: <20211018190115.5365-18-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::136; envelope-from=imp@bsdimp.com; helo=mail-il1-x136.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , Warner Losh , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" All architectures have a ELF_HWCAP, so remove the fallback ifdef. Place ELF_HWCAP in the same order as on native FreeBSD. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/freebsd/target_os_elf.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/bsd-user/freebsd/target_os_elf.h b/bsd-user/freebsd/target_os_elf.h index 2d03a883aa..adcffd1ddb 100644 --- a/bsd-user/freebsd/target_os_elf.h +++ b/bsd-user/freebsd/target_os_elf.h @@ -38,10 +38,6 @@ #define ELF_PLATFORM (NULL) #endif -#ifndef ELF_HWCAP -#define ELF_HWCAP 0 -#endif - /* XXX Look at the other conflicting AT_* values. */ #define FREEBSD_AT_NCPUS 19 #define FREEBSD_AT_HWCAP 25 @@ -114,12 +110,12 @@ static abi_ulong target_create_elf_tables(abi_ulong p, int argc, int envc, NEW_AUX_ENT(AT_FLAGS, (abi_ulong)0); NEW_AUX_ENT(FREEBSD_AT_NCPUS, (abi_ulong)bsd_get_ncpu()); NEW_AUX_ENT(AT_ENTRY, load_bias + exec->e_entry); + features = ELF_HWCAP; + NEW_AUX_ENT(FREEBSD_AT_HWCAP, features); NEW_AUX_ENT(AT_UID, (abi_ulong)getuid()); NEW_AUX_ENT(AT_EUID, (abi_ulong)geteuid()); NEW_AUX_ENT(AT_GID, (abi_ulong)getgid()); NEW_AUX_ENT(AT_EGID, (abi_ulong)getegid()); - features = ELF_HWCAP; - NEW_AUX_ENT(FREEBSD_AT_HWCAP, features); target_auxents = sp; /* Note where the aux entries are in the target */ #ifdef ARCH_DLINFO /* From patchwork Mon Oct 18 19:01:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542864 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=GJwBQFgm; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY6JB6rpmz9sR4 for ; Tue, 19 Oct 2021 06:24:25 +1100 (AEDT) Received: from localhost ([::1]:41124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcYFC-00088R-20 for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:24:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtd-0008Ox-14 for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:02:05 -0400 Received: from mail-il1-x131.google.com ([2607:f8b0:4864:20::131]:40931) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXta-0001wV-5w for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:02:04 -0400 Received: by mail-il1-x131.google.com with SMTP id k3so5597931ilo.7 for ; Mon, 18 Oct 2021 12:02:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HPM2AzR8oxs4nLDPoDsk3u1X7tCQIZsDcwBBkLry0yo=; b=GJwBQFgmf4MAUHfvDecqbOVCBJdLu21CUaELdwmil5hl8DU9JkaJWngSXS2WnbpSS0 j6w5hg/I3/hN2zHs1ypqg7i9x+CJqRQyS3HpN6nDbGHPYH7xfuV8rCLTa9OATiDV/+LJ 9ZuVuXLFVjju7hNjREqt/Y2XP8yVg+xiiXpmcyCA7hC88fAb1UDHFHT+Q1pymjX3NsEo 4t3GrZFF61Jy1dMgjvOSC4IIbxpGuJNP0FzkQJ6pqNDMUq1S59bMwXLQ1wrmjS3uRY/j JiEq5eNo6eYd5jMzRF/5OV8qSPyft91wBLKKZ0DtnauAMtSLhtPgVDoSotm5rRcOffmT L0EA== 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=HPM2AzR8oxs4nLDPoDsk3u1X7tCQIZsDcwBBkLry0yo=; b=pQA6tx58/LA9EDVjlRCzjVN6lFoQt5K//q9z7v0Yv63gpjgcZfP+hMSnSN06vwSU5B Zq29OvW05zCXqEfjtrP+dRUyll07Rn5WYlSLdbFmbYa5OdZUMuQl6ckapiCD2gPg+9um 8b6Z8zDql1w7gtBWgy+Cle6aC+3MduvxeS2CYxdZYjHBH4kMIwank7HzPdRzqW87qY0u Y6Nv+Z3Bhgm8vFOKITx8CN08Qq0B8QgFpNASZ0HhY+ViAOH0k3S57ANBDy3nmZKfavFf 23ymKXZY81hpNkm0rlWmM1QrnSRKG+rBp9b5rtBmvbuGu6WBQbczeTExlpoKrdknir3E Omwg== X-Gm-Message-State: AOAM532CKAhYZKNhol6VWsYv8esr8opo+l3kILeVU6WjbR60dGmi1Iw+ A86w7X/ksrLRCMMRoh2jpEhEyqW/oAvDbQ== X-Google-Smtp-Source: ABdhPJxWjR9xh4SZK1zNuilupLDY3GkDrhTXK/3vNDouMqzHMs3JnyVb+y7UAOyrkuK3hqlT9WEVYw== X-Received: by 2002:a05:6e02:20ca:: with SMTP id 10mr15971021ilq.118.1634583720772; Mon, 18 Oct 2021 12:02:00 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.01.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:02:00 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 18/23] bsd-user/target_os_elf: If ELF_HWCAP2 is defined, publish it Date: Mon, 18 Oct 2021 13:01:10 -0600 Message-Id: <20211018190115.5365-19-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::131; envelope-from=imp@bsdimp.com; helo=mail-il1-x131.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , Warner Losh , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Some architectures publish AT_HWCAP2 as well as AT_HWCAP. Those architectures will define ELF_HWCAP2 in their target_arch_elf.h files for the value for this process. If it is defined, then publish it. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/freebsd/target_os_elf.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bsd-user/freebsd/target_os_elf.h b/bsd-user/freebsd/target_os_elf.h index adcffd1ddb..e5ac8e8e50 100644 --- a/bsd-user/freebsd/target_os_elf.h +++ b/bsd-user/freebsd/target_os_elf.h @@ -112,6 +112,10 @@ static abi_ulong target_create_elf_tables(abi_ulong p, int argc, int envc, NEW_AUX_ENT(AT_ENTRY, load_bias + exec->e_entry); features = ELF_HWCAP; NEW_AUX_ENT(FREEBSD_AT_HWCAP, features); +#ifdef ELF_HWCAP2 + features = ELF_HWCAP2; + NEW_AUX_ENT(FREEBSD_AT_HWCAP2, features); +#endif NEW_AUX_ENT(AT_UID, (abi_ulong)getuid()); NEW_AUX_ENT(AT_EUID, (abi_ulong)geteuid()); NEW_AUX_ENT(AT_GID, (abi_ulong)getgid()); From patchwork Mon Oct 18 19:01:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542860 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=Xa/xZRAd; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY6Bh6VlBz9sR4 for ; Tue, 19 Oct 2021 06:19:40 +1100 (AEDT) Received: from localhost ([::1]:60616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcYAc-00021c-Kl for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:19:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtf-0008R6-VK for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:02:08 -0400 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]:41600) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtb-0001xX-Id for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:02:07 -0400 Received: by mail-il1-x132.google.com with SMTP id l7so2644031iln.8 for ; Mon, 18 Oct 2021 12:02:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9dKXTIcJctOXE/jsCcOkT7BJa9rm6vlffSX8NI3ogMM=; b=Xa/xZRAdxg3Ps4yxMAf9i3Qx+riEAsB7zzJulNrByDaCHQ0xDF2ApWMnAQ0oESMhoI HBylhO+tEarMED2YPBSY4/XV5qtvHLbff+Nwz8+62WWu+7c74FjIpw4uhpvH0SGyiK6l 340gEImFW87fO1bPfBWWSnrYGUiMhvYTxPgkEb0wsJUhZbOiZM950sSXK5M7P0Sv7U6K l3B6CrMxiPhlXTVko5Ap0PXQsyEw9odOTziB7vhjH75ik1S4F831wEeypCp7I+gx879e PfiEDd+IVgEvtg67tuJbybfeE4IkR242KVwN+cznjBp0weoib/8jzex/bxgL0HxclJFn WWjQ== 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=9dKXTIcJctOXE/jsCcOkT7BJa9rm6vlffSX8NI3ogMM=; b=4fKoyy0A/3yvYm6unkw+EFRpSYqU2wLnvEPxrz8TPwIlQptybPwK2YDOBq1FsQDqp+ KuxPyOsa/bXrUyc/+YDO0IqAtR52yZ5QfXLU9M6ohdR5HKUUqFqhszAYtSUOS7ETdpTD H8fcHdW7ihRMXFcUdJ1rTwybTVX0H9hGKcobIinY4EvK54RNR61SRtou4mmGmNUwwmT2 Q2Je/t63qLl/534KiJsYvnRmKx8x/2I/mZCi3OwPS4Ft9l8j2A2xf7Jv52uY4vB3gdrB afPJ+nxMGZt32yE6zuzmr6RJgpm4G4U5/+F33JABkO0E2xjUQSgDtFLOpBCWi4fS64uv /AgA== X-Gm-Message-State: AOAM533TFw5pPGvunjuj1l7yDQ1l4wRlfa+Jfpe1QYGtUTmkaHk+n78k DErsRPx1GMkgPCV6Dc5uVHEbFofW8jUYvw== X-Google-Smtp-Source: ABdhPJyn8qGBCUqOtRX+FI3Thwl0y7SMJguI+XAmy9Jyi8ffNC0JAEwE5YNbNX156/EfIIwPNns9RQ== X-Received: by 2002:a05:6e02:194d:: with SMTP id x13mr15493780ilu.266.1634583721974; Mon, 18 Oct 2021 12:02:01 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.02.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:02:01 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 19/23] bsd-user: Remove used from TaskState Date: Mon, 18 Oct 2021 13:01:11 -0600 Message-Id: <20211018190115.5365-20-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::132; envelope-from=imp@bsdimp.com; helo=mail-il1-x132.google.com X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , Warner Losh , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The 'used' field in TaskState is write only. Remove it from TaskState. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/main.c | 1 - bsd-user/qemu.h | 1 - 2 files changed, 2 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index 48643eeabc..ee84554854 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -210,7 +210,6 @@ void init_task_state(TaskState *ts) { int i; - ts->used = 1; ts->first_free = ts->sigqueue_table; for (i = 0; i < MAX_SIGQUEUE_SIZE - 1; i++) { ts->sigqueue_table[i].next = &ts->sigqueue_table[i + 1]; diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 3b8475394c..c1170f14d9 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -92,7 +92,6 @@ typedef struct TaskState { struct TaskState *next; struct bsd_binprm *bprm; - int used; /* non zero if used */ struct image_info *info; struct emulated_sigtable sigtab[TARGET_NSIG]; From patchwork Mon Oct 18 19:01:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542863 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=663SJcFM; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY6HN62chz9sR4 for ; Tue, 19 Oct 2021 06:23:44 +1100 (AEDT) Received: from localhost ([::1]:39790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcYEY-0007DC-KN for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:23:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtf-0008Qk-Cm for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:02:08 -0400 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]:37743) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtd-0001yM-32 for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:02:06 -0400 Received: by mail-il1-x12a.google.com with SMTP id x1so15977584ilv.4 for ; Mon, 18 Oct 2021 12:02:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gOB7gGX/i+XSfRneCtiATYoM7MpsErjYQkyIib0hZP8=; b=663SJcFMTOTKwHKIfFAXsFP0UsQcj5WO4YnnL6vTxkByWulZHLAtBMbMz5K5z4N0+a LhQAIU8TYivoGGJhLAA6YrxvB+FzZrl/iqkXdLwYNGqRfjSQeMcLpOcxF9Kcb/EbTUGh 9Qe+cm1c2fWYmg8TQ1Nvpq1a9rXo3MxBRd7a5URQJ4HRxdPNpYYplFE/Gn1145Qam+Id QL1flDQkkfoWfz0QQBl261kQr92VWOjavWLIYEF0yap4sfoTu1BdtOCdQRTArJ7/2ZIT rQFFIwsMYERNYHn4hdE35Y+wZv+gmEPGhyMUH4uflTP/HNeNUXWAzM+OtLcsOUXXtVGz 6Amw== 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=gOB7gGX/i+XSfRneCtiATYoM7MpsErjYQkyIib0hZP8=; b=B8klNYjBddKWH5y7BvLOEi+FKorkTS5tf2BXN77qtLMWvtJQ5lvSRmL4UPUIYZftC5 6RqE2kaqGSet6kOV1ivJdziGGnxOxZR1mF6cUlWl99JvVz0h+I2clzR0XgAwJdiIohY2 /SSccUHaVsXPb46ZMmOYJhdD3pdSov5St1qbuoQCpqQn2azz+hpI4d1KAzfePaYDs/wL gXFEBrR7jCr6rk9TRkg9UB1JXOYLd+rUJaT+tpkpn4FgANQmvlQcjVa05hhgFPniyLMJ mk8OCi1UUQaKD+/8YVb/ifWjuoxqoHi80ksikaJFTGZYa7PPo0sKNo0+atyZFHVUYRZf 1KRw== X-Gm-Message-State: AOAM532S4DlE0tlF1iEMU6HMx7VAnYS3Oid/FUEIsEyMnGVV646QgI/+ zNY3chI8mbzDpi9eboQ96Q9fUz000j6iqw== X-Google-Smtp-Source: ABdhPJyv5FShyUJTBOtYeSIX+d757pUmDm7QHJKwyCI6JU0Lt5749Rl8PAFC4fM4Zxvugg1eiuS7CQ== X-Received: by 2002:a05:6e02:1a8e:: with SMTP id k14mr15124708ilv.77.1634583723787; Mon, 18 Oct 2021 12:02:03 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.02.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:02:02 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 20/23] bsd-user: Add stop_all_tasks Date: Mon, 18 Oct 2021 13:01:12 -0600 Message-Id: <20211018190115.5365-21-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::12a; envelope-from=imp@bsdimp.com; helo=mail-il1-x12a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Stacey Son , Laurent Vivier , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Similar to the same function in linux-user: this stops all the current tasks. Signed-off-by: Stacey Son Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/main.c | 9 +++++++++ bsd-user/qemu.h | 1 + 2 files changed, 10 insertions(+) diff --git a/bsd-user/main.c b/bsd-user/main.c index ee84554854..cb5ea40236 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -195,6 +195,15 @@ static void usage(void) __thread CPUState *thread_cpu; +void stop_all_tasks(void) +{ + /* + * We trust when using NPTL (pthreads) start_exclusive() handles thread + * stopping correctly. + */ + start_exclusive(); +} + bool qemu_cpu_is_self(CPUState *cpu) { return thread_cpu == cpu; diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index c1170f14d9..cdb85140f4 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -103,6 +103,7 @@ typedef struct TaskState { } __attribute__((aligned(16))) TaskState; void init_task_state(TaskState *ts); +void stop_all_tasks(void); extern const char *qemu_uname_release; /* From patchwork Mon Oct 18 19:01:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542856 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=SIvtSSa1; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY66t30X4z9sR4 for ; Tue, 19 Oct 2021 06:16:22 +1100 (AEDT) Received: from localhost ([::1]:53328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcY7O-0005Qk-Fa for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:16:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43598) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtg-0008RA-QB for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:02:08 -0400 Received: from mail-io1-xd31.google.com ([2607:f8b0:4864:20::d31]:43585) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXte-0001zQ-TB for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:02:08 -0400 Received: by mail-io1-xd31.google.com with SMTP id y67so17467999iof.10 for ; Mon, 18 Oct 2021 12:02:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=G30MUb6lWC10SOxAq7yJXdYDan64XgWpt5jR9Uu/6d8=; b=SIvtSSa1iC7GMo61jPcI2EQHMyUzwACYL2xcTXKSDi7B8s6iWa9r64/wPqBuWcZHsC cx9vL4VWUDn3SzKkGAPtbZA4RC3VbZ1CqCqmQnJZkg5FV5Ss2h4wmV5i48xPdObH17J4 9VBL96DrxcMCh1jV95EGCY5Gxou9qae/KVL9r89IrVZveGuLY/44XDJNXOMkIYqzrav1 EnRzIJAo1cmaJYKUWrHnZ2NUYzt3OZ2UAQLAjYHEFLAS4/7vXVGOsVZgaFY7RNsVz7d0 IF8Z4Hqme9OxGUdtYWsM6OoHYBbyYoeowu2H9oF6SIAYUG11+Yx1BIlRPspLaUyJ/tQH t3uA== 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=G30MUb6lWC10SOxAq7yJXdYDan64XgWpt5jR9Uu/6d8=; b=MhaR/sEYLvnKUOtrPU0p+TEaZ8ARci0A+N6MK3hgv7XNv5yNHckSdEKUs4S7Tehy/6 x+RB4Y4TCUvVd8gHcDrNC/TDG1cnAQx2JozfIVPJHv0XBFR0c7lrlfXz6MeYv2kOKsXY 1Qe1Z6X6vfhZczJEtJRhf/hjTYbAFHTM9/eudO/4L0FX/V6UFKAQjh0vrO5nEVB3K9LZ /Dcen6u66CTlKd+LvT+uv8FpaSZ8+9LeMhwssI0n4pd1NmqkGyd7rsuewU4BsAY2xRP1 kq4U9l61TI8zmCzGLYF/6owULTYsiHX5r+FS2URxH3mP/pWOnRioAlrvV0otXWF96crm aizg== X-Gm-Message-State: AOAM531o5iLXyUurKPALiIc4at1eQFVbnNbJ5w9PS5BwE2AP/M7kciDu 6K5C6vsBbOBDo6+w9WvBLedxuAfyzPoDBg== X-Google-Smtp-Source: ABdhPJzGgbZihhsk49p+aR1PX3rMONsM31g30/GxytW2I+5PyeyGztCZerVIu7sYU3VWDuQlWjzUnw== X-Received: by 2002:a02:9f1a:: with SMTP id z26mr1142458jal.86.1634583724845; Mon, 18 Oct 2021 12:02:04 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.02.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:02:04 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 21/23] bsd-user/sysarch: Move to using do_freebsd_arch_sysarch interface Date: Mon, 18 Oct 2021 13:01:13 -0600 Message-Id: <20211018190115.5365-22-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::d31; envelope-from=imp@bsdimp.com; helo=mail-io1-xd31.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" do_freebsd_arch_sysarch() exists in $ARCH/target_arch_sysarch.h for x86. Call it from do_freebsd_sysarch() and remove the mostly duplicate version in syscall.c. Future changes will move it to os-sys.c and support other architectures. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/freebsd/meson.build | 3 +++ bsd-user/freebsd/os-sys.c | 27 +++++++++++++++++++ bsd-user/meson.build | 3 +++ bsd-user/qemu.h | 3 +++ bsd-user/syscall.c | 50 ------------------------------------ 5 files changed, 36 insertions(+), 50 deletions(-) create mode 100644 bsd-user/freebsd/meson.build create mode 100644 bsd-user/freebsd/os-sys.c diff --git a/bsd-user/freebsd/meson.build b/bsd-user/freebsd/meson.build new file mode 100644 index 0000000000..4b69cca7b9 --- /dev/null +++ b/bsd-user/freebsd/meson.build @@ -0,0 +1,3 @@ +bsd_user_ss.add(files( + 'os-sys.c', +)) diff --git a/bsd-user/freebsd/os-sys.c b/bsd-user/freebsd/os-sys.c new file mode 100644 index 0000000000..309e27b9d6 --- /dev/null +++ b/bsd-user/freebsd/os-sys.c @@ -0,0 +1,27 @@ +/* + * FreeBSD sysctl() and sysarch() system call emulation + * + * Copyright (c) 2013-15 Stacey D. Son + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "qemu.h" +#include "target_arch_sysarch.h" + +/* sysarch() is architecture dependent. */ +abi_long do_freebsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2) +{ + return do_freebsd_arch_sysarch(cpu_env, arg1, arg2); +} diff --git a/bsd-user/meson.build b/bsd-user/meson.build index 5378f56f71..87885d91ed 100644 --- a/bsd-user/meson.build +++ b/bsd-user/meson.build @@ -12,3 +12,6 @@ bsd_user_ss.add(files( 'syscall.c', 'uaccess.c', )) + +# Pull in the OS-specific build glue, if any +subdir(targetos) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index cdb85140f4..e65e41d53d 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -239,6 +239,9 @@ extern unsigned long target_sgrowsiz; abi_long get_errno(abi_long ret); bool is_error(abi_long ret); +/* os-sys.c */ +abi_long do_freebsd_sysarch(void *cpu_env, abi_long arg1, abi_long arg2); + /* user access */ #define VERIFY_READ PAGE_READ diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c index 2fd2ba8330..d3322760f4 100644 --- a/bsd-user/syscall.c +++ b/bsd-user/syscall.c @@ -88,56 +88,6 @@ static abi_long do_obreak(abi_ulong new_brk) return 0; } -#if defined(TARGET_I386) -static abi_long do_freebsd_sysarch(CPUX86State *env, int op, abi_ulong parms) -{ - abi_long ret = 0; - abi_ulong val; - int idx; - - switch (op) { -#ifdef TARGET_ABI32 - case TARGET_FREEBSD_I386_SET_GSBASE: - case TARGET_FREEBSD_I386_SET_FSBASE: - if (op == TARGET_FREEBSD_I386_SET_GSBASE) -#else - case TARGET_FREEBSD_AMD64_SET_GSBASE: - case TARGET_FREEBSD_AMD64_SET_FSBASE: - if (op == TARGET_FREEBSD_AMD64_SET_GSBASE) -#endif - idx = R_GS; - else - idx = R_FS; - if (get_user(val, parms, abi_ulong)) - return -TARGET_EFAULT; - cpu_x86_load_seg(env, idx, 0); - env->segs[idx].base = val; - break; -#ifdef TARGET_ABI32 - case TARGET_FREEBSD_I386_GET_GSBASE: - case TARGET_FREEBSD_I386_GET_FSBASE: - if (op == TARGET_FREEBSD_I386_GET_GSBASE) -#else - case TARGET_FREEBSD_AMD64_GET_GSBASE: - case TARGET_FREEBSD_AMD64_GET_FSBASE: - if (op == TARGET_FREEBSD_AMD64_GET_GSBASE) -#endif - idx = R_GS; - else - idx = R_FS; - val = env->segs[idx].base; - if (put_user(val, parms, abi_ulong)) - return -TARGET_EFAULT; - break; - /* XXX handle the others... */ - default: - ret = -TARGET_EINVAL; - break; - } - return ret; -} -#endif - #ifdef __FreeBSD__ /* * XXX this uses the undocumented oidfmt interface to find the kind of From patchwork Mon Oct 18 19:01:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542859 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=ec1Wj0My; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY6B35tPLz9sR4 for ; Tue, 19 Oct 2021 06:19:06 +1100 (AEDT) Received: from localhost ([::1]:59770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcYA3-0001TQ-2G for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:19:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXth-0008T5-Mm for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:02:10 -0400 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]:34740) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXtf-00020K-FQ for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:02:09 -0400 Received: by mail-il1-x129.google.com with SMTP id g2so15998677ild.1 for ; Mon, 18 Oct 2021 12:02:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jkxdthMQGPp9kZB9oWq7ZCkR2L8kWX3z9UnL4TGn9bM=; b=ec1Wj0MyN58Zbz/9bzaK5NaZR44hFM1orKD/Trc4v7WqOIPEoO1MyadPM/R2/DmEc7 zIQ70PbLo6yEWl6Of4+telQTM9Q+hF+fiMVcZpawSeRVt9+Cbssejn2qyXwdhdpNZeQn tcDvuxrdY/3s3a1dsKs/heG5ptsUHk7dHRPBOGA/LL/+MQmmrpnU4sMc8MaOP4+twNCb GwAObmBsrAOpkLgIlKipRkahnj5AVBLmzoIWO3R9e0NRqzfmTC5/D2sVKOj+lJstBZgB GA6YqpkhBSC+lTbRfxuaVYt9ZQLyc8wWx0vYUI68iDwH4slSjmRVo31V2DosAPgBq5R+ MHSw== 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=jkxdthMQGPp9kZB9oWq7ZCkR2L8kWX3z9UnL4TGn9bM=; b=lLtkCY4HbCF67wslnjNAeWVxJuhA1MKGGTAOLqudlEySTWymEldrhWVgMcPyIEPI/2 JT0bCnKYBj1JWAQvOuSlbXhChigNZTcU+oMVMVwR0L/TLqnxPDLW3XV8ctvAoUw1Vato lOpsTp3LV9MEbjBmXiPhZK5LJUFJw91idRFW0Hf1T32ylh0YwB+G62rjjH5czBcjpOeg vOqj7UaSm/tgaM1++MOQnFMA4sLdtJYWQ/2T6JOrA5H3Dh1xkfJyNCUgUESentFIbxcI Ti3AQanzWUb2fcT/8QiraYnSQD+f/RuhJFAh4T0g7Oouho4dZrX3eCWUtGm1umxp68qd oIxA== X-Gm-Message-State: AOAM532wMDv614WS31r+AZ4pwWExzHGUdac6ZG6bRYKEfLhRcJhOsSfi u6AYlB0Bb65cJjr17i/gttyK35M9qCwM6Q== X-Google-Smtp-Source: ABdhPJxmG7AyVf0NLM0ZKLoQKdc5JxvGGaxzGPD0mED0Wh4xcCVB0XIMj0y28cEDAp6SB7O4IRulCg== X-Received: by 2002:a92:c545:: with SMTP id a5mr15666585ilj.172.1634583726212; Mon, 18 Oct 2021 12:02:06 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.02.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:02:05 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 22/23] bsd-user: Rename sigqueue to qemu_sigqueue Date: Mon, 18 Oct 2021 13:01:14 -0600 Message-Id: <20211018190115.5365-23-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::129; envelope-from=imp@bsdimp.com; helo=mail-il1-x129.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , Warner Losh , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" To avoid a name clash with FreeBSD's sigqueue data structure in signalvar.h, rename sigqueue to qemu_sigqueue. This structure is currently defined, but unused. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Kyle Evans --- bsd-user/qemu.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index e65e41d53d..ba15b1b56f 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -73,15 +73,15 @@ struct image_info { #define MAX_SIGQUEUE_SIZE 1024 -struct sigqueue { - struct sigqueue *next; +struct qemu_sigqueue { + struct qemu_sigqueue *next; + target_siginfo_t info; }; struct emulated_sigtable { int pending; /* true if signal is pending */ - struct sigqueue *first; - /* in order to always have memory for the first signal, we put it here */ - struct sigqueue info; + struct qemu_sigqueue *first; + struct qemu_sigqueue info; /* Put first signal info here */ }; /* @@ -95,8 +95,8 @@ typedef struct TaskState { struct image_info *info; struct emulated_sigtable sigtab[TARGET_NSIG]; - struct sigqueue sigqueue_table[MAX_SIGQUEUE_SIZE]; /* siginfo queue */ - struct sigqueue *first_free; /* first free siginfo queue entry */ + struct qemu_sigqueue sigqueue_table[MAX_SIGQUEUE_SIZE]; /* siginfo queue */ + struct qemu_sigqueue *first_free; /* first free siginfo queue entry */ int signal_pending; /* non zero if a signal may be pending */ uint8_t stack[]; From patchwork Mon Oct 18 19:01:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Warner Losh X-Patchwork-Id: 1542862 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bsdimp-com.20210112.gappssmtp.com header.i=@bsdimp-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=mrIAc+ka; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HY6HB6d7Zz9sR4 for ; Tue, 19 Oct 2021 06:23:34 +1100 (AEDT) Received: from localhost ([::1]:38914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcYEM-0006cB-GA for incoming@patchwork.ozlabs.org; Mon, 18 Oct 2021 15:23:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcXtk-0008UK-Im for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:02:12 -0400 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]:35480) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mcXth-000218-9t for qemu-devel@nongnu.org; Mon, 18 Oct 2021 15:02:12 -0400 Received: by mail-il1-x130.google.com with SMTP id k3so15986295ilu.2 for ; Mon, 18 Oct 2021 12:02:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=U8eVRhdRDAX2Ff1OPrMk4PiZ7Kj1eOgqNZuEjvmZbbc=; b=mrIAc+kapMRKb7J0agTZ83y7q8Ta4plKO/2I6HoUQjpC1g/eNYu0fmhjKswFj3g6rK FwgZ87uSLivOdvgXehgZsW4g7GUX7po4IT7vVAJZi8jPw5Xg66eELVSL0z55nsbRXH66 057sphz0+PutWeeUpfGSXTqgtUbkhgIb/WM3SoWBgdzPbovv//m1km0fnN4pOUStswgh KwWLhqD/XyTbJ51BoIQAIQfB2fUwC328btCwiCI5srz86ruYFvPTgvyyy5Msws4741v9 M4MvfgFxBrj5n/vlwXbsgfdUKEiV+9DnbmDeZkxXHpADLcsVUDMyVB2G78yFTucSO4UQ GIdQ== 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=U8eVRhdRDAX2Ff1OPrMk4PiZ7Kj1eOgqNZuEjvmZbbc=; b=NK6xMzPklllGADxg4xeUVRPyxKGNUQGmsp1xVBRwKvlfCcYEYAoLPLn8PM4t685Fe6 qJmuLd0srng+diOkQ0FIBHHlVcHqFp2+7by/7WHCHIef6+WaipbfbxhWzSG993P6O2wq 3FmqDK8FN3aPrciedOrmvERPLf9gKDWvVc/GfLzoDi7mw21YuPn3lJKuoCD2K168xpUL GDMANU72jXh6YKsU/tQVg/OvViNy5z25x4sL2Wnj3RdFydcp5MEwguMhD+KHrMSFH7fH /2OOhryryQ931uIjeUO3t99BLxinvWipqk+bKtuXQLxt+D5YrswKiNFN804nQ6gsyoPj GTCw== X-Gm-Message-State: AOAM531cuOyr33BzNkON3uaVgFRBtvpjG51PgG8zxY2sv57fCxVm+D9z tzcR9pwCM0BUWvaOIZwx8T+rPhm40Nd56Q== X-Google-Smtp-Source: ABdhPJyClczp6PJcQuEMXAAb7/XvhE9AQWJI1djGu6EYbqsFtPwVEolnVXkKoOsRUP/FOKOP11A+ew== X-Received: by 2002:a92:1a08:: with SMTP id a8mr15277032ila.67.1634583727832; Mon, 18 Oct 2021 12:02:07 -0700 (PDT) Received: from dune.bsdimp.com (50-253-99-174-static.hfc.comcastbusiness.net. [50.253.99.174]) by smtp.gmail.com with ESMTPSA id a8sm6945151ilh.5.2021.10.18.12.02.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Oct 2021 12:02:06 -0700 (PDT) From: Warner Losh To: qemu-devel@nongnu.org Subject: [PULL v2 23/23] bsd-user/signal: Create a dummy signal queueing function Date: Mon, 18 Oct 2021 13:01:15 -0600 Message-Id: <20211018190115.5365-24-imp@bsdimp.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211018190115.5365-1-imp@bsdimp.com> References: <20211018190115.5365-1-imp@bsdimp.com> MIME-Version: 1.0 Received-SPF: none client-ip=2607:f8b0:4864:20::130; envelope-from=imp@bsdimp.com; helo=mail-il1-x130.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kyle Evans , Richard Henderson , Laurent Vivier , Warner Losh Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Create dummy signal queueing function so we can start to integrate other architectures (at the cost of signals remaining broken) to tame the dependency graph a bit and to bring in signals in a more controlled fashion. Log unimplemented events to it in the mean time. Signed-off-by: Warner Losh Reviewed-by: Richard Henderson Reviewed-by: Kyle Evans --- bsd-user/qemu.h | 2 +- bsd-user/signal.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index ba15b1b56f..1b3b974afe 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -17,7 +17,6 @@ #ifndef QEMU_H #define QEMU_H - #include "qemu/osdep.h" #include "cpu.h" #include "qemu/units.h" @@ -209,6 +208,7 @@ void process_pending_signals(CPUArchState *cpu_env); void signal_init(void); long do_sigreturn(CPUArchState *env); long do_rt_sigreturn(CPUArchState *env); +void queue_signal(CPUArchState *env, int sig, target_siginfo_t *info); abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp); /* mmap.c */ diff --git a/bsd-user/signal.c b/bsd-user/signal.c index ad6d935569..0c1093deb1 100644 --- a/bsd-user/signal.c +++ b/bsd-user/signal.c @@ -16,10 +16,19 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ -#include "qemu/osdep.h" +#include "qemu/osdep.h" #include "qemu.h" +/* + * Queue a signal so that it will be send to the virtual CPU as soon as + * possible. + */ +void queue_signal(CPUArchState *env, int sig, target_siginfo_t *info) +{ + qemu_log_mask(LOG_UNIMP, "No signal queueing, dropping signal %d\n", sig); +} + void signal_init(void) { }