From patchwork Fri Jun 18 19:29:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 463068 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:102:0:0:0:0 with SMTP id x2csp170423jao; Fri, 18 Jun 2021 12:30:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZMA4pkcBzPpg6//RAAo8wn69GOS1RuBzwLPD8nEXPpACQtgV4Scq3X0g9yifja7BPo3t5 X-Received: by 2002:a1f:fecc:: with SMTP id l195mr4631841vki.21.1624044641310; Fri, 18 Jun 2021 12:30:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624044641; cv=none; d=google.com; s=arc-20160816; b=FAu8WMqsIWDN3mz/F7CG5KrUJSAFfZjnexrOZI7LhJViXaIYeCoS0WhgeosNcvpTpK 7f4syIoqZw6iX4w1S/bkhBCLW45PaWT7QHQp+IScQM8ELj+2oTeE6xMOWf2UA1R2eKfj 3oxTEcsBk/bFAkeHJctitqXSlrCORj3LRPkYBxF1OFGj6/DIuFwNK1pZU0xvq6Hi3Uml 0TwSOC9BTKlc0OltJt2DWOBte/JzejLG+9/MZf8c9Xr/ltGzVSOuqWmgVFiOLCmWnGjV ZqlGlrAXosX6Q1pGhNOLelo5e+p3tyal8IwQHm4i9KEIoEwMJoft9eIrf28hORoiz8wA fdwA== 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=Wv3mpzlnfIAV57P1hJ2KU7zBQ0rbv6sTsg7IkpZV+ig=; b=TAH9aXR+Z7t82DId6uXKeIEkRP9yxlRjVYyb9XC7jCTbIakHaKYEC2QXXUlns84uBa GSbnMNItfvEvF+w1FwUMsgx1gYkof/odfSfs1g+AmYmsNnIv5P6wPs1CIjUvvKZkm1Dl 9T0gxcKY6IqVnr0YbGzRqMQ4KdDKZdTipZWrtaAakXLvdw0L6AoGDsMgpWbfMk2Us+st J+J8cpWp3hLqMf+JTj4PT6B5fz4AeBJsdDCeqs+9ypzwPvvBaXyZLjb9Z1jt468Zo7c/ vjHpflP3n9K2p/BttxMmvtjFd2xqab8YeDUjhOQsuq29L8IUl/g2HkDXrN/msRiwdhhk bLrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=eohdhx1L; 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 98si4630368uao.177.2021.06.18.12.30.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Jun 2021 12:30:41 -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=eohdhx1L; 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]:55442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1luKCO-0001MV-3d for patch@linaro.org; Fri, 18 Jun 2021 15:30:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1luKBg-0001M6-9v for qemu-devel@nongnu.org; Fri, 18 Jun 2021 15:29:56 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:44770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1luKBe-0001Oo-9R for qemu-devel@nongnu.org; Fri, 18 Jun 2021 15:29:55 -0400 Received: by mail-pj1-x1032.google.com with SMTP id p4-20020a17090a9304b029016f3020d867so4393635pjo.3 for ; Fri, 18 Jun 2021 12:29:53 -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=Wv3mpzlnfIAV57P1hJ2KU7zBQ0rbv6sTsg7IkpZV+ig=; b=eohdhx1Le9dx+kBF603qyjYyLeZMaFsfSjtGUL0HjEgXFMgBg6GWoghxr5EWH6nURM ge94K+Dr77XWpZ2yLBsaVPjf8xUxhDPRJ3dI8mPNsUD/i53CfCGyNkCl6adhZclMupnC j368vxseNLl7FqrrvJyIX6Yq8Czct8mhFgW4gxHx9tKHpo7CapP/vygY2MpqZvOAjmdN 2aPcq1/284vwURTrkqRplMyPhEbFFUmQoGsXRRI2k9D6uQUDtu3XyZoryjbPl9uDv6Kx huP7ADMJqoEkqzehMmjATAwkG6S2oAeciGtaQAy3/xwR/gw8AO4VG+fmU560htfrCNTF gC/A== 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=Wv3mpzlnfIAV57P1hJ2KU7zBQ0rbv6sTsg7IkpZV+ig=; b=RHMThiuwOnUEMOuu/Xosc/qgY13mI28vJVLsVmUk/gH7d3sP36HCkG2R0Bb3mQvP8s BK9mI0uaGFxkSQ7a5i2UC5gQxz1d92O4SsW0BbCzvCjFnOZRYGVGlVg2b+l7wt0ZtPji kNn2EY7P5qx/xhUcL1UlshOHNSx6/lbBnios8wyZJMlsSKs2CyrBcd+YMF+cJ4dvCIos mIfVFFm3RcRyJTVDZ84+dKF405aOWd/iGam5ukGOiDDc9AhRfa2ydwKCBB30CysDo2bv Q7Hn+JXnIs+JEt0tmfpj5ostMFfHo4XS9gmjMoiQ6t6cOSyLRC1ExdkOAN5D2XcTW/JZ BdDw== X-Gm-Message-State: AOAM532yIfnILEFFfdsAa46mFoVyEbW5jCqDVNkqODBQel1PWeAVakgw b34XOyQGaajnpNeEraEZng4MuFreFK1Zfg== X-Received: by 2002:a17:90a:d18f:: with SMTP id fu15mr3577991pjb.107.1624044592562; Fri, 18 Jun 2021 12:29:52 -0700 (PDT) Received: from localhost.localdomain ([71.212.149.176]) by smtp.gmail.com with ESMTPSA id 92sm11938234pjv.29.2021.06.18.12.29.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jun 2021 12:29:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 00/23] linux-user: Move signal trampolines to new page Date: Fri, 18 Jun 2021 12:29:28 -0700 Message-Id: <20210618192951.125651-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::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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. Changes for v2: * Add r-b tags * Split arm v2_frame patch (phil) * Split mips install_sigtramp patch (phil) * Fix some arithmetic in a couple of setup_sigtramp (phil) r~ Richard Henderson (23): linux-user: Add infrastructure for a signal trampoline page linux-user/aarch64: Implement setup_sigtramp linux-user/arm: Split out v2_frame 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: Tidy install_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