lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55E80EF6.9060008@intel.com>
Date:	Thu, 3 Sep 2015 12:12:22 +0300
From:	Adrian Hunter <adrian.hunter@...el.com>
To:	Jan Stancek <jstancek@...hat.com>
Cc:	linux-kernel@...r.kernel.org, acme@...nel.org, jolsa@...nel.org,
	dsahern@...il.com, cjashfor@...ux.vnet.ibm.com, fweisbec@...il.com,
	mingo@...nel.org, namhyung@...nel.org, paulus@...ba.org,
	a.p.zijlstra@...llo.nl
Subject: Re: [PATCH v2 3/4] perf tests: stop reading if objdump output crossed
 sections

On 02/09/15 11:19, Jan Stancek wrote:
> objdump output can span across multiple sections:
> 
>   Disassembly of section .text:
>     0000000000000008 <crc32c+0x8>:
>        8:       48 89 e5                mov    %rsp,%rbp
>        b:       53                      push   %rbx
>        c:       8b 01                   mov    (%rcx),%eax
>     <snip>
>       6b:       90                      nop
> 
>   Disassembly of section .init.text:
>     0000000000000008 <init_module+0x8>:
>        8:       00 00                   add    %al,(%rax)
>        a:       00 00                   add    %al,(%rax)
>        c:       48 89 e5
> 
> Stop further reading if address starts going backwards,
> assuming we crossed sections.
> 
> Signed-off-by: Jan Stancek <jstancek@...hat.com>
> Cc: Arnaldo Carvalho de Melo <acme@...nel.org>
> Cc: Jiri Olsa <jolsa@...nel.org>
> Cc: Adrian Hunter <adrian.hunter@...el.com>
> Cc: David Ahern <dsahern@...il.com>
> Cc: Corey Ashford <cjashfor@...ux.vnet.ibm.com>
> Cc: Frederic Weisbecker <fweisbec@...il.com>
> Cc: Ingo Molnar <mingo@...nel.org>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Cc: Paul Mackerras <paulus@...ba.org>
> Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>


Acked-by: Adrian Hunter <adrian.hunter@...el.com>


> ---
>  tools/perf/tests/code-reading.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
> index 375ba30e4ed0..e6bf47ff7e91 100644
> --- a/tools/perf/tests/code-reading.c
> +++ b/tools/perf/tests/code-reading.c
> @@ -79,7 +79,7 @@ static int read_objdump_output(FILE *f, void *buf, size_t *len, u64 start_addr)
>  	size_t line_len, off_last = 0;
>  	ssize_t ret;
>  	int err = 0;
> -	u64 addr;
> +	u64 addr, last_addr = start_addr;
>  
>  	while (off_last < *len) {
>  		size_t off, read_bytes, written_bytes;
> @@ -101,6 +101,11 @@ static int read_objdump_output(FILE *f, void *buf, size_t *len, u64 start_addr)
>  
>  		if (sscanf(line, "%"PRIx64, &addr) != 1)
>  			continue;
> +		if (addr < last_addr) {
> +			pr_debug("addr going backwards, read beyond section?\n");
> +			break;
> +		}
> +		last_addr = addr;
>  
>  		/* copy it from temporary buffer to 'buf' according
>  		 * to address on current objdump line */
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ