You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kernel_samsung_sm7125/lib/ubsan.h

96 lines
1.8 KiB

License cleanup: add SPDX GPL-2.0 license identifier to files with no license Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years ago
/* SPDX-License-Identifier: GPL-2.0 */
UBSAN: run-time undefined behavior sanity checker UBSAN uses compile-time instrumentation to catch undefined behavior (UB). Compiler inserts code that perform certain kinds of checks before operations that could cause UB. If check fails (i.e. UB detected) __ubsan_handle_* function called to print error message. So the most of the work is done by compiler. This patch just implements ubsan handlers printing errors. GCC has this capability since 4.9.x [1] (see -fsanitize=undefined option and its suboptions). However GCC 5.x has more checkers implemented [2]. Article [3] has a bit more details about UBSAN in the GCC. [1] - https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Debugging-Options.html [2] - https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html [3] - http://developerblog.redhat.com/2014/10/16/gcc-undefined-behavior-sanitizer-ubsan/ Issues which UBSAN has found thus far are: Found bugs: * out-of-bounds access - 97840cb67ff5 ("netfilter: nfnetlink: fix insufficient validation in nfnetlink_bind") undefined shifts: * d48458d4a768 ("jbd2: use a better hash function for the revoke table") * 10632008b9e1 ("clockevents: Prevent shift out of bounds") * 'x << -1' shift in ext4 - http://lkml.kernel.org/r/<5444EF21.8020501@samsung.com> * undefined rol32(0) - http://lkml.kernel.org/r/<1449198241-20654-1-git-send-email-sasha.levin@oracle.com> * undefined dirty_ratelimit calculation - http://lkml.kernel.org/r/<566594E2.3050306@odin.com> * undefined roundown_pow_of_two(0) - http://lkml.kernel.org/r/<1449156616-11474-1-git-send-email-sasha.levin@oracle.com> * [WONTFIX] undefined shift in __bpf_prog_run - http://lkml.kernel.org/r/<CACT4Y+ZxoR3UjLgcNdUm4fECLMx2VdtfrENMtRRCdgHB2n0bJA@mail.gmail.com> WONTFIX here because it should be fixed in bpf program, not in kernel. signed overflows: * 32a8df4e0b33f ("sched: Fix odd values in effective_load() calculations") * mul overflow in ntp - http://lkml.kernel.org/r/<1449175608-1146-1-git-send-email-sasha.levin@oracle.com> * incorrect conversion into rtc_time in rtc_time64_to_tm() - http://lkml.kernel.org/r/<1449187944-11730-1-git-send-email-sasha.levin@oracle.com> * unvalidated timespec in io_getevents() - http://lkml.kernel.org/r/<CACT4Y+bBxVYLQ6LtOKrKtnLthqLHcw-BMp3aqP3mjdAvr9FULQ@mail.gmail.com> * [NOTABUG] signed overflow in ktime_add_safe() - http://lkml.kernel.org/r/<CACT4Y+aJ4muRnWxsUe1CMnA6P8nooO33kwG-c8YZg=0Xc8rJqw@mail.gmail.com> [akpm@linux-foundation.org: fix unused local warning] [akpm@linux-foundation.org: fix __int128 build woes] Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sasha Levin <sasha.levin@oracle.com> Cc: Randy Dunlap <rdunlap@infradead.org> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Michal Marek <mmarek@suse.cz> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Yury Gribov <y.gribov@samsung.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Konstantin Khlebnikov <koct9i@gmail.com> Cc: Kostya Serebryany <kcc@google.com> Cc: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years ago
#ifndef _LIB_UBSAN_H
#define _LIB_UBSAN_H
enum {
type_kind_int = 0,
type_kind_float = 1,
type_unknown = 0xffff
};
struct type_descriptor {
u16 type_kind;
u16 type_info;
char type_name[1];
};
struct source_location {
const char *file_name;
union {
unsigned long reported;
struct {
u32 line;
u32 column;
};
};
};
struct overflow_data {
struct source_location location;
struct type_descriptor *type;
};
struct type_mismatch_data {
struct source_location location;
struct type_descriptor *type;
unsigned long alignment;
unsigned char type_check_kind;
};
struct type_mismatch_data_v1 {
struct source_location location;
struct type_descriptor *type;
unsigned char log_alignment;
unsigned char type_check_kind;
};
UBSAN: run-time undefined behavior sanity checker UBSAN uses compile-time instrumentation to catch undefined behavior (UB). Compiler inserts code that perform certain kinds of checks before operations that could cause UB. If check fails (i.e. UB detected) __ubsan_handle_* function called to print error message. So the most of the work is done by compiler. This patch just implements ubsan handlers printing errors. GCC has this capability since 4.9.x [1] (see -fsanitize=undefined option and its suboptions). However GCC 5.x has more checkers implemented [2]. Article [3] has a bit more details about UBSAN in the GCC. [1] - https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Debugging-Options.html [2] - https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html [3] - http://developerblog.redhat.com/2014/10/16/gcc-undefined-behavior-sanitizer-ubsan/ Issues which UBSAN has found thus far are: Found bugs: * out-of-bounds access - 97840cb67ff5 ("netfilter: nfnetlink: fix insufficient validation in nfnetlink_bind") undefined shifts: * d48458d4a768 ("jbd2: use a better hash function for the revoke table") * 10632008b9e1 ("clockevents: Prevent shift out of bounds") * 'x << -1' shift in ext4 - http://lkml.kernel.org/r/<5444EF21.8020501@samsung.com> * undefined rol32(0) - http://lkml.kernel.org/r/<1449198241-20654-1-git-send-email-sasha.levin@oracle.com> * undefined dirty_ratelimit calculation - http://lkml.kernel.org/r/<566594E2.3050306@odin.com> * undefined roundown_pow_of_two(0) - http://lkml.kernel.org/r/<1449156616-11474-1-git-send-email-sasha.levin@oracle.com> * [WONTFIX] undefined shift in __bpf_prog_run - http://lkml.kernel.org/r/<CACT4Y+ZxoR3UjLgcNdUm4fECLMx2VdtfrENMtRRCdgHB2n0bJA@mail.gmail.com> WONTFIX here because it should be fixed in bpf program, not in kernel. signed overflows: * 32a8df4e0b33f ("sched: Fix odd values in effective_load() calculations") * mul overflow in ntp - http://lkml.kernel.org/r/<1449175608-1146-1-git-send-email-sasha.levin@oracle.com> * incorrect conversion into rtc_time in rtc_time64_to_tm() - http://lkml.kernel.org/r/<1449187944-11730-1-git-send-email-sasha.levin@oracle.com> * unvalidated timespec in io_getevents() - http://lkml.kernel.org/r/<CACT4Y+bBxVYLQ6LtOKrKtnLthqLHcw-BMp3aqP3mjdAvr9FULQ@mail.gmail.com> * [NOTABUG] signed overflow in ktime_add_safe() - http://lkml.kernel.org/r/<CACT4Y+aJ4muRnWxsUe1CMnA6P8nooO33kwG-c8YZg=0Xc8rJqw@mail.gmail.com> [akpm@linux-foundation.org: fix unused local warning] [akpm@linux-foundation.org: fix __int128 build woes] Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sasha Levin <sasha.levin@oracle.com> Cc: Randy Dunlap <rdunlap@infradead.org> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Michal Marek <mmarek@suse.cz> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Yury Gribov <y.gribov@samsung.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Konstantin Khlebnikov <koct9i@gmail.com> Cc: Kostya Serebryany <kcc@google.com> Cc: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years ago
struct nonnull_arg_data {
struct source_location location;
Merge remote-tracking branch 'remotes/origin/tmp-0a91e84' into msm-4.14 * remotes/origin/tmp-0a91e84: Linux 4.14.20 scsi: cxlflash: Reset command ioasc scsi: lpfc: Fix crash after bad bar setup on driver attachment rcu: Export init_rcu_head() and destroy_rcu_head() to GPL modules scsi: core: Ensure that the SCSI error handler gets woken up ftrace: Remove incorrect setting of glob search field devpts: fix error handling in devpts_mntget() mn10300/misalignment: Use SIGSEGV SEGV_MAPERR to report a failed user copy ovl: take mnt_want_write() for removing impure xattr ovl: fix failure to fsync lower dir acpi, nfit: fix register dimm error handling ACPI: sbshc: remove raw pointer from printk() message drm/i915: Avoid PPS HW/SW state mismatch due to rounding arm64: dts: marvell: add Ethernet aliases objtool: Fix switch-table detection btrfs: Handle btrfs_set_extent_delalloc failure in fixup worker lib/ubsan: add type mismatch handler for new GCC/Clang lib/ubsan.c: s/missaligned/misaligned/ clocksource/drivers/stm32: Fix kernel panic with multiple timers blk-mq: quiesce queue before freeing queue pktcdvd: Fix a recently introduced NULL pointer dereference pktcdvd: Fix pkt_setup_dev() error path pinctrl: sx150x: Add a static gpio/pinctrl pin range mapping pinctrl: sx150x: Register pinctrl before adding the gpiochip pinctrl: sx150x: Unregister the pinctrl on release pinctrl: mcp23s08: fix irq setup order pinctrl: intel: Initialize GPIO properly when used through irqchip EDAC, octeon: Fix an uninitialized variable warning xtensa: fix futex_atomic_cmpxchg_inatomic alpha: fix formating of stack content alpha: fix reboot on Avanti platform alpha: Fix mixed up args in EXC macro in futex operations alpha: osf_sys.c: fix put_tv32 regression alpha: fix crash if pthread_create races with signal delivery signal/sh: Ensure si_signo is initialized in do_divide_error signal/openrisc: Fix do_unaligned_access to send the proper signal ipmi: use dynamic memory for DMI driver override Bluetooth: btusb: Restore QCA Rome suspend/resume fix with a "rewritten" version Revert "Bluetooth: btusb: fix QCA Rome suspend/resume" Bluetooth: btsdio: Do not bind to non-removable BCM43341 HID: quirks: Fix keyboard + touchpad on Toshiba Click Mini not working pipe: fix off-by-one error when checking buffer limits pipe: actually allow root to exceed the pipe buffer limits kernel/relay.c: revert "kernel/relay.c: fix potential memory leak" kernel/async.c: revert "async: simplify lowest_in_progress()" fs/proc/kcore.c: use probe_kernel_read() instead of memcpy() media: cxusb, dib0700: ignore XC2028_I2C_FLUSH media: ts2020: avoid integer overflows on 32 bit machines media: dvb-frontends: fix i2c access helpers for KASAN kasan: rework Kconfig settings kasan: don't emit builtin calls when sanitization is off Btrfs: raid56: iterate raid56 internal bio with bio_for_each_segment_all watchdog: imx2_wdt: restore previous timeout after suspend+resume ASoC: skl: Fix kernel warning due to zero NHTL entry ASoC: rockchip: i2s: fix playback after runtime resume KVM: PPC: Book3S PR: Fix broken select due to misspelling KVM: arm/arm64: Handle CPU_PM_ENTER_FAILED KVM: PPC: Book3S HV: Drop locks before reading guest memory KVM: PPC: Book3S HV: Make sure we don't re-enter guest without XIVE loaded KVM: nVMX: Fix bug of injecting L2 exception into L1 KVM: nVMX: Fix races when sending nested PI while dest enters/leaves L2 arm: KVM: Fix SMCCC handling of unimplemented SMC/HVC calls crypto: sha512-mb - initialize pending lengths correctly crypto: caam - fix endless loop when DECO acquire fails media: v4l2-compat-ioctl32.c: make ctrl_is_pointer work for subdevs media: v4l2-compat-ioctl32.c: refactor compat ioctl32 logic media: v4l2-compat-ioctl32.c: don't copy back the result for certain errors media: v4l2-compat-ioctl32.c: drop pr_info for unknown buffer type media: v4l2-compat-ioctl32.c: copy clip list in put_v4l2_window32 media: v4l2-compat-ioctl32.c: fix ctrl_is_pointer media: v4l2-compat-ioctl32.c: copy m.userptr in put_v4l2_plane32 media: v4l2-compat-ioctl32.c: avoid sizeof(type) media: v4l2-compat-ioctl32.c: move 'helper' functions to __get/put_v4l2_format32 media: v4l2-compat-ioctl32.c: fix the indentation media: v4l2-compat-ioctl32.c: add missing VIDIOC_PREPARE_BUF media: v4l2-ioctl.c: don't copy back the result for -ENOTTY media: v4l2-ioctl.c: use check_fmt for enum/g/s/try_fmt crypto: hash - prevent using keyed hashes without setting key crypto: hash - annotate algorithms taking optional key crypto: poly1305 - remove ->setkey() method crypto: mcryptd - pass through absence of ->setkey() crypto: cryptd - pass through absence of ->setkey() crypto: hash - introduce crypto_hash_alg_has_setkey() ahci: Add Intel Cannon Lake PCH-H PCI ID ahci: Add PCI ids for Intel Bay Trail, Cherry Trail and Apollo Lake AHCI ahci: Annotate PCI ids for mobile Intel chipsets as such kernfs: fix regression in kernfs_fop_write caused by wrong type NFS: Fix a race between mmap() and O_DIRECT NFS: reject request for id_legacy key without auxdata NFS: commit direct writes even if they fail partially NFS: Fix nfsstat breakage due to LOOKUPP NFS: Add a cond_resched() to nfs_commit_release_pages() nfs41: do not return ENOMEM on LAYOUTUNAVAILABLE nfs/pnfs: fix nfs_direct_req ref leak when i/o falls back to the mds ubifs: free the encrypted symlink target ubi: block: Fix locking for idr_alloc/idr_remove ubi: fastmap: Erase outdated anchor PEBs during attach ubi: Fix race condition between ubi volume creation and udev mtd: nand: sunxi: Fix ECC strength choice mtd: nand: Fix nand_do_read_oob() return value mtd: nand: brcmnand: Disable prefetch by default mtd: cfi: convert inline functions to macros arm64: Kill PSCI_GET_VERSION as a variant-2 workaround arm64: Add ARM_SMCCC_ARCH_WORKAROUND_1 BP hardening support arm/arm64: smccc: Implement SMCCC v1.1 inline primitive arm/arm64: smccc: Make function identifiers an unsigned quantity firmware/psci: Expose SMCCC version through psci_ops firmware/psci: Expose PSCI conduit arm64: KVM: Add SMCCC_ARCH_WORKAROUND_1 fast handling arm64: KVM: Report SMCCC_ARCH_WORKAROUND_1 BP hardening support arm/arm64: KVM: Turn kvm_psci_version into a static inline arm64: KVM: Make PSCI_VERSION a fast path arm/arm64: KVM: Advertise SMCCC v1.1 arm/arm64: KVM: Implement PSCI 1.0 support arm/arm64: KVM: Add smccc accessors to PSCI code arm/arm64: KVM: Add PSCI_VERSION helper arm/arm64: KVM: Consolidate the PSCI include files arm64: KVM: Increment PC after handling an SMC trap arm64: Branch predictor hardening for Cavium ThunderX2 arm64: Implement branch predictor hardening for Falkor arm64: Implement branch predictor hardening for affected Cortex-A CPUs arm64: cputype: Add missing MIDR values for Cortex-A72 and Cortex-A75 arm64: entry: Apply BP hardening for suspicious interrupts from EL0 arm64: entry: Apply BP hardening for high-priority synchronous exceptions arm64: KVM: Use per-CPU vector when BP hardening is enabled arm64: Move BP hardening to check_and_switch_context arm64: Add skeleton to harden the branch predictor against aliasing attacks arm64: Move post_ttbr_update_workaround to C code drivers/firmware: Expose psci_get_version through psci_ops structure arm64: cpufeature: Pass capability structure to ->enable callback arm64: Run enable method for errata work arounds on late CPUs arm64: cpufeature: __this_cpu_has_cap() shouldn't stop early arm64: futex: Mask __user pointers prior to dereference arm64: uaccess: Mask __user pointers for __arch_{clear, copy_*}_user arm64: uaccess: Don't bother eliding access_ok checks in __{get, put}_user arm64: uaccess: Prevent speculative use of the current addr_limit arm64: entry: Ensure branch through syscall table is bounded under speculation arm64: Use pointer masking to limit uaccess speculation arm64: Make USER_DS an inclusive limit arm64: Implement array_index_mask_nospec() arm64: barrier: Add CSDB macros to control data-value prediction arm64: idmap: Use "awx" flags for .idmap.text .pushsection directives arm64: entry: Reword comment about post_ttbr_update_workaround arm64: Force KPTI to be disabled on Cavium ThunderX arm64: kpti: Add ->enable callback to remap swapper using nG mappings arm64: mm: Permit transitioning from Global to Non-Global without BBM arm64: kpti: Make use of nG dependent on arm64_kernel_unmapped_at_el0() arm64: Turn on KPTI only on CPUs that need it arm64: cputype: Add MIDR values for Cavium ThunderX2 CPUs arm64: kpti: Fix the interaction between ASID switching and software PAN arm64: mm: Introduce TTBR_ASID_MASK for getting at the ASID in the TTBR arm64: capabilities: Handle duplicate entries for a capability arm64: Take into account ID_AA64PFR0_EL1.CSV3 arm64: Kconfig: Reword UNMAP_KERNEL_AT_EL0 kconfig entry arm64: Kconfig: Add CONFIG_UNMAP_KERNEL_AT_EL0 arm64: use RET instruction for exiting the trampoline arm64: kaslr: Put kernel vectors address in separate data page arm64: entry: Add fake CPU feature for unmapping the kernel at EL0 arm64: tls: Avoid unconditional zeroing of tpidrro_el0 for native tasks arm64: cpu_errata: Add Kryo to Falkor 1003 errata arm64: erratum: Work around Falkor erratum #E1003 in trampoline code arm64: entry: Hook up entry trampoline to exception vectors arm64: entry: Explicitly pass exception level to kernel_ventry macro arm64: mm: Map entry trampoline into trampoline and kernel page tables arm64: entry: Add exception trampoline page for exceptions from EL0 arm64: mm: Invalidate both kernel and user ASIDs when performing TLBI arm64: mm: Add arm64_kernel_unmapped_at_el0 helper arm64: mm: Allocate ASIDs in pairs arm64: mm: Fix and re-enable ARM64_SW_TTBR0_PAN arm64: mm: Rename post_ttbr0_update_workaround arm64: mm: Remove pre_ttbr0_update_workaround for Falkor erratum #E1003 arm64: mm: Move ASID from TTBR0 to TTBR1 arm64: mm: Temporarily disable ARM64_SW_TTBR0_PAN arm64: mm: Use non-global mappings for kernel space arm64: move TASK_* definitions to <asm/processor.h> media: hdpvr: Fix an error handling path in hdpvr_probe() media: dvb-usb-v2: lmedm04: move ts2020 attach to dm04_lme2510_tuner media: dvb-usb-v2: lmedm04: Improve logic checking of warm start dccp: CVE-2017-8824: use-after-free in DCCP code drm/i915: Fix deadlock in i830_disable_pipe() drm/i915: Redo plane sanitation during readout drm/i915: Add .get_hw_state() method for planes sched/rt: Up the root domain ref count when passing it around via IPIs sched/rt: Use container_of() to get root domain in rto_push_irq_work_func() KVM MMU: check pending exception before injecting APF arm64: Add software workaround for Falkor erratum 1041 arm64: Define cputype macros for Falkor CPU watchdog: gpio_wdt: set WDOG_HW_RUNNING in gpio_wdt_stop sched/wait: Fix add_wait_queue() behavioral change dmaengine: dmatest: fix container_of member in dmatest_callback cpufreq: mediatek: add mediatek related projects into blacklist CIFS: zero sensitive data when freeing cifs: Fix autonegotiate security settings mismatch cifs: Fix missing put_xid in cifs_file_strict_mmap powerpc/pseries: include linux/types.h in asm/hvcall.h watchdog: indydog: Add dependency on SGI_HAS_INDYDOG ANDROID: Fixup 64/32-bit divide confusion for WALT configs Conflicts: include/trace/events/sched.h kernel/sched/sched.h lib/ubsan.c lib/ubsan.h arch/arm64/configs/sdm855_defconfig arch/arm64/configs/sdm855-perf_defconfig Change-Id: I034588046a45f3d8be0615bed40d2ddd334ebd74 Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
7 years ago
struct type_descriptor *type;
unsigned char log_alignment;
unsigned char type_check_kind;
UBSAN: run-time undefined behavior sanity checker UBSAN uses compile-time instrumentation to catch undefined behavior (UB). Compiler inserts code that perform certain kinds of checks before operations that could cause UB. If check fails (i.e. UB detected) __ubsan_handle_* function called to print error message. So the most of the work is done by compiler. This patch just implements ubsan handlers printing errors. GCC has this capability since 4.9.x [1] (see -fsanitize=undefined option and its suboptions). However GCC 5.x has more checkers implemented [2]. Article [3] has a bit more details about UBSAN in the GCC. [1] - https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Debugging-Options.html [2] - https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html [3] - http://developerblog.redhat.com/2014/10/16/gcc-undefined-behavior-sanitizer-ubsan/ Issues which UBSAN has found thus far are: Found bugs: * out-of-bounds access - 97840cb67ff5 ("netfilter: nfnetlink: fix insufficient validation in nfnetlink_bind") undefined shifts: * d48458d4a768 ("jbd2: use a better hash function for the revoke table") * 10632008b9e1 ("clockevents: Prevent shift out of bounds") * 'x << -1' shift in ext4 - http://lkml.kernel.org/r/<5444EF21.8020501@samsung.com> * undefined rol32(0) - http://lkml.kernel.org/r/<1449198241-20654-1-git-send-email-sasha.levin@oracle.com> * undefined dirty_ratelimit calculation - http://lkml.kernel.org/r/<566594E2.3050306@odin.com> * undefined roundown_pow_of_two(0) - http://lkml.kernel.org/r/<1449156616-11474-1-git-send-email-sasha.levin@oracle.com> * [WONTFIX] undefined shift in __bpf_prog_run - http://lkml.kernel.org/r/<CACT4Y+ZxoR3UjLgcNdUm4fECLMx2VdtfrENMtRRCdgHB2n0bJA@mail.gmail.com> WONTFIX here because it should be fixed in bpf program, not in kernel. signed overflows: * 32a8df4e0b33f ("sched: Fix odd values in effective_load() calculations") * mul overflow in ntp - http://lkml.kernel.org/r/<1449175608-1146-1-git-send-email-sasha.levin@oracle.com> * incorrect conversion into rtc_time in rtc_time64_to_tm() - http://lkml.kernel.org/r/<1449187944-11730-1-git-send-email-sasha.levin@oracle.com> * unvalidated timespec in io_getevents() - http://lkml.kernel.org/r/<CACT4Y+bBxVYLQ6LtOKrKtnLthqLHcw-BMp3aqP3mjdAvr9FULQ@mail.gmail.com> * [NOTABUG] signed overflow in ktime_add_safe() - http://lkml.kernel.org/r/<CACT4Y+aJ4muRnWxsUe1CMnA6P8nooO33kwG-c8YZg=0Xc8rJqw@mail.gmail.com> [akpm@linux-foundation.org: fix unused local warning] [akpm@linux-foundation.org: fix __int128 build woes] Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sasha Levin <sasha.levin@oracle.com> Cc: Randy Dunlap <rdunlap@infradead.org> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Michal Marek <mmarek@suse.cz> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Yury Gribov <y.gribov@samsung.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Konstantin Khlebnikov <koct9i@gmail.com> Cc: Kostya Serebryany <kcc@google.com> Cc: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years ago
};
Merge remote-tracking branch 'remotes/origin/tmp-0a91e84' into msm-4.14 * remotes/origin/tmp-0a91e84: Linux 4.14.20 scsi: cxlflash: Reset command ioasc scsi: lpfc: Fix crash after bad bar setup on driver attachment rcu: Export init_rcu_head() and destroy_rcu_head() to GPL modules scsi: core: Ensure that the SCSI error handler gets woken up ftrace: Remove incorrect setting of glob search field devpts: fix error handling in devpts_mntget() mn10300/misalignment: Use SIGSEGV SEGV_MAPERR to report a failed user copy ovl: take mnt_want_write() for removing impure xattr ovl: fix failure to fsync lower dir acpi, nfit: fix register dimm error handling ACPI: sbshc: remove raw pointer from printk() message drm/i915: Avoid PPS HW/SW state mismatch due to rounding arm64: dts: marvell: add Ethernet aliases objtool: Fix switch-table detection btrfs: Handle btrfs_set_extent_delalloc failure in fixup worker lib/ubsan: add type mismatch handler for new GCC/Clang lib/ubsan.c: s/missaligned/misaligned/ clocksource/drivers/stm32: Fix kernel panic with multiple timers blk-mq: quiesce queue before freeing queue pktcdvd: Fix a recently introduced NULL pointer dereference pktcdvd: Fix pkt_setup_dev() error path pinctrl: sx150x: Add a static gpio/pinctrl pin range mapping pinctrl: sx150x: Register pinctrl before adding the gpiochip pinctrl: sx150x: Unregister the pinctrl on release pinctrl: mcp23s08: fix irq setup order pinctrl: intel: Initialize GPIO properly when used through irqchip EDAC, octeon: Fix an uninitialized variable warning xtensa: fix futex_atomic_cmpxchg_inatomic alpha: fix formating of stack content alpha: fix reboot on Avanti platform alpha: Fix mixed up args in EXC macro in futex operations alpha: osf_sys.c: fix put_tv32 regression alpha: fix crash if pthread_create races with signal delivery signal/sh: Ensure si_signo is initialized in do_divide_error signal/openrisc: Fix do_unaligned_access to send the proper signal ipmi: use dynamic memory for DMI driver override Bluetooth: btusb: Restore QCA Rome suspend/resume fix with a "rewritten" version Revert "Bluetooth: btusb: fix QCA Rome suspend/resume" Bluetooth: btsdio: Do not bind to non-removable BCM43341 HID: quirks: Fix keyboard + touchpad on Toshiba Click Mini not working pipe: fix off-by-one error when checking buffer limits pipe: actually allow root to exceed the pipe buffer limits kernel/relay.c: revert "kernel/relay.c: fix potential memory leak" kernel/async.c: revert "async: simplify lowest_in_progress()" fs/proc/kcore.c: use probe_kernel_read() instead of memcpy() media: cxusb, dib0700: ignore XC2028_I2C_FLUSH media: ts2020: avoid integer overflows on 32 bit machines media: dvb-frontends: fix i2c access helpers for KASAN kasan: rework Kconfig settings kasan: don't emit builtin calls when sanitization is off Btrfs: raid56: iterate raid56 internal bio with bio_for_each_segment_all watchdog: imx2_wdt: restore previous timeout after suspend+resume ASoC: skl: Fix kernel warning due to zero NHTL entry ASoC: rockchip: i2s: fix playback after runtime resume KVM: PPC: Book3S PR: Fix broken select due to misspelling KVM: arm/arm64: Handle CPU_PM_ENTER_FAILED KVM: PPC: Book3S HV: Drop locks before reading guest memory KVM: PPC: Book3S HV: Make sure we don't re-enter guest without XIVE loaded KVM: nVMX: Fix bug of injecting L2 exception into L1 KVM: nVMX: Fix races when sending nested PI while dest enters/leaves L2 arm: KVM: Fix SMCCC handling of unimplemented SMC/HVC calls crypto: sha512-mb - initialize pending lengths correctly crypto: caam - fix endless loop when DECO acquire fails media: v4l2-compat-ioctl32.c: make ctrl_is_pointer work for subdevs media: v4l2-compat-ioctl32.c: refactor compat ioctl32 logic media: v4l2-compat-ioctl32.c: don't copy back the result for certain errors media: v4l2-compat-ioctl32.c: drop pr_info for unknown buffer type media: v4l2-compat-ioctl32.c: copy clip list in put_v4l2_window32 media: v4l2-compat-ioctl32.c: fix ctrl_is_pointer media: v4l2-compat-ioctl32.c: copy m.userptr in put_v4l2_plane32 media: v4l2-compat-ioctl32.c: avoid sizeof(type) media: v4l2-compat-ioctl32.c: move 'helper' functions to __get/put_v4l2_format32 media: v4l2-compat-ioctl32.c: fix the indentation media: v4l2-compat-ioctl32.c: add missing VIDIOC_PREPARE_BUF media: v4l2-ioctl.c: don't copy back the result for -ENOTTY media: v4l2-ioctl.c: use check_fmt for enum/g/s/try_fmt crypto: hash - prevent using keyed hashes without setting key crypto: hash - annotate algorithms taking optional key crypto: poly1305 - remove ->setkey() method crypto: mcryptd - pass through absence of ->setkey() crypto: cryptd - pass through absence of ->setkey() crypto: hash - introduce crypto_hash_alg_has_setkey() ahci: Add Intel Cannon Lake PCH-H PCI ID ahci: Add PCI ids for Intel Bay Trail, Cherry Trail and Apollo Lake AHCI ahci: Annotate PCI ids for mobile Intel chipsets as such kernfs: fix regression in kernfs_fop_write caused by wrong type NFS: Fix a race between mmap() and O_DIRECT NFS: reject request for id_legacy key without auxdata NFS: commit direct writes even if they fail partially NFS: Fix nfsstat breakage due to LOOKUPP NFS: Add a cond_resched() to nfs_commit_release_pages() nfs41: do not return ENOMEM on LAYOUTUNAVAILABLE nfs/pnfs: fix nfs_direct_req ref leak when i/o falls back to the mds ubifs: free the encrypted symlink target ubi: block: Fix locking for idr_alloc/idr_remove ubi: fastmap: Erase outdated anchor PEBs during attach ubi: Fix race condition between ubi volume creation and udev mtd: nand: sunxi: Fix ECC strength choice mtd: nand: Fix nand_do_read_oob() return value mtd: nand: brcmnand: Disable prefetch by default mtd: cfi: convert inline functions to macros arm64: Kill PSCI_GET_VERSION as a variant-2 workaround arm64: Add ARM_SMCCC_ARCH_WORKAROUND_1 BP hardening support arm/arm64: smccc: Implement SMCCC v1.1 inline primitive arm/arm64: smccc: Make function identifiers an unsigned quantity firmware/psci: Expose SMCCC version through psci_ops firmware/psci: Expose PSCI conduit arm64: KVM: Add SMCCC_ARCH_WORKAROUND_1 fast handling arm64: KVM: Report SMCCC_ARCH_WORKAROUND_1 BP hardening support arm/arm64: KVM: Turn kvm_psci_version into a static inline arm64: KVM: Make PSCI_VERSION a fast path arm/arm64: KVM: Advertise SMCCC v1.1 arm/arm64: KVM: Implement PSCI 1.0 support arm/arm64: KVM: Add smccc accessors to PSCI code arm/arm64: KVM: Add PSCI_VERSION helper arm/arm64: KVM: Consolidate the PSCI include files arm64: KVM: Increment PC after handling an SMC trap arm64: Branch predictor hardening for Cavium ThunderX2 arm64: Implement branch predictor hardening for Falkor arm64: Implement branch predictor hardening for affected Cortex-A CPUs arm64: cputype: Add missing MIDR values for Cortex-A72 and Cortex-A75 arm64: entry: Apply BP hardening for suspicious interrupts from EL0 arm64: entry: Apply BP hardening for high-priority synchronous exceptions arm64: KVM: Use per-CPU vector when BP hardening is enabled arm64: Move BP hardening to check_and_switch_context arm64: Add skeleton to harden the branch predictor against aliasing attacks arm64: Move post_ttbr_update_workaround to C code drivers/firmware: Expose psci_get_version through psci_ops structure arm64: cpufeature: Pass capability structure to ->enable callback arm64: Run enable method for errata work arounds on late CPUs arm64: cpufeature: __this_cpu_has_cap() shouldn't stop early arm64: futex: Mask __user pointers prior to dereference arm64: uaccess: Mask __user pointers for __arch_{clear, copy_*}_user arm64: uaccess: Don't bother eliding access_ok checks in __{get, put}_user arm64: uaccess: Prevent speculative use of the current addr_limit arm64: entry: Ensure branch through syscall table is bounded under speculation arm64: Use pointer masking to limit uaccess speculation arm64: Make USER_DS an inclusive limit arm64: Implement array_index_mask_nospec() arm64: barrier: Add CSDB macros to control data-value prediction arm64: idmap: Use "awx" flags for .idmap.text .pushsection directives arm64: entry: Reword comment about post_ttbr_update_workaround arm64: Force KPTI to be disabled on Cavium ThunderX arm64: kpti: Add ->enable callback to remap swapper using nG mappings arm64: mm: Permit transitioning from Global to Non-Global without BBM arm64: kpti: Make use of nG dependent on arm64_kernel_unmapped_at_el0() arm64: Turn on KPTI only on CPUs that need it arm64: cputype: Add MIDR values for Cavium ThunderX2 CPUs arm64: kpti: Fix the interaction between ASID switching and software PAN arm64: mm: Introduce TTBR_ASID_MASK for getting at the ASID in the TTBR arm64: capabilities: Handle duplicate entries for a capability arm64: Take into account ID_AA64PFR0_EL1.CSV3 arm64: Kconfig: Reword UNMAP_KERNEL_AT_EL0 kconfig entry arm64: Kconfig: Add CONFIG_UNMAP_KERNEL_AT_EL0 arm64: use RET instruction for exiting the trampoline arm64: kaslr: Put kernel vectors address in separate data page arm64: entry: Add fake CPU feature for unmapping the kernel at EL0 arm64: tls: Avoid unconditional zeroing of tpidrro_el0 for native tasks arm64: cpu_errata: Add Kryo to Falkor 1003 errata arm64: erratum: Work around Falkor erratum #E1003 in trampoline code arm64: entry: Hook up entry trampoline to exception vectors arm64: entry: Explicitly pass exception level to kernel_ventry macro arm64: mm: Map entry trampoline into trampoline and kernel page tables arm64: entry: Add exception trampoline page for exceptions from EL0 arm64: mm: Invalidate both kernel and user ASIDs when performing TLBI arm64: mm: Add arm64_kernel_unmapped_at_el0 helper arm64: mm: Allocate ASIDs in pairs arm64: mm: Fix and re-enable ARM64_SW_TTBR0_PAN arm64: mm: Rename post_ttbr0_update_workaround arm64: mm: Remove pre_ttbr0_update_workaround for Falkor erratum #E1003 arm64: mm: Move ASID from TTBR0 to TTBR1 arm64: mm: Temporarily disable ARM64_SW_TTBR0_PAN arm64: mm: Use non-global mappings for kernel space arm64: move TASK_* definitions to <asm/processor.h> media: hdpvr: Fix an error handling path in hdpvr_probe() media: dvb-usb-v2: lmedm04: move ts2020 attach to dm04_lme2510_tuner media: dvb-usb-v2: lmedm04: Improve logic checking of warm start dccp: CVE-2017-8824: use-after-free in DCCP code drm/i915: Fix deadlock in i830_disable_pipe() drm/i915: Redo plane sanitation during readout drm/i915: Add .get_hw_state() method for planes sched/rt: Up the root domain ref count when passing it around via IPIs sched/rt: Use container_of() to get root domain in rto_push_irq_work_func() KVM MMU: check pending exception before injecting APF arm64: Add software workaround for Falkor erratum 1041 arm64: Define cputype macros for Falkor CPU watchdog: gpio_wdt: set WDOG_HW_RUNNING in gpio_wdt_stop sched/wait: Fix add_wait_queue() behavioral change dmaengine: dmatest: fix container_of member in dmatest_callback cpufreq: mediatek: add mediatek related projects into blacklist CIFS: zero sensitive data when freeing cifs: Fix autonegotiate security settings mismatch cifs: Fix missing put_xid in cifs_file_strict_mmap powerpc/pseries: include linux/types.h in asm/hvcall.h watchdog: indydog: Add dependency on SGI_HAS_INDYDOG ANDROID: Fixup 64/32-bit divide confusion for WALT configs Conflicts: include/trace/events/sched.h kernel/sched/sched.h lib/ubsan.c lib/ubsan.h arch/arm64/configs/sdm855_defconfig arch/arm64/configs/sdm855-perf_defconfig Change-Id: I034588046a45f3d8be0615bed40d2ddd334ebd74 Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
7 years ago
struct type_mismatch_data_common {
struct source_location *location;
struct type_descriptor *type;
unsigned long alignment;
unsigned char type_check_kind;
UBSAN: run-time undefined behavior sanity checker UBSAN uses compile-time instrumentation to catch undefined behavior (UB). Compiler inserts code that perform certain kinds of checks before operations that could cause UB. If check fails (i.e. UB detected) __ubsan_handle_* function called to print error message. So the most of the work is done by compiler. This patch just implements ubsan handlers printing errors. GCC has this capability since 4.9.x [1] (see -fsanitize=undefined option and its suboptions). However GCC 5.x has more checkers implemented [2]. Article [3] has a bit more details about UBSAN in the GCC. [1] - https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Debugging-Options.html [2] - https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html [3] - http://developerblog.redhat.com/2014/10/16/gcc-undefined-behavior-sanitizer-ubsan/ Issues which UBSAN has found thus far are: Found bugs: * out-of-bounds access - 97840cb67ff5 ("netfilter: nfnetlink: fix insufficient validation in nfnetlink_bind") undefined shifts: * d48458d4a768 ("jbd2: use a better hash function for the revoke table") * 10632008b9e1 ("clockevents: Prevent shift out of bounds") * 'x << -1' shift in ext4 - http://lkml.kernel.org/r/<5444EF21.8020501@samsung.com> * undefined rol32(0) - http://lkml.kernel.org/r/<1449198241-20654-1-git-send-email-sasha.levin@oracle.com> * undefined dirty_ratelimit calculation - http://lkml.kernel.org/r/<566594E2.3050306@odin.com> * undefined roundown_pow_of_two(0) - http://lkml.kernel.org/r/<1449156616-11474-1-git-send-email-sasha.levin@oracle.com> * [WONTFIX] undefined shift in __bpf_prog_run - http://lkml.kernel.org/r/<CACT4Y+ZxoR3UjLgcNdUm4fECLMx2VdtfrENMtRRCdgHB2n0bJA@mail.gmail.com> WONTFIX here because it should be fixed in bpf program, not in kernel. signed overflows: * 32a8df4e0b33f ("sched: Fix odd values in effective_load() calculations") * mul overflow in ntp - http://lkml.kernel.org/r/<1449175608-1146-1-git-send-email-sasha.levin@oracle.com> * incorrect conversion into rtc_time in rtc_time64_to_tm() - http://lkml.kernel.org/r/<1449187944-11730-1-git-send-email-sasha.levin@oracle.com> * unvalidated timespec in io_getevents() - http://lkml.kernel.org/r/<CACT4Y+bBxVYLQ6LtOKrKtnLthqLHcw-BMp3aqP3mjdAvr9FULQ@mail.gmail.com> * [NOTABUG] signed overflow in ktime_add_safe() - http://lkml.kernel.org/r/<CACT4Y+aJ4muRnWxsUe1CMnA6P8nooO33kwG-c8YZg=0Xc8rJqw@mail.gmail.com> [akpm@linux-foundation.org: fix unused local warning] [akpm@linux-foundation.org: fix __int128 build woes] Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sasha Levin <sasha.levin@oracle.com> Cc: Randy Dunlap <rdunlap@infradead.org> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Michal Marek <mmarek@suse.cz> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Yury Gribov <y.gribov@samsung.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Konstantin Khlebnikov <koct9i@gmail.com> Cc: Kostya Serebryany <kcc@google.com> Cc: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9 years ago
};
struct vla_bound_data {
struct source_location location;
struct type_descriptor *type;
};
struct out_of_bounds_data {
struct source_location location;
struct type_descriptor *array_type;
struct type_descriptor *index_type;
};
struct shift_out_of_bounds_data {
struct source_location location;
struct type_descriptor *lhs_type;
struct type_descriptor *rhs_type;
};
struct unreachable_data {
struct source_location location;
};
struct invalid_value_data {
struct source_location location;
struct type_descriptor *type;
};
#if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__)
typedef __int128 s_max;
typedef unsigned __int128 u_max;
#else
typedef s64 s_max;
typedef u64 u_max;
#endif
#endif