linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Why is text_mutex used in jump_label_transform for x86_64
@ 2020-03-19 13:49 chengjian (D)
  2020-03-20 10:27 ` Peter Zijlstra
  0 siblings, 1 reply; 6+ messages in thread
From: chengjian (D) @ 2020-03-19 13:49 UTC (permalink / raw)
  To: andrew.murray, bristot, jakub.kicinski, Kees Cook
  Cc: x86, linux-kernel, linux-arm-kernel, Xiexiuqi (Xie XiuQi),
	Li Bin, bobo.shaobowang, chengjian (D)

Hi,everyone

I'm sorry to disturb you. I have a problem about jump_label, and a bit 
confused about the code

I noticed that text_mutex is used in this function under x86_64 
architecture,
but other architectures do not.

in arch/x86/kernel/jump_label.c
         static void __ref jump_label_transform(struct jump_entry *entry,
              enum jump_label_type type,
              int init)
         {
          mutex_lock(&text_mutex);
          __jump_label_transform(entry, type, init);
          mutex_unlock(&text_mutex);

in arch/arm64/kernel/jump_label.c

         void arch_jump_label_transform(struct jump_entry *entry,
                                        enum jump_label_type type)
         {
                 void *addr = (void *)jump_entry_code(entry);
                 u32 insn;

                 if (type == JUMP_LABEL_JMP) {
                         insn = 
aarch64_insn_gen_branch_imm(jump_entry_code(entry),
jump_entry_target(entry),
AARCH64_INSN_BRANCH_NOLINK);
                 } else {
                         insn = aarch64_insn_gen_nop();
                 }

                 aarch64_insn_patch_text_nosync(addr, insn);
         }


Is there anything wrong with x86

or

is this missing for other architectures?


Thanks

---- Cheng Jian






^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-04-08  1:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19 13:49 Why is text_mutex used in jump_label_transform for x86_64 chengjian (D)
2020-03-20 10:27 ` Peter Zijlstra
2020-04-06  8:39   ` chengjian (D)
2020-04-06  9:15     ` Peter Zijlstra
2020-04-06 14:10       ` Will Deacon
2020-04-08  1:17         ` chengjian (D)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).