All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: "Farber, Eliav" <farbere@amazon.com>
Cc: mchehab@kernel.org, linux-edac@vger.kernel.org,
	linux-kernel@vger.kernel.org, ronenk@amazon.com,
	talel@amazon.com, hhhawa@amazon.com, jonnyc@amazon.com,
	hanochu@amazon.com
Subject: Re: [PATCH 1/4] EDAC: Fix calculation of returned address and next offset in edac_align_ptr()
Date: Tue, 15 Feb 2022 13:34:14 +0100	[thread overview]
Message-ID: <YgudxpqAlyQ5UqlF@zn.tnic> (raw)
In-Reply-To: <9bd8f3c5-2281-8235-9eac-d2c371245a54@amazon.com>

On Thu, Jan 27, 2022 at 11:58:58AM +0200, Farber, Eliav wrote:
> One of the fields in our private-data structure is 'struct notifier_block'
> which has a next field of type 'struct notifier_block __rcu *'.

Just to make sure I understand you correctly: you're talking about some
internal version of al_mc_edac - not what's upstream?

> The size of our private-data structure is greater than 8, and it comes after
> 'struct edac_mc_layer' which has a size that is not zero modulo eight, and
> also ends at an address that is not zero modulo eight.
> Because of the bug in edac_align_ptr(), our private-data structure which
> should have been aligned to 8 wasn't (it was aligned to 4), so
> notifier_block was also not aligned to 8, and finally next wasn't aligned
> to 8.

Ok, I think I see what's going on. So this:

8447c4d15e35 ("edac: Do alignment logic properly in edac_align_ptr()")

changed that remainder computation thing and it was supposed to do what
your patch does. Hell, even the commit message says so:

"The logic was checking the sizeof the structure being allocated to
determine whether an alignment fixup was required. This isn't right;
what we actually care about is the alignment of the actual pointer
that's about to be returned."

So if we really do care about the alignment of the actual pointer we're
about to return, then yes, we should check ptr - not p.

Lemme add that newly discovered info to your patch and queue it.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

  reply	other threads:[~2022-02-15 12:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13 10:06 [PATCH 0/4] edac_align_ptr() bug fix and refactoring Eliav Farber
2022-01-13 10:06 ` [PATCH 1/4] EDAC: Fix calculation of returned address and next offset in edac_align_ptr() Eliav Farber
2022-01-25 14:37   ` Borislav Petkov
2022-01-27  9:58     ` Farber, Eliav
2022-02-15 12:34       ` Borislav Petkov [this message]
2022-02-15 13:06         ` Farber, Eliav
2022-01-13 10:06 ` [PATCH 2/4] EDAC: Remove unnecessary cast to char* in edac_align_ptr() function Eliav Farber
2022-01-26 18:46   ` Borislav Petkov
2022-01-13 10:06 ` [PATCH 3/4] EDAC: Refactor edac_align_ptr() to use u8/u16/u32/u64 data types Eliav Farber
2022-02-15 16:55   ` Borislav Petkov
2022-01-13 10:06 ` [PATCH 4/4] EDAC: Refactor edac_align_ptr() flow Eliav Farber
2022-02-15 17:08   ` Borislav Petkov

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=YgudxpqAlyQ5UqlF@zn.tnic \
    --to=bp@alien8.de \
    --cc=farbere@amazon.com \
    --cc=hanochu@amazon.com \
    --cc=hhhawa@amazon.com \
    --cc=jonnyc@amazon.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ronenk@amazon.com \
    --cc=talel@amazon.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 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.