From patchwork Wed Jun 16 01:11:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 461311 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp98415jae; Tue, 15 Jun 2021 18:18:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJoVchkoEODATaufmMPciCLhryfS7l+giViAdluQ/HaLxEKqjFDwOlFWhfGoeWkBBnwSrk X-Received: by 2002:a05:622a:647:: with SMTP id a7mr2569838qtb.187.1623806280322; Tue, 15 Jun 2021 18:18:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623806280; cv=none; d=google.com; s=arc-20160816; b=us+0aKJ+3PxRNvJ27MO90MPIsUNZ2a0cKk91ecB2Xn10WZw9QYstWiPfyvpsMe2riT 0GatbQjj0ztkL4LBpyAmebQX9V+LGCmsNKbReZ+WrNctiht/e6x68hcT3GaZPAamC+Ta rLCf4gL0Y07XsDDjFoZr4MF4BTgiOCCDaD4XlowVua8pGKd4wxIHiWJvLiCa1yFfVhb3 um4ipC90/By198zmiNBXYtDezCSbuArSBFrvmZya9kaZHdRYYqWl6LO2GdapMbi3S+4T nB9eO+zavVZuypiGy6nEv0ivIipg+lXMjAVPVuyT4tpI6/9F7D8KrwmBOXFKCvTnAoEb w/iQ== 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:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature; bh=QHSnCIV82Ge9sARBFtd/73rfOAneaeCBmUE5i/C71tA=; b=MFywGjNPEMhka0+zKvtfgTexWnNI5PKdI3k1LCkwU32rOsiL48m1iMt94fvca/6Xef gdk3dLAWC7E2wq/HbTdk4d0aWimhuC6mmVDY1Y5bUHzUy0Tc/BQ5IPvRSEgxXExg9VnO ZJDE7GBbJOtyhQ750DUQiMfAwqPJVS7mFyo4jAbQvcV/qFVwkjqOH2y+pmdSzfxNAEwj lraEtK7r10Rfn/pz5RAV3SJI/PACn1mhaiYQF9YAmYcREELvknA+BcTwiOq7la+K45S6 eZLq55nLWJPXfVT2UF9oEKZl21I1e2A1KmRDfph8CsZD4TMZUWFGxbNKNYwhu2UWinQi aS6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=l02ya0Bj; 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=fail (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 n19si527520qtk.325.2021.06.15.18.18.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Jun 2021 18:18:00 -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=fail header.i=@linaro.org header.s=google header.b=l02ya0Bj; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:44316 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltKBr-0004PX-MD for patch@linaro.org; Tue, 15 Jun 2021 21:17:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52078) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltK6P-0005MY-OA for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:12:21 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:44695) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltK6G-0008JG-2l for qemu-devel@nongnu.org; Tue, 15 Jun 2021 21:12:21 -0400 Received: by mail-pf1-x42b.google.com with SMTP id u18so811773pfk.11 for ; Tue, 15 Jun 2021 18:12:11 -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:mime-version :content-transfer-encoding; bh=QHSnCIV82Ge9sARBFtd/73rfOAneaeCBmUE5i/C71tA=; b=l02ya0BjUqrHPLS7Xgef0H/p9PP0Rrq4vFKS2RxSfokaXpQXbaFm/PaWjrtN6vP5lu XDYrd09hE9ml4jMcxUdIDDy1yvcOu4+ExxtZyclJorMQg1oGdE+ja33FbxYY3gKQJ8Fi PTYU8BwTUGYoPOcHnwKLHgzCsvpy/dFe5Vjls7qeFoGVGy0TjF5kY/PaRtsyeeNWB2qY g4oeFHaokiG3nPq1B3vPHCPqkNWfJfzzCkdonRdE7uIzAW+wpOVDrzBvO/W3Qrs1UAKo CR0wK8ynOnpNgeLxC9Xzz/c92pJVKJK1YbNNO4qxERkrszzs7a9WYd5awPvLuSP9ozyI G+TA== 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:mime-version :content-transfer-encoding; bh=QHSnCIV82Ge9sARBFtd/73rfOAneaeCBmUE5i/C71tA=; b=k10p0UXuClZwlFyzh5jvrkReBZ0XwoXDlPKA66d332d4Mag1S/JmXl+Sw0rpOu8gm9 tU/VLfR6bu1oxNgvJE7pa2J4pNklbHIiuM79yRsVngR2+lnR1bmpYbJPINbKkQzkLiLp Y2jAECZplF3ulBsMtW7SJIx0IgQicv+Mu0cQpjBE2Y49uszznHknnWiuw/RetF26fVpp V2HzVajVXuIrrPcv7xtxnFz+ziX6HtsCfC6UkvCbxRsrMUyf7miJpWvL+JzWj2b67suK EhipR25GE/Yjn4/sNO7jn3lZFVYlW+a2RiCFO38e40gkc+fMeCmb4ubqiWn1yv6vv1+T MR+A== X-Gm-Message-State: AOAM5322lsvoRZ8AU9potJQZl/NB09oaAXfagS6zhs3R99+l49hNq84w ZOn/Tya/U16MV6XEurXqPlo872knyzDhPA== X-Received: by 2002:a62:e50c:0:b029:2f9:b9b1:d44f with SMTP id n12-20020a62e50c0000b02902f9b9b1d44fmr6878395pff.42.1623805930515; Tue, 15 Jun 2021 18:12:10 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id y18sm305297pgk.53.2021.06.15.18.12.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 18:12:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 00/21] linux-user: Move signal trampolines to new page Date: Tue, 15 Jun 2021 18:11:48 -0700 Message-Id: <20210616011209.1446045-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alex.bennee@linaro.org, laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" It is my guess that the majority of the flakiness with the linux-user signals.c test is due to a race condition between translation and page writes. I vaguely recall a bug report about this, but I cannot find it now. Since the vast majority of "self-modifying code" is due to signal delivery, work around this by allocating a new page, into which we write the signal handlers. A better workaround would be to implement the vdso that is required by many guests. However, that is a much larger problem, and some guests do not define a vdso in upstream linux. This serves as a decent fallback. Neither bit of work, I will note, solves the posited race condition described above. r~ Richard Henderson (21): linux-user: Add infrastructure for a signal trampoline page linux-user/aarch64: Implement setup_sigtramp linux-user/arm: Force v2 frames for fdpic linux-user/arm: Implement setup_sigtramp linux-user/alpha: Implement setup_sigtramp linux-user/cris: Implement setup_sigtramp linux-user/hexagon: Implement setup_sigtramp linux-user/hppa: Document non-use of setup_sigtramp linux-user/i386: Implement setup_sigtramp linux-user/m68k: Implement setup_sigtramp linux-user/microblaze: Implement setup_sigtramp linux-user/mips: Implement setup_sigtramp linux-user/nios2: Document non-use of setup_sigtramp linux-user/openrisc: Implement setup_sigtramp linux-user/ppc: Implement setup_sigtramp linux-user/riscv: Implement setup_sigtramp linux-user/s390x: Implement setup_sigtramp linux-user/sh4: Implement setup_sigtramp linux-user/sparc: Implement setup_sigtramp linux-user/xtensa: Implement setup_sigtramp linux-user: Remove default for TARGET_ARCH_HAS_SIGTRAMP_PAGE linux-user/aarch64/target_signal.h | 2 + linux-user/alpha/target_signal.h | 1 + linux-user/arm/target_signal.h | 2 + linux-user/cris/target_signal.h | 2 + linux-user/hexagon/target_signal.h | 2 + linux-user/hppa/target_signal.h | 14 ++ linux-user/i386/target_signal.h | 2 + linux-user/m68k/target_signal.h | 2 + linux-user/microblaze/target_signal.h | 2 + linux-user/mips/target_signal.h | 1 + linux-user/mips64/target_signal.h | 2 + linux-user/nios2/target_signal.h | 3 + linux-user/openrisc/target_signal.h | 2 + linux-user/ppc/target_signal.h | 2 + linux-user/qemu.h | 7 + linux-user/riscv/target_signal.h | 2 + linux-user/s390x/target_signal.h | 2 + linux-user/sh4/target_signal.h | 2 + linux-user/sparc/target_signal.h | 4 + linux-user/x86_64/target_signal.h | 3 + linux-user/xtensa/target_signal.h | 2 + linux-user/aarch64/signal.c | 28 ++-- linux-user/alpha/signal.c | 34 +++-- linux-user/arm/signal.c | 190 +++++++++++++++----------- linux-user/cris/signal.c | 29 ++-- linux-user/elfload.c | 13 ++ linux-user/hexagon/signal.c | 19 ++- linux-user/i386/signal.c | 42 +++--- linux-user/m68k/signal.c | 47 +++---- linux-user/microblaze/signal.c | 24 +++- linux-user/mips/signal.c | 39 ++++-- linux-user/openrisc/signal.c | 24 ++-- linux-user/ppc/signal.c | 34 ++--- linux-user/riscv/signal.c | 22 +-- linux-user/s390x/signal.c | 24 ++-- linux-user/sh4/signal.c | 40 +++--- linux-user/signal.c | 3 + linux-user/sparc/signal.c | 32 +++-- linux-user/xtensa/signal.c | 50 ++++--- 39 files changed, 488 insertions(+), 267 deletions(-) -- 2.25.1 Tested-by: Alex Bennée