linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Ramana <sramana@codeaurora.org>
To: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: "linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	linux-arm-msm@vger.kernel.org, catalin.marinas@arm.com,
	will.deacon@arm.com, neeraju@codeaurora.org
Subject: Re: LDM/STM alignment fixups on arm64
Date: Wed, 19 Apr 2017 18:20:10 +0530	[thread overview]
Message-ID: <58F75D02.1030104@codeaurora.org> (raw)
In-Reply-To: <20170419095830.GK17774@n2100.armlinux.org.uk>

On 04/19/2017 03:28 PM, Russell King - ARM Linux wrote:
> On Wed, Apr 19, 2017 at 12:03:58PM +0530, Srinivas Ramana wrote:
>> Hi,
>>
>> While understanding how the alignment are handled on arm and arm64, we came
>> across the fixups for LDM/LDRD/STM on arm where as these fixups are not
>> present on arm64.
>>
>> There may be some specific reason why these fixups are not ported to arm64.
>> Can you please help us understand this?
>>
>> With this difference in how kernel handles 32-bit apps on arm and arm64,
>> there can be apps which are working without abort on arm, but fail on arm64
>> (SIGBUS). We have tried to get some history on web, but not successful.
>>
>> If this is indeed missing on arm64, do you see any issue if its ported (does
>> it fail any guidance)?
>
> Do you have an application that fails because of this?  Your email makes
> it sound very theoretical.
>

I don't have any application with me right now. But i just tried passing 
an intentional misaligned address in a test program. When i say 
intentional, please note this code is buggy and should be fixed.

So, my question is when arm has such fixups to handle such cases and do 
gracefully, is there any reason why those fixups are not ported to 
arm64? Again, I do agree that apps has to fix these instances, but we do 
have fixups in arch/arm.

I do see that the compiler can detect (if its not intentionally induced) 
such cases and avoiding to generate LDM/STM and generates multiple 
LDR/STR. So, I just want to know if it is safe to assume that the 
compiler would take care of all such misaligned addresses passed to LDM/STM?

------------------------>8---------------------------------------
struct locat {
         int a;
         int b;
         int c;
         int d;
};

int test_func()
{
         struct locat *int_pool1;
         struct locat int_pool2;
         struct locat *int_pool3;
         char *ptr;

         int_pool1 = malloc(sizeof(struct locat) + 16);
         ptr = (char *)int_pool1;
         int_pool3 = (struct locat *)(ptr+1);

         printf("pool1 addr: 0x%08x pool3 addr: 0x%08x \n", &int_pool1, 
int_pool3);
         int_pool2 = *int_pool3;
}

------------------------8<---------------------------------------


Thanks,
-- Srinivas R


-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, 
Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.

  reply	other threads:[~2017-04-19 12:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-19  6:33 LDM/STM alignment fixups on arm64 Srinivas Ramana
2017-04-19  9:58 ` Russell King - ARM Linux
2017-04-19 12:50   ` Srinivas Ramana [this message]
2017-04-19 13:17     ` Russell King - ARM Linux
2017-04-19 15:58     ` Catalin Marinas
2017-04-20 11:20       ` Srinivas Ramana

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=58F75D02.1030104@codeaurora.org \
    --to=sramana@codeaurora.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=neeraju@codeaurora.org \
    --cc=will.deacon@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).