All of lore.kernel.org
 help / color / mirror / Atom feed
From: tixy@linaro.org (Jon Medhurst (Tixy))
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v20 08/11] ARM: kprobes: enable OPTPROBES for ARM 32
Date: Fri, 09 Jan 2015 19:18:49 +0000	[thread overview]
Message-ID: <1420831129.4160.78.camel@linaro.org> (raw)
In-Reply-To: <20150109175711.GA12302@n2100.arm.linux.org.uk>

On Fri, 2015-01-09 at 17:57 +0000, Russell King - ARM Linux wrote:
[...]
> For me:
> 
> $ echo 'asm ("bx r2\n");' | arm-linux-gcc -x c -c -marm -march=armv4 -v - -o o.o
> 
> calls the assembler thusly:
> 
> /usr/local/lib/gcc/arm-linux-gnueabi/4.7.4/../../../../arm-linux-gnueabi/bin/as \
> -v -march=armv4 -meabi=5 --fix-v4bx -o o.o /tmp/ccB0cZgO.s
> 
> Sure enough, the object file contains:
> 
> 00000000 <.text>:
>    0:   e12fff12        bx      r2
>                         0: R_ARM_V4BX   *ABS*
> 
> so it looks like it's been told...  Then if you do:
> 
> $ arm-linux-ld --fix-v4bx -o o1.o o.o
> $ arm-linux-objdump -dr o1.o
> 
> you get:
> 
>     8074:       e1a0f002        mov     pc, r2

I get results consistent with what you get above. A bit of googling
seems to indicate the generate-BX-and-fix-it-in-the-linker came in many
years ago with AEABI support.

> Hmm, I wonder if this means we should have the kernel linker deal with
> V4BX relocations on ARMv4, converting them to their mov pc, X variant.
> 
> Also, do we need --fix-v4bx for the link of vmlinux?

I guess the answer is yes if we want to catch uses of BX in inline
assembly. A quick and not very thorough grep of arch/arm for 'bx'
doesn't seem to turn up any existing dodgy uses, except in the kprobes
test code I wrote :-(

-- 
Tixy

WARNING: multiple messages have this Message-ID (diff)
From: "Jon Medhurst (Tixy)" <tixy@linaro.org>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Wang Nan <wangnan0@huawei.com>,
	masami.hiramatsu.pt@hitachi.com, lizefan@huawei.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v20 08/11] ARM: kprobes: enable OPTPROBES for ARM 32
Date: Fri, 09 Jan 2015 19:18:49 +0000	[thread overview]
Message-ID: <1420831129.4160.78.camel@linaro.org> (raw)
In-Reply-To: <20150109175711.GA12302@n2100.arm.linux.org.uk>

On Fri, 2015-01-09 at 17:57 +0000, Russell King - ARM Linux wrote:
[...]
> For me:
> 
> $ echo 'asm ("bx r2\n");' | arm-linux-gcc -x c -c -marm -march=armv4 -v - -o o.o
> 
> calls the assembler thusly:
> 
> /usr/local/lib/gcc/arm-linux-gnueabi/4.7.4/../../../../arm-linux-gnueabi/bin/as \
> -v -march=armv4 -meabi=5 --fix-v4bx -o o.o /tmp/ccB0cZgO.s
> 
> Sure enough, the object file contains:
> 
> 00000000 <.text>:
>    0:   e12fff12        bx      r2
>                         0: R_ARM_V4BX   *ABS*
> 
> so it looks like it's been told...  Then if you do:
> 
> $ arm-linux-ld --fix-v4bx -o o1.o o.o
> $ arm-linux-objdump -dr o1.o
> 
> you get:
> 
>     8074:       e1a0f002        mov     pc, r2

I get results consistent with what you get above. A bit of googling
seems to indicate the generate-BX-and-fix-it-in-the-linker came in many
years ago with AEABI support.

> Hmm, I wonder if this means we should have the kernel linker deal with
> V4BX relocations on ARMv4, converting them to their mov pc, X variant.
> 
> Also, do we need --fix-v4bx for the link of vmlinux?

I guess the answer is yes if we want to catch uses of BX in inline
assembly. A quick and not very thorough grep of arch/arm for 'bx'
doesn't seem to turn up any existing dodgy uses, except in the kprobes
test code I wrote :-(

-- 
Tixy



  reply	other threads:[~2015-01-09 19:18 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-05 11:28 [PATCH v19 00/11] ARM: kprobes: OPTPROBES and other improvements Wang Nan
2015-01-05 11:28 ` Wang Nan
2015-01-05 11:29 ` [PATCH v19 01/11] ARM: probes: move all probe code to dedicate directory Wang Nan
2015-01-05 11:29   ` Wang Nan
2015-01-09  2:19   ` [PATCH v20 " Wang Nan
2015-01-09  2:19     ` Wang Nan
2015-01-09  9:47     ` Jon Medhurst (Tixy)
2015-01-09  9:47       ` Jon Medhurst (Tixy)
2015-01-09  9:50       ` Wang Nan
2015-01-09  9:50         ` Wang Nan
2015-01-09  2:28   ` [PATCH v19 " Wang Nan
2015-01-09  2:28     ` Wang Nan
2015-01-05 11:29 ` [PATCH v19 02/11] ARM: kprobes: remove unused ARM decoder actions Wang Nan
2015-01-05 11:29   ` Wang Nan
2015-01-07 11:50   ` Jon Medhurst (Tixy)
2015-01-07 11:50     ` Jon Medhurst (Tixy)
2015-01-05 11:29 ` [PATCH v19 03/11] ARM: kprobes: introduces checker Wang Nan
2015-01-05 11:29   ` Wang Nan
2015-01-05 11:29 ` [PATCH v19 04/11] ARM: kprobes: collects stack consumption for store instructions Wang Nan
2015-01-05 11:29   ` Wang Nan
2015-01-05 11:29 ` [PATCH v19 05/11] ARM: kprobes: disallow probing stack consuming instructions Wang Nan
2015-01-05 11:29   ` Wang Nan
2015-01-05 11:29 ` [PATCH v19 06/11] ARM: kprobes: Add test cases for " Wang Nan
2015-01-05 11:29   ` Wang Nan
2015-01-05 11:29 ` [PATCH v19 07/11] kprobes: Pass the original kprobe for preparing optimized kprobe Wang Nan
2015-01-05 11:29   ` Wang Nan
2015-01-05 11:29 ` [PATCH v19 08/11] ARM: kprobes: enable OPTPROBES for ARM 32 Wang Nan
2015-01-05 11:29   ` Wang Nan
2015-01-07 13:01   ` Jon Medhurst (Tixy)
2015-01-07 13:01     ` Jon Medhurst (Tixy)
2015-01-09  6:37   ` [PATCH v20 " Wang Nan
2015-01-09  6:37     ` Wang Nan
2015-01-09 10:25     ` Jon Medhurst (Tixy)
2015-01-09 10:25       ` Jon Medhurst (Tixy)
2015-01-09 10:55       ` Wang Nan
2015-01-09 10:55         ` Wang Nan
2015-01-09 16:35       ` Russell King - ARM Linux
2015-01-09 16:35         ` Russell King - ARM Linux
2015-01-09 17:28         ` Jon Medhurst (Tixy)
2015-01-09 17:28           ` Jon Medhurst (Tixy)
2015-01-09 17:57           ` Russell King - ARM Linux
2015-01-09 17:57             ` Russell King - ARM Linux
2015-01-09 19:18             ` Jon Medhurst (Tixy) [this message]
2015-01-09 19:18               ` Jon Medhurst (Tixy)
2015-01-09  6:51   ` [PATCH v19 " Wang Nan
2015-01-09  6:51     ` Wang Nan
2015-01-05 11:29 ` [PATCH v19 09/11] ARM: kprobes: Fix unreliable MRS instruction tests Wang Nan
2015-01-05 11:29   ` Wang Nan
2015-01-05 11:29 ` [PATCH v19 10/11] ARM: kprobes: check register usage for probed instruction Wang Nan
2015-01-05 11:29   ` Wang Nan
2015-01-13 15:01   ` Jon Medhurst (Tixy)
2015-01-13 15:01     ` Jon Medhurst (Tixy)
2015-01-13 16:13     ` [PATCH] " Jon Medhurst (Tixy)
2015-01-13 16:13       ` Jon Medhurst (Tixy)
2015-01-19 10:37       ` Wang Nan
2015-01-19 10:37         ` Wang Nan
2015-01-05 11:34 ` [PATCH v19 11/11] ARM: optprobes: execute instruction during restoring if possible Wang Nan
2015-01-05 11:34   ` Wang Nan
2015-01-07 13:40 ` [PATCH v19 00/11] ARM: kprobes: OPTPROBES and other improvements Jon Medhurst (Tixy)
2015-01-07 13:40   ` Jon Medhurst (Tixy)
2015-01-20  2:17   ` Masami Hiramatsu
2015-01-20  2:17     ` Masami Hiramatsu

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=1420831129.4160.78.camel@linaro.org \
    --to=tixy@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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.