* [PATCH] perf tools: Fix /proc/kcore access on 32 bit systems
@ 2021-10-21 11:27 James Clark
2021-10-21 12:54 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 2+ messages in thread
From: James Clark @ 2021-10-21 11:27 UTC (permalink / raw)
To: acme, linux-perf-users
Cc: denik, James Clark, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Namhyung Kim, linux-kernel
Because _LARGEFILE64_SOURCE is set in perf, file offset sizes can be
64 bits. If a workflow needs to open /proc/kcore on a 32 bit system
(for example to decode Arm ETM kernel trace) then the size value will be
wrapped to 32 bits in the function file_size() at this line:
dso->data.file_size = st.st_size;
Setting the file_size member to be u64 fixes the issue and allows
/proc/kcore to be opened.
Reported-by: Denis Nikitin <denik@chromium.org>
Signed-off-by: James Clark <james.clark@arm.com>
---
tools/perf/util/dso.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index 83723ba11dc8..011da3924fc1 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -193,7 +193,7 @@ struct dso {
int fd;
int status;
u32 status_seen;
- size_t file_size;
+ u64 file_size;
struct list_head open_entry;
u64 debug_frame_offset;
u64 eh_frame_hdr_offset;
--
2.28.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] perf tools: Fix /proc/kcore access on 32 bit systems
2021-10-21 11:27 [PATCH] perf tools: Fix /proc/kcore access on 32 bit systems James Clark
@ 2021-10-21 12:54 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-10-21 12:54 UTC (permalink / raw)
To: James Clark
Cc: linux-perf-users, denik, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Namhyung Kim, linux-kernel
Em Thu, Oct 21, 2021 at 12:27:00PM +0100, James Clark escreveu:
> Because _LARGEFILE64_SOURCE is set in perf, file offset sizes can be
> 64 bits. If a workflow needs to open /proc/kcore on a 32 bit system
> (for example to decode Arm ETM kernel trace) then the size value will be
> wrapped to 32 bits in the function file_size() at this line:
>
> dso->data.file_size = st.st_size;
>
> Setting the file_size member to be u64 fixes the issue and allows
> /proc/kcore to be opened.
Thanks, applied.
- Arnaldo
> Reported-by: Denis Nikitin <denik@chromium.org>
> Signed-off-by: James Clark <james.clark@arm.com>
> ---
> tools/perf/util/dso.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
> index 83723ba11dc8..011da3924fc1 100644
> --- a/tools/perf/util/dso.h
> +++ b/tools/perf/util/dso.h
> @@ -193,7 +193,7 @@ struct dso {
> int fd;
> int status;
> u32 status_seen;
> - size_t file_size;
> + u64 file_size;
> struct list_head open_entry;
> u64 debug_frame_offset;
> u64 eh_frame_hdr_offset;
> --
> 2.28.0
--
- Arnaldo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-21 12:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21 11:27 [PATCH] perf tools: Fix /proc/kcore access on 32 bit systems James Clark
2021-10-21 12:54 ` Arnaldo Carvalho de Melo
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).