linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: marc.zyngier@arm.com, mark.rutland@arm.com, james.morse@arm.com,
	linux-arm-kernel@lists.infradead.org, guillaume.gardet@arm.com
Subject: Re: [PATCH] arm64/module: deal with ambiguity in PRELxx relocation ranges
Date: Thu, 23 May 2019 11:24:24 +0100	[thread overview]
Message-ID: <20190523102424.GI26646@fuggles.cambridge.arm.com> (raw)
In-Reply-To: <20190521125707.6115-1-ard.biesheuvel@arm.com>

On Tue, May 21, 2019 at 01:57:07PM +0100, Ard Biesheuvel wrote:
> The R_AARCH64_PREL16 and R_AARCH64_PREL32 relocations are
> documented as permitting a range of [-2^15 .. 2^16), resp.
> [-2^31 .. 2^32). It is also documented that this means we
> cannot detect overflow in some cases, which is bad.
> 
> Since we always interpret the targets of these relocations as
> signed quantities (e.g., in the ksymtab handling code), let's
> tighten the overflow checks so that targets that are out of
> range for our signed interpretation of the relocated quantity
> get flagged.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
> ---
>  arch/arm64/kernel/module.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c
> index f713e2fc4d75..2e4e3915b4d0 100644
> --- a/arch/arm64/kernel/module.c
> +++ b/arch/arm64/kernel/module.c
> @@ -99,12 +99,12 @@ static int reloc_data(enum aarch64_reloc_op op, void *place, u64 val, int len)
>  	switch (len) {
>  	case 16:
>  		*(s16 *)place = sval;
> -		if (sval < S16_MIN || sval > U16_MAX)
> +		if (sval < S16_MIN || sval > S16_MAX)

Sorry to be a pain, but can you add a comment here saying why we're
devaiting from the AArch64 ELF spec, please? It's all in the commit message,
but I'd like to have it in the code too so we don't "fix" it later on.

Cheers,

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      reply	other threads:[~2019-05-23 10:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-21 12:57 [PATCH] arm64/module: deal with ambiguity in PRELxx relocation ranges Ard Biesheuvel
2019-05-23 10:24 ` Will Deacon [this message]

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=20190523102424.GI26646@fuggles.cambridge.arm.com \
    --to=will.deacon@arm.com \
    --cc=ard.biesheuvel@arm.com \
    --cc=guillaume.gardet@arm.com \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.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;
as well as URLs for NNTP newsgroup(s).