mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Liu, Yujie" <yujie.liu@intel.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>,
	"lkp@lists.01.org" <lkp@lists.01.org>, lkp <lkp@intel.com>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	"Sang, Oliver" <oliver.sang@intel.com>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [LKP] Re: [jump_label, x86]  e7bf1ba97a: BUG:unable_to_handle_page_fault_for_address
Date: Mon, 28 Jun 2021 12:08:22 +0200	[thread overview]
Message-ID: <YNmflj/WpFG5Ivmb@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <YNmUzDjX6sECp37P@hirez.programming.kicks-ass.net>

On Mon, Jun 28, 2021 at 11:22:20AM +0200, Peter Zijlstra wrote:
> On Thu, Jun 24, 2021 at 06:32:25AM +0000, Liu, Yujie wrote:
> > > > [  222.094341] BUG: unable to handle page fault for address:
> > > > ffffffff83ccffe0
> > > 
> > > I *think* the below might help, can you try?
> > 
> > Hi Peter Z,
> > 
> > We try to apply the patch on commit e7bf1ba97afdd (jump_label, x86: Emit short JMP)
> > A new BUG appeared before reaching the BUG reported in previous mail.
> > Full dmesg in attachment.
> 
> > > @@ -555,6 +558,7 @@ static int __jump_label_mod_text_reserved(void *start, void *end)
> > >  	WARN_ON_ONCE(__module_text_address((unsigned long)end) != mod);
> > >  	if (!try_module_get(mod))
> > >  		mod = NULL;
> > > +	init = mod->state == MODULE_STATE_COMING;
> > >  	preempt_enable();
> > > 
> > >  	if (!mod)
> 
> *groan*, I'm an idiot... There's an obvious NULL pointer deref right
> there.
> 
> Let me try locally first before I send yet another dud.

OK, the below seems to work. Your report might've been easier to parse
if it had told me the failing test was:

  tools/testing/selftests/ftrace/ftracetest

And that test would've been easier to use if it would just say wth was
missing from the .config :/

Let me go write up a proper patch and do the same for static_call.

---
diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index ba39fbb1f8e7..af520ca26360 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -316,14 +316,16 @@ static int addr_conflict(struct jump_entry *entry, void *start, void *end)
 }
 
 static int __jump_label_text_reserved(struct jump_entry *iter_start,
-		struct jump_entry *iter_stop, void *start, void *end)
+		struct jump_entry *iter_stop, void *start, void *end, bool init)
 {
 	struct jump_entry *iter;
 
 	iter = iter_start;
 	while (iter < iter_stop) {
-		if (addr_conflict(iter, start, end))
-			return 1;
+		if (init || !jump_entry_is_init(iter)) {
+			if (addr_conflict(iter, start, end))
+				return 1;
+		}
 		iter++;
 	}
 
@@ -561,7 +563,7 @@ static int __jump_label_mod_text_reserved(void *start, void *end)
 
 	ret = __jump_label_text_reserved(mod->jump_entries,
 				mod->jump_entries + mod->num_jump_entries,
-				start, end);
+				start, end, mod->state == MODULE_STATE_COMING);
 
 	module_put(mod);
 
@@ -786,8 +788,9 @@ early_initcall(jump_label_init_module);
  */
 int jump_label_text_reserved(void *start, void *end)
 {
+	bool init = system_state < SYSTEM_RUNNING;
 	int ret = __jump_label_text_reserved(__start___jump_table,
-			__stop___jump_table, start, end);
+			__stop___jump_table, start, end, init);
 
 	if (ret)
 		return ret;

  reply	other threads:[~2021-06-28 10:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-23  2:28 kernel test robot
2021-06-23  8:14 ` Peter Zijlstra
2021-06-24  6:32   ` [LKP] " Liu, Yujie
2021-06-28  9:22     ` Peter Zijlstra
2021-06-28 10:08       ` Peter Zijlstra [this message]
2021-06-28 11:36         ` Peter Zijlstra
2021-06-29  5:59           ` Liu, Yujie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YNmflj/WpFG5Ivmb@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=lkp@lists.01.org \
    --cc=mingo@kernel.org \
    --cc=oliver.sang@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=x86@kernel.org \
    --cc=yujie.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®