From patchwork Thu Aug 24 01:02:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 716489 Delivered-To: patch@linaro.org Received: by 2002:adf:f747:0:b0:317:ecd7:513f with SMTP id z7csp1091318wrp; Wed, 23 Aug 2023 18:03:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZAVUrfQzSy3waUxB6R+ktmGvdbw4RHL9g7lXdiPFhqUZdyBBJ/2DgClOw1MX7xFjTIzX7 X-Received: by 2002:a05:6214:1a47:b0:635:eff8:2b4c with SMTP id fi7-20020a0562141a4700b00635eff82b4cmr16581384qvb.31.1692839033732; Wed, 23 Aug 2023 18:03:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692839033; cv=none; d=google.com; s=arc-20160816; b=e2Pw4+uovNpURso4hYaeeNaWmJaziAoD8LOKdfCvnoFtrtI3rFsyG1jImLtdUA85AV Ec6sFu/JtF9Q3w6NmArsT/vmiisOBRAlFIOKYng+mHhbmwN8qjf4HAgF768ByJVbNIcy sDr5kHqZRAzIu88nmjibxc8kAh8yCGKS3kziu3mSM96goel8zxEi4dk0as/o+9b16eZx g2ECooprpYaUOhxsSW9kznd4l/yuwPvI3T1EJCi30OJG7ffxAspf7NIC0MGgg9UvpR8A 6FtZa16Wv52gG0rEaG1kgPtRpTBzbm23HHmDCl7l5g+cydblcCdJ7kwwbW6CKYGnlarV s1Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UxFB11WokbscidLNJIq7jg3sXBkPLDLF7tCCnRzjj4U=; fh=F9+CNiVJwRFefBQuaFQguBFal8jOUM389V8ndcNesT0=; b=wF7R0GuS1hLy3/iOOClArGlpg16sEdaXePXdHsw5SeLn97H4iXxKNseKK/yV1nvZf3 gCYLBwleJPkUqjfOu1QJwYbI7NnFW9m7LPmvyFGLElQjPJKexkgDSFEThbRcEkoh7peD n+195O+IGeyUpmMyRcIBBqVQZMCZyaKFYpnEBQ1Z06HW+4UAnUs2rBxXEKZ3UBsVqYBo GhBQsAZSbX0+kperQ4SjRcLuItr2NM5Uixy/0YMHara8eJ0zRpOpBzNzZ8OzqQIH0OyQ pMZP0J2y1QIc4K7quOx4u8bv7lKQtgVxo9Ez8rt+pwHPSZCjDl6YfDgGrLysrWTraXk8 2Ecg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H9bvMoeL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m3-20020a0cdb83000000b0064c5c85a364si6712128qvk.526.2023.08.23.18.03.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 Aug 2023 18:03:53 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H9bvMoeL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYykM-0000AF-RV; Wed, 23 Aug 2023 21:02:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYykL-00009k-UO for qemu-devel@nongnu.org; Wed, 23 Aug 2023 21:02:49 -0400 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYykJ-0000RQ-1B for qemu-devel@nongnu.org; Wed, 23 Aug 2023 21:02:49 -0400 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-68a56401c12so2779210b3a.2 for ; Wed, 23 Aug 2023 18:02:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692838965; x=1693443765; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UxFB11WokbscidLNJIq7jg3sXBkPLDLF7tCCnRzjj4U=; b=H9bvMoeLhoUHrZtnCvcK2q8sTAW8YFr3Gk8vqZHjcigHMn5j2JB0fCkYjBhoQHsZfN wuRU7jak5o8OIJEDzFpUBfPPEbEbTbM1oNYUFf3MBcto0b50axh6u5v7xCxYxIXgaN7z qydF1HWyoIPbtiWcYT5UtCO+fXuoc6rRcTEi4trD/P6HrBVqCTakzpiVhs3TYml0nme/ pBEWkfXTfPrgJPFk6bpP9k+eH5XKTE7lYTH6QvzSzu/wfiXn5aeI+BpIPkZ1fLclp2tc OCIDE/eiZQYilPjjCA1ARGVvGbbfhiz3Vgj87pc79qtZIqqgAdSjgv0W94mK4Ph5czhB kEjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692838965; x=1693443765; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UxFB11WokbscidLNJIq7jg3sXBkPLDLF7tCCnRzjj4U=; b=BOs9sh3pR2Z5APbmu4rxPbPRgPaOmD9rHwJlN578f3GVgkgAEPvO/2HUHYQq70z57n mEliIg3fsZ/z09Jog3IF11EQ5H/57EG/y4VuPA8+VbiWrrCL/hUY4AjYl8U96szL5OsT L0nS6sbhFPi5Rxus4FN8lTBfUdhbO71mDtXw5Wp7H8UPjpQElZuquW2Q07JhjJ27aLx6 SmcoojYLnZ1zUUEG7Q8BguNEw+zTW+V+O9NJmIJvJ5o4v32sqj+9TdiFMc/Dz6QUHbe7 PTJcDKTFCH0S0540NNyQa6Ohk72milv4dQM7r5hZSw7la2Di3SwBszGKfCsfHbIvuol0 Ya6A== X-Gm-Message-State: AOJu0Yzxk37bo+2r/IQhlAXS4rF71qH8jcWHgN+7VN+hq5DEDlF4f/Pe lM6U427mxwiImT9PHRYBdVWrKOaRDTsNJ2fLAUw= X-Received: by 2002:a05:6a21:7905:b0:14b:8023:33bb with SMTP id bg5-20020a056a21790500b0014b802333bbmr3110411pzc.22.1692838965541; Wed, 23 Aug 2023 18:02:45 -0700 (PDT) Received: from stoup.. ([2602:47:d483:7301:72f0:1ea7:85d2:141e]) by smtp.gmail.com with ESMTPSA id c10-20020aa78c0a000000b006875df4773fsm2050789pfd.163.2023.08.23.18.02.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Aug 2023 18:02:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich Subject: [PATCH 08/13] linux-user: Emulate the Anonymous: keyword in /proc/self/smaps Date: Wed, 23 Aug 2023 18:02:32 -0700 Message-Id: <20230824010237.1379735-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230824010237.1379735-1-richard.henderson@linaro.org> References: <20230824010237.1379735-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich Core dumps produced by gdb's gcore when connected to qemu's gdbstub lack stack. The reason is that gdb includes only anonymous memory in core dumps, which is distinguished by a non-0 Anonymous: value. Consider the mappings with PAGE_ANON fully anonymous, and the mappings without it fully non-anonymous. Signed-off-by: Ilya Leoshkevich [rth: Update for open_self_maps_* rewrite] Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- linux-user/syscall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 0641d8f433..8d96acd085 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8167,7 +8167,7 @@ static void open_self_maps_4(const struct open_self_maps_data *d, "Private_Clean: 0 kB\n" "Private_Dirty: 0 kB\n" "Referenced: 0 kB\n" - "Anonymous: 0 kB\n" + "Anonymous: %lu kB\n" "LazyFree: 0 kB\n" "AnonHugePages: 0 kB\n" "ShmemPmdMapped: 0 kB\n" @@ -8180,6 +8180,7 @@ static void open_self_maps_4(const struct open_self_maps_data *d, "THPeligible: 0\n" "VmFlags:%s%s%s%s%s%s%s%s\n", size_kb, page_size_kb, page_size_kb, + (flags & PAGE_ANON ? size_kb : 0), (flags & PAGE_READ) ? " rd" : "", (flags & PAGE_WRITE_ORG) ? " wr" : "", (flags & PAGE_EXEC) ? " ex" : "",