From: Greg Kroah-Hartman Date: Tue, 16 Oct 2018 13:09:35 +0000 (+0200) Subject: 4.9-stable patches X-Git-Tag: v4.9.134~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ebd6b12c5df08dc1ebc1c800c833e06172f87c6b;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: ext4-fix-error-code-in-ext4_xattr_set_entry.patch mach64-detect-the-dot-clock-divider-correctly-on-sparc.patch mips-vdso-always-map-near-top-of-user-memory.patch mm-preserve-_page_devmap-across-mprotect-calls.patch mm-vmstat.c-fix-outdated-vmstat_text.patch perf-script-python-fix-export-to-postgresql.py-occasional-failure.patch --- diff --git a/queue-4.9/ext4-fix-error-code-in-ext4_xattr_set_entry.patch b/queue-4.9/ext4-fix-error-code-in-ext4_xattr_set_entry.patch new file mode 100644 index 00000000000..e93b4591ce6 --- /dev/null +++ b/queue-4.9/ext4-fix-error-code-in-ext4_xattr_set_entry.patch @@ -0,0 +1,34 @@ +From drosen@google.com Tue Oct 16 14:50:44 2018 +From: Daniel Rosenberg +Date: Mon, 15 Oct 2018 15:10:52 -0700 +Subject: ext4: Fix error code in ext4_xattr_set_entry() +To: stable@vger.kernel.org +Cc: Ben Hutchings , Daniel Rosenberg +Message-ID: <20181015221052.104133-1-drosen@google.com> + +From: Daniel Rosenberg + +ext4_xattr_set_entry should return EFSCORRUPTED instead of EIO +for corrupted xattr entries. + +Fixes b469713e0c0c ("ext4: add corruption check in ext4_xattr_set_entry()") + +Signed-off-by: Daniel Rosenberg +Signed-off-by: Greg Kroah-Hartman +--- +Apply to 4.9 + + fs/ext4/xattr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/ext4/xattr.c ++++ b/fs/ext4/xattr.c +@@ -657,7 +657,7 @@ ext4_xattr_set_entry(struct ext4_xattr_i + next = EXT4_XATTR_NEXT(last); + if ((void *)next >= s->end) { + EXT4_ERROR_INODE(inode, "corrupted xattr entries"); +- return -EIO; ++ return -EFSCORRUPTED; + } + if (last->e_value_size) { + size_t offs = le16_to_cpu(last->e_value_offs); diff --git a/queue-4.9/mach64-detect-the-dot-clock-divider-correctly-on-sparc.patch b/queue-4.9/mach64-detect-the-dot-clock-divider-correctly-on-sparc.patch new file mode 100644 index 00000000000..821b0487d6d --- /dev/null +++ b/queue-4.9/mach64-detect-the-dot-clock-divider-correctly-on-sparc.patch @@ -0,0 +1,135 @@ +From 76ebebd2464c5c8a4453c98b6dbf9c95a599e810 Mon Sep 17 00:00:00 2001 +From: Mikulas Patocka +Date: Fri, 17 Aug 2018 15:19:37 -0400 +Subject: mach64: detect the dot clock divider correctly on sparc +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Mikulas Patocka + +commit 76ebebd2464c5c8a4453c98b6dbf9c95a599e810 upstream. + +On Sun Ultra 5, it happens that the dot clock is not set up properly for +some videomodes. For example, if we set the videomode "r1024x768x60" in +the firmware, Linux would incorrectly set a videomode with refresh rate +180Hz when booting (suprisingly, my LCD monitor can display it, although +display quality is very low). + +The reason is this: Older mach64 cards set the divider in the register +VCLK_POST_DIV. The register has four 2-bit fields (the field that is +actually used is specified in the lowest two bits of the register +CLOCK_CNTL). The 2 bits select divider "1, 2, 4, 8". On newer mach64 cards, +there's another bit added - the top four bits of PLL_EXT_CNTL extend the +divider selection, so we have possible dividers "1, 2, 4, 8, 3, 5, 6, 12". +The Linux driver clears the top four bits of PLL_EXT_CNTL and never sets +them, so it can work regardless if the card supports them. However, the +sparc64 firmware may set these extended dividers during boot - and the +mach64 driver detects incorrect dot clock in this case. + +This patch makes the driver read the additional divider bit from +PLL_EXT_CNTL and calculate the initial refresh rate properly. + +Signed-off-by: Mikulas Patocka +Cc: stable@vger.kernel.org +Acked-by: David S. Miller +Reviewed-by: Ville Syrjälä +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/video/fbdev/aty/atyfb.h | 3 ++- + drivers/video/fbdev/aty/atyfb_base.c | 7 ++++--- + drivers/video/fbdev/aty/mach64_ct.c | 10 +++++----- + 3 files changed, 11 insertions(+), 9 deletions(-) + +--- a/drivers/video/fbdev/aty/atyfb.h ++++ b/drivers/video/fbdev/aty/atyfb.h +@@ -332,6 +332,8 @@ extern const struct aty_pll_ops aty_pll_ + extern void aty_set_pll_ct(const struct fb_info *info, const union aty_pll *pll); + extern u8 aty_ld_pll_ct(int offset, const struct atyfb_par *par); + ++extern const u8 aty_postdividers[8]; ++ + + /* + * Hardware cursor support +@@ -358,7 +360,6 @@ static inline void wait_for_idle(struct + + extern void aty_reset_engine(const struct atyfb_par *par); + extern void aty_init_engine(struct atyfb_par *par, struct fb_info *info); +-extern u8 aty_ld_pll_ct(int offset, const struct atyfb_par *par); + + void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); + void atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect); +--- a/drivers/video/fbdev/aty/atyfb_base.c ++++ b/drivers/video/fbdev/aty/atyfb_base.c +@@ -3093,17 +3093,18 @@ static int atyfb_setup_sparc(struct pci_ + /* + * PLL Reference Divider M: + */ +- M = pll_regs[2]; ++ M = pll_regs[PLL_REF_DIV]; + + /* + * PLL Feedback Divider N (Dependent on CLOCK_CNTL): + */ +- N = pll_regs[7 + (clock_cntl & 3)]; ++ N = pll_regs[VCLK0_FB_DIV + (clock_cntl & 3)]; + + /* + * PLL Post Divider P (Dependent on CLOCK_CNTL): + */ +- P = 1 << (pll_regs[6] >> ((clock_cntl & 3) << 1)); ++ P = aty_postdividers[((pll_regs[VCLK_POST_DIV] >> ((clock_cntl & 3) << 1)) & 3) | ++ ((pll_regs[PLL_EXT_CNTL] >> (2 + (clock_cntl & 3))) & 4)]; + + /* + * PLL Divider Q: +--- a/drivers/video/fbdev/aty/mach64_ct.c ++++ b/drivers/video/fbdev/aty/mach64_ct.c +@@ -114,7 +114,7 @@ static void aty_st_pll_ct(int offset, u8 + */ + + #define Maximum_DSP_PRECISION 7 +-static u8 postdividers[] = {1,2,4,8,3}; ++const u8 aty_postdividers[8] = {1,2,4,8,3,5,6,12}; + + static int aty_dsp_gt(const struct fb_info *info, u32 bpp, struct pll_ct *pll) + { +@@ -221,7 +221,7 @@ static int aty_valid_pll_ct(const struct + pll->vclk_post_div += (q < 64*8); + pll->vclk_post_div += (q < 32*8); + } +- pll->vclk_post_div_real = postdividers[pll->vclk_post_div]; ++ pll->vclk_post_div_real = aty_postdividers[pll->vclk_post_div]; + // pll->vclk_post_div <<= 6; + pll->vclk_fb_div = q * pll->vclk_post_div_real / 8; + pllvclk = (1000000 * 2 * pll->vclk_fb_div) / +@@ -512,7 +512,7 @@ static int aty_init_pll_ct(const struct + u8 mclk_fb_div, pll_ext_cntl; + pll->ct.pll_ref_div = aty_ld_pll_ct(PLL_REF_DIV, par); + pll_ext_cntl = aty_ld_pll_ct(PLL_EXT_CNTL, par); +- pll->ct.xclk_post_div_real = postdividers[pll_ext_cntl & 0x07]; ++ pll->ct.xclk_post_div_real = aty_postdividers[pll_ext_cntl & 0x07]; + mclk_fb_div = aty_ld_pll_ct(MCLK_FB_DIV, par); + if (pll_ext_cntl & PLL_MFB_TIMES_4_2B) + mclk_fb_div <<= 1; +@@ -534,7 +534,7 @@ static int aty_init_pll_ct(const struct + xpost_div += (q < 64*8); + xpost_div += (q < 32*8); + } +- pll->ct.xclk_post_div_real = postdividers[xpost_div]; ++ pll->ct.xclk_post_div_real = aty_postdividers[xpost_div]; + pll->ct.mclk_fb_div = q * pll->ct.xclk_post_div_real / 8; + + #ifdef CONFIG_PPC +@@ -583,7 +583,7 @@ static int aty_init_pll_ct(const struct + mpost_div += (q < 64*8); + mpost_div += (q < 32*8); + } +- sclk_post_div_real = postdividers[mpost_div]; ++ sclk_post_div_real = aty_postdividers[mpost_div]; + pll->ct.sclk_fb_div = q * sclk_post_div_real / 8; + pll->ct.spll_cntl2 = mpost_div << 4; + #ifdef DEBUG diff --git a/queue-4.9/mips-vdso-always-map-near-top-of-user-memory.patch b/queue-4.9/mips-vdso-always-map-near-top-of-user-memory.patch new file mode 100644 index 00000000000..17ebfeae6d4 --- /dev/null +++ b/queue-4.9/mips-vdso-always-map-near-top-of-user-memory.patch @@ -0,0 +1,186 @@ +From ea7e0480a4b695d0aa6b3fa99bd658a003122113 Mon Sep 17 00:00:00 2001 +From: Paul Burton +Date: Tue, 25 Sep 2018 15:51:26 -0700 +Subject: MIPS: VDSO: Always map near top of user memory + +From: Paul Burton + +commit ea7e0480a4b695d0aa6b3fa99bd658a003122113 upstream. + +When using the legacy mmap layout, for example triggered using ulimit -s +unlimited, get_unmapped_area() fills memory from bottom to top starting +from a fairly low address near TASK_UNMAPPED_BASE. + +This placement is suboptimal if the user application wishes to allocate +large amounts of heap memory using the brk syscall. With the VDSO being +located low in the user's virtual address space, the amount of space +available for access using brk is limited much more than it was prior to +the introduction of the VDSO. + +For example: + + # ulimit -s unlimited; cat /proc/self/maps + 00400000-004ec000 r-xp 00000000 08:00 71436 /usr/bin/coreutils + 004fc000-004fd000 rwxp 000ec000 08:00 71436 /usr/bin/coreutils + 004fd000-0050f000 rwxp 00000000 00:00 0 + 00cc3000-00ce4000 rwxp 00000000 00:00 0 [heap] + 2ab96000-2ab98000 r--p 00000000 00:00 0 [vvar] + 2ab98000-2ab99000 r-xp 00000000 00:00 0 [vdso] + 2ab99000-2ab9d000 rwxp 00000000 00:00 0 + ... + +Resolve this by adjusting STACK_TOP to reserve space for the VDSO & +providing an address hint to get_unmapped_area() causing it to use this +space even when using the legacy mmap layout. + +We reserve enough space for the VDSO, plus 1MB or 256MB for 32 bit & 64 +bit systems respectively within which we randomize the VDSO base +address. Previously this randomization was taken care of by the mmap +base address randomization performed by arch_mmap_rnd(). The 1MB & 256MB +sizes are somewhat arbitrary but chosen such that we have some +randomization without taking up too much of the user's virtual address +space, which is often in short supply for 32 bit systems. + +With this the VDSO is always mapped at a high address, leaving lots of +space for statically linked programs to make use of brk: + + # ulimit -s unlimited; cat /proc/self/maps + 00400000-004ec000 r-xp 00000000 08:00 71436 /usr/bin/coreutils + 004fc000-004fd000 rwxp 000ec000 08:00 71436 /usr/bin/coreutils + 004fd000-0050f000 rwxp 00000000 00:00 0 + 00c28000-00c49000 rwxp 00000000 00:00 0 [heap] + ... + 7f67c000-7f69d000 rwxp 00000000 00:00 0 [stack] + 7f7fc000-7f7fd000 rwxp 00000000 00:00 0 + 7fcf1000-7fcf3000 r--p 00000000 00:00 0 [vvar] + 7fcf3000-7fcf4000 r-xp 00000000 00:00 0 [vdso] + +Signed-off-by: Paul Burton +Reported-by: Huacai Chen +Fixes: ebb5e78cc634 ("MIPS: Initial implementation of a VDSO") +Cc: Huacai Chen +Cc: linux-mips@linux-mips.org +Cc: stable@vger.kernel.org # v4.4+ +Signed-off-by: Greg Kroah-Hartman + +--- + arch/mips/include/asm/processor.h | 10 +++++----- + arch/mips/kernel/process.c | 25 +++++++++++++++++++++++++ + arch/mips/kernel/vdso.c | 18 +++++++++++++++++- + 3 files changed, 47 insertions(+), 6 deletions(-) + +--- a/arch/mips/include/asm/processor.h ++++ b/arch/mips/include/asm/processor.h +@@ -13,6 +13,7 @@ + + #include + #include ++#include + #include + + #include +@@ -80,11 +81,10 @@ extern unsigned int vced_count, vcei_cou + + #endif + +-/* +- * One page above the stack is used for branch delay slot "emulation". +- * See dsemul.c for details. +- */ +-#define STACK_TOP ((TASK_SIZE & PAGE_MASK) - PAGE_SIZE) ++#define VDSO_RANDOMIZE_SIZE (TASK_IS_32BIT_ADDR ? SZ_1M : SZ_256M) ++ ++extern unsigned long mips_stack_top(void); ++#define STACK_TOP mips_stack_top() + + /* + * This decides where the kernel will search for a free chunk of vm +--- a/arch/mips/kernel/process.c ++++ b/arch/mips/kernel/process.c +@@ -28,6 +28,7 @@ + #include + #include + ++#include + #include + #include + #include +@@ -35,6 +36,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -621,6 +623,29 @@ out: + return pc; + } + ++unsigned long mips_stack_top(void) ++{ ++ unsigned long top = TASK_SIZE & PAGE_MASK; ++ ++ /* One page for branch delay slot "emulation" */ ++ top -= PAGE_SIZE; ++ ++ /* Space for the VDSO, data page & GIC user page */ ++ top -= PAGE_ALIGN(current->thread.abi->vdso->size); ++ top -= PAGE_SIZE; ++ top -= mips_gic_present() ? PAGE_SIZE : 0; ++ ++ /* Space for cache colour alignment */ ++ if (cpu_has_dc_aliases) ++ top -= shm_align_mask + 1; ++ ++ /* Space to randomize the VDSO base */ ++ if (current->flags & PF_RANDOMIZE) ++ top -= VDSO_RANDOMIZE_SIZE; ++ ++ return top; ++} ++ + /* + * Don't forget that the stack pointer must be aligned on a 8 bytes + * boundary for 32-bits ABI and 16 bytes for 64-bits ABI. +--- a/arch/mips/kernel/vdso.c ++++ b/arch/mips/kernel/vdso.c +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -97,6 +98,21 @@ void update_vsyscall_tz(void) + } + } + ++static unsigned long vdso_base(void) ++{ ++ unsigned long base; ++ ++ /* Skip the delay slot emulation page */ ++ base = STACK_TOP + PAGE_SIZE; ++ ++ if (current->flags & PF_RANDOMIZE) { ++ base += get_random_int() & (VDSO_RANDOMIZE_SIZE - 1); ++ base = PAGE_ALIGN(base); ++ } ++ ++ return base; ++} ++ + int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) + { + struct mips_vdso_image *image = current->thread.abi->vdso; +@@ -138,7 +154,7 @@ int arch_setup_additional_pages(struct l + if (cpu_has_dc_aliases) + size += shm_align_mask + 1; + +- base = get_unmapped_area(NULL, 0, size, 0, 0); ++ base = get_unmapped_area(NULL, vdso_base(), size, 0, 0); + if (IS_ERR_VALUE(base)) { + ret = base; + goto out; diff --git a/queue-4.9/mm-preserve-_page_devmap-across-mprotect-calls.patch b/queue-4.9/mm-preserve-_page_devmap-across-mprotect-calls.patch new file mode 100644 index 00000000000..b1863ba983e --- /dev/null +++ b/queue-4.9/mm-preserve-_page_devmap-across-mprotect-calls.patch @@ -0,0 +1,86 @@ +From 4628a64591e6cee181237060961e98c615c33966 Mon Sep 17 00:00:00 2001 +From: Jan Kara +Date: Tue, 9 Oct 2018 12:19:17 +0200 +Subject: mm: Preserve _PAGE_DEVMAP across mprotect() calls + +From: Jan Kara + +commit 4628a64591e6cee181237060961e98c615c33966 upstream. + +Currently _PAGE_DEVMAP bit is not preserved in mprotect(2) calls. As a +result we will see warnings such as: + +BUG: Bad page map in process JobWrk0013 pte:800001803875ea25 pmd:7624381067 +addr:00007f0930720000 vm_flags:280000f9 anon_vma: (null) mapping:ffff97f2384056f0 index:0 +file:457-000000fe00000030-00000009-000000ca-00000001_2001.fileblock fault:xfs_filemap_fault [xfs] mmap:xfs_file_mmap [xfs] readpage: (null) +CPU: 3 PID: 15848 Comm: JobWrk0013 Tainted: G W 4.12.14-2.g7573215-default #1 SLE12-SP4 (unreleased) +Hardware name: Intel Corporation S2600WFD/S2600WFD, BIOS SE5C620.86B.01.00.0833.051120182255 05/11/2018 +Call Trace: + dump_stack+0x5a/0x75 + print_bad_pte+0x217/0x2c0 + ? enqueue_task_fair+0x76/0x9f0 + _vm_normal_page+0xe5/0x100 + zap_pte_range+0x148/0x740 + unmap_page_range+0x39a/0x4b0 + unmap_vmas+0x42/0x90 + unmap_region+0x99/0xf0 + ? vma_gap_callbacks_rotate+0x1a/0x20 + do_munmap+0x255/0x3a0 + vm_munmap+0x54/0x80 + SyS_munmap+0x1d/0x30 + do_syscall_64+0x74/0x150 + entry_SYSCALL_64_after_hwframe+0x3d/0xa2 +... + +when mprotect(2) gets used on DAX mappings. Also there is a wide variety +of other failures that can result from the missing _PAGE_DEVMAP flag +when the area gets used by get_user_pages() later. + +Fix the problem by including _PAGE_DEVMAP in a set of flags that get +preserved by mprotect(2). + +Fixes: 69660fd797c3 ("x86, mm: introduce _PAGE_DEVMAP") +Fixes: ebd31197931d ("powerpc/mm: Add devmap support for ppc64") +Cc: +Signed-off-by: Jan Kara +Acked-by: Michal Hocko +Reviewed-by: Johannes Thumshirn +Signed-off-by: Dan Williams +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/include/asm/book3s/64/pgtable.h | 4 ++-- + arch/x86/include/asm/pgtable_types.h | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +--- a/arch/powerpc/include/asm/book3s/64/pgtable.h ++++ b/arch/powerpc/include/asm/book3s/64/pgtable.h +@@ -53,7 +53,7 @@ + */ + #define _HPAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ + _PAGE_ACCESSED | H_PAGE_THP_HUGE | _PAGE_PTE | \ +- _PAGE_SOFT_DIRTY) ++ _PAGE_SOFT_DIRTY | _PAGE_DEVMAP) + /* + * user access blocked by key + */ +@@ -71,7 +71,7 @@ + */ + #define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \ + _PAGE_ACCESSED | _PAGE_SPECIAL | _PAGE_PTE | \ +- _PAGE_SOFT_DIRTY) ++ _PAGE_SOFT_DIRTY | _PAGE_DEVMAP) + /* + * Mask of bits returned by pte_pgprot() + */ +--- a/arch/x86/include/asm/pgtable_types.h ++++ b/arch/x86/include/asm/pgtable_types.h +@@ -134,7 +134,7 @@ + */ + #define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \ + _PAGE_SPECIAL | _PAGE_ACCESSED | _PAGE_DIRTY | \ +- _PAGE_SOFT_DIRTY) ++ _PAGE_SOFT_DIRTY | _PAGE_DEVMAP) + #define _HPAGE_CHG_MASK (_PAGE_CHG_MASK | _PAGE_PSE) + + /* The ASID is the lower 12 bits of CR3 */ diff --git a/queue-4.9/mm-vmstat.c-fix-outdated-vmstat_text.patch b/queue-4.9/mm-vmstat.c-fix-outdated-vmstat_text.patch new file mode 100644 index 00000000000..d42df955f29 --- /dev/null +++ b/queue-4.9/mm-vmstat.c-fix-outdated-vmstat_text.patch @@ -0,0 +1,47 @@ +From 28e2c4bb99aa40f9d5f07ac130cbc4da0ea93079 Mon Sep 17 00:00:00 2001 +From: Jann Horn +Date: Fri, 5 Oct 2018 15:52:03 -0700 +Subject: mm/vmstat.c: fix outdated vmstat_text + +From: Jann Horn + +commit 28e2c4bb99aa40f9d5f07ac130cbc4da0ea93079 upstream. + +7a9cdebdcc17 ("mm: get rid of vmacache_flush_all() entirely") removed the +VMACACHE_FULL_FLUSHES statistics, but didn't remove the corresponding +entry in vmstat_text. This causes an out-of-bounds access in +vmstat_show(). + +Luckily this only affects kernels with CONFIG_DEBUG_VM_VMACACHE=y, which +is probably very rare. + +Link: http://lkml.kernel.org/r/20181001143138.95119-1-jannh@google.com +Fixes: 7a9cdebdcc17 ("mm: get rid of vmacache_flush_all() entirely") +Signed-off-by: Jann Horn +Reviewed-by: Kees Cook +Reviewed-by: Andrew Morton +Acked-by: Michal Hocko +Acked-by: Roman Gushchin +Cc: Davidlohr Bueso +Cc: Oleg Nesterov +Cc: Christoph Lameter +Cc: Kemi Wang +Cc: Andy Lutomirski +Cc: Ingo Molnar +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman + +--- + mm/vmstat.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/mm/vmstat.c ++++ b/mm/vmstat.c +@@ -1089,7 +1089,6 @@ const char * const vmstat_text[] = { + #ifdef CONFIG_DEBUG_VM_VMACACHE + "vmacache_find_calls", + "vmacache_find_hits", +- "vmacache_full_flushes", + #endif + #endif /* CONFIG_VM_EVENTS_COUNTERS */ + }; diff --git a/queue-4.9/perf-script-python-fix-export-to-postgresql.py-occasional-failure.patch b/queue-4.9/perf-script-python-fix-export-to-postgresql.py-occasional-failure.patch new file mode 100644 index 00000000000..6c3f02792b4 --- /dev/null +++ b/queue-4.9/perf-script-python-fix-export-to-postgresql.py-occasional-failure.patch @@ -0,0 +1,50 @@ +From 25e11700b54c7b6b5ebfc4361981dae12299557b Mon Sep 17 00:00:00 2001 +From: Adrian Hunter +Date: Tue, 11 Sep 2018 14:45:03 +0300 +Subject: perf script python: Fix export-to-postgresql.py occasional failure + +From: Adrian Hunter + +commit 25e11700b54c7b6b5ebfc4361981dae12299557b upstream. + +Occasional export failures were found to be caused by truncating 64-bit +pointers to 32-bits. Fix by explicitly setting types for all ctype +arguments and results. + +Signed-off-by: Adrian Hunter +Cc: Jiri Olsa +Cc: stable@vger.kernel.org +Link: http://lkml.kernel.org/r/20180911114504.28516-2-adrian.hunter@intel.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Greg Kroah-Hartman + +--- + tools/perf/scripts/python/export-to-postgresql.py | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/tools/perf/scripts/python/export-to-postgresql.py ++++ b/tools/perf/scripts/python/export-to-postgresql.py +@@ -204,14 +204,23 @@ from ctypes import * + libpq = CDLL("libpq.so.5") + PQconnectdb = libpq.PQconnectdb + PQconnectdb.restype = c_void_p ++PQconnectdb.argtypes = [ c_char_p ] + PQfinish = libpq.PQfinish ++PQfinish.argtypes = [ c_void_p ] + PQstatus = libpq.PQstatus ++PQstatus.restype = c_int ++PQstatus.argtypes = [ c_void_p ] + PQexec = libpq.PQexec + PQexec.restype = c_void_p ++PQexec.argtypes = [ c_void_p, c_char_p ] + PQresultStatus = libpq.PQresultStatus ++PQresultStatus.restype = c_int ++PQresultStatus.argtypes = [ c_void_p ] + PQputCopyData = libpq.PQputCopyData ++PQputCopyData.restype = c_int + PQputCopyData.argtypes = [ c_void_p, c_void_p, c_int ] + PQputCopyEnd = libpq.PQputCopyEnd ++PQputCopyEnd.restype = c_int + PQputCopyEnd.argtypes = [ c_void_p, c_void_p ] + + sys.path.append(os.environ['PERF_EXEC_PATH'] + \ diff --git a/queue-4.9/series b/queue-4.9/series index e78128dd1d6..9092545eb24 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -11,3 +11,9 @@ net-macb-disable-scatter-gather-for-macb-on-sama5d3.patch arm-dts-at91-add-new-compatibility-string-for-macb-on-sama5d3.patch x86-kvm-lapic-always-disable-mmio-interface-in-x2apic-mode.patch drm-amdgpu-fix-sdma-hqd-destroy-error-on-gfx_v7.patch +ext4-fix-error-code-in-ext4_xattr_set_entry.patch +mm-vmstat.c-fix-outdated-vmstat_text.patch +mips-vdso-always-map-near-top-of-user-memory.patch +mach64-detect-the-dot-clock-divider-correctly-on-sparc.patch +perf-script-python-fix-export-to-postgresql.py-occasional-failure.patch +mm-preserve-_page_devmap-across-mprotect-calls.patch