Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1470400ybh; Thu, 23 Jul 2020 09:37:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxRKvCFMr2aJU1l29A8Gsv/gqwbvr7AZh93sinDkfXnlwBRAhzVkLEwuZWSvad0eiUfG0A X-Received: by 2002:a05:6402:b9b:: with SMTP id cf27mr5069546edb.84.1595522262434; Thu, 23 Jul 2020 09:37:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595522262; cv=none; d=google.com; s=arc-20160816; b=zVrMOHbBsG8cF2f/523Eh7tyfoGQXc5VshhjXVOXiPfhehqH5nLjNni64cfI0XKH+M t9koLte6LhHIkiFDmOuQKhlBEumX2RQ8qCE6SHF3JtrnO2gPhxmTEIvOFkkxL8KifO1s 600Yq7OmYKd33ucEDb/TswE2QXMeo2Cse+xH0LC79V+YAJyyaAu7+eWQ4zSZ9x3e9L8E Tdn9P8EWUPITf7Gn0Y0eg1CbTJHAzhPvuP2ddNPIW6ESOcoNqoghOJIMmpYJfvtJHRJj d5ipQJz4X7GuTs60xWQOX88T7HE4YeW4dn4qEHRk+Q6RNIePmW5hjfyiV/iklGC4PZd3 HYwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+bQZoXIFqfGEwjMaiaB7VWns9AxgAgz8MsvENSHF3qY=; b=pTy5JhTLFG/+DBBU4pz2zXuE9GSOKE91I6z9+LRZvvtE6V0s876rGnafEx25FfhYFM 6+fi1ozuWPkuRwSAE46PH7P4uNsq7uuNhQGQQOXslY3f93uegBozHAmmvbqTfghg4H+q M/5hwrZKaBZMwmKrWrqOfgm1egQ7N3tf4ppnGeJqyNsElPh6c2Nq0esK2Mgwr+FgK3zu myq7FixB7QuP0Z3CJyl1JeJWewOhANG9PfSAIt36eWXhqPEzhwdjxicLlLQdQUlcL3oi Hz8F+xtAIv3iG79B+OX614LkAy3Aj27NgZK2uG4TGuE7F3dxqiTyMIubmhvHcq11DYKI MkCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=cTICzKj0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l3si2576329ejd.17.2020.07.23.09.37.19; Thu, 23 Jul 2020 09:37:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=cTICzKj0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729839AbgGWQg5 (ORCPT + 99 others); Thu, 23 Jul 2020 12:36:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726621AbgGWQg5 (ORCPT ); Thu, 23 Jul 2020 12:36:57 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92088C0619DC for ; Thu, 23 Jul 2020 09:36:56 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id x5so4985115wmi.2 for ; Thu, 23 Jul 2020 09:36:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+bQZoXIFqfGEwjMaiaB7VWns9AxgAgz8MsvENSHF3qY=; b=cTICzKj0aMs/8vGqHK/g2hIbInMQECfRZuUvt4UmcNWYRqk4xjATkzw4Md7VTesbK9 0kXACOaYojQvUMt8hJJT+8DqTHfA17ryD0glQDk8JH2nVSP0Q4uBUYu/BAlzRAHmYA8o y0kYtGciTUeol5L1fqlgNU5tvMXEEVhxrZ8JxZwzJ/f3M2PfP0/hJYt23ZKfrBJ0Cy3g sf+5xxkkh9aFDlpfsJCo9y7d7Rci8zdg8zDIDIEXRlzdECbjUvgZWo5brVCHoGxKlSkt ATq44f9IehaGrRpVQdy6xcH9zPONKCfD5Jiro1QmN0+EwIVSmPKq9p/ixYDoRczjnuBV o65Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=+bQZoXIFqfGEwjMaiaB7VWns9AxgAgz8MsvENSHF3qY=; b=iBkm5cH4G+1nhDovJR1dOpXULQijVXswAbTGhMRnOOl2x7nMJO58u2bd760WPEFvnR n5/2mmSDe688HDgSUdCuKT7uUK+GS9Ps91GNAuwKUdmvTKp5sf43fsungcllt6rSq4P6 /IROoz5T52KTHJkUSF3nSGvUs2ZlmI9y3kjnBAKw5M4WWNNaFwSmfImfsVY9YCM519lc Gm8NbMevourDZm43U4FXIcPpRdaEJ7L2rO4IyKW3k/5EntQIArQnzpK9d0R8StMZG/Km MMtPkhNnxXF1dHHFssERFLm2nYL9qkDhbQMGazRbN8Y7GQQa6vntFeqT046YUjIJ/30o E3LA== X-Gm-Message-State: AOAM53255bksMrrDLCSvkvbRPulsoByDPAVpWtkg2cKeYo6cAA2Ez8N1 5pr5DHcIBNE4EYBViOhLQ/4= X-Received: by 2002:a7b:c08b:: with SMTP id r11mr4810194wmh.130.1595522215302; Thu, 23 Jul 2020 09:36:55 -0700 (PDT) Received: from localhost.localdomain ([80.71.140.73]) by smtp.gmail.com with ESMTPSA id f9sm4274342wru.47.2020.07.23.09.36.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 09:36:54 -0700 (PDT) From: Emil Renner Berthing To: linux-riscv@lists.infradead.org, Palmer Dabbelt Cc: Emil Renner Berthing , Paul Walmsley , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , linux-kernel@vger.kernel.org Subject: [PATCH] riscv: Grab text_mutex before patching jump-labels Date: Thu, 23 Jul 2020 18:36:28 +0200 Message-Id: <20200723163628.82794-1-kernel@esmil.dk> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Like other arch's we use patch_text_nosync or equivalent to patch the jump-labels, but also like other arch's we need to hold the text_mutex before calling that. Signed-off-by: Emil Renner Berthing --- Fixes: b6e0878a4ec8 ("riscv: Add jump-label implementation") ..that is already in riscv/for-next. Palmer: Sorry, I didn't notice this before. Feel free to squash this into the commit above if you like. --- arch/riscv/kernel/jump_label.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/riscv/kernel/jump_label.c b/arch/riscv/kernel/jump_label.c index 1bab1abc1aa5..20e09056d141 100644 --- a/arch/riscv/kernel/jump_label.c +++ b/arch/riscv/kernel/jump_label.c @@ -4,8 +4,10 @@ * * Based on arch/arm64/kernel/jump_label.c */ -#include #include +#include +#include +#include #include #include @@ -33,7 +35,9 @@ void arch_jump_label_transform(struct jump_entry *entry, insn = RISCV_INSN_NOP; } + mutex_lock(&text_mutex); patch_text_nosync(addr, &insn, sizeof(insn)); + mutex_unlock(&text_mutex); } void arch_jump_label_transform_static(struct jump_entry *entry, -- 2.27.0