Skip to content

Commit 590627f

Browse files
committed
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf tooling fixes from Thomas Gleixner: "Core libraries: - Fix max perf_event_attr.precise_ip detection. - Fix parser error for uncore event alias - Fixup ordering of kernel maps after obtaining the main kernel map address. Intel PT: - Fix TSC slip where A TSC packet can slip past MTC packets so that the timestamp appears to go backwards. - Fixes for exported-sql-viewer GUI conversion to python3. ARM coresight: - Fix the build by adding a missing case value for enumeration value introduced in newer library, that now is the required one. tool headers: - Syncronize kernel headers with the kernel, getting new io_uring and pidfd_send_signal syscalls so that 'perf trace' can handle them" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf pmu: Fix parser error for uncore event alias perf scripts python: exported-sql-viewer.py: Fix python3 support perf scripts python: exported-sql-viewer.py: Fix never-ending loop perf machine: Update kernel map address and re-order properly tools headers uapi: Sync powerpc's asm/kvm.h copy with the kernel sources tools headers: Update x86's syscall_64.tbl and uapi/asm-generic/unistd tools headers uapi: Update drm/i915_drm.h tools arch x86: Sync asm/cpufeatures.h with the kernel sources tools headers uapi: Sync linux/fcntl.h to get the F_SEAL_FUTURE_WRITE addition tools headers uapi: Sync asm-generic/mman-common.h and linux/mman.h perf evsel: Fix max perf_event_attr.precise_ip detection perf intel-pt: Fix TSC slip perf cs-etm: Add missing case value
2 parents c29d854 + 22261fd commit 590627f

File tree

26 files changed

+288
-103
lines changed

26 files changed

+288
-103
lines changed

tools/arch/alpha/include/uapi/asm/mman.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#define MAP_NONBLOCK 0x40000
2828
#define MAP_NORESERVE 0x10000
2929
#define MAP_POPULATE 0x20000
30-
#define MAP_PRIVATE 0x02
31-
#define MAP_SHARED 0x01
3230
#define MAP_STACK 0x80000
3331
#define PROT_EXEC 0x4
3432
#define PROT_GROWSDOWN 0x01000000

tools/arch/mips/include/uapi/asm/mman.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
#define MAP_NONBLOCK 0x20000
2929
#define MAP_NORESERVE 0x0400
3030
#define MAP_POPULATE 0x10000
31-
#define MAP_PRIVATE 0x002
32-
#define MAP_SHARED 0x001
3331
#define MAP_STACK 0x40000
3432
#define PROT_EXEC 0x04
3533
#define PROT_GROWSDOWN 0x01000000

tools/arch/parisc/include/uapi/asm/mman.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#define MAP_NONBLOCK 0x20000
2828
#define MAP_NORESERVE 0x4000
2929
#define MAP_POPULATE 0x10000
30-
#define MAP_PRIVATE 0x02
31-
#define MAP_SHARED 0x01
3230
#define MAP_STACK 0x40000
3331
#define PROT_EXEC 0x4
3432
#define PROT_GROWSDOWN 0x01000000

tools/arch/powerpc/include/uapi/asm/kvm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,12 @@ struct kvm_ppc_cpu_char {
463463
#define KVM_PPC_CPU_CHAR_BR_HINT_HONOURED (1ULL << 58)
464464
#define KVM_PPC_CPU_CHAR_MTTRIG_THR_RECONF (1ULL << 57)
465465
#define KVM_PPC_CPU_CHAR_COUNT_CACHE_DIS (1ULL << 56)
466+
#define KVM_PPC_CPU_CHAR_BCCTR_FLUSH_ASSIST (1ull << 54)
466467

467468
#define KVM_PPC_CPU_BEHAV_FAVOUR_SECURITY (1ULL << 63)
468469
#define KVM_PPC_CPU_BEHAV_L1D_FLUSH_PR (1ULL << 62)
469470
#define KVM_PPC_CPU_BEHAV_BNDS_CHK_SPEC_BAR (1ULL << 61)
471+
#define KVM_PPC_CPU_BEHAV_FLUSH_COUNT_CACHE (1ull << 58)
470472

471473
/* Per-vcpu XICS interrupt controller state */
472474
#define KVM_REG_PPC_ICP_STATE (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8c)

tools/arch/x86/include/asm/cpufeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@
344344
/* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */
345345
#define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */
346346
#define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */
347+
#define X86_FEATURE_TSX_FORCE_ABORT (18*32+13) /* "" TSX_FORCE_ABORT */
347348
#define X86_FEATURE_PCONFIG (18*32+18) /* Intel PCONFIG */
348349
#define X86_FEATURE_SPEC_CTRL (18*32+26) /* "" Speculation Control (IBRS + IBPB) */
349350
#define X86_FEATURE_INTEL_STIBP (18*32+27) /* "" Single Thread Indirect Branch Predictors */

tools/arch/xtensa/include/uapi/asm/mman.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#define MAP_NONBLOCK 0x20000
2828
#define MAP_NORESERVE 0x0400
2929
#define MAP_POPULATE 0x10000
30-
#define MAP_PRIVATE 0x002
31-
#define MAP_SHARED 0x001
3230
#define MAP_STACK 0x40000
3331
#define PROT_EXEC 0x4
3432
#define PROT_GROWSDOWN 0x01000000

tools/build/feature/test-libopencsd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
/*
55
* Check OpenCSD library version is sufficient to provide required features
66
*/
7-
#define OCSD_MIN_VER ((0 << 16) | (10 << 8) | (0))
7+
#define OCSD_MIN_VER ((0 << 16) | (11 << 8) | (0))
88
#if !defined(OCSD_VER_NUM) || (OCSD_VER_NUM < OCSD_MIN_VER)
9-
#error "OpenCSD >= 0.10.0 is required"
9+
#error "OpenCSD >= 0.11.0 is required"
1010
#endif
1111

1212
int main(void)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+
#ifndef __ASM_GENERIC_MMAN_COMMON_TOOLS_ONLY_H
3+
#define __ASM_GENERIC_MMAN_COMMON_TOOLS_ONLY_H
4+
5+
#include <asm-generic/mman-common.h>
6+
7+
/* We need this because we need to have tools/include/uapi/ included in the tools
8+
* header search path to get access to stuff that is not yet in the system's
9+
* copy of the files in that directory, but since this cset:
10+
*
11+
* 746c9398f5ac ("arch: move common mmap flags to linux/mman.h")
12+
*
13+
* We end up making sys/mman.h, that is in the system headers, to not find the
14+
* MAP_SHARED and MAP_PRIVATE defines because they are not anymore in our copy
15+
* of asm-generic/mman-common.h. So we define them here and include this header
16+
* from each of the per arch mman.h headers.
17+
*/
18+
#ifndef MAP_SHARED
19+
#define MAP_SHARED 0x01 /* Share changes */
20+
#define MAP_PRIVATE 0x02 /* Changes are private */
21+
#define MAP_SHARED_VALIDATE 0x03 /* share + validate extension flags */
22+
#endif
23+
#endif // __ASM_GENERIC_MMAN_COMMON_TOOLS_ONLY_H

tools/include/uapi/asm-generic/mman-common.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
1616
#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
1717

18-
#define MAP_SHARED 0x01 /* Share changes */
19-
#define MAP_PRIVATE 0x02 /* Changes are private */
20-
#define MAP_SHARED_VALIDATE 0x03 /* share + validate extension flags */
18+
/* 0x01 - 0x03 are defined in linux/mman.h */
2119
#define MAP_TYPE 0x0f /* Mask for type of mapping */
2220
#define MAP_FIXED 0x10 /* Interpret addr exactly */
2321
#define MAP_ANONYMOUS 0x20 /* don't use a file */

tools/include/uapi/asm-generic/mman.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#ifndef __ASM_GENERIC_MMAN_H
33
#define __ASM_GENERIC_MMAN_H
44

5-
#include <asm-generic/mman-common.h>
5+
#include <asm-generic/mman-common-tools.h>
66

77
#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
88
#define MAP_DENYWRITE 0x0800 /* ETXTBSY */

tools/include/uapi/asm-generic/unistd.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,8 +824,17 @@ __SYSCALL(__NR_futex_time64, sys_futex)
824824
__SYSCALL(__NR_sched_rr_get_interval_time64, sys_sched_rr_get_interval)
825825
#endif
826826

827+
#define __NR_pidfd_send_signal 424
828+
__SYSCALL(__NR_pidfd_send_signal, sys_pidfd_send_signal)
829+
#define __NR_io_uring_setup 425
830+
__SYSCALL(__NR_io_uring_setup, sys_io_uring_setup)
831+
#define __NR_io_uring_enter 426
832+
__SYSCALL(__NR_io_uring_enter, sys_io_uring_enter)
833+
#define __NR_io_uring_register 427
834+
__SYSCALL(__NR_io_uring_register, sys_io_uring_register)
835+
827836
#undef __NR_syscalls
828-
#define __NR_syscalls 424
837+
#define __NR_syscalls 428
829838

830839
/*
831840
* 32 bit systems traditionally used different

tools/include/uapi/drm/i915_drm.h

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,9 +1486,73 @@ struct drm_i915_gem_context_param {
14861486
#define I915_CONTEXT_MAX_USER_PRIORITY 1023 /* inclusive */
14871487
#define I915_CONTEXT_DEFAULT_PRIORITY 0
14881488
#define I915_CONTEXT_MIN_USER_PRIORITY -1023 /* inclusive */
1489+
/*
1490+
* When using the following param, value should be a pointer to
1491+
* drm_i915_gem_context_param_sseu.
1492+
*/
1493+
#define I915_CONTEXT_PARAM_SSEU 0x7
14891494
__u64 value;
14901495
};
14911496

1497+
/**
1498+
* Context SSEU programming
1499+
*
1500+
* It may be necessary for either functional or performance reason to configure
1501+
* a context to run with a reduced number of SSEU (where SSEU stands for Slice/
1502+
* Sub-slice/EU).
1503+
*
1504+
* This is done by configuring SSEU configuration using the below
1505+
* @struct drm_i915_gem_context_param_sseu for every supported engine which
1506+
* userspace intends to use.
1507+
*
1508+
* Not all GPUs or engines support this functionality in which case an error
1509+
* code -ENODEV will be returned.
1510+
*
1511+
* Also, flexibility of possible SSEU configuration permutations varies between
1512+
* GPU generations and software imposed limitations. Requesting such a
1513+
* combination will return an error code of -EINVAL.
1514+
*
1515+
* NOTE: When perf/OA is active the context's SSEU configuration is ignored in
1516+
* favour of a single global setting.
1517+
*/
1518+
struct drm_i915_gem_context_param_sseu {
1519+
/*
1520+
* Engine class & instance to be configured or queried.
1521+
*/
1522+
__u16 engine_class;
1523+
__u16 engine_instance;
1524+
1525+
/*
1526+
* Unused for now. Must be cleared to zero.
1527+
*/
1528+
__u32 flags;
1529+
1530+
/*
1531+
* Mask of slices to enable for the context. Valid values are a subset
1532+
* of the bitmask value returned for I915_PARAM_SLICE_MASK.
1533+
*/
1534+
__u64 slice_mask;
1535+
1536+
/*
1537+
* Mask of subslices to enable for the context. Valid values are a
1538+
* subset of the bitmask value return by I915_PARAM_SUBSLICE_MASK.
1539+
*/
1540+
__u64 subslice_mask;
1541+
1542+
/*
1543+
* Minimum/Maximum number of EUs to enable per subslice for the
1544+
* context. min_eus_per_subslice must be inferior or equal to
1545+
* max_eus_per_subslice.
1546+
*/
1547+
__u16 min_eus_per_subslice;
1548+
__u16 max_eus_per_subslice;
1549+
1550+
/*
1551+
* Unused for now. Must be cleared to zero.
1552+
*/
1553+
__u32 rsvd;
1554+
};
1555+
14921556
enum drm_i915_oa_format {
14931557
I915_OA_FORMAT_A13 = 1, /* HSW only */
14941558
I915_OA_FORMAT_A29, /* HSW only */

tools/include/uapi/linux/fcntl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */
4242
#define F_SEAL_GROW 0x0004 /* prevent file from growing */
4343
#define F_SEAL_WRITE 0x0008 /* prevent writes */
44+
#define F_SEAL_FUTURE_WRITE 0x0010 /* prevent future writes while mapped */
4445
/* (1U << 31) is reserved for signed error codes */
4546

4647
/*

tools/include/uapi/linux/mman.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
#define OVERCOMMIT_ALWAYS 1
1313
#define OVERCOMMIT_NEVER 2
1414

15+
#define MAP_SHARED 0x01 /* Share changes */
16+
#define MAP_PRIVATE 0x02 /* Changes are private */
17+
#define MAP_SHARED_VALIDATE 0x03 /* share + validate extension flags */
18+
1519
/*
1620
* Huge page size encoding when MAP_HUGETLB is specified, and a huge page
1721
* size other than the default is desired. See hugetlb_encode.h.

tools/perf/Makefile.perf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,8 @@ $(madvise_behavior_array): $(madvise_hdr_dir)/mman-common.h $(madvise_behavior_t
481481
mmap_flags_array := $(beauty_outdir)/mmap_flags_array.c
482482
mmap_flags_tbl := $(srctree)/tools/perf/trace/beauty/mmap_flags.sh
483483

484-
$(mmap_flags_array): $(asm_generic_uapi_dir)/mman.h $(asm_generic_uapi_dir)/mman-common.h $(mmap_flags_tbl)
485-
$(Q)$(SHELL) '$(mmap_flags_tbl)' $(asm_generic_uapi_dir) $(arch_asm_uapi_dir) > $@
484+
$(mmap_flags_array): $(linux_uapi_dir)/mman.h $(asm_generic_uapi_dir)/mman.h $(asm_generic_uapi_dir)/mman-common.h $(mmap_flags_tbl)
485+
$(Q)$(SHELL) '$(mmap_flags_tbl)' $(linux_uapi_dir) $(asm_generic_uapi_dir) $(arch_asm_uapi_dir) > $@
486486

487487
mount_flags_array := $(beauty_outdir)/mount_flags_array.c
488488
mount_flags_tbl := $(srctree)/tools/perf/trace/beauty/mount_flags.sh

tools/perf/arch/x86/entry/syscalls/syscall_64.tbl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,10 @@
345345
334 common rseq __x64_sys_rseq
346346
# don't use numbers 387 through 423, add new calls after the last
347347
# 'common' entry
348+
424 common pidfd_send_signal __x64_sys_pidfd_send_signal
349+
425 common io_uring_setup __x64_sys_io_uring_setup
350+
426 common io_uring_enter __x64_sys_io_uring_enter
351+
427 common io_uring_register __x64_sys_io_uring_register
348352

349353
#
350354
# x32-specific system call numbers start at 512 to avoid cache impact

tools/perf/check-headers.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ done
103103
# diff with extra ignore lines
104104
check arch/x86/lib/memcpy_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"'
105105
check arch/x86/lib/memset_64.S '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"'
106-
check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common.h>"'
106+
check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common\(-tools\)*.h>"'
107107
check include/uapi/linux/mman.h '-I "^#include <\(uapi/\)*asm/mman.h>"'
108108

109109
# diff non-symmetric files

tools/perf/scripts/python/exported-sql-viewer.py

Lines changed: 63 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
from PySide.QtCore import *
108108
from PySide.QtGui import *
109109
from PySide.QtSql import *
110+
pyside_version_1 = True
110111
from decimal import *
111112
from ctypes import *
112113
from multiprocessing import Process, Array, Value, Event
@@ -1526,6 +1527,19 @@ def BranchDataPrep(query):
15261527
" (" + dsoname(query.value(15)) + ")")
15271528
return data
15281529

1530+
def BranchDataPrepWA(query):
1531+
data = []
1532+
data.append(query.value(0))
1533+
# Workaround pyside failing to handle large integers (i.e. time) in python3 by converting to a string
1534+
data.append("{:>19}".format(query.value(1)))
1535+
for i in xrange(2, 8):
1536+
data.append(query.value(i))
1537+
data.append(tohex(query.value(8)).rjust(16) + " " + query.value(9) + offstr(query.value(10)) +
1538+
" (" + dsoname(query.value(11)) + ")" + " -> " +
1539+
tohex(query.value(12)) + " " + query.value(13) + offstr(query.value(14)) +
1540+
" (" + dsoname(query.value(15)) + ")")
1541+
return data
1542+
15291543
# Branch data model
15301544

15311545
class BranchModel(TreeModel):
@@ -1553,7 +1567,11 @@ def __init__(self, glb, event_id, where_clause, parent=None):
15531567
" AND evsel_id = " + str(self.event_id) +
15541568
" ORDER BY samples.id"
15551569
" LIMIT " + str(glb_chunk_sz))
1556-
self.fetcher = SQLFetcher(glb, sql, BranchDataPrep, self.AddSample)
1570+
if pyside_version_1 and sys.version_info[0] == 3:
1571+
prep = BranchDataPrepWA
1572+
else:
1573+
prep = BranchDataPrep
1574+
self.fetcher = SQLFetcher(glb, sql, prep, self.AddSample)
15571575
self.fetcher.done.connect(self.Update)
15581576
self.fetcher.Fetch(glb_chunk_sz)
15591577

@@ -2079,14 +2097,6 @@ def IsSelectable(db, table, sql = ""):
20792097
return False
20802098
return True
20812099

2082-
# SQL data preparation
2083-
2084-
def SQLTableDataPrep(query, count):
2085-
data = []
2086-
for i in xrange(count):
2087-
data.append(query.value(i))
2088-
return data
2089-
20902100
# SQL table data model item
20912101

20922102
class SQLTableItem():
@@ -2110,7 +2120,7 @@ def __init__(self, glb, sql, column_headers, parent=None):
21102120
self.more = True
21112121
self.populated = 0
21122122
self.column_headers = column_headers
2113-
self.fetcher = SQLFetcher(glb, sql, lambda x, y=len(column_headers): SQLTableDataPrep(x, y), self.AddSample)
2123+
self.fetcher = SQLFetcher(glb, sql, lambda x, y=len(column_headers): self.SQLTableDataPrep(x, y), self.AddSample)
21142124
self.fetcher.done.connect(self.Update)
21152125
self.fetcher.Fetch(glb_chunk_sz)
21162126

@@ -2154,6 +2164,12 @@ def columnCount(self, parent=None):
21542164
def columnHeader(self, column):
21552165
return self.column_headers[column]
21562166

2167+
def SQLTableDataPrep(self, query, count):
2168+
data = []
2169+
for i in xrange(count):
2170+
data.append(query.value(i))
2171+
return data
2172+
21572173
# SQL automatic table data model
21582174

21592175
class SQLAutoTableModel(SQLTableModel):
@@ -2182,8 +2198,32 @@ def __init__(self, glb, table_name, parent=None):
21822198
QueryExec(query, "SELECT column_name FROM information_schema.columns WHERE table_schema = '" + schema + "' and table_name = '" + select_table_name + "'")
21832199
while query.next():
21842200
column_headers.append(query.value(0))
2201+
if pyside_version_1 and sys.version_info[0] == 3:
2202+
if table_name == "samples_view":
2203+
self.SQLTableDataPrep = self.samples_view_DataPrep
2204+
if table_name == "samples":
2205+
self.SQLTableDataPrep = self.samples_DataPrep
21852206
super(SQLAutoTableModel, self).__init__(glb, sql, column_headers, parent)
21862207

2208+
def samples_view_DataPrep(self, query, count):
2209+
data = []
2210+
data.append(query.value(0))
2211+
# Workaround pyside failing to handle large integers (i.e. time) in python3 by converting to a string
2212+
data.append("{:>19}".format(query.value(1)))
2213+
for i in xrange(2, count):
2214+
data.append(query.value(i))
2215+
return data
2216+
2217+
def samples_DataPrep(self, query, count):
2218+
data = []
2219+
for i in xrange(9):
2220+
data.append(query.value(i))
2221+
# Workaround pyside failing to handle large integers (i.e. time) in python3 by converting to a string
2222+
data.append("{:>19}".format(query.value(9)))
2223+
for i in xrange(10, count):
2224+
data.append(query.value(i))
2225+
return data
2226+
21872227
# Base class for custom ResizeColumnsToContents
21882228

21892229
class ResizeColumnsToContentsBase(QObject):
@@ -2868,9 +2908,13 @@ def DisassembleOne(self, inst, bytes_ptr, bytes_cnt, ip):
28682908
ok = self.xed_format_context(2, inst.xedp, inst.bufferp, sizeof(inst.buffer), ip, 0, 0)
28692909
if not ok:
28702910
return 0, ""
2911+
if sys.version_info[0] == 2:
2912+
result = inst.buffer.value
2913+
else:
2914+
result = inst.buffer.value.decode()
28712915
# Return instruction length and the disassembled instruction text
28722916
# For now, assume the length is in byte 166
2873-
return inst.xedd[166], inst.buffer.value
2917+
return inst.xedd[166], result
28742918

28752919
def TryOpen(file_name):
28762920
try:
@@ -2886,9 +2930,14 @@ def Is64Bit(f):
28862930
header = f.read(7)
28872931
f.seek(pos)
28882932
magic = header[0:4]
2889-
eclass = ord(header[4])
2890-
encoding = ord(header[5])
2891-
version = ord(header[6])
2933+
if sys.version_info[0] == 2:
2934+
eclass = ord(header[4])
2935+
encoding = ord(header[5])
2936+
version = ord(header[6])
2937+
else:
2938+
eclass = header[4]
2939+
encoding = header[5]
2940+
version = header[6]
28922941
if magic == chr(127) + "ELF" and eclass > 0 and eclass < 3 and encoding > 0 and encoding < 3 and version == 1:
28932942
result = True if eclass == 2 else False
28942943
return result

0 commit comments

Comments
 (0)