From patchwork Tue Jun 18 19:43:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Olsa X-Patchwork-Id: 13702879 X-Patchwork-Delegate: mhiramat@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98D0016CD2F; Tue, 18 Jun 2024 19:43:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718739791; cv=none; b=kIKosu8RrgI3kMNfUpL6wpAgRtqPi/5TLv8ghx+AEiO9NiHaANwEnDtvA5RRUavOtXH4flIhImiMX8T+7RlK5wW4zDx2Y5LqbDKNDwPuHwYjSbVECERHC0ilyUCpkrNuF/nmENb9ZXeTCHO+hLI5S0TL1zKbOsqMkbMtxSVJdMw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718739791; c=relaxed/simple; bh=zwl6yr893bBfcdiqEmF2QjAt7NjyQRGKsWlJ2ipbcWw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=YUEk0YjTVsoDOhF9iv7Nj+nrvP5qHsGyDAZzFbu/GK/3TPBJHpOQXSIQjvpPSa2aAH3p42YfdF6JHpqhPCzB8hQS1bXpmyvRSEkVSLdRNouSNGkpgF7WC/rnqYsAfVnWizulJFvptFZzoBVpPdFsCD/fdYXMv23oPsX6zs9KXNg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r2UCoRi8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="r2UCoRi8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1E78C3277B; Tue, 18 Jun 2024 19:43:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718739791; bh=zwl6yr893bBfcdiqEmF2QjAt7NjyQRGKsWlJ2ipbcWw=; h=From:To:Cc:Subject:Date:From; b=r2UCoRi8UhpFvz6j1T82/uNvxvuR1UoWmq4cH+Q/GoWUNUnz++FOck2Uf4bATbU7V qSrfvyjQ2/Y9Fd8244L29eVy+GdjsS8Pwp9PMQ+yMgKfswyfVvnI+wexmdxEHcC3ZL WGywm17Bb4wdihGiwqbRnh8LIvyu8TdAkhauXcug3fC6A3Yms2GAugxRB5KLtfY85V XKcfOs9kEHGJIyOmCZhfBwmCoQyJWcyZ2Bb37kctHYJ+AGJXqXURPaarfjnb/A12Gy AnBYCpwsp8i8GTc/pDMabaTZLi6iT0zuDQknWCM8APN2bzONcnMwFeltrB6R6f+Fee UaUoU/gRuwMYw== From: Jiri Olsa To: Steven Rostedt , Masami Hiramatsu , Andrii Nakryiko Cc: Oleg Nesterov , Nathan Chancellor , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH] uprobe: Do not use UPROBE_SWBP_INSN as static initializer Date: Tue, 18 Jun 2024 21:43:06 +0200 Message-ID: <20240618194306.1577022-1-jolsa@kernel.org> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Nathan reported compilation fail for loongarch arch: kernel/events/uprobes.c: In function 'arch_uprobe_trampoline': arch/loongarch/include/asm/uprobes.h:12:33: error: initializer element is not constant 12 | #define UPROBE_SWBP_INSN larch_insn_gen_break(BRK_UPROBE_BP) | ^~~~~~~~~~~~~~~~~~~~ kernel/events/uprobes.c:1479:39: note: in expansion of macro 'UPROBE_SWBP_INSN' 1479 | static uprobe_opcode_t insn = UPROBE_SWBP_INSN; Loongarch defines UPROBE_SWBP_INSN as function call, so we can't use it to initialize static variable. Cc: Oleg Nesterov Fixes: ff474a78cef5 ("uprobe: Add uretprobe syscall to speed up return probe") Reported-by: Nathan Chancellor Signed-off-by: Jiri Olsa --- kernel/events/uprobes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 2816e65729ac..6986bd993702 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -1476,8 +1476,9 @@ static int xol_add_vma(struct mm_struct *mm, struct xol_area *area) void * __weak arch_uprobe_trampoline(unsigned long *psize) { - static uprobe_opcode_t insn = UPROBE_SWBP_INSN; + static uprobe_opcode_t insn; + insn = insn ?: UPROBE_SWBP_INSN; *psize = UPROBE_SWBP_INSN_SIZE; return &insn; }