From: "禹舟健(基础平台部)" <yuzhoujian@didichuxing.com>
To: Michal Hocko <mhocko@kernel.org>, David Rientjes <rientjes@google.com>
Cc: kernel test robot <rong.a.chen@intel.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
Roman Gushchin <guro@fb.com>, Yang Shi <yang.s@alibaba-inc.com>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>, "lkp@01.org" <lkp@01.org>
Subject: Re: [LKP] [mm, oom] c1e4c54f9c: BUG:KASAN:null-ptr-deref_in_d
Date: Wed, 1 Aug 2018 02:17:04 +0000 [thread overview]
Message-ID: <0d4090532f15434aa71779e9dc8a0014@BJSGEXMBX10.didichuxing.com> (raw)
OK, no problems.
-----邮件原件-----
发件人: Michal Hocko <mhocko@kernel.org>
发送时间: 2018年7月31日 14:55
收件人: David Rientjes <rientjes@google.com>; 禹舟健(基础平台部) <yuzhoujian@didichuxing.com>
抄送: kernel test robot <rong.a.chen@intel.com>; Stephen Rothwell <sfr@canb.auug.org.au>; Kirill A. Shutemov <kirill.shutemov@linux.intel.com>; Andrea Arcangeli <aarcange@redhat.com>; Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>; Roman Gushchin <guro@fb.com>; Yang Shi <yang.s@alibaba-inc.com>; Andrew Morton <akpm@linux-foundation.org>; LKML <linux-kernel@vger.kernel.org>; lkp@01.org
主题: [此邮件疑似为垃圾邮件] Re: [LKP] [mm, oom] c1e4c54f9c: BUG:KASAN:null-ptr-deref_in_d
On Mon 30-07-18 19:05:50, David Rientjes wrote:
> On Mon, 30 Jul 2018, Michal Hocko wrote:
>
> > On Mon 30-07-18 17:03:20, kernel test robot wrote:
> > [...]
> > > [ 9.034310] BUG: KASAN: null-ptr-deref in dump_header+0x10c/0x448
> >
> > Could you faddr2line on the offset please?
> >
>
> It's possible that p is NULL when calling dump_header(). In this case
> we do not want to print any line concerning a victim because no oom
> kill has occurred.
You are right. I have missed those.
> This code shouldn't be part of dump_header(), which is called from
> multiple contexts even when an oom kill has not occurred, and is
> ratelimited. The single line output should be the canonical way that
> userspace parses the log for oom victims, we can't ratelimit it.
>
> The following would be a fix patch, but it will be broken if the
> cgroup aware oom killer is removed from -mm so that the oom_group
> stuff can be merged.
cgroup aware oom killer is going to be replaced by a new implementation IIUC so the fix should be based on the yuzhoujian patch. Ideally to be resubmitted.
I would just suggest adding it into a function dump_oom_summary(struct oom_control *oc, struct task_struct *p)
yuzhoujian could you take care of that please?
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -438,14 +438,6 @@ static void dump_header(struct oom_control *oc,
> struct task_struct *p)
>
> dump_stack();
>
> - /* one line summary of the oom killer context. */
> - pr_info("oom-kill:constraint=%s,nodemask=%*pbl",
> - oom_constraint_text[oc->constraint],
> - nodemask_pr_args(oc->nodemask));
> - cpuset_print_current_mems_allowed();
> - mem_cgroup_print_oom_context(oc->memcg, p);
> - pr_cont(",task=%s,pid=%d,uid=%d\n", p->comm, p->pid,
> - from_kuid(&init_user_ns, task_uid(p)));
> if (is_memcg_oom(oc))
> mem_cgroup_print_oom_meminfo(oc->memcg);
> else {
> @@ -836,7 +828,8 @@ static bool task_will_free_mem(struct task_struct *task)
> return ret;
> }
>
> -static void __oom_kill_process(struct task_struct *victim)
> +static void __oom_kill_process(struct task_struct *victim,
> + struct oom_control *oc)
> {
> struct task_struct *p;
> struct mm_struct *mm;
> @@ -883,6 +876,18 @@ static void __oom_kill_process(struct task_struct *victim)
> K(get_mm_counter(victim->mm, MM_ANONPAGES)),
> K(get_mm_counter(victim->mm, MM_FILEPAGES)),
> K(get_mm_counter(victim->mm, MM_SHMEMPAGES)));
> +
> + if (oc) {
> + /* One line summary for non-group oom kills */
> + pr_info("oom-kill: constraint=%s, nodemask=%*pbl",
> + oom_constraint_text[oc->constraint],
> + nodemask_pr_args(oc->nodemask));
> + cpuset_print_current_mems_allowed();
> + mem_cgroup_print_oom_context(oc->memcg, victim);
> + pr_cont(", task=%s, pid=%d, uid=%d\n",
> + victim->comm, victim->pid,
> + from_kuid(&init_user_ns, task_uid(victim)));
> + }
> task_unlock(victim);
>
> /*
> @@ -986,13 +991,13 @@ static void oom_kill_process(struct oom_control *oc, const char *message)
> }
> read_unlock(&tasklist_lock);
>
> - __oom_kill_process(victim);
> + __oom_kill_process(victim, oc);
> }
>
> static int oom_kill_memcg_member(struct task_struct *task, void
> *unused) {
> get_task_struct(task);
> - __oom_kill_process(task);
> + __oom_kill_process(task, NULL);
> return 0;
> }
>
> @@ -1020,7 +1025,7 @@ static bool oom_kill_memcg_victim(struct oom_control *oc)
> oc->chosen_task == INFLIGHT_VICTIM)
> goto out;
>
> - __oom_kill_process(oc->chosen_task);
> + __oom_kill_process(oc->chosen_task, oc);
> }
>
> out:
--
Michal Hocko
SUSE Labs
next reply other threads:[~2018-08-01 2:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-01 2:17 禹舟健(基础平台部) [this message]
2018-08-05 3:41 ` 禹舟键
2018-08-06 6:06 ` Michal Hocko
2018-08-06 10:02 ` 禹舟键
2018-08-06 21:37 ` David Rientjes
-- strict thread matches above, loose matches on Subject: below --
2018-07-30 9:03 kernel test robot
2018-07-30 9:56 ` Michal Hocko
2018-07-31 2:05 ` David Rientjes
2018-07-31 6:54 ` Michal Hocko
2018-07-31 2:06 ` Rong Chen
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=0d4090532f15434aa71779e9dc8a0014@BJSGEXMBX10.didichuxing.com \
--to=yuzhoujian@didichuxing.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=guro@fb.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@01.org \
--cc=mhocko@kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=rientjes@google.com \
--cc=rong.a.chen@intel.com \
--cc=sfr@canb.auug.org.au \
--cc=yang.s@alibaba-inc.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®