linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Dave.Martin@arm.com (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/4] ARM: kprobes-test: move to using a pointer to the title text
Date: Fri, 26 Jul 2013 15:02:36 +0100	[thread overview]
Message-ID: <20130726140236.GB2282@localhost.localdomain> (raw)
In-Reply-To: <1374786537-10726-5-git-send-email-ben.dooks@codethink.co.uk>

On Thu, Jul 25, 2013 at 10:08:57PM +0100, Ben Dooks wrote:
> When testing the kprobes test code with BE8, there is either an
> issue with the linker or how the code is being built. The issue
> is with embedding the title text as the first part of the test.
> 
> Change to placing a pointer to .rodata with the text title in it
> for the test which seems to stop the issue of the alignment of
> the data following it being changed arbitrarily by the linker.
> 
> The proper thing to do here is to fix the linker, however this
> patch also makes the output much easier to read as there are no
> variable length data items here any more.

Can you elaborate?  I don't understand from this what problem you are
trying to solve.  Can you give a more concrete example?

It should be impossible for the linker to change the alignment of
anything _within_ an input section (bugs notwithstanding).

The assembler might be doing something unexpected, particularly
for Thumb kernels, but I don't know of any bug relating to this.

Cheers
---Dave

> 
> CC: Jon Medhurst <tixy@yxit.co.uk>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
>  arch/arm/kernel/kprobes-test.c |   12 +++++-------
>  arch/arm/kernel/kprobes-test.h |    6 ++++--
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c
> index 6cfa04d..a915ac3 100644
> --- a/arch/arm/kernel/kprobes-test.c
> +++ b/arch/arm/kernel/kprobes-test.c
> @@ -111,9 +111,7 @@
>   *	@ TESTCASE_START
>   *	bl	__kprobes_test_case_start
>   *	@ start of inline data...
> - *	.ascii "mov r0, r7"	@ text title for test case
> - *	.byte	0
> - *	.align	2
> + *	.word	title_addr	 @ text title for test case
>   *
>   *	@ TEST_ARG_REG
>   *	.byte	ARG_TYPE_REG
> @@ -959,7 +957,7 @@ void __naked __kprobes_test_case_start(void)
>  	__asm__ __volatile__ (
>  		"stmdb	sp!, {r4-r11}				\n\t"
>  		"sub	sp, sp, #"__stringify(TEST_MEMORY_SIZE)"\n\t"
> -		"bic	r0, lr, #1  @ r0 = inline title string	\n\t"
> +		"bic	r0, lr, #3  @ r0 = inline title block	\n\t"
>  		"mov	r1, sp					\n\t"
>  		"bl	kprobes_test_case_start			\n\t"
>  		"bx	r0					\n\t"
> @@ -1336,15 +1334,15 @@ static unsigned long next_instruction(unsigned long pc)
>  	return pc + 4;
>  }
>  
> -static uintptr_t __used kprobes_test_case_start(const char *title, void *stack)
> +static uintptr_t __used kprobes_test_case_start(const char **title, void *stack)
>  {
>  	struct test_arg *args;
>  	struct test_arg_end *end_arg;
>  	unsigned long test_code;
>  
> -	args = (struct test_arg *)PTR_ALIGN(title + strlen(title) + 1, 4);
> +	args = (struct test_arg *)(title + 1);
>  
> -	current_title = title;
> +	current_title = *title;
>  	current_args = args;
>  	current_stack = stack;
>  
> diff --git a/arch/arm/kernel/kprobes-test.h b/arch/arm/kernel/kprobes-test.h
> index e28a869..a71db09 100644
> --- a/arch/arm/kernel/kprobes-test.h
> +++ b/arch/arm/kernel/kprobes-test.h
> @@ -113,9 +113,11 @@ struct test_arg_end {
>  	"bl	__kprobes_test_case_start		\n\t"	\
>  	/* don't use .asciz here as 'title' may be */		\
>  	/* multiple strings to be concatenated.  */		\
> -	".ascii "#title"				\n\t"	\
> +	".pushsection .rodata				\n\t"	\
> +	"9999: .ascii "#title"				\n\t"	\
>  	".byte	0					\n\t"	\
> -	".align	2					\n\t"
> +	".popsection					\n\t"	\
> +	".word	9999b					\n\t"
>  
>  #define	TEST_ARG_REG(reg, val)					\
>  	".byte	"__stringify(ARG_TYPE_REG)"		\n\t"	\
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2013-07-26 14:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-25 21:08 fyi - kprobes testing patches Ben Dooks
2013-07-25 21:08 ` [PATCH 1/4] ARM: kprobes: fix instruction fetch order with <asm/opcodes.h> Ben Dooks
2013-07-29  8:01   ` Jon Medhurst (Tixy)
2013-07-31 19:43     ` Ben Dooks
2013-08-02 13:57       ` Dave Martin
2013-08-02 13:58         ` Ben Dooks
2013-08-02 14:03       ` Dave Martin
2013-07-25 21:08 ` [PATCH 2/4] ARM: kprobes, change arm test to .instr Ben Dooks
2013-07-25 21:08 ` [PATCH 3/4] ARM: kprobes-test: use <asm/opcodes.h> Ben Dooks
2013-07-29  8:07   ` Jon Medhurst (Tixy)
2013-07-31 19:38     ` Ben Dooks
2013-07-25 21:08 ` [PATCH 4/4] ARM: kprobes-test: move to using a pointer to the title text Ben Dooks
2013-07-26 14:02   ` Dave Martin [this message]
2013-07-26 14:08     ` Ben Dooks
2013-07-26 10:52 ` fyi - kprobes testing patches Ben Dooks

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=20130726140236.GB2282@localhost.localdomain \
    --to=dave.martin@arm.com \
    --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 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).