From patchwork Mon Jul 30 20:15:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 143164 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4486093ljj; Mon, 30 Jul 2018 13:16:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdmKfwmfa36xqF/+zXTfhNDaRRqU0bK3EfY/WO4EXyFDLeAVm179OGi342bsJJMC4s9nzMx X-Received: by 2002:a0c:c130:: with SMTP id f45-v6mr16730059qvh.7.1532981792476; Mon, 30 Jul 2018 13:16:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532981792; cv=none; d=google.com; s=arc-20160816; b=y//fUlYm7lAh0A1yYnCTYVkAoMioSh/yvelqH6TP9O3XHq2iS3xWSlg0Y5aCB2YcTy vMO7lrRgEgP8khGI/aq2sv4IMeC/gAd55LOYEAia3iiH6B+wUcwfsn3E2pKegBsmA9eF 0gt1Y8rNoGpjySCIQbGhCdKl5zbF1rqo3O1gAV5OY+u8MEHV059aGCdzvsD8c/Lg5r9X oRSIB3jt/+ToNTIWTi+3LsSDAv6UJvviWz3+CSwS6cytz0vpVtYo5KnnFkS+bnZsLsRf RFPWqQ3+aPayS1MM93dGqEiD4o85ylS9hGcFIwmVHgVc1mKPwpoEwJfJA8XTPOI0/baK N/RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=HJJxjQY5Eqen2ptXTG03qTKxyp25C6AErLjt9Myyuc8=; b=j4cFwy3kEkb6+ZMEqaBJmXYdsvWCPoJ0myaow4ZZEBsZDf9UbFgv5+1vyUJ/SvmLCU foWNexzcK7uQ9S6PxYthSMlqLbW9pMpuXsHF9bgl3SvCcBr8LaoYEpP91yNpc7PUpl9q Edwb9fW3dZ2G4VfHbDRxtxHH0VT6SRXszEwJ9q3NvnN7IukV3jXl5WJpFiyqGyfBDIFR e7z8x+dyiXKIJnrG0VHea/leP7AAcAGysqsnL7V+YKlYT0W7w6zywPeGGikLbEh/NGwE QRFlRl6cNkAo9NY7Vn6L63dusZlM0Q9YFSOTBDBmVkex7s9YdceGzOwHzmG/VV5lngbA G8NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kVpSHZwo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id b25-v6si3594006qto.332.2018.07.30.13.16.32 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 30 Jul 2018 13:16:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=kVpSHZwo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkEal-0000SS-VR for patch@linaro.org; Mon, 30 Jul 2018 16:16:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55790) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkEaL-0000RK-0O for qemu-devel@nongnu.org; Mon, 30 Jul 2018 16:16:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fkEaG-00020C-2M for qemu-devel@nongnu.org; Mon, 30 Jul 2018 16:16:04 -0400 Received: from mail-ua0-x235.google.com ([2607:f8b0:400c:c08::235]:33608) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fkEaF-0001zv-Tx for qemu-devel@nongnu.org; Mon, 30 Jul 2018 16:15:59 -0400 Received: by mail-ua0-x235.google.com with SMTP id i4-v6so8733136uak.0 for ; Mon, 30 Jul 2018 13:15:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=HJJxjQY5Eqen2ptXTG03qTKxyp25C6AErLjt9Myyuc8=; b=kVpSHZwoND5DZMgFKd8N2YyrnYniNcwjnZeFGAR9HJfPNdgGtkN25ZTP98lI5oiTQl 6WAl8dKiZ+58eRjFljdbtGvI6ksopNv1dFnYzHYz3ukQSa0hfggw1l5cgoYmAlwqknLJ YHFmK8Ke66Lsa7JcFenC/SBo5dsIHG7rcPX4Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=HJJxjQY5Eqen2ptXTG03qTKxyp25C6AErLjt9Myyuc8=; b=VpU2Y+7xEHg76xMrWgUOvnx+SIZ8oIO5ebBU3yD8jLBnZYLDc7C9xTjp+V/1dr5WmM 6bpWxq/z9anBBOFfdtNWT4+9/h52zs/PLv92TGgJv2LSceYDF04/0gK78vxWnXBPal3P k2SGeIs9SPet+2ZMrZWD1Zi5jYIKxpd2g3TSqW8JFj5wlufLNgTt6QVrhaZ1PD4i/RcO pNnmlIAb5yKesg6XegHvF+Ky4NEZH3niYzKH92NXvNTITdNwX9EA/63GCfmuMIYfKC/A WXnoAAJXcwcjHLmUUs86ARUeNj0qkHMs3CtlBEEJk7/5/YVOimszFq/P9SnUl59uvQn2 eN0Q== X-Gm-Message-State: AOUpUlGq60sSYHtT9fhnud4WiJEayv59wPa5hRwgTKETFQXakPCLzcg8 d5bWHCovXPoWo0NcXoFRWLKqUsF0QfQ= X-Received: by 2002:ab0:622:: with SMTP id f31-v6mr14119744uaf.189.1532981758927; Mon, 30 Jul 2018 13:15:58 -0700 (PDT) Received: from cloudburst.twiddle.net ([190.166.236.188]) by smtp.gmail.com with ESMTPSA id x12-v6sm2542448uaj.48.2018.07.30.13.15.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 13:15:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 30 Jul 2018 16:15:49 -0400 Message-Id: <20180730201553.32423-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400c:c08::235 Subject: [Qemu-devel] [PATCH 0/3] linux-user/sparc: Fixes for clone X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.cave-ayland@ilande.co.uk, alex.bennee@linaro.org, laurent@vivier.eu, atar4qemu@gmail.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" There are at least 4 separate bugs preventing clone from working. (1) cpu_copy left both cpus sharing the same register window (!) (2) cpu_clone_regs did not initialize %o1, so the new thread path in the guest __clone was always taken, even for the parent (old %o1 value was newsp, and so non-zero). (3) cpu_clone_regs did not advance the pc past the syscall in the child, which meant that the child re-executed the syscall (and because of (1), with essentially random inputs). (4) clone did not flush register windows, which would cause the parent stack to be clobbered by the child writing out old windows in order to allocate a new one. This is enough for Alex's atomic-test to make progress, but not quite enough for it to actually work. What I'm seeing now is a legitimate SEGV for a write to a r-xp memory segment. I'll need to examine the testcase further to see why that is happening. r~ Richard Henderson (4): linux-user: Disallow setting newsp for fork linux-user: Pass the parent env to cpu_clone_regs linux-user/sparc: Fix cpu_clone_regs linux-user/sparc: Flush register windows before clone linux-user/aarch64/target_cpu.h | 3 ++- linux-user/alpha/target_cpu.h | 3 ++- linux-user/arm/target_cpu.h | 3 ++- linux-user/cris/target_cpu.h | 3 ++- linux-user/hppa/target_cpu.h | 3 ++- linux-user/i386/target_cpu.h | 3 ++- linux-user/m68k/target_cpu.h | 3 ++- linux-user/microblaze/target_cpu.h | 3 ++- linux-user/mips/target_cpu.h | 3 ++- linux-user/nios2/target_cpu.h | 3 ++- linux-user/openrisc/target_cpu.h | 4 +++- linux-user/ppc/target_cpu.h | 3 ++- linux-user/riscv/target_cpu.h | 3 ++- linux-user/s390x/target_cpu.h | 3 ++- linux-user/sh4/target_cpu.h | 3 ++- linux-user/sparc/target_cpu.h | 23 ++++++++++++++++++++--- linux-user/tilegx/target_cpu.h | 3 ++- linux-user/xtensa/target_cpu.h | 3 ++- linux-user/sparc/cpu_loop.c | 3 +++ linux-user/syscall.c | 9 ++++++--- 20 files changed, 64 insertions(+), 23 deletions(-) -- 2.17.1