From patchwork Mon Feb 12 02:55:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 199569 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2204094dyd; Sun, 11 Feb 2024 18:56:38 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX/WKeTYN+iI96b26OdIwOn14Pmv0HGsmzuRPKU/50w875NybKCHwr+I+zQWS+B3CEtNhpoYSfPG292FPn7oNnCLvvDeQ== X-Google-Smtp-Source: AGHT+IHuJlXUZEJPGpiNaKUVAXRvWo0ykUOqL7qd0b4EcOJ9/j9Rf6NQc3HAsWTOFGSjDZpbuqA5 X-Received: by 2002:a05:620a:677:b0:783:f753:813b with SMTP id a23-20020a05620a067700b00783f753813bmr4783841qkh.64.1707706598227; Sun, 11 Feb 2024 18:56:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707706598; cv=pass; d=google.com; s=arc-20160816; b=MaUUHerDWcCyFmJxm3aH3No3zFO1vG8mRyW2vJ9IyIOQm0NETiG964UH6PjjwYki0X 3r+1u+vJ0OGP6lPlaKg83USs+nuK2xJvOZDsIAgQ80qgT3fYca+Ph0Ur/JKC2yFPIyw6 KTMWOfz8asSTJsPs8ZkeCJi8gUCFvk9aWw2CXgQ2HdzgcLpIY9kmx1A5DrS/T64LDXln roXsW66KQQQ+l6nWeVgYJlgVbfgT7gqSA621rkF9F6nxaFLwMvO/3eAAN9loL03/PlbZ fHSg3GHJJVvPpW8qWWPe5nIy5f/vR7jyQBLns1wLmkYQClTu85CrcutoDXVhU3uhGgFk 3KPg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=dyWEpJBZa6N5gG6vKnxq0FYgwkGh/wmTGuSHlmGCra0=; fh=5hvfg/Zixbr7D1fmIyi954j4Jr9hzeVRmN4mkxlSt7U=; b=BwZSJQkMor6osrd98LRBKTzyxmp6X055X+UDP5ik/PC5t2eeDjkrj7ujljgGX3g9Ts 9iFUSZbS6T+MZP9IzSWn/hOAe3rOPUnB1VpEaFJPg6pr+lHhjtCEQpeyrBNIRY2pv4Bw Ox+3a8H7fzqTUS2HorifmX5yUPQ6LvIxNry9E2rcVuHMwEeoB5qW97Hdwgyj/lGlsFjY //AeEMnGA39q7nsIIFRQsKYUPucYEflxnNOza2j0U9ueycz9BQ1ssKERjuRx7i5bGhBK iswmauwGLNhwUzVyDNuKMSXW/219Fquqs+fTvIuEyoImeLNTe5mM211PvHg4+XJBPMYL b66A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=bMMscS28; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-61077-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61077-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com X-Forwarded-Encrypted: i=2; AJvYcCWagADOb47op/tTBkVe1LI2Gy5kNmPqRTpnDO/w+rb0rLBzI9gFJP1fvPqQtePO/Y2SeaJI4yqkP3bTVYT7nC5rRWfKEg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h15-20020a05620a13ef00b00785d7692a94si1161670qkl.323.2024.02.11.18.56.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 18:56:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61077-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=bMMscS28; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-61077-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61077-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 09FA31C21640 for ; Mon, 12 Feb 2024 02:56:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D48610A1D; Mon, 12 Feb 2024 02:55:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="bMMscS28" Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BC6279F9 for ; Mon, 12 Feb 2024 02:55:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707706535; cv=none; b=ghHA7AroQGwIUH+dM7Wfoo6cz17lLu14SSLCfxFeOLiC7R87FH2emmDESYBqDE82vgs42XWNP7oKgZzVb9J8vjqvh3AZ4YWzybCICrOtgAs4+C38PKYoGyQCEYFXYDGzFG5UIC0LzXPg7s2QVxNczMipTCefB+Qfz7PJ63pu+z4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707706535; c=relaxed/simple; bh=hGoXyhdOZzkX3SM1U+B5MT4w/IBhEMz7O05oyr3ELpo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cFFVCM787g95Bx04rYcZtAW2AqFGe7NyZj50t65eiintkls+FnrZiGYijjzmM0TjwJDrMwFabOU7sM+XG3yshhS97n5De/mbCo7xeH3zJI6aZmm6pI0mQQm8QKijPKkEZwPL2dhMfpBUXPxGrHWxmXhGLwTIBF2zsJQV/kJXB3U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com; spf=pass smtp.mailfrom=sifive.com; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b=bMMscS28; arc=none smtp.client-ip=209.85.214.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1d7354ba334so23827625ad.1 for ; Sun, 11 Feb 2024 18:55:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1707706533; x=1708311333; darn=vger.kernel.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=dyWEpJBZa6N5gG6vKnxq0FYgwkGh/wmTGuSHlmGCra0=; b=bMMscS28ybqZed+IqfZ7jZKNX0g7EIzEqtxxZFAj+qIfU9LC35OF1R9gUFycjHUOBi Ju+NPeFKADCulqAAQp5fwII+5c+FmRPjb5lkm45/rDPAIomSj+T+11VsozZhWK3PBygP uXct7LhbF/2J+VGPmUClSiqqoLIwIFpwzkOwLIMQVsjZ6Yd9EDHMSaWtbTpduftCsFPO grpqZPJqDhZoXhgmbWl8O4q1rozy76l5bGQvAldBRWNkOPyNxMavAgeTvhajZQeC/ei8 +8rVSLow/+NZ0qPrMDzkQY4EdbI9dHw1WZuSfW1pyk6YlkTG/9EK/LZrUkkYkKtt4UdU Exbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707706533; x=1708311333; 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=dyWEpJBZa6N5gG6vKnxq0FYgwkGh/wmTGuSHlmGCra0=; b=q21cMQrtuvJQdwEhaSnJEfmMSo5SEjpVyKJn8Q2zi1PGw3THqAXOOjSgoqGFCYbhva IhviF6U1KfLYqJjpKB7NfB4YQk7VP0XjCqJ/jHxXCYofsY1tnYN8+4dUWfkFT8SQe5uq L1sg+3aBVQCzxOnYj5C/RwX+ugfOQJlBlvtPc1+HfuumIoT4rT6CBYFlLYREwyHWAG97 QiVSKwb5tjN9g57yq1Zq2Qt09OYeKE0vYLwcglBqX1xV4FCp1t6PkcXrV2t2ErQCPhPo UkSbdyaCQMWLsWV0k070MpcWy8+CrAOfSEXKx5pr2Gpc62sxT4OChyfJe+iU0nEnGOxJ rLpA== X-Forwarded-Encrypted: i=1; AJvYcCUUiVyzJ0gjNEi71wXykTvC/K0asAdQVgHF/SYjLArUZcdb69uy0GoIPkIAeEHCxgFd6/tNkZnJzrZgSWyh6p5IsqbuNBAIPFKGoQbf X-Gm-Message-State: AOJu0Yz/0mQyU9WjZl7wdt4fWx5ih/lU9x6Pwgm7viL9o19BooaopzWw EtGoD+LytUfxxwiY3b+NU4imn+9T5yCGDFMOLhubKd0JyxMMQYKHnlDX1IC15Es= X-Received: by 2002:a17:902:e543:b0:1da:2a91:8c08 with SMTP id n3-20020a170902e54300b001da2a918c08mr2970896plf.3.1707706533677; Sun, 11 Feb 2024 18:55:33 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUuWR7ifv90QrNgp9OEt3yI6Kuwl8TrHbiwLrMId33GgFSjH88KNG50sMejjWgECWoCB1ug+/IqU9OjHkK5Vn/juEDCGgYKNrlq73OyQmooS6Cdg7mXmU3LW3vffu4GbXxiPKCchb2+ Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id lb3-20020a170902fa4300b001d9af77893esm4906443plb.58.2024.02.11.18.55.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 18:55:33 -0800 (PST) From: Samuel Holland To: Palmer Dabbelt Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Samuel Holland Subject: [PATCH 3/7] riscv: kprobes: Use patch_text_nosync() for insn slots Date: Sun, 11 Feb 2024 18:55:14 -0800 Message-ID: <20240212025529.1971876-4-samuel.holland@sifive.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240212025529.1971876-1-samuel.holland@sifive.com> References: <20240212025529.1971876-1-samuel.holland@sifive.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790660153766042046 X-GMAIL-MSGID: 1790660153766042046 These instructions are not yet visible to the rest of the system, so there is no need to do the whole stop_machine() dance. Signed-off-by: Samuel Holland Reviewed-by: Björn Töpel --- arch/riscv/kernel/probes/kprobes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/riscv/kernel/probes/kprobes.c b/arch/riscv/kernel/probes/kprobes.c index 2f08c14a933d..cbf8197072bf 100644 --- a/arch/riscv/kernel/probes/kprobes.c +++ b/arch/riscv/kernel/probes/kprobes.c @@ -28,9 +28,9 @@ static void __kprobes arch_prepare_ss_slot(struct kprobe *p) p->ainsn.api.restore = (unsigned long)p->addr + offset; - patch_text(p->ainsn.api.insn, &p->opcode, 1); - patch_text((void *)((unsigned long)(p->ainsn.api.insn) + offset), - &insn, 1); + patch_text_nosync(p->ainsn.api.insn, &p->opcode, 1); + patch_text_nosync(p->ainsn.api.insn + offset, + &insn, 1); } static void __kprobes arch_prepare_simulate(struct kprobe *p)