From nobody Mon Nov 17 12:05:12 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1603749979; cv=none; d=zohomail.com; s=zohoarc; b=PPOzDJ/bwI2sgWClKd6ou/01ROoquPTkDmVnSjVlaTG6itBQ/8oJQJCXTtsnJHwZ3hMdi8YLlWhnm8XP1vtqsKuat8FZDMbCkq30PaU/6+Z9jSbCu19xOCewMklILWa2rGdjhDNeiPFnRpV/4zElrRZC9AX+KAF4U2D3Li2o5Q4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603749979; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=q1zFSxjAOgf7Hw7iHYnPFh572P9Hey0TztVUYYm+9go=; b=Uq0pQiYyg9tED2q16s7DYjSmNWBXQbq96za5Wn02z8/B+XMfiop0adj+imcbu28yFnTIzr3iCcK5r9kb9t/1P76EzfkqFq5Cyt1DLAla9aTgRIWU747chgz/PA8zDn9fKE/ntQ3dgnbxQsO54kxc9hZHOOuDtqD4Qf0j52usqeY= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 160374997991910.331193035828505; Mon, 26 Oct 2020 15:06:19 -0700 (PDT) Received: from localhost ([::1]:39204 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kXAd8-0007Lv-LD for importer@patchew.org; Mon, 26 Oct 2020 18:06:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXAak-0005eQ-Ax for qemu-devel@nongnu.org; Mon, 26 Oct 2020 18:03:50 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:47613) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kXAah-0005F2-3D for qemu-devel@nongnu.org; Mon, 26 Oct 2020 18:03:49 -0400 Received: from localhost.localdomain ([82.252.139.38]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MysiI-1kAhkl38iY-00vwkZ; Mon, 26 Oct 2020 23:03:41 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PULL 1/8] Fix stack smashing when handling PR_GET_PDEATHSIG Date: Mon, 26 Oct 2020 23:03:32 +0100 Message-Id: <20201026220339.195790-2-laurent@vivier.eu> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201026220339.195790-1-laurent@vivier.eu> References: <20201026220339.195790-1-laurent@vivier.eu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:15vxF7go/XQMFN3i8nJigGNO8kI5rqgsx9En3d19jArHNduwS0Y 5hqtPsyPoZKJYOn6VkzYlVpGegbPYZqbZpqoYuiKsTJuYydKo1eYFhgDYk/m1LboSAUtuBd KqY+gYsoQt0gp5/jYyk2mQyTYjnlPaz+T93OWByjqPaHb4Jc8weY6QdR3AQwI8v8E3k23cD BbVKedXUcU7DhMZRpepBQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:CWFt4d6rj40=:cNiQn6H/r53l+vABA852wB LR2AlXwxkc3RfNoUWgaNNFqaYTbNbZe0VZO5oSg+DoXWomKydqnwyJLQpDFYD6dOzuTDKC29P 2RSLZoJ6hipY+iIlvQ9PpuyljC8LeitBozyqJ0nYXed2dOMLBaLLuY7P4nrLW6KgUHjv3oKhi Tmk0nq4x3g2RztAhwv788ijWOp30YkwUXbpENpMsc2v9wDqgI4f/lgR0hznTnMm/m468cWKyy 0g3uXbA/w4QjFdoFUrhyRh9k8pKOvV50AJtbgCAFqAMMA0R2+6o48tD5SXQ8hitr/tFF+AsKr H9ZX7m23iA61bwB373pmNJJwm68f9duyW+7+XQ/k4w7fj4jG8E4VXIjS8WZzOq9M7g40tlD1g 7M5DvWr9lTdra/nVmfDHXTHiZ63CQBNGS4e3hlGold7iVzJ6ulcHF+1JAyIhwVKU3/1ZnSjQa zI24ab4pcA== 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: none client-ip=212.227.126.187; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/26 18:03:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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: Ana Pazos , Laurent Vivier , Stephen Long Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Stephen Long The bug was triggered by the following code on aarch64-linux-user: int main(void) { int PDeathSig =3D 0; if (prctl(PR_GET_PDEATHSIG, &PDeathSig) =3D=3D 0 && PDeathSig =3D=3D SIGK= ILL) prctl(PR_GET_PDEATHSIG, 0); return (PDeathSig =3D=3D SIGKILL); } Signed-off-by: Stephen Long Signed-off-by: Ana Pazos Reviewed-by: Laurent Vivier Message-Id: <20200507130302.3684-1-steplong@quicinc.com> Signed-off-by: Laurent Vivier --- linux-user/syscall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 897d20c076ce..3e0f14f2e67f 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -10703,7 +10703,7 @@ static abi_long do_syscall1(void *cpu_env, int num,= abi_long arg1, int deathsig; ret =3D get_errno(prctl(arg1, &deathsig, arg3, arg4, arg5)); if (!is_error(ret) && arg2 - && put_user_ual(deathsig, arg2)) { + && put_user_s32(deathsig, arg2)) { return -TARGET_EFAULT; } return ret; --=20 2.26.2