From nobody Tue Nov 26 19:56:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1706005538; cv=none; d=zohomail.com; s=zohoarc; b=hrcaDISaAFcZukG7SNXFcQNHBpsvhMHRb4u7g8na6PlKshxiDWoSRChTx4c6vp5xudOuNtxUz+kUZ93AeC6ND5ndPIE5KDlVRbKG9FugtdNP4XKY1eMZ6BJlfaq7+bttSVvp3exiuJxPQdytwfEXE3O1qjUuAZJCZL6i7iYlNrE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706005538; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=McCaPLIJxvTbADv66BEO7sWToPqj2hCMM+otAiFa5d4=; b=S5x5dWAo4WQ9vTk3/uD7pHvWq+OI7xgZ3V7ikYYAU6JBLHiK9UI7ACMkWgMNtJLfe5TOTkBiXQ12OFKnai36Xt3eWz+dg65gg00AQz7jlhvZJq9PWZ5GpvheGOPkOAZ6Fq/1XEWLUHY4GEmf+RUY2auTa0XjEDVoWsEvdNiVsAw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706005538631864.151569459585; Tue, 23 Jan 2024 02:25:38 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSDxR-0000QJ-FS; Tue, 23 Jan 2024 05:24:41 -0500 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 1rSDxQ-0000Q8-Ih for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:40 -0500 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSDxP-0004dp-0z for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:40 -0500 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6d9344f30caso2556378b3a.1 for ; Tue, 23 Jan 2024 02:24:38 -0800 (PST) Received: from stoup.lan (2001-44b8-2176-c800-b8a0-0408-58be-7d2e.static.ipv6.internode.on.net. [2001:44b8:2176:c800:b8a0:408:58be:7d2e]) by smtp.gmail.com with ESMTPSA id d8-20020a62f808000000b006d9ce7d3258sm11072408pfh.204.2024.01.23.02.24.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 02:24:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706005478; x=1706610278; darn=nongnu.org; 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=McCaPLIJxvTbADv66BEO7sWToPqj2hCMM+otAiFa5d4=; b=AQKv+fNArFTzeLgw7mDKhKdqnNm9cP0JQu4QCwk5UTbURygHnNhjDCEKUClHRjic9B rdTsPRLTyf2Rx3Pu6xMMT3Gz9DEBWB1EHxZsaXjeMTXypHOtG70W5uk/MnfqFJiRkGwy V4J24KJZOA11sNop/Bx8vM9Lopk9rtv49rNb+57s91phKK9T+jDde4tzEfkspLT1UXT1 hLHwoFLj3OcnYVkxHaI9DawFDLq8uEo/qhiHuy5yRpWPUgTIHnZdJ762Z9bSXs3tEAzO FOdocvJH8TSoLHEjzckUVQMFinvF/T15ptLA9CsjwiOuRdIu1YMJ9fXu0ITzsZ1tUe4J z+Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706005478; x=1706610278; 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=McCaPLIJxvTbADv66BEO7sWToPqj2hCMM+otAiFa5d4=; b=qBsBmmlT8fvMqm35Tn0taEhZN/m+jdBUFVRuGl33AlOr1wwB/HVwrB523DHZXLHuB4 k+s2o/Jv7i7NZUM0TWUiYGUG4fqEO6EMfrIzzhrm7KrQceLFs091nJ0ToXWQZMHc7LFb zvMfX3ZMbiqF4heelhPiJR5rof/Wd8dmYF/T4v2xIrOqM9iCMkyqr4RQfNulsyUHXnS1 JtP2HGEauuKxlmfL9VpMgFW0WmKo3V1cDHVzlfiDbm64Oad3Eg//f7ciqxBO/UgY7+lC 6nW6oaVFgAFuqutaak4taRa/9SKu+zQ7fjSK06/Qo1D4JvYxrvn1to6z7x1kybqmtLZs e8oA== X-Gm-Message-State: AOJu0YxNF/d3/K99CU/gx1Zste6L/VD6yqPZBG0YO+7+8ZvfuS+/f6w0 C4poTP3mzyhLNVWkRgbwSbohRsGxg4k5ABbGGJDWLJuMHfIqvvVEsEUoqNfuijidHkAQAktn4rH 8NJY= X-Google-Smtp-Source: AGHT+IFG63a/PFhuWVxUEhb9qe/0tUlKvJr3xTRvIjk+1oY3X3bFH6u9zHzH/1F7kvUtT/b0TJu0MA== X-Received: by 2002:a05:6a20:4329:b0:199:89a0:9f2b with SMTP id h41-20020a056a20432900b0019989a09f2bmr6537956pzk.26.1706005477681; Tue, 23 Jan 2024 02:24:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL v2 7/8] linux-user/elfload: check PR_GET_DUMPABLE before creating coredump Date: Tue, 23 Jan 2024 20:24:11 +1000 Message-Id: <20240123102412.4569-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123102412.4569-1-richard.henderson@linaro.org> References: <20240123102412.4569-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1706005540083100011 From: Thomas Wei=C3=9Fschuh A process can opt-out of coredump creation by calling prctl(PR_SET_DUMPABLE, 0). linux-user passes this call from the guest through to the operating system. From there it can be read back again to avoid creating coredumps from qemu-user itself if the guest chose so. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Signed-off-by: Thomas Wei=C3=9Fschuh Message-Id: <20240120-qemu-user-dumpable-v3-2-6aa410c933f1@t-8ch.de> Signed-off-by: Richard Henderson --- linux-user/elfload.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index c596871938..daf7ef8435 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2,6 +2,7 @@ #include "qemu/osdep.h" #include =20 +#include #include #include =20 @@ -4667,6 +4668,11 @@ static int elf_core_dump(int signr, const CPUArchSta= te *env) init_note_info(&info); =20 errno =3D 0; + + if (prctl(PR_GET_DUMPABLE) =3D=3D 0) { + return 0; + } + if (getrlimit(RLIMIT_CORE, &dumpsize) =3D=3D 0 && dumpsize.rlim_cur = =3D=3D 0) { return 0; } --=20 2.34.1