summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2018-05-11Add linux-next specific files for 20180511next-20180511Stephen Rothwell
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
2018-05-11Merge branch 'akpm/master'Stephen Rothwell
2018-05-11sparc64: NG4 memset 32 bits overflowPavel Tatashin
Early in boot Linux patches memset and memcpy to branch to platform optimized versions of these routines. The NG4 (Niagra 4) versions are currently used on all platforms starting from T4. Recently, there were M7 optimized routines added into UEK4 but not into mainline yet. So, even with M7 optimized routines NG4 are still going to be used on T4, T5, M5, and M6 processors. While investigating how to improve initialization time of dentry_hashtable which is 8G long on M6 ldom with 7T of main memory, I noticed that memset() does not reset all the memory in this array, after studying the code, I realized that NG4memset() branches use %icc register instead of %xcc to check compare, so if value of length is over 32-bit long, which is true for 8G array, these routines fail to work properly. The fix is to replace all %icc with %xcc in these routines. (Alternative is to use %ncc, but this is misleading, as the code already has sparcv9 only instructions, and cannot be compiled on 32-bit). This is important to fix this bug, because even older T4-4 can have 2T of memory, and there are large memory proportional data structures in kernel which can be larger than 4G in size. The failing of memset() is silent and corruption is hard to detect. Link: http://lkml.kernel.org/r/1488432825-92126-2-git-send-email-pasha.tatashin@oracle.com Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com> Reviewed-by: Babu Moger <babu.moger@oracle.com> Cc: Babu Moger <babu.moger@amd.com> Cc: David Miller <davem@davemloft.net> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
2018-05-11drivers/media/platform/sti/delta/delta-ipc.c: fix read buffer overflowAndi Kleen
The single caller passes a string to delta_ipc_open, which copies with a fixed size larger than the string. So it copies some random data after the original string the ro segment. If the string was at the end of a page it may fault. Just copy the string with a normal strcpy after clearing the field. Found by a LTO build (which errors out) because the compiler inlines the functions and can resolve the string sizes and triggers the compile time checks in memcpy. In function `memcpy', inlined from `delta_ipc_open.constprop' at linux/drivers/media/platform/sti/delta/delta-ipc.c:178:0, inlined from `delta_mjpeg_ipc_open' at linux/drivers/media/platform/sti/delta/delta-mjpeg-dec.c:227:0, inlined from `delta_mjpeg_decode' at linux/drivers/media/platform/sti/delta/delta-mjpeg-dec.c:403:0: /home/andi/lsrc/linux/include/linux/string.h:337:0: error: call to `__read_overflow2' declared with attribute error: detected read beyond size of object passed as 2nd parameter __read_overflow2(); Link: http://lkml.kernel.org/r/20171222001212.1850-1-andi@firstfloor.org Signed-off-by: Andi Kleen <ak@linux.intel.com> Cc: Hugues FRUCHET <hugues.fruchet@st.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
2018-05-11kernel/kexec_file.c: load kernel at top of system RAM if requiredBaoquan He
For kexec_file loading, if kexec_buf.top_down is 'true', the memory which is used to load kernel/initrd/purgatory is supposed to be allocated from top to down. This is also consistent with the old kexec loading interface. However, the current arch_kexec_walk_mem() doesn't do like this. It ignores checking kexec_buf.top_down, but calls walk_system_ram_res() directly to go through all resources of System RAM, to try to find a memory region which can contain the specific kexec buffer, then calls locate_mem_hole_callback() to allocate memory in that found memory region from top to down. This is not right. Here add checking if kexec_buf.top_down is 'true' in arch_kexec_walk_mem(), if yes, call the newly added walk_system_ram_res_rev() to find memory region from top to down to load kernel. The problem is the current kexec file loading has different behaviour with the old kexec loading. In kexec loading, user space kexec_tools utility does most of job, it searches in /proc/iomem to try to find a memory region from top to down to load kernel. Therefore with the kexec loading, x86_64 bzImage kernel are all loaded at top of System RAM. However, the kexec file loading just searches for available memory region in iomem resource from bottom to top, then try to allocate from top to down in that region. E.g on my testing system with 2G memory as below, the kexec loading will put kernel near 0x000000013fffffff, while kexec file loading will put kernel near 0x000000003ffddfff. There's no bug reported yet, just we need consider it when take care of the kexec collaboration with other kernel components like kaslr/hotplug etc, and also the consistentency between the different kexec interface. [Mar23 15:13] Linux version 4.16.0-rc3+ (bhe@localhost.localdomain) (gcc version [ +0.000000] Command line: BOOT_IMAGE=/vmlinuz-4.16.0-rc3+ root=UUID=be8f8e3a-9 [ +0.000000] x86/fpu: x87 FPU will use FXSAVE [ +0.000000] e820: BIOS-provided physical RAM map: [ +0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable [ +0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved [ +0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved [ +0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000003ffddfff] usable [ +0.000000] BIOS-e820: [mem 0x000000003ffde000-0x000000003fffffff] reserved [ +0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved [ +0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved [ +0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000013fffffff] usable I searched on internet and found the original patches posted for adding bzImage 64 support into the old kexec loading, which is located in user space kexec_tools utility made by Yinghai, and Vivek and hpa reviewed patches. Still I didn't found out why kernel has to be put at top of system RAM. I guess low memory are reserved for system usage mostly, putting kexec kernel at top is safer and no need to exclude those resereved regions by system or firmware which we may not find out all of them, but not very sure about it. Link: http://lkml.kernel.org/r/20180322033722.9279-3-bhe@redhat.com Signed-off-by: Baoquan He <bhe@redhat.com> Cc: AKASHI Takahiro <takahiro.akashi@linaro.org> Cc: Dave Young <dyoung@redhat.com> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Philipp Rudo <prudo@linux.vnet.ibm.com> Cc: Vivek Goyal <vgoyal@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
2018-05-11kernel/kexec_file.c: add walk_system_ram_res_rev()AKASHI Takahiro
This function, being a variant of walk_system_ram_res() introduced in commit 8c86e70acead ("resource: provide new functions to walk through resources"), walks through a list of all the resources of System RAM in reversed order, i.e., from higher to lower. It will be used in kexec_file code. Link: http://lkml.kernel.org/r/20180322033722.9279-2-bhe@redhat.com Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Baoquan He <bhe@redhat.com> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Vivek Goyal <vgoyal@redhat.com> Cc: Dave Young <dyoung@redhat.com> Cc: Philipp Rudo <prudo@linux.vnet.ibm.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
2018-05-11mm: fix oom_kill event handlingRoman Gushchin
e27be240df53 ("mm: memcg: make sure memory.events is uptodate when waking pollers") converted most of memcg event counters to per-memcg atomics, which made them less confusing for a user. The "oom_kill" counter remained untouched, so now it behaves differently than other counters (including "oom"). This adds nothing but confusion. Let's fix this by adding the MEMCG_OOM_KILL event, and follow the MEMCG_OOM approach. This also removes a hack from count_memcg_event_mm(), introduced earlier specially for the OOM_KILL counter. Link: http://lkml.kernel.org/r/20180508124637.29984-1-guro@fb.com Signed-off-by: Roman Gushchin <guro@fb.com> Acked-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Vladimir Davydov <vdavydov.dev@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
2018-05-11treewide: use PHYS_ADDR_MAX to avoid type casting ULLONG_MAXStefan Agner
With PHYS_ADDR_MAX there is now a type safe variant for all bits set. Make use of it. Patch created using a semantic patch as follows: // <smpl> @@ typedef phys_addr_t; @@ -(phys_addr_t)ULLONG_MAX +PHYS_ADDR_MAX // </smpl> Link: http://lkml.kernel.org/r/20180419214204.19322-1-stefan@agner.ch Signed-off-by: Stefan Agner <stefan@agner.ch> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Catalin Marinas <catalin.marinas@arm.com> [arm64] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
2018-05-11mm: use octal not symbolic permissionsJoe Perches
mm/*.c files use symbolic and octal styles for permissions. Using octal and not symbolic permissions is preferred by many as more readable. https://lkml.org/lkml/2016/8/2/1945 Prefer the direct use of octal for permissions. Done using $ scripts/checkpatch.pl -f --types=SYMBOLIC_PERMS --fix-inplace mm/*.c and some typing. Before: $ git grep -P -w "0[0-7]{3,3}" mm | wc -l 44 After: $ git grep -P -w "0[0-7]{3,3}" mm | wc -l 86 Miscellanea: o Whitespace neatening around these conversions. Link: http://lkml.kernel.org/r/2e032ef111eebcd4c5952bae86763b541d373469.1522102887.git.joe@perches.com Signed-off-by: Joe Perches <joe@perches.com> Acked-by: David Rientjes <rientjes@google.com> Acked-by: Michal Hocko <mhocko@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
2018-05-11Merge branch 'akpm-current/current'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'kspp/for-next/kspp'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'ntb/ntb-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'at24/at24/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'nvdimm/libnvdimm-for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'rtc/rtc-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'coresight/next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'livepatching/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'kselftest/next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'userns/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'pwm/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'pinctrl-samsung/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'pinctrl/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'gpio/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'rpmsg/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'vhost/linux-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'libata/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'scsi-mkp/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'scsi/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'cgroup/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'slave-dma/next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'mux/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'staging/staging-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'char-misc/char-misc-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'tty/tty-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'phy-next/next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'usb-chipidea-next/ci-for-usb-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'usb-serial/usb-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'usb/usb-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'driver-core/driver-core-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'ipmi/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'leds/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'hsi/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'drivers-x86/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'workqueues/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'xen-tip/linux-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'kvms390/next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'rcu/rcu/next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'edac-amd/for-next'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'tip/auto-latest'Stephen Rothwell
2018-05-11Merge remote-tracking branch 'spi/for-next'Stephen Rothwell