All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
To: Borislav Petkov <bp@alien8.de>
Cc: <dougthompson@xmission.com>, <linux-edac@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] EDAC, MCE, AMD: Fix code to prevent NULL dereference
Date: Mon, 17 Feb 2014 16:36:24 -0600	[thread overview]
Message-ID: <53028EE8.20106@amd.com> (raw)
In-Reply-To: <20140217194153.GG4559@pd.tnic>

On 2/17/2014 1:41 PM, Borislav Petkov wrote:
> On Mon, Feb 17, 2014 at 01:26:20PM -0600, Aravind Gopalakrishnan wrote:
>>>   	if (c->x86_vendor != X86_VENDOR_AMD)
>>> -		return 0;
>>> +		return -ENODEV;
>>>   	if (c->x86 < 0xf || c->x86 > 0x16)
>>> -		return 0;
>>> +		return -ENODEV;
>>
> But we still need a fix, I guess the one I sent you does the job, yes,
> no?

Actually, the changes you sent above does the job only if 'edac-mce-amd' 
is configured as module.
If it is built-in (and looks like this is what Kconfig recommends as 
well..), then -
   * We can still modprobe mce_amd_inj
   * inject error
   * mce_amd_inj calls into amd_decode_mce and
   * this for mc0, mc1 and mc2 will lead to NULL dereference if family 
is unsupported.

So we'd still need the patch I sent earlier.
I guess what we really need is a mash-up of both changes..

> If not, I'd need more background info though - you're loading this on an
> unsupported family, right?
Yes. (more or less :) )
(background info to make things clear-)
someone did try this on unsupported HW and got kernel oops.
But since I can't get my hands on one,  I am simulating it by using a 
fam15, M30h box and setting the init condition as
      if (c->x86 < 0xf || c->x86 > 0x14)

snapshot of the oops from simulating on my system:
[   28.846200] [Hardware Error]: MC0 Error:
[   28.846218] BUG: unable to handle kernel NULL pointer dereference 
at           (null)
[   28.846232] IP: [<ffffffff81608526>] amd_decode_mce+0x526/0x900
[   28.846247] PGD 40bc9e067 PUD 40c677067 PMD 0
[   28.846257] Oops: 0000 [#1] SMP
[   28.846264] Modules linked in: mce_amd_inj amd64_edac_mod r8169


here's a sample mc0 error injected after applying both sets of changes 
to the code:
[   94.109090] [Hardware Error]: MC0 Error:
[   94.109103] fam_ops structure not alloc-ed. Cannot provide detailed 
family/model specific error decoding.
[   94.109119] [Hardware Error]: Error Status: Uncorrected, software 
containable error.
[   94.109132] [Hardware Error]: CPU:0 (15:30:0) 
MC0_STATUS[-|UE|-|-|-|-|-]: 0xa000000000010f0f
[   94.109146] [Hardware Error]: cache level: L3/GEN, mem/io: GEN, 
mem-tx: GEN, part-proc: GEN (timed out)


Shall I work up the patch with both sets of changes and resend?

Thanks,
-Aravind.


  reply	other threads:[~2014-02-17 22:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-17 17:49 [PATCH] EDAC, MCE, AMD: Fix code to prevent NULL dereference Aravind Gopalakrishnan
2014-02-17 18:27 ` Borislav Petkov
2014-02-17 19:26   ` Aravind Gopalakrishnan
2014-02-17 19:41     ` Borislav Petkov
2014-02-17 22:36       ` Aravind Gopalakrishnan [this message]
2014-02-18  0:36         ` Borislav Petkov
2014-02-18  8:46           ` Borislav Petkov
2014-02-18 18:27             ` Aravind Gopalakrishnan
2014-02-20  9:32               ` Borislav Petkov
2014-02-20 16:07                 ` Aravind Gopalakrishnan
2014-02-20 16:13                   ` Borislav Petkov
2014-02-21 14:23                     ` Borislav Petkov
2014-02-21 16:46                       ` Aravind Gopalakrishnan

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=53028EE8.20106@amd.com \
    --to=aravind.gopalakrishnan@amd.com \
    --cc=bp@alien8.de \
    --cc=dougthompson@xmission.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.