297 Commits

Author SHA1 Message Date
Lucas Wei
28ab10340e Merge android-4.9-q (4.9.258) into android-msm-pixel-4.9-lts
Merge 4.9.258 into android-4.9-q
Linux 4.9.258
    kvm: check tlbs_dirty directly
    scsi: qla2xxx: Fix crash during driver load on big endian machines
    xen-blkback: fix error handling in xen_blkbk_map()
    xen-scsiback: don't "handle" error by BUG()
    xen-netback: don't "handle" error by BUG()
    xen-blkback: don't "handle" error by BUG()
    xen/arm: don't ignore return errors from set_phys_to_machine
    Xen/gntdev: correct error checking in gntdev_map_grant_pages()
    Xen/gntdev: correct dev_bus_addr handling in gntdev_map_grant_pages()
    Xen/x86: also check kernel mapping in set_foreign_p2m_mapping()
    Xen/x86: don't bail early from clear_foreign_p2m_mapping()
  * tracing: Avoid calling cc-option -mrecord-mcount for every Makefile
      Makefile
      scripts/Makefile.build
  * tracing: Fix SKIP_STACK_VALIDATION=1 build due to bad merge with -mrecord-mcount
      scripts/Makefile.build
  * trace: Use -mcount-record for dynamic ftrace
      scripts/Makefile.build
    x86/build: Disable CET instrumentation in the kernel for 32-bit too
    vsock: fix locking in vsock_shutdown()
    vsock/virtio: update credit only if socket is not closed
  * net: watchdog: hold device global xmit lock during tx disable
      include/linux/netdevice.h
    net/vmw_vsock: improve locking in vsock_connect_timeout()
    usb: dwc3: ulpi: Replace CPU-based busyloop with Protocol-based one
    usb: dwc3: ulpi: fix checkpatch warning
    h8300: fix PREEMPTION build, TI_PRE_COUNT undefined
  * netfilter: conntrack: skip identical origin tuple in same zone only
      net/netfilter/nf_conntrack_core.c
    xen/netback: avoid race in xenvif_rx_ring_slots_available()
    netfilter: xt_recent: Fix attempt to update deleted entry
  * bpf: Check for integer overflow when using roundup_pow_of_two()
      kernel/bpf/stackmap.c
  * memblock: do not start bottom-up allocations with kernel_end
      mm/memblock.c
    ARM: dts: lpc32xx: Revert set default clock rate of HCLK PLL
  * ovl: skip getxattr of security labels
      fs/overlayfs/copy_up.c
  * tracing: Check length before giving out the filter buffer
      kernel/trace/trace.c
  * tracing: Do not count ftrace events in top level enable output
      kernel/trace/trace_events.c
    squashfs: add more sanity checks in xattr id lookup
    squashfs: add more sanity checks in inode lookup
    squashfs: add more sanity checks in id lookup
  * futex: Cure exit race
      kernel/futex.c
  * futex: Change locking rules
      kernel/futex.c
  * futex: Ensure the correct return value from futex_lock_pi()
      kernel/futex.c
  * memcg: fix a crash in wb_workfn when a device disappears
      fs/fs-writeback.c
      include/linux/backing-dev.h
      include/trace/events/writeback.h
      mm/backing-dev.c
  * include/trace/events/writeback.h: fix -Wstringop-truncation warnings
      include/trace/events/writeback.h
  * lib/string: Add strscpy_pad() function
      include/linux/string.h
      lib/string.c
    SUNRPC: Handle 0 length opaque XDR object data properly
  * SUNRPC: Move simple_get_bytes and simple_get_netobj into private header
      include/linux/sunrpc/xdr.h
    iwlwifi: mvm: guard against device removal in reprobe
    iwlwifi: pcie: add a NULL check in iwl_pcie_txq_unmap
    iwlwifi: mvm: take mutex for calling iwl_mvm_get_sync_time()
  * af_key: relax availability checks for skb size calculation
      net/key/af_key.c
    remoteproc: qcom_q6v5_mss: Validate MBA firmware size before load
  * fgraph: Initialize tracing_graph_pause at task creation
      include/linux/ftrace.h
  * mm: memcontrol: fix NULL pointer crash in test_clear_page_writeback()
      include/linux/memcontrol.h
      mm/page-writeback.c
    Merge 4.9.257 into android-4.9-q
Linux 4.9.257
    ALSA: hda/realtek - Fix typo of pincfg for Dell quirk
    iommu/vt-d: Do not use flush-queue when caching-mode is on
    ACPI: thermal: Do not call acpi_thermal_check() directly
  * Input: xpad - sync supported devices with fork on GitHub
      drivers/input/joystick/xpad.c
    x86/apic: Add extra serialization for non-serializing MSRs
  * x86/build: Disable CET instrumentation in the kernel
      Makefile
    mm: thp: fix MADV_REMOVE deadlock on shmem THP
    mm: hugetlb: remove VM_BUG_ON_PAGE from page_huge_active
    mm: hugetlb: fix a race between isolating and freeing page
  * mm: hugetlbfs: fix cannot migrate the fallocated HugeTLB page
      include/linux/hugetlb.h
    ARM: footbridge: fix dc21285 PCI configuration accessors
  * mmc: core: Limit retries when analyse of SDIO tuples fails
      drivers/mmc/core/sdio_cis.c
    cifs: report error instead of invalid when revalidating a dentry fails
  * xhci: fix bounce buffer usage for non-sg list case
      drivers/usb/host/xhci-ring.c
    kretprobe: Avoid re-registration of the same kretprobe earlier
    mac80211: fix station rate table updates on assoc
    usb: dwc2: Fix endpoint direction check in ep_from_windex
    USB: usblp: don't call usb_set_interface if there's a single alt
    USB: gadget: legacy: fix an error code in eth_bind()
  * elfcore: fix building with clang
      include/linux/elfcore.h
      kernel/Makefile
    net: lapb: Copy the skb before sending a packet
    Input: i8042 - unbreak Pegatron C15B
    USB: serial: option: Adding support for Cinterion MV31
    USB: serial: cp210x: add new VID/PID for supporting Teraoka AD2000
    USB: serial: cp210x: add pid/vid for WSDA-200-USB
  * stable: clamp SUBLEVEL in 4.4 and 4.9
      Makefile
    objtool: Don't fail on missing symbol table
    scsi: ibmvfc: Set default timeout to avoid crash during migration
    mac80211: fix fast-rx encryption check
    scsi: libfc: Avoid invoking response handler twice if ep is already completed
  * futex: Handle faults correctly for PI futexes
      kernel/futex.c
  * futex: Simplify fixup_pi_state_owner()
      kernel/futex.c
  * futex: Use pi_state_update_owner() in put_pi_state()
      kernel/futex.c
  * rtmutex: Remove unused argument from rt_mutex_proxy_unlock()
      kernel/futex.c
      kernel/locking/rtmutex.c
      kernel/locking/rtmutex_common.h
  * futex: Provide and use pi_state_update_owner()
      kernel/futex.c
  * futex: Replace pointless printk in fixup_owner()
      kernel/futex.c
  * futex: Avoid violating the 10th rule of futex
      kernel/futex.c
      kernel/locking/rtmutex.c
      kernel/locking/rtmutex_common.h
  * futex: Rework inconsistent rt_mutex/futex_q state
      kernel/futex.c
  * futex: Remove rt_mutex_deadlock_account_*()
      kernel/locking/rtmutex.c
      kernel/locking/rtmutex.h
  * futex,rt_mutex: Provide futex specific rt_mutex API
      kernel/futex.c
      kernel/locking/rtmutex.c
      kernel/locking/rtmutex_common.h
  * net_sched: reject silly cell_log in qdisc_get_rtab()
      net/sched/sch_api.c
    ibmvnic: Ensure that CRQ entry read are correctly ordered
    net: dsa: bcm_sf2: put device node before return
    Merge 4.9.256 into android-4.9-q
Linux 4.9.256
    Merge 4.9.255 into android-4.9-q
Linux 4.9.255
    NFC: fix possible resource leak
    NFC: fix resource leak when target index is invalid
    iommu/vt-d: Don't dereference iommu_device if IOMMU_API is not built
    iommu/vt-d: Gracefully handle DMAR units with no supported address widths
    can: dev: prevent potential information leak in can_fill_info()
    mac80211: pause TX while changing interface type
    iwlwifi: pcie: reschedule in long-running memory reads
    iwlwifi: pcie: use jiffies for memory read spin time limit
    RDMA/cxgb4: Fix the reported max_recv_sge value
  * xfrm: Fix oops in xfrm_replay_advance_bmp
      net/xfrm/xfrm_input.c
    netfilter: nft_dynset: add timeout extension to template
    ARM: imx: build suspend-imx6.S with arm instruction set
    mt7601u: fix rx buffer refcounting
    mt7601u: fix kernel crash unplugging the device
  * leds: trigger: fix potential deadlock with libata
      drivers/leds/led-triggers.c
    KVM: x86: get smi pending status correctly
    KVM: x86/pmu: Fix HW_REF_CPU_CYCLES event pseudo-encoding in intel_arch_events[]
  * futex: Prevent exit livelock
      kernel/futex.c
  * futex: Provide distinct return value when owner is exiting
      kernel/futex.c
  * futex: Add mutex around futex exit
      include/linux/futex.h
      include/linux/sched.h
      kernel/futex.c
  * futex: Provide state handling for exec() as well
      kernel/futex.c
  * futex: Sanitize exit state handling
      kernel/futex.c
  * futex: Mark the begin of futex exit explicitly
      include/linux/futex.h
      kernel/exit.c
      kernel/futex.c
  * futex: Set task::futex_state to DEAD right after handling futex exit
      kernel/exit.c
      kernel/futex.c
  * futex: Split futex_mm_release() for exit/exec
      include/linux/futex.h
      kernel/fork.c
      kernel/futex.c
  * exit/exec: Seperate mm_release()
      fs/exec.c
      include/linux/sched.h
      kernel/exit.c
      kernel/fork.c
  * futex: Replace PF_EXITPIDONE with a state
      include/linux/futex.h
      include/linux/sched.h
      kernel/exit.c
      kernel/futex.c
  * futex: Move futex exit handling into futex code
      include/linux/compat.h
      include/linux/futex.h
      kernel/fork.c
      kernel/futex.c
  * y2038: futex: Move compat implementation into futex.c
      include/linux/futex.h
      kernel/Makefile
      kernel/futex.c
    net: usb: qmi_wwan: added support for Thales Cinterion PLSx3 modem family
  * wext: fix NULL-ptr-dereference with cfg80211's lack of commit()
      net/wireless/wext-core.c
    ACPI: sysfs: Prefer "compatible" modalias

Bug: 181732917
Change-Id: Ice169f5980390199db8f86d42e944cdf5f37c562
Signed-off-by: Lucas Wei <lucaswei@google.com>
2021-03-12 14:56:50 +08:00
Greg Kroah-Hartman
df5e32a90a Merge 4.9.257 into android-4.9-q
Changes in 4.9.257
	net: dsa: bcm_sf2: put device node before return
	ibmvnic: Ensure that CRQ entry read are correctly ordered
	net_sched: reject silly cell_log in qdisc_get_rtab()
	futex,rt_mutex: Provide futex specific rt_mutex API
	futex: Remove rt_mutex_deadlock_account_*()
	futex: Rework inconsistent rt_mutex/futex_q state
	futex: Avoid violating the 10th rule of futex
	futex: Replace pointless printk in fixup_owner()
	futex: Provide and use pi_state_update_owner()
	rtmutex: Remove unused argument from rt_mutex_proxy_unlock()
	futex: Use pi_state_update_owner() in put_pi_state()
	futex: Simplify fixup_pi_state_owner()
	futex: Handle faults correctly for PI futexes
	scsi: libfc: Avoid invoking response handler twice if ep is already completed
	mac80211: fix fast-rx encryption check
	scsi: ibmvfc: Set default timeout to avoid crash during migration
	objtool: Don't fail on missing symbol table
	stable: clamp SUBLEVEL in 4.4 and 4.9
	USB: serial: cp210x: add pid/vid for WSDA-200-USB
	USB: serial: cp210x: add new VID/PID for supporting Teraoka AD2000
	USB: serial: option: Adding support for Cinterion MV31
	Input: i8042 - unbreak Pegatron C15B
	net: lapb: Copy the skb before sending a packet
	elfcore: fix building with clang
	USB: gadget: legacy: fix an error code in eth_bind()
	USB: usblp: don't call usb_set_interface if there's a single alt
	usb: dwc2: Fix endpoint direction check in ep_from_windex
	mac80211: fix station rate table updates on assoc
	kretprobe: Avoid re-registration of the same kretprobe earlier
	xhci: fix bounce buffer usage for non-sg list case
	cifs: report error instead of invalid when revalidating a dentry fails
	mmc: core: Limit retries when analyse of SDIO tuples fails
	ARM: footbridge: fix dc21285 PCI configuration accessors
	mm: hugetlbfs: fix cannot migrate the fallocated HugeTLB page
	mm: hugetlb: fix a race between isolating and freeing page
	mm: hugetlb: remove VM_BUG_ON_PAGE from page_huge_active
	mm: thp: fix MADV_REMOVE deadlock on shmem THP
	x86/build: Disable CET instrumentation in the kernel
	x86/apic: Add extra serialization for non-serializing MSRs
	Input: xpad - sync supported devices with fork on GitHub
	ACPI: thermal: Do not call acpi_thermal_check() directly
	iommu/vt-d: Do not use flush-queue when caching-mode is on
	ALSA: hda/realtek - Fix typo of pincfg for Dell quirk
	Linux 4.9.257

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I0c0cef0706decd8fd5c8da6b276e83bdcc7ea066
2021-02-10 10:12:51 +01:00
Arnd Bergmann
f54be213e2 elfcore: fix building with clang
commit 6e7b64b9dd6d96537d816ea07ec26b7dedd397b9 upstream.

kernel/elfcore.c only contains weak symbols, which triggers a bug with
clang in combination with recordmcount:

  Cannot find symbol for section 2: .text.
  kernel/elfcore.o: failed

Move the empty stubs into linux/elfcore.h as inline functions.  As only
two architectures use these, just use the architecture specific Kconfig
symbols to key off the declaration.

Link: https://lkml.kernel.org/r/20201204165742.3815221-2-arnd@kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Nathan Chancellor <natechancellor@gmail.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Barret Rhoden <brho@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-10 09:09:25 +01:00
Greg Kroah-Hartman
2a2b02a000 Merge 4.9.255 into android-4.9-q
Changes in 4.9.255
	ACPI: sysfs: Prefer "compatible" modalias
	wext: fix NULL-ptr-dereference with cfg80211's lack of commit()
	net: usb: qmi_wwan: added support for Thales Cinterion PLSx3 modem family
	y2038: futex: Move compat implementation into futex.c
	futex: Move futex exit handling into futex code
	futex: Replace PF_EXITPIDONE with a state
	exit/exec: Seperate mm_release()
	futex: Split futex_mm_release() for exit/exec
	futex: Set task::futex_state to DEAD right after handling futex exit
	futex: Mark the begin of futex exit explicitly
	futex: Sanitize exit state handling
	futex: Provide state handling for exec() as well
	futex: Add mutex around futex exit
	futex: Provide distinct return value when owner is exiting
	futex: Prevent exit livelock
	KVM: x86/pmu: Fix HW_REF_CPU_CYCLES event pseudo-encoding in intel_arch_events[]
	KVM: x86: get smi pending status correctly
	leds: trigger: fix potential deadlock with libata
	mt7601u: fix kernel crash unplugging the device
	mt7601u: fix rx buffer refcounting
	ARM: imx: build suspend-imx6.S with arm instruction set
	netfilter: nft_dynset: add timeout extension to template
	xfrm: Fix oops in xfrm_replay_advance_bmp
	RDMA/cxgb4: Fix the reported max_recv_sge value
	iwlwifi: pcie: use jiffies for memory read spin time limit
	iwlwifi: pcie: reschedule in long-running memory reads
	mac80211: pause TX while changing interface type
	can: dev: prevent potential information leak in can_fill_info()
	iommu/vt-d: Gracefully handle DMAR units with no supported address widths
	iommu/vt-d: Don't dereference iommu_device if IOMMU_API is not built
	NFC: fix resource leak when target index is invalid
	NFC: fix possible resource leak
	Linux 4.9.255

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I1ead684216d7f27b8209f4d680f40b3619d16e3a
2021-02-03 23:44:54 +01:00
Arnd Bergmann
bdb116cd8a y2038: futex: Move compat implementation into futex.c
commit 04e7712f4460585e5eed5b853fd8b82a9943958f upstream.

We are going to share the compat_sys_futex() handler between 64-bit
architectures and 32-bit architectures that need to deal with both 32-bit
and 64-bit time_t, and this is easier if both entry points are in the
same file.

In fact, most other system call handlers do the same thing these days, so
let's follow the trend here and merge all of futex_compat.c into futex.c.

In the process, a few minor changes have to be done to make sure everything
still makes sense: handle_futex_death() and futex_cmpxchg_enabled() become
local symbol, and the compat version of the fetch_robust_entry() function
gets renamed to compat_fetch_robust_entry() to avoid a symbol clash.

This is intended as a purely cosmetic patch, no behavior should
change.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[Lee: Back-ported to satisfy a build dependency]
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-03 23:19:49 +01:00
Robin Peng
3352ba1a12 Merge android-4.9 (4.9.185) into android-msm-pixel-4.9-lts
Merge 4.9.185 into android-4.9
Linux 4.9.185
  * arm64: kaslr: keep modules inside module region when KASAN is enabled
      arch/arm64/kernel/module.c
    dmaengine: imx-sdma: remove BD_INTR for channel0
    MIPS: Add missing EHB in mtc0 -> mfc0 sequence.
    IB/hfi1: Close PSM sdma_progress sleep window
    KVM: LAPIC: Fix pending interrupt in IRR blocked by software disable LAPIC
  * arm64, vdso: Define vdso_{start,end} as array
      arch/arm64/kernel/vdso.c
    tty: rocket: fix incorrect forward declaration of 'rp_init()'
    btrfs: Ensure replaced device doesn't have pending chunk allocation
    drm/imx: only send event on crtc disable if kept disabled
    drm/imx: notify drm core before sending event during crtc disable
  * lib/mpi: Fix karactx leak in mpi_powm
      lib/mpi/mpi-pow.c
  * ALSA: usb-audio: fix sign unintended sign extension on left shifts
      sound/usb/mixer_quirks.c
    ALSA: line6: Fix write on zero-sized buffer
    ALSA: firewire-lib/fireworks: fix miss detection of received MIDI messages
    ALSA: seq: fix incorrect order of dest_client/dest_ports arguments
    crypto: user - prevent operating on larval algorithms
  * ptrace: Fix ->ptracer_cred handling for PTRACE_TRACEME
      kernel/ptrace.c
    MIPS: Workaround GCC __builtin_unreachable reordering bug
    drm/i915/dmc: protect against reading random memory
    KVM: x86: degrade WARN to pr_warn_ratelimited
    clk: sunxi: fix uninitialized access
    ARC: handle gcc generated __builtin_trap for older compiler
  * bug.h: work around GCC PR82365 in BUG()
      include/asm-generic/bug.h
      include/linux/compiler-gcc.h
      include/linux/compiler.h
    ARC: fix allnoconfig build warning
    mfd: omap-usb-tll: Fix register offsets
    MIPS: netlogic: xlr: Remove erroneous check in nlm_fmn_send()
    MIPS: math-emu: do not use bools for arithmetic
  * mm/mlock.c: change count_mm_mlocked_page_nr return type
      mm/mlock.c
    scripts/decode_stacktrace.sh: prefix addr2line with $CROSS_COMPILE
    scsi: hpsa: correct ioaccel2 chaining
    usb: gadget: udc: lpc32xx: allocate descriptor with GFP_ATOMIC
    usb: gadget: fusb300_udc: Fix memory leak of fusb300->ep[i]
    ASoC: max98090: remove 24-bit format support if RJ is 0
    drm/mediatek: fix unbind functions
    spi: bitbang: Fix NULL pointer dereference in spi_unregister_master
  * ASoC: soc-pcm: BE dai needs prepare when pause release after resume
      sound/soc/soc-pcm.c
    ASoC : cs4265 : readable register too low
  * Bluetooth: Fix faulty expression for minimum encryption key size check
      net/bluetooth/l2cap_core.c
    tipc: pass tunnel dev as NULL to udp_tunnel(6)_xmit_skb
  * bpf: udp: ipv6: Avoid running reuseport's bpf_prog from __udp6_lib_err
      net/ipv6/udp.c
  * bpf: udp: Avoid calling reuseport's bpf_prog from udp_gro
      net/ipv4/udp.c
      net/ipv6/udp.c
  * net: check before dereferencing netdev_ops during busy poll
      net/core/dev.c
  * ipv4: Use return value of inet_iif() for __raw_v4_lookup in the while loop
      net/ipv4/raw.c
  * bonding: Always enable vlan tx offload
      drivers/net/bonding/bond_main.c
    team: Always enable vlan tx offload
  * tun: wake up waitqueues after IFF_UP is set
      drivers/net/tun.c
    tipc: check msg->req data len in tipc_nl_compat_bearer_disable
    tipc: change to use register_pernet_device
    sctp: change to hold sk after auth shkey is created successfully
    net: stmmac: fixed new system time seconds value calculation
  * af_packet: Block execution of tasks waiting for transmit to complete in AF_PACKET
      net/packet/af_packet.c
      net/packet/internal.h
  * cpu/speculation: Warn on unsupported mitigations= parameter
      kernel/cpu.c
    NFS/flexfiles: Use the correct TCP timeout for flexfiles I/O
    x86/speculation: Allow guests to use SSBD even if host does not
    scsi: vmw_pscsi: Fix use-after-free in pvscsi_queue_lck()
  * mm/page_idle.c: fix oops because end_pfn is larger than max_pfn
      mm/page_idle.c
    fs/binfmt_flat.c: make load_flat_shared_library() work
  * fs/proc/array.c: allow reporting eip/esp for all coredumping threads
      fs/proc/array.c
    net/9p: include trans_common.h to fix missing prototype warning.
    9p: p9dirent_read: check network-provided name length
    9p/rdma: remove useless check in cm_event_handler
    9p: acl: fix uninitialized iattr access
    9p/rdma: do not disconnect on down_interruptible EAGAIN
    perf header: Fix unchecked usage of strncpy()
    perf help: Remove needless use of strncpy()
    perf ui helpline: Use strlcpy() as a shorter form of strncpy() + explicit set nul
    IB/hfi1: Avoid hardlockup with flushlist_lock
    mac80211: Do not use stack memory with scatterlist for GMAC
    mac80211: drop robust management frames from unknown TA
  * cfg80211: fix memory leak of wiphy device name
      net/wireless/core.c
  * Bluetooth: Fix regression with minimum encryption key size alignment
      net/bluetooth/hci_conn.c
      net/bluetooth/l2cap_core.c
  * Bluetooth: Align minimum encryption key size for LE and BR/EDR connections
      include/net/bluetooth/hci_core.h
      net/bluetooth/hci_conn.c
    ARM: imx: cpuidle-imx6sx: Restrict the SW2ISO increase to i.MX6SX
    powerpc/bpf: use unsigned division instruction for 64-bit operations
    can: purge socket error queue on sock destruct
    can: flexcan: fix timeout when set small bitrate
    btrfs: start readahead also in seed devices
    nvme: Fix u32 overflow in the number of namespace list calculation
    hwmon: (pmbus/core) Treat parameters as paged if on multiple pages
    s390/qeth: fix VLAN attribute in bridge_hostnotify udev event
  * scsi: ufs: Check that space was properly alloced in copy_query_response
      drivers/scsi/ufs/ufshcd.c
    scripts/checkstack.pl: Fix arm64 wrong or unknown architecture
    drm/arm/hdlcd: Allow a bit of clock tolerance
    net: ethernet: mediatek: Use NET_IP_ALIGN to judge if HW RX_2BYTE_OFFSET is enabled
    net: ethernet: mediatek: Use hw_feature to judge if HWLRO is supported
    sparc: perf: fix updated event period in response to PERF_EVENT_IOC_PERIOD
    net: hns: Fix loopback test failed at copper ports
    net: dsa: mv88e6xxx: avoid error message on remove from VLAN 0
    MIPS: uprobes: remove set but not used variable 'epc'
    IB/{qib, hfi1, rdmavt}: Correct ibv_devinfo max_mr value
    IB/hfi1: Insure freeze_work work_struct is canceled on shutdown
    IB/rdmavt: Fix alloc_qpn() WARN_ON()
    parisc: Fix compiler warnings in float emulation code
    parport: Fix mem leak in parport_register_dev_model
    ARC: fix build warnings with !CONFIG_KPROBES
    apparmor: enforce nullbyte at end of tag string
  * Input: uinput - add compat ioctl number translation for UI_*_FF_UPLOAD
      drivers/input/misc/uinput.c
    IB/hfi1: Silence txreq allocation warnings
    usb: chipidea: udc: workaround for endpoint conflict issue
  * scsi: ufs: Avoid runtime suspend possibly being blocked forever
      drivers/scsi/ufs/ufshcd-pltfrm.c
  * gcc-9: silence 'address-of-packed-member' warning
      Makefile
  * tracing: Silence GCC 9 array bounds warning
      kernel/trace/trace.c
      kernel/trace/trace.h
    BACKPORT: kheaders: Do not regenerate archive if config is not changed
  * BACKPORT: kheaders: Move from proc to sysfs
      init/Kconfig
      kernel/Makefile
  * BACKPORT: Provide in-kernel headers to make extending kernel easier
      init/Kconfig
      kernel/Makefile
    Merge 4.9.184 into android-4.9
Linux 4.9.184
  * tcp: refine memory limit test in tcp_fragment()
      net/ipv4/tcp_output.c
    Merge 4.9.183 into android-4.9
Linux 4.9.183
  * Abort file_remove_privs() for non-reg. files
      fs/inode.c
    mlxsw: spectrum: Prevent force of 56G
    scsi: libsas: delete sas port if expander discover failed
    scsi: smartpqi: properly set both the DMA mask and the coherent DMA mask
    scsi: libcxgbi: add a check for NULL pointer in cxgbi_check_route()
    net: sh_eth: fix mdio access in sh_eth_close() for R-Car Gen2 and RZ/A1 SoCs
    KVM: PPC: Book3S HV: Don't take kvm->lock around kvm_for_each_vcpu
    KVM: PPC: Book3S: Use new mutex to synchronize access to rtas token list
    ia64: fix build errors by exporting paddr_to_nid()
    perf record: Fix s390 missing module symbol and warning for non-root users
    perf data: Fix 'strncat may truncate' build failure with recent gcc
  * configfs: Fix use-after-free when accessing sd->s_dentry
      fs/configfs/dir.c
  * i2c: dev: fix potential memory leak in i2cdev_ioctl_rdwr
      drivers/i2c/i2c-dev.c
    net: tulip: de4x5: Drop redundant MODULE_DEVICE_TABLE()
  * gpio: fix gpio-adp5588 build errors
      drivers/gpio/Kconfig
  * perf/ring_buffer: Add ordering to rb->nest increment
      kernel/events/ring_buffer.c
  * perf/ring_buffer: Fix exposing a temporarily decreased data_head
      kernel/events/ring_buffer.c
    x86/CPU/AMD: Don't force the CPB cap when running under a hypervisor
    mISDN: make sure device name is NUL terminated
    selftests: netfilter: missing error check when setting up veth interface
    perf/x86/intel/ds: Fix EVENT vs. UEVENT PEBS constraints
    Revert "staging: vc04_services: prevent integer overflow in create_pagelist()"
    sunhv: Fix device naming inconsistency between sunhv_console and sunhv_reg
  * neigh: fix use-after-free read in pneigh_get_next
      net/core/neighbour.c
    lapb: fixed leak of control-blocks.
  * ipv6: flowlabel: fl6_sock_lookup() must use atomic_inc_not_zero
      net/ipv6/ip6_flowlabel.c
    be2net: Fix number of Rx queues used for flow hashing
    ax25: fix inconsistent lock state in ax25_destroy_timer
    rtc: pcf8523: don't return invalid date when battery is low
    USB: serial: option: add Telit 0x1260 and 0x1261 compositions
    USB: serial: option: add support for Simcom SIM7500/SIM7600 RNDIS mode
    USB: serial: pl2303: add Allied Telesis VT-Kit3
  * USB: usb-storage: Add new ID to ums-realtek
      drivers/usb/storage/unusual_realtek.h
  * USB: Fix chipmunk-like voice when using Logitech C270 for recording audio.
      drivers/usb/core/quirks.c
    usb: dwc2: Fix DMA cache alignment issues
    drm/vmwgfx: NULL pointer dereference from vmw_cmd_dx_view_define()
    drm/vmwgfx: integer underflow in vmw_cmd_dx_set_shader() leading to an invalid read
    KVM: s390: fix memory slot handling for KVM_SET_USER_MEMORY_REGION
    KVM: x86/pmu: do not mask the value that is written to fixed PMUs
    usbnet: ipheth: fix racing condition
    selftests/timers: Add missing fflush(stdout) calls
    scsi: bnx2fc: fix incorrect cast to u64 on shift operation
  * arm64/mm: Inhibit huge-vmap with ptdump
      arch/arm64/mm/mmu.c
    scsi: lpfc: add check for loss of ndlp when sending RRQ
    Drivers: misc: fix out-of-bounds access in function param_set_kgdbts_var
    Revert "ALSA: seq: Protect in-kernel ioctl calls with mutex"
    ALSA: seq: Fix race of get-subscription call vs port-delete ioctls
    ALSA: seq: Protect in-kernel ioctl calls with mutex
  * x86/uaccess, kcov: Disable stack protector
      kernel/Makefile
    ASoC: fsl_asrc: Fix the issue about unsupported rate
    ASoC: cs42xx8: Add regcache mask dirty
  * cgroup: Use css_tryget() instead of css_tryget_online() in task_get_css()
      include/linux/cgroup.h
    bcache: fix stack corruption by PRECEDING_KEY()
    i2c: acorn: fix i2c warning
  * media: v4l2-ioctl: clear fields in s_parm
      drivers/media/v4l2-core/v4l2-ioctl.c
  * ptrace: restore smp_rmb() in __ptrace_may_access()
      kernel/cred.c
      kernel/ptrace.c
  * signal/ptrace: Don't leak unitialized kernel memory with PTRACE_PEEK_SIGINFO
      kernel/ptrace.c
    fs/ocfs2: fix race in ocfs2_dentry_attach_lock()
  * mm/list_lru.c: fix memory leak in __memcg_init_list_lru_node
      mm/list_lru.c
    libata: Extend quirks for the ST1000LM024 drives with NOLPM quirk
    ALSA: oxfw: allow PCM capture for Stanton SCS.1m
    ALSA: seq: Cover unsubscribe_port() in list_mutex
  * Revert "Bluetooth: Align minimum encryption key size for LE and BR/EDR connections"
      include/net/bluetooth/hci_core.h
      net/bluetooth/hci_conn.c
    ARM: exynos: Fix undefined instruction during Exynos5422 resume
  * pwm: Fix deadlock warning when removing PWM device
      drivers/pwm/core.c
      drivers/pwm/sysfs.c
      include/linux/pwm.h
    ARM: dts: exynos: Always enable necessary APIO_1V8 and ABB_1V8 regulators on Arndale Octa
    pwm: tiehrpwm: Update shadow register for disabling PWMs
    dmaengine: idma64: Use actual device for DMA transfers
    gpio: gpio-omap: add check for off wake capable gpios
    PCI: xilinx: Check for __get_free_pages() failure
    video: imsttfb: fix potential NULL pointer dereferences
    video: hgafb: fix potential NULL pointer dereference
    PCI: rcar: Fix 64bit MSI message address handling
    PCI: rcar: Fix a potential NULL pointer dereference
    platform/x86: intel_pmc_ipc: adding error handling
    PCI: rpadlpar: Fix leaked device_node references in add/remove paths
    ARM: dts: imx6qdl: Specify IMX6QDL_CLK_IPG as "ipg" clock to SDMA
    ARM: dts: imx6sx: Specify IMX6SX_CLK_IPG as "ipg" clock to SDMA
    ARM: dts: imx6ul: Specify IMX6UL_CLK_IPG as "ipg" clock to SDMA
    ARM: dts: imx7d: Specify IMX7D_CLK_IPG as "ipg" clock to SDMA
    ARM: dts: imx6sx: Specify IMX6SX_CLK_IPG as "ahb" clock to SDMA
    clk: rockchip: Turn on "aclk_dmac1" for suspend on rk3288
    soc: mediatek: pwrap: Zero initialize rdata in pwrap_init_cipher
    platform/chrome: cros_ec_proto: check for NULL transfer function
    x86/PCI: Fix PCI IRQ routing table memory leak
    nfsd: allow fh_want_write to be called twice
  * fuse: retrieve: cap requested size to negotiated max_write
      fs/fuse/dev.c
  * nvmem: core: fix read buffer in place
      drivers/nvmem/core.c
    ALSA: hda - Register irq handler after the chip initialization
    iommu/vt-d: Set intel_iommu_gfx_mapped correctly
  * watchdog: fix compile time error of pretimeout governors
      drivers/watchdog/Kconfig
    watchdog: imx2_wdt: Fix set_timeout for big timeout values
    uml: fix a boot splat wrt use of cpu_all_mask
  * configfs: fix possible use-after-free in configfs_register_group
      fs/configfs/dir.c
  * f2fs: fix to do sanity check on valid block count of segment
      fs/f2fs/segment.h
  * f2fs: fix to clear dirty inode in error path of f2fs_iget()
      fs/f2fs/inode.c
  * f2fs: fix to avoid panic in do_recover_data()
      fs/f2fs/recovery.c
  * ntp: Allow TAI-UTC offset to be set to zero
      kernel/time/ntp.c
    pwm: meson: Use the spin-lock only to protect register modifications
    objtool: Don't use ignore flag for fake jumps
    drm/bridge: adv7511: Fix low refresh rate selection
    perf/x86/intel: Allow PEBS multi-entry in watermark mode
    mfd: twl6040: Fix device init errors for ACCCTL register
    mfd: intel-lpss: Set the device in reset state when init
    mfd: tps65912-spi: Add missing of table registration
    drivers: thermal: tsens: Don't print error message on -EPROBE_DEFER
  * kernel/sys.c: prctl: fix false positive in validate_prctl_map()
      kernel/sys.c
    mm/slab.c: fix an infinite loop in leaks_show()
    mm/cma_debug.c: fix the break condition in cma_maxchunk_get()
  * mm/cma.c: fix crash on CMA allocation if bitmap allocation fails
      mm/cma.c
  * mem-hotplug: fix node spanned pages when we have a node with only ZONE_MOVABLE
      mm/page_alloc.c
    hugetlbfs: on restore reserve error path retain subpool reservation
    ARM: prevent tracing IPI_CPU_BACKTRACE
    ipc: prevent lockup on alloc_msg and free_msg
  * sysctl: return -EINVAL if val violates minmax
      kernel/sysctl.c
  * fs/fat/file.c: issue flush after the writeback of FAT
      fs/fat/file.c
    rapidio: fix a NULL pointer dereference when create_workqueue() fails
  * ANDROID: kernel: cgroup: cpuset: Clear cpus_requested for empty buf
      kernel/cpuset.c
  * ANDROID: kernel: cgroup: cpuset: Add missing allocation of cpus_requested in alloc_trial_cpuset
      kernel/cpuset.c
  * mm: memcontrol: fix NULL pointer crash in test_clear_page_writeback()
      include/linux/memcontrol.h
      mm/memcontrol.c
      mm/page-writeback.c
    Merge 4.9.182 into android-4.9
Linux 4.9.182
  * tcp: enforce tcp_min_snd_mss in tcp_mtu_probing()
      net/ipv4/tcp_timer.c
  * tcp: add tcp_min_snd_mss sysctl
      include/net/netns/ipv4.h
      net/ipv4/sysctl_net_ipv4.c
      net/ipv4/tcp_ipv4.c
      net/ipv4/tcp_output.c
  * tcp: tcp_fragment() should apply sane memory limits
      include/uapi/linux/snmp.h
      net/ipv4/proc.c
      net/ipv4/tcp_output.c
  * tcp: limit payload size of sacked skbs
      include/linux/tcp.h
      include/net/tcp.h
      net/ipv4/tcp.c
      net/ipv4/tcp_input.c
      net/ipv4/tcp_output.c
  * tcp: reduce tcp_fastretrans_alert() verbosity
      net/ipv4/tcp_input.c
    efi/libstub: remove duplicate nokaslr
  * BACKPORT: Add support for BPF_FUNC_probe_read_str
      kernel/trace/bpf_trace.c
  * UPSTREAM: binder: check for overflow when alloc for security context
      drivers/android/binder.c
  * BACKPORT: binder: fix race between munmap() and direct reclaim
      drivers/android/binder_alloc.c
    Merge 4.9.181 into android-4.9
Linux 4.9.181
  * ethtool: check the return value of get_regs_len
      net/core/ethtool.c
  * ipv4: Define __ipv4_neigh_lookup_noref when CONFIG_INET is disabled
      include/net/arp.h
  * fuse: Add FOPEN_STREAM to use stream_open()
      fs/fuse/file.c
      include/uapi/linux/fuse.h
  * fs: stream_open - opener for stream-like files so that read and write can run simultaneously without deadlock
      fs/open.c
      fs/read_write.c
      include/linux/fs.h
  * TTY: serial_core, add ->install
      drivers/tty/serial/serial_core.c
    drm/i915: Fix I915_EXEC_RING_MASK
    drm/radeon: prefer lower reference dividers
    drm/gma500/cdv: Check vbt config bits when detecting lvds panels
    genwqe: Prevent an integer overflow in the ioctl
    Revert "MIPS: perf: ath79: Fix perfcount IRQ assignment"
    MIPS: pistachio: Build uImage.gz by default
  * x86/power: Fix 'nosmt' vs hibernation triple fault during resume
      include/linux/cpu.h
      kernel/cpu.c
  * fuse: fallocate: fix return with locked inode
      fs/fuse/file.c
    parisc: Use implicit space register selection for loading the coherence index of I/O pdirs
  * rcu: locking and unlocking need to always be at least barriers
      include/linux/rcupdate.h
  * Revert "fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied"
      net/core/fib_rules.c
  * Revert "fib_rules: fix error in backport of e9919a24d302 ("fib_rules: return 0...")"
      net/core/fib_rules.c
  * ipv6: use READ_ONCE() for inet->hdrincl as in ipv4
      net/ipv6/raw.c
  * ipv6: fix EFAULT on sendto with icmpv6 and hdrincl
      net/ipv6/raw.c
    pktgen: do not sleep with the thread lock held.
    net: rds: fix memory leak in rds_ib_flush_mr_pool
    net/mlx4_en: ethtool, Remove unsupported SFP EEPROM high pages query
  * neighbor: Call __ipv4_neigh_lookup_noref in neigh_xmit
      net/core/neighbour.c
  * ethtool: fix potential userspace buffer overflow
      net/core/ethtool.c
    media: uvcvideo: Fix uvc_alloc_entity() allocation alignment
  * efi/libstub: Unify command line param parsing
      include/linux/efi.h
    Revert "x86/build: Move _etext to actual end of .text"
  * mm: make page ref count overflow check tighter and more explicit
      include/linux/mm.h
  * mm: prevent get_user_pages() from overflowing page refcount
      mm/gup.c
  * mm, gup: ensure real head page is ref-counted when using hugepages
      mm/gup.c
  * mm, gup: remove broken VM_BUG_ON_PAGE compound check for hugepages
      mm/gup.c
  * fs: prevent page refcount overflow in pipe_buf_get
      fs/fuse/dev.c
      fs/pipe.c
      fs/splice.c
      include/linux/pipe_fs_i.h
      kernel/trace/trace.c
  * binder: replace "%p" with "%pK"
      drivers/android/binder.c
  * binder: Replace "%p" with "%pK" for stable
      drivers/android/binder.c
    brcmfmac: add subtype check for event handling in data path
    brcmfmac: assure SSID length from firmware is limited
    brcmfmac: add length checks in scheduled scan result handler
    drm/vmwgfx: Don't send drm sysfs hotplug events on initial master set
    gcc-plugins: Fix build failures under Darwin host
    CIFS: cifs_read_allocate_pages: don't iterate through whole page array on ENOMEM
    staging: vc04_services: prevent integer overflow in create_pagelist()
    docs: Fix conf.py for Sphinx 2.0
  * kernel/signal.c: trace_signal_deliver when signal_group_exit
      kernel/signal.c
  * memcg: make it work on sparse non-0-node systems
      include/linux/list_lru.h
      mm/list_lru.c
    tty: max310x: Fix external crystal register setup
    tty: serial: msm_serial: Fix XON/XOFF
    drm/nouveau/i2c: Disable i2c bus access after ->fini()
    ALSA: hda/realtek - Set default power save node to 0
    powerpc/perf: Fix MMCRA corruption by bhrb_filter
    Btrfs: fix race updating log root item during fsync
    scsi: zfcp: fix to prevent port_remove with pure auto scan LUNs (only sdevs)
    scsi: zfcp: fix missing zfcp_port reference put on -EBUSY from port_remove
    media: smsusb: better handle optional alignment
    media: usb: siano: Fix false-positive "uninitialized variable" warning
    media: usb: siano: Fix general protection fault in smsusb
    USB: rio500: fix memory leak in close after disconnect
    USB: rio500: refuse more than one device at a time
  * USB: Add LPM quirk for Surface Dock GigE adapter
      drivers/usb/core/quirks.c
    USB: sisusbvga: fix oops in error path of sisusb_probe
  * USB: Fix slab-out-of-bounds write in usb_get_bos_descriptor
      drivers/usb/core/config.c
    usbip: usbip_host: fix stub_dev lock context imbalance regression
    usbip: usbip_host: fix BUG: sleeping function called from invalid context
  * usb: xhci: avoid null pointer deref when bos field is NULL
      drivers/usb/host/xhci.c
  * xhci: Convert xhci_handshake() to use readl_poll_timeout_atomic()
      drivers/usb/host/xhci.c
  * xhci: Use %zu for printing size_t type
      drivers/usb/host/xhci-ring.c
  * xhci: update bounce buffer with correct sg num
      drivers/usb/host/xhci-ring.c
  * include/linux/bitops.h: sanitize rotate primitives
      include/linux/bitops.h
    sparc64: Fix regression in non-hypervisor TLB flush xcall
    tipc: fix modprobe tipc failed after switch order of device registration
    Revert "tipc: fix modprobe tipc failed after switch order of device registration"
    xen/pciback: Don't disable PCI_COMMAND on PCI device reset.
    crypto: vmx - ghash: do nosimd fallback manually
    net: mvpp2: fix bad MVPP2_TXQ_SCHED_TOKEN_CNTR_REG queue value
    net: mvneta: Fix err code path of probe
    net: dsa: mv88e6xxx: fix handling of upper half of STATS_TYPE_PORT
  * ipv4/igmp: fix build error if !CONFIG_IP_MULTICAST
      net/ipv4/igmp.c
  * ipv4/igmp: fix another memory leak in igmpv3_del_delrec()
      net/ipv4/igmp.c
    bnxt_en: Fix aggregation buffer leak under OOM condition.
    tipc: Avoid copying bytes beyond the supplied data
  * usbnet: fix kernel crash after disconnect
      drivers/net/usb/usbnet.c
    net: stmmac: fix reset gpio free missing
  * net-gro: fix use-after-free read in napi_gro_frags()
      net/core/dev.c
    net: fec: fix the clk mismatch in failed_reset path
  * llc: fix skb leak in llc_build_and_send_ui_pkt()
      net/llc/llc_output.c
  * ipv6: Consider sk_bound_dev_if when binding a raw socket to an address
      net/ipv6/raw.c
  * Revert "fib_rules: return 0 directly if an exactly same rule exists when NLM_F_EXCL not supplied"
      net/core/fib_rules.c
  * Revert "fib_rules: fix error in backport of e9919a24d302 ("fib_rules: return 0...")"
      net/core/fib_rules.c
    Revert "x86/build: Move _etext to actual end of .text"
    Merge 4.9.180 into android-4.9
Linux 4.9.180
  * drm: Wake up next in drm_read() chain if we are forced to putback the event
      drivers/gpu/drm/drm_fops.c
    ASoC: davinci-mcasp: Fix clang warning without CONFIG_PM
  * spi: Fix zero length xfer bug
      drivers/spi/spi.c
    spi: rspi: Fix sequencer reset during initialization
    spi : spi-topcliff-pch: Fix to handle empty DMA buffers
    scsi: lpfc: Fix SLI3 commands being issued on SLI4 devices
    media: saa7146: avoid high stack usage with clang
    scsi: lpfc: Fix FDMI manufacturer attribute value
    media: go7007: avoid clang frame overflow warning with KASAN
    media: m88ds3103: serialize reset messages in m88ds3103_set_frontend
    dmaengine: tegra210-adma: use devm_clk_*() helpers
    scsi: qla4xxx: avoid freeing unallocated dma memory
  * usb: core: Add PM runtime calls to usb_hcd_platform_shutdown
      drivers/usb/core/hcd.c
    rcuperf: Fix cleanup path for invalid perf_type strings
    rcutorture: Fix cleanup path for invalid torture_type strings
    x86/mce: Fix machine_check_poll() tests for error types
    tty: ipwireless: fix missing checks for ioremap
    virtio_console: initialize vtermno value for ports
    media: wl128x: prevent two potential buffer overflows
    spi: tegra114: reset controller on probe
    cxgb3/l2t: Fix undefined behaviour
    ASoC: fsl_utils: fix a leaked reference by adding missing of_node_put
    ASoC: eukrea-tlv320: fix a leaked reference by adding missing of_node_put
  * HID: core: move Usage Page concatenation to Main item
      drivers/hid/hid-core.c
      include/linux/hid.h
  * chardev: add additional check for minor range overlap
      fs/char_dev.c
    x86/ia32: Fix ia32_restore_sigcontext() AC leak
    x86/uaccess, signal: Fix AC=1 bloat
  * arm64: cpu_ops: fix a leaked reference by adding missing of_node_put
      arch/arm64/kernel/cpu_ops.c
  * scsi: ufs: Avoid configuring regulator with undefined voltage range
      drivers/scsi/ufs/ufshcd.c
  * scsi: ufs: Fix regulator load and icc-level configuration
      drivers/scsi/ufs/ufshcd.c
    brcmfmac: fix Oops when bringing up interface during USB disconnect
    brcmfmac: fix race during disconnect when USB completion is in progress
    brcmfmac: convert dev_init_lock mutex to completion
    b43: shut up clang -Wuninitialized variable warning
    brcmfmac: fix missing checks for kmemdup
    mwifiex: Fix mem leak in mwifiex_tm_cmd
    rtlwifi: fix a potential NULL pointer dereference
    iio: common: ssp_sensors: Initialize calculated_time in ssp_common_process_data
    iio: hmc5843: fix potential NULL pointer dereferences
    iio: ad_sigma_delta: Properly handle SPI bus locking vs CS assertion
    x86/build: Keep local relocations with ld.lld
    cpufreq: pmac32: fix possible object reference leak
    cpufreq/pasemi: fix possible object reference leak
    cpufreq: ppc_cbe: fix possible object reference leak
    s390: cio: fix cio_irb declaration
    extcon: arizona: Disable mic detect if running when driver is removed
  * PM / core: Propagate dev->power.wakeup_path when no callbacks
      drivers/base/power/main.c
    mmc: sdhci-of-esdhc: add erratum eSDHC-A001 and A-008358 support
    mmc: sdhci-of-esdhc: add erratum eSDHC5 support
    mmc_spi: add a status check for spi_sync_locked
  * mmc: core: make pwrseq_emmc (partially) support sleepy GPIO controllers
      drivers/mmc/core/pwrseq_emmc.c
    scsi: libsas: Do discovery on empty PHY to update PHY info
    hwmon: (f71805f) Use request_muxed_region for Super-IO accesses
    hwmon: (pc87427) Use request_muxed_region for Super-IO accesses
    hwmon: (smsc47b397) Use request_muxed_region for Super-IO accesses
    hwmon: (smsc47m1) Use request_muxed_region for Super-IO accesses
    hwmon: (vt1211) Use request_muxed_region for Super-IO accesses
    RDMA/cxgb4: Fix null pointer dereference on alloc_skb failure
  * arm64: vdso: Fix clock_getres() for CLOCK_REALTIME
      arch/arm64/include/asm/vdso_datapage.h
      arch/arm64/kernel/asm-offsets.c
      arch/arm64/kernel/vdso.c
    i40e: don't allow changes to HW VLAN stripping on active port VLANs
    x86/irq/64: Limit IST stack overflow check to #DB stack
  * USB: core: Don't unbind interfaces following device reset failure
      drivers/usb/core/hub.c
  * sched/core: Handle overflow in cpu_shares_write_u64
      kernel/sched/core.c
  * sched/core: Check quota and period overflow at usec to nsec conversion
      kernel/sched/core.c
    powerpc/numa: improve control of topology updates
    media: pvrusb2: Prevent a buffer overflow
    media: au0828: Fix NULL pointer dereference in au0828_analog_stream_enable()
  * audit: fix a memory leak bug
      kernel/auditfilter.c
    media: ov2659: make S_FMT succeed even if requested format doesn't match
    media: au0828: stop video streaming only when last user stops
    media: ov6650: Move v4l2_clk_get() to ov6650_video_probe() helper
    media: coda: clear error return value before picture run
    dmaengine: at_xdmac: remove BUG_ON macro in tasklet
    pinctrl: pistachio: fix leaked of_node references
    HID: logitech-hidpp: use RAP instead of FAP to get the protocol version
  * mm/uaccess: Use 'unsigned long' to placate UBSAN warnings on older GCC versions
      lib/strncpy_from_user.c
      lib/strnlen_user.c
    x86/mm: Remove in_nmi() warning from 64-bit implementation of vmalloc_fault()
  * smpboot: Place the __percpu annotation correctly
      include/linux/smpboot.h
    x86/build: Move _etext to actual end of .text
    bcache: avoid clang -Wunintialized warning
    bcache: add failure check to run_cache_set() for journal replay
    bcache: fix failure in journal relplay
    bcache: return error immediately in bch_journal_replay()
    crypto: sun4i-ss - Fix invalid calculation of hash end
    net: cw1200: fix a NULL pointer dereference
    mwifiex: prevent an array overflow
    ASoC: fsl_sai: Update is_slave_mode with correct value
  * mac80211/cfg80211: update bss channel on channel switch
      net/wireless/nl80211.c
    dmaengine: pl330: _stop: clear interrupt status
    w1: fix the resume command API
    rtc: 88pm860x: prevent use-after-free on device remove
    iwlwifi: pcie: don't crash on invalid RX interrupt
    scsi: qla2xxx: Fix a qla24xx_enable_msix() error path
  * sched/cpufreq: Fix kobject memleak
      drivers/cpufreq/cpufreq.c
  * arm64: Fix compiler warning from pte_unmap() with -Wunused-but-set-variable
      arch/arm64/include/asm/pgtable.h
    ARM: vdso: Remove dependency with the arch_timer driver internals
    brcm80211: potential NULL dereference in brcmf_cfg80211_vndr_cmds_dcmd_handler()
    spi: pxa2xx: fix SCR (divisor) calculation
  * ASoC: imx: fix fiq dependencies
      sound/soc/fsl/Kconfig
    powerpc/boot: Fix missing check of lseek() return value
  * ASoC: hdmi-codec: unlock the device on startup errors
      sound/soc/codecs/hdmi-codec.c
    net: ena: gcc 8: fix compilation warning
    dmaengine: tegra210-dma: free dma controller in remove()
  * mmc: core: Verify SD bus width
      drivers/mmc/core/sd.c
    cxgb4: Fix error path in cxgb4_init_module
    gfs2: Fix lru_count going negative
    Revert "btrfs: Honour FITRIM range constraints during free space trim"
    tools include: Adopt linux/bits.h
    perf tools: No need to include bitops.h in util.h
    at76c50x-usb: Don't register led_trigger if usb_register_driver failed
    ssb: Fix possible NULL pointer dereference in ssb_host_pcmcia_exit
    media: vivid: use vfree() instead of kfree() for dev->bitmap_cap
    media: cpia2: Fix use-after-free in cpia2_exit
  * fbdev: fix WARNING in __alloc_pages_nodemask bug
      drivers/video/fbdev/core/fbcmap.c
  * hugetlb: use same fault hash key for shared and private mappings
      include/linux/hugetlb.h
  * fbdev: fix divide error in fb_var_to_videomode
      drivers/video/fbdev/core/modedb.c
    btrfs: sysfs: don't leak memory when failing add fsid
    Btrfs: fix race between ranged fsync and writeback of adjacent ranges
    Btrfs: do not abort transaction at btrfs_update_root() after failure to COW path
    gfs2: Fix sign extension bug in gfs2_update_stats
  * arm64: Save and restore OSDLR_EL1 across suspend/resume
      arch/arm64/mm/proc.S
    libnvdimm/namespace: Fix label tracking error
    kvm: svm/avic: fix off-by-one in checking host APIC ID
    crypto: vmx - CTR: always increment IV as quadword
  * Revert "scsi: sd: Keep disk read-only when re-reading partition"
      drivers/scsi/sd.c
  * bio: fix improper use of smp_mb__before_atomic()
      include/linux/bio.h
    KVM: x86: fix return value for reserved EFER
  * ext4: do not delete unlinked inode from orphan list on failed truncate
      fs/ext4/inode.c
    Merge remote-tracking branch 'origin/upstream-f2fs-stable-linux-4.9.y' into android-4.9
    Merge 4.9.179 into android-4.9
Linux 4.9.179
    fbdev: sm712fb: fix memory frequency by avoiding a switch/case fallthrough
    btrfs: Honour FITRIM range constraints during free space trim
    md/raid: raid5 preserve the writeback action after the parity check
    Revert "Don't jump to compute_result state from check_result state"
    perf bench numa: Add define for RUSAGE_THREAD if not present
    ufs: fix braino in ufs_get_inode_gid() for solaris UFS flavour
  * power: supply: sysfs: prevent endless uevent loop with CONFIG_POWER_SUPPLY_DEBUG
      drivers/power/supply/power_supply_sysfs.c
    KVM: arm/arm64: Ensure vcpu target is unset on reset failure
    mac80211: Fix kernel panic due to use of txq after free
  * xfrm4: Fix uninitialized memory read in _decode_session4
      net/ipv4/xfrm4_policy.c
  * vti4: ipip tunnel deregistration fixes.
      net/ipv4/ip_vti.c
  * xfrm6_tunnel: Fix potential panic when unloading xfrm6_tunnel module
      net/ipv6/xfrm6_tunnel.c
  * xfrm: policy: Fix out-of-bound array accesses in __xfrm_policy_unlink
      net/xfrm/xfrm_user.c
    dm delay: fix a crash when invalid device is specified
  * PCI: Work around Pericom PCIe-to-PCI bridge Retrain Link erratum
      drivers/pci/quirks.c
      include/linux/pci.h
    PCI: Factor out pcie_retrain_link() function
  * PCI: Mark Atheros AR9462 to avoid bus reset
      drivers/pci/quirks.c
    fbdev: sm712fb: fix crashes and garbled display during DPMS modesetting
    fbdev: sm712fb: use 1024x768 by default on non-MIPS, fix garbled display
    fbdev: sm712fb: fix support for 1024x768-16 mode
    fbdev: sm712fb: fix crashes during framebuffer writes by correctly mapping VRAM
    fbdev: sm712fb: fix boot screen glitch when sm712fb replaces VGA
    fbdev: sm712fb: fix white screen of death on reboot, don't set CR3B-CR3F
    fbdev: sm712fb: fix VRAM detection, don't set SR70/71/74/75
    fbdev: sm712fb: fix brightness control on reboot, don't set SR30
    objtool: Allow AR to be overridden with HOSTAR
    perf intel-pt: Fix sample timestamp wrt non-taken branches
    perf intel-pt: Fix improved sample timestamp
    perf intel-pt: Fix instructions sampling rate
    memory: tegra: Fix integer overflow on tick value calculation
  * tracing: Fix partial reading of trace event's id file
      kernel/trace/trace_events.c
    ceph: flush dirty inodes before proceeding with remount
    iommu/tegra-smmu: Fix invalid ASID bits on Tegra30/114
  * fuse: honor RLIMIT_FSIZE in fuse_file_fallocate
      fs/fuse/file.c
  * fuse: fix writepages on 32bit
      fs/fuse/file.c
    clk: tegra: Fix PLLM programming on Tegra124+ when PMC overrides divider
    NFS4: Fix v4.0 client state corruption when mount
    media: ov6650: Fix sensor possibly not detected on probe
    cifs: fix strcat buffer overflow and reduce raciness in smb21_set_oplock_level()
  * of: fix clang -Wunsequenced for be32_to_cpu()
      include/linux/of.h
    p54: drop device reference count if fails to enable device
    intel_th: msu: Fix single mode with IOMMU
    md: add mddev->pers to avoid potential NULL pointer dereference
    stm class: Fix channel free in stm output free path
    parisc: Rename LEVEL to PA_ASM_LEVEL to avoid name clash with DRBD code
    parisc: Skip registering LED when running in QEMU
    parisc: Export running_on_qemu symbol for modules
    vsock/virtio: Initialize core virtio vsock before registering the driver
    tipc: fix modprobe tipc failed after switch order of device registration
    vsock/virtio: free packets during the socket release
    tipc: switch order of device registration to fix a crash
  * ppp: deflate: Fix possible crash in deflate_init
      drivers/net/ppp/ppp_deflate.c
    net/mlx4_core: Change the error print to info print
  * net: avoid weird emergency message
      net/core/dev.c
  * f2fs: link f2fs quota ops for sysfile
      fs/f2fs/checkpoint.c
      fs/f2fs/super.c
  * BACKPORT: gcov: clang support
      kernel/gcov/Kconfig
    UPSTREAM: gcov: docs: add a note on GCC vs Clang differences
    UPSTREAM: gcov: clang: move common GCC code into gcc_base.c
  * UPSTREAM: module: add stubs for within_module functions
      include/linux/module.h
  * UPSTREAM: gcov: remove CONFIG_GCOV_FORMAT_AUTODETECT
      kernel/gcov/Kconfig
  * BACKPORT: kbuild: gcov: enable -fno-tree-loop-im if supported
      Makefile
    Merge remote-tracking branch 'origin/upstream-f2fs-stable-linux-4.9.y' into android-4.9
  * ext4: fix build warning
      fs/ext4/file.c

Change-Id: I8e7abd3cefdf0f9d9c1fa5b63a0abf243fe7c7d1
Signed-off-by: Robin Peng <robinpeng@google.com>
2019-07-26 21:29:11 +08:00
Joel Fernandes (Google)
59d642e923 BACKPORT: kheaders: Move from proc to sysfs
The kheaders archive consisting of the kernel headers used for compiling
bpf programs is in /proc. However there is concern that moving it here
will make it permanent. Let us move it to /sys/kernel as discussed [1].

[1] https://lore.kernel.org/patchwork/patch/1067310/#1265969

(cherry picked from commit f7b101d33046a837c2aa4526cef28a3c785d7af2)
Bug: 78013494
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Change-Id: I3bf86d0b0f2b73094c2ed29bfda1a57436f9d956
2019-07-03 14:31:02 -04:00
Joel Fernandes (Google)
9d3b23c460 BACKPORT: Provide in-kernel headers to make extending kernel easier
Introduce in-kernel headers which are made available as an archive
through proc (/proc/kheaders.tar.xz file). This archive makes it
possible to run eBPF and other tracing programs that need to extend the
kernel for tracing purposes without any dependency on the file system
having headers.

A github PR is sent for the corresponding BCC patch at:
https://github.com/iovisor/bcc/pull/2312

On Android and embedded systems, it is common to switch kernels but not
have kernel headers available on the file system. Further once a
different kernel is booted, any headers stored on the file system will
no longer be useful. This is an issue even well known to distros.
By storing the headers as a compressed archive within the kernel, we can
avoid these issues that have been a hindrance for a long time.

The best way to use this feature is by building it in. Several users
have a need for this, when they switch debug kernels, they do not want to
update the filesystem or worry about it where to store the headers on
it. However, the feature is also buildable as a module in case the user
desires it not being part of the kernel image. This makes it possible to
load and unload the headers from memory on demand. A tracing program can
load the module, do its operations, and then unload the module to save
kernel memory. The total memory needed is 3.3MB.

By having the archive available at a fixed location independent of
filesystem dependencies and conventions, all debugging tools can
directly refer to the fixed location for the archive, without concerning
with where the headers on a typical filesystem which significantly
simplifies tooling that needs kernel headers.

The code to read the headers is based on /proc/config.gz code and uses
the same technique to embed the headers.

Other approaches were discussed such as having an in-memory mountable
filesystem, but that has drawbacks such as requiring an in-kernel xz
decompressor which we don't have today, and requiring usage of 42 MB of
kernel memory to host the decompressed headers at anytime. Also this
approach is simpler than such approaches.

(Resolved minor conflicts in Makefile)
(cherry picked from commit 43d8ce9d65a54846d378545770991e65838981e0)
Bug: 78013494
Change-Id: Id40724018c0c68d5ea159822c269e23897d43826
Reviewed-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-03 14:30:53 -04:00
Greg Kroah-Hartman
a0b21f86b2 Merge 4.9.183 into android-4.9-q
Changes in 4.9.183
	rapidio: fix a NULL pointer dereference when create_workqueue() fails
	fs/fat/file.c: issue flush after the writeback of FAT
	sysctl: return -EINVAL if val violates minmax
	ipc: prevent lockup on alloc_msg and free_msg
	ARM: prevent tracing IPI_CPU_BACKTRACE
	hugetlbfs: on restore reserve error path retain subpool reservation
	mem-hotplug: fix node spanned pages when we have a node with only ZONE_MOVABLE
	mm/cma.c: fix crash on CMA allocation if bitmap allocation fails
	mm/cma_debug.c: fix the break condition in cma_maxchunk_get()
	mm/slab.c: fix an infinite loop in leaks_show()
	kernel/sys.c: prctl: fix false positive in validate_prctl_map()
	drivers: thermal: tsens: Don't print error message on -EPROBE_DEFER
	mfd: tps65912-spi: Add missing of table registration
	mfd: intel-lpss: Set the device in reset state when init
	mfd: twl6040: Fix device init errors for ACCCTL register
	perf/x86/intel: Allow PEBS multi-entry in watermark mode
	drm/bridge: adv7511: Fix low refresh rate selection
	objtool: Don't use ignore flag for fake jumps
	pwm: meson: Use the spin-lock only to protect register modifications
	ntp: Allow TAI-UTC offset to be set to zero
	f2fs: fix to avoid panic in do_recover_data()
	f2fs: fix to clear dirty inode in error path of f2fs_iget()
	f2fs: fix to do sanity check on valid block count of segment
	configfs: fix possible use-after-free in configfs_register_group
	uml: fix a boot splat wrt use of cpu_all_mask
	watchdog: imx2_wdt: Fix set_timeout for big timeout values
	watchdog: fix compile time error of pretimeout governors
	iommu/vt-d: Set intel_iommu_gfx_mapped correctly
	ALSA: hda - Register irq handler after the chip initialization
	nvmem: core: fix read buffer in place
	fuse: retrieve: cap requested size to negotiated max_write
	nfsd: allow fh_want_write to be called twice
	x86/PCI: Fix PCI IRQ routing table memory leak
	platform/chrome: cros_ec_proto: check for NULL transfer function
	soc: mediatek: pwrap: Zero initialize rdata in pwrap_init_cipher
	clk: rockchip: Turn on "aclk_dmac1" for suspend on rk3288
	ARM: dts: imx6sx: Specify IMX6SX_CLK_IPG as "ahb" clock to SDMA
	ARM: dts: imx7d: Specify IMX7D_CLK_IPG as "ipg" clock to SDMA
	ARM: dts: imx6ul: Specify IMX6UL_CLK_IPG as "ipg" clock to SDMA
	ARM: dts: imx6sx: Specify IMX6SX_CLK_IPG as "ipg" clock to SDMA
	ARM: dts: imx6qdl: Specify IMX6QDL_CLK_IPG as "ipg" clock to SDMA
	PCI: rpadlpar: Fix leaked device_node references in add/remove paths
	platform/x86: intel_pmc_ipc: adding error handling
	PCI: rcar: Fix a potential NULL pointer dereference
	PCI: rcar: Fix 64bit MSI message address handling
	video: hgafb: fix potential NULL pointer dereference
	video: imsttfb: fix potential NULL pointer dereferences
	PCI: xilinx: Check for __get_free_pages() failure
	gpio: gpio-omap: add check for off wake capable gpios
	dmaengine: idma64: Use actual device for DMA transfers
	pwm: tiehrpwm: Update shadow register for disabling PWMs
	ARM: dts: exynos: Always enable necessary APIO_1V8 and ABB_1V8 regulators on Arndale Octa
	pwm: Fix deadlock warning when removing PWM device
	ARM: exynos: Fix undefined instruction during Exynos5422 resume
	Revert "Bluetooth: Align minimum encryption key size for LE and BR/EDR connections"
	ALSA: seq: Cover unsubscribe_port() in list_mutex
	ALSA: oxfw: allow PCM capture for Stanton SCS.1m
	libata: Extend quirks for the ST1000LM024 drives with NOLPM quirk
	mm/list_lru.c: fix memory leak in __memcg_init_list_lru_node
	fs/ocfs2: fix race in ocfs2_dentry_attach_lock()
	signal/ptrace: Don't leak unitialized kernel memory with PTRACE_PEEK_SIGINFO
	ptrace: restore smp_rmb() in __ptrace_may_access()
	media: v4l2-ioctl: clear fields in s_parm
	i2c: acorn: fix i2c warning
	bcache: fix stack corruption by PRECEDING_KEY()
	cgroup: Use css_tryget() instead of css_tryget_online() in task_get_css()
	ASoC: cs42xx8: Add regcache mask dirty
	ASoC: fsl_asrc: Fix the issue about unsupported rate
	x86/uaccess, kcov: Disable stack protector
	ALSA: seq: Protect in-kernel ioctl calls with mutex
	ALSA: seq: Fix race of get-subscription call vs port-delete ioctls
	Revert "ALSA: seq: Protect in-kernel ioctl calls with mutex"
	Drivers: misc: fix out-of-bounds access in function param_set_kgdbts_var
	scsi: lpfc: add check for loss of ndlp when sending RRQ
	arm64/mm: Inhibit huge-vmap with ptdump
	scsi: bnx2fc: fix incorrect cast to u64 on shift operation
	selftests/timers: Add missing fflush(stdout) calls
	usbnet: ipheth: fix racing condition
	KVM: x86/pmu: do not mask the value that is written to fixed PMUs
	KVM: s390: fix memory slot handling for KVM_SET_USER_MEMORY_REGION
	drm/vmwgfx: integer underflow in vmw_cmd_dx_set_shader() leading to an invalid read
	drm/vmwgfx: NULL pointer dereference from vmw_cmd_dx_view_define()
	usb: dwc2: Fix DMA cache alignment issues
	USB: Fix chipmunk-like voice when using Logitech C270 for recording audio.
	USB: usb-storage: Add new ID to ums-realtek
	USB: serial: pl2303: add Allied Telesis VT-Kit3
	USB: serial: option: add support for Simcom SIM7500/SIM7600 RNDIS mode
	USB: serial: option: add Telit 0x1260 and 0x1261 compositions
	rtc: pcf8523: don't return invalid date when battery is low
	ax25: fix inconsistent lock state in ax25_destroy_timer
	be2net: Fix number of Rx queues used for flow hashing
	ipv6: flowlabel: fl6_sock_lookup() must use atomic_inc_not_zero
	lapb: fixed leak of control-blocks.
	neigh: fix use-after-free read in pneigh_get_next
	sunhv: Fix device naming inconsistency between sunhv_console and sunhv_reg
	Revert "staging: vc04_services: prevent integer overflow in create_pagelist()"
	perf/x86/intel/ds: Fix EVENT vs. UEVENT PEBS constraints
	selftests: netfilter: missing error check when setting up veth interface
	mISDN: make sure device name is NUL terminated
	x86/CPU/AMD: Don't force the CPB cap when running under a hypervisor
	perf/ring_buffer: Fix exposing a temporarily decreased data_head
	perf/ring_buffer: Add ordering to rb->nest increment
	gpio: fix gpio-adp5588 build errors
	net: tulip: de4x5: Drop redundant MODULE_DEVICE_TABLE()
	i2c: dev: fix potential memory leak in i2cdev_ioctl_rdwr
	configfs: Fix use-after-free when accessing sd->s_dentry
	perf data: Fix 'strncat may truncate' build failure with recent gcc
	perf record: Fix s390 missing module symbol and warning for non-root users
	ia64: fix build errors by exporting paddr_to_nid()
	KVM: PPC: Book3S: Use new mutex to synchronize access to rtas token list
	KVM: PPC: Book3S HV: Don't take kvm->lock around kvm_for_each_vcpu
	net: sh_eth: fix mdio access in sh_eth_close() for R-Car Gen2 and RZ/A1 SoCs
	scsi: libcxgbi: add a check for NULL pointer in cxgbi_check_route()
	scsi: smartpqi: properly set both the DMA mask and the coherent DMA mask
	scsi: libsas: delete sas port if expander discover failed
	mlxsw: spectrum: Prevent force of 56G
	Abort file_remove_privs() for non-reg. files
	Linux 4.9.183

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2019-06-22 08:56:18 +02:00
Greg Kroah-Hartman
a80a7ab5f7 Merge 4.9.183 into android-4.9
Changes in 4.9.183
	rapidio: fix a NULL pointer dereference when create_workqueue() fails
	fs/fat/file.c: issue flush after the writeback of FAT
	sysctl: return -EINVAL if val violates minmax
	ipc: prevent lockup on alloc_msg and free_msg
	ARM: prevent tracing IPI_CPU_BACKTRACE
	hugetlbfs: on restore reserve error path retain subpool reservation
	mem-hotplug: fix node spanned pages when we have a node with only ZONE_MOVABLE
	mm/cma.c: fix crash on CMA allocation if bitmap allocation fails
	mm/cma_debug.c: fix the break condition in cma_maxchunk_get()
	mm/slab.c: fix an infinite loop in leaks_show()
	kernel/sys.c: prctl: fix false positive in validate_prctl_map()
	drivers: thermal: tsens: Don't print error message on -EPROBE_DEFER
	mfd: tps65912-spi: Add missing of table registration
	mfd: intel-lpss: Set the device in reset state when init
	mfd: twl6040: Fix device init errors for ACCCTL register
	perf/x86/intel: Allow PEBS multi-entry in watermark mode
	drm/bridge: adv7511: Fix low refresh rate selection
	objtool: Don't use ignore flag for fake jumps
	pwm: meson: Use the spin-lock only to protect register modifications
	ntp: Allow TAI-UTC offset to be set to zero
	f2fs: fix to avoid panic in do_recover_data()
	f2fs: fix to clear dirty inode in error path of f2fs_iget()
	f2fs: fix to do sanity check on valid block count of segment
	configfs: fix possible use-after-free in configfs_register_group
	uml: fix a boot splat wrt use of cpu_all_mask
	watchdog: imx2_wdt: Fix set_timeout for big timeout values
	watchdog: fix compile time error of pretimeout governors
	iommu/vt-d: Set intel_iommu_gfx_mapped correctly
	ALSA: hda - Register irq handler after the chip initialization
	nvmem: core: fix read buffer in place
	fuse: retrieve: cap requested size to negotiated max_write
	nfsd: allow fh_want_write to be called twice
	x86/PCI: Fix PCI IRQ routing table memory leak
	platform/chrome: cros_ec_proto: check for NULL transfer function
	soc: mediatek: pwrap: Zero initialize rdata in pwrap_init_cipher
	clk: rockchip: Turn on "aclk_dmac1" for suspend on rk3288
	ARM: dts: imx6sx: Specify IMX6SX_CLK_IPG as "ahb" clock to SDMA
	ARM: dts: imx7d: Specify IMX7D_CLK_IPG as "ipg" clock to SDMA
	ARM: dts: imx6ul: Specify IMX6UL_CLK_IPG as "ipg" clock to SDMA
	ARM: dts: imx6sx: Specify IMX6SX_CLK_IPG as "ipg" clock to SDMA
	ARM: dts: imx6qdl: Specify IMX6QDL_CLK_IPG as "ipg" clock to SDMA
	PCI: rpadlpar: Fix leaked device_node references in add/remove paths
	platform/x86: intel_pmc_ipc: adding error handling
	PCI: rcar: Fix a potential NULL pointer dereference
	PCI: rcar: Fix 64bit MSI message address handling
	video: hgafb: fix potential NULL pointer dereference
	video: imsttfb: fix potential NULL pointer dereferences
	PCI: xilinx: Check for __get_free_pages() failure
	gpio: gpio-omap: add check for off wake capable gpios
	dmaengine: idma64: Use actual device for DMA transfers
	pwm: tiehrpwm: Update shadow register for disabling PWMs
	ARM: dts: exynos: Always enable necessary APIO_1V8 and ABB_1V8 regulators on Arndale Octa
	pwm: Fix deadlock warning when removing PWM device
	ARM: exynos: Fix undefined instruction during Exynos5422 resume
	Revert "Bluetooth: Align minimum encryption key size for LE and BR/EDR connections"
	ALSA: seq: Cover unsubscribe_port() in list_mutex
	ALSA: oxfw: allow PCM capture for Stanton SCS.1m
	libata: Extend quirks for the ST1000LM024 drives with NOLPM quirk
	mm/list_lru.c: fix memory leak in __memcg_init_list_lru_node
	fs/ocfs2: fix race in ocfs2_dentry_attach_lock()
	signal/ptrace: Don't leak unitialized kernel memory with PTRACE_PEEK_SIGINFO
	ptrace: restore smp_rmb() in __ptrace_may_access()
	media: v4l2-ioctl: clear fields in s_parm
	i2c: acorn: fix i2c warning
	bcache: fix stack corruption by PRECEDING_KEY()
	cgroup: Use css_tryget() instead of css_tryget_online() in task_get_css()
	ASoC: cs42xx8: Add regcache mask dirty
	ASoC: fsl_asrc: Fix the issue about unsupported rate
	x86/uaccess, kcov: Disable stack protector
	ALSA: seq: Protect in-kernel ioctl calls with mutex
	ALSA: seq: Fix race of get-subscription call vs port-delete ioctls
	Revert "ALSA: seq: Protect in-kernel ioctl calls with mutex"
	Drivers: misc: fix out-of-bounds access in function param_set_kgdbts_var
	scsi: lpfc: add check for loss of ndlp when sending RRQ
	arm64/mm: Inhibit huge-vmap with ptdump
	scsi: bnx2fc: fix incorrect cast to u64 on shift operation
	selftests/timers: Add missing fflush(stdout) calls
	usbnet: ipheth: fix racing condition
	KVM: x86/pmu: do not mask the value that is written to fixed PMUs
	KVM: s390: fix memory slot handling for KVM_SET_USER_MEMORY_REGION
	drm/vmwgfx: integer underflow in vmw_cmd_dx_set_shader() leading to an invalid read
	drm/vmwgfx: NULL pointer dereference from vmw_cmd_dx_view_define()
	usb: dwc2: Fix DMA cache alignment issues
	USB: Fix chipmunk-like voice when using Logitech C270 for recording audio.
	USB: usb-storage: Add new ID to ums-realtek
	USB: serial: pl2303: add Allied Telesis VT-Kit3
	USB: serial: option: add support for Simcom SIM7500/SIM7600 RNDIS mode
	USB: serial: option: add Telit 0x1260 and 0x1261 compositions
	rtc: pcf8523: don't return invalid date when battery is low
	ax25: fix inconsistent lock state in ax25_destroy_timer
	be2net: Fix number of Rx queues used for flow hashing
	ipv6: flowlabel: fl6_sock_lookup() must use atomic_inc_not_zero
	lapb: fixed leak of control-blocks.
	neigh: fix use-after-free read in pneigh_get_next
	sunhv: Fix device naming inconsistency between sunhv_console and sunhv_reg
	Revert "staging: vc04_services: prevent integer overflow in create_pagelist()"
	perf/x86/intel/ds: Fix EVENT vs. UEVENT PEBS constraints
	selftests: netfilter: missing error check when setting up veth interface
	mISDN: make sure device name is NUL terminated
	x86/CPU/AMD: Don't force the CPB cap when running under a hypervisor
	perf/ring_buffer: Fix exposing a temporarily decreased data_head
	perf/ring_buffer: Add ordering to rb->nest increment
	gpio: fix gpio-adp5588 build errors
	net: tulip: de4x5: Drop redundant MODULE_DEVICE_TABLE()
	i2c: dev: fix potential memory leak in i2cdev_ioctl_rdwr
	configfs: Fix use-after-free when accessing sd->s_dentry
	perf data: Fix 'strncat may truncate' build failure with recent gcc
	perf record: Fix s390 missing module symbol and warning for non-root users
	ia64: fix build errors by exporting paddr_to_nid()
	KVM: PPC: Book3S: Use new mutex to synchronize access to rtas token list
	KVM: PPC: Book3S HV: Don't take kvm->lock around kvm_for_each_vcpu
	net: sh_eth: fix mdio access in sh_eth_close() for R-Car Gen2 and RZ/A1 SoCs
	scsi: libcxgbi: add a check for NULL pointer in cxgbi_check_route()
	scsi: smartpqi: properly set both the DMA mask and the coherent DMA mask
	scsi: libsas: delete sas port if expander discover failed
	mlxsw: spectrum: Prevent force of 56G
	Abort file_remove_privs() for non-reg. files
	Linux 4.9.183

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2019-06-22 08:54:42 +02:00
Peter Zijlstra
c9eb92de72 x86/uaccess, kcov: Disable stack protector
[ Upstream commit 40ea97290b08be2e038b31cbb33097d1145e8169 ]

New tooling noticed this mishap:

  kernel/kcov.o: warning: objtool: write_comp_data()+0x138: call to __stack_chk_fail() with UACCESS enabled
  kernel/kcov.o: warning: objtool: __sanitizer_cov_trace_pc()+0xd9: call to __stack_chk_fail() with UACCESS enabled

All the other instrumentation (KASAN,UBSAN) also have stack protector
disabled.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-06-22 08:17:19 +02:00
Sami Tolvanen
f344424f3c ANDROID: add support for clang Shadow Call Stack (SCS)
This change adds generic support for clang's Shadow Call Stack, which
uses a shadow stack to protect return addresses from being overwritten
by an attacker. Details are available here:

  https://clang.llvm.org/docs/ShadowCallStack.html

Bug: 112277034
Change-Id: Idd553b7c978b0673ab533a68980fb9a654f4510c
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2018-11-09 08:44:42 -08:00
jonechou
ea300e89d4 kdebuginfo: Backup kernel information for bootloader
Bug: 116451871
Bug: 117934423
Change-Id: If572809074a4a091d25819bafacd2cebfa593693
Signed-off-by: jonechou <jonechou@google.com>
2018-10-24 03:59:31 +00:00
Sami Tolvanen
ddab5886dd Revert "add support for clang SafeStack"
This reverts commit 26a804d93d.

Bug: 112277034
Change-Id: I3c2a293fbb82858acf06559cbb2755eeba0caa8a
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2018-10-17 08:17:42 -07:00
Sami Tolvanen
00a195e7c0 add support for clang Control Flow Integrity (CFI)
This change adds the CONFIG_CFI_CLANG option, CFI error handling,
and a faster look-up table for cross module CFI checks.

Bug: 67506682
Change-Id: Ic009f0a629b552a0eb16e6d89808c7029e91447d
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2018-02-28 15:09:58 -08:00
Sami Tolvanen
26a804d93d add support for clang SafeStack
This change adds support for clang SafeStack, which protects function
return addresses against attacks based on stack buffer overflows:

  https://clang.llvm.org/docs/SafeStack.html

SafeStack splits the kernel stack into safe and unsafe parts. Safe
stack is used only for data that's at compile time determined to be
only accessed in a safe way. This prevents a buffer overflow in the
unsafe stack from overwriting any data in the safe stack, including
the return address.

Bug: 67506682
Bug: 67507327
Change-Id: I6ce8dbf80dfd8a97d16e049531bba900eb8699b3
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2018-02-12 09:41:58 -08:00
Sami Tolvanen
4ca69fba29 add support for clang Control Flow Integrity (CFI)
This change adds the CONFIG_CFI_CLANG option, CFI error handling,
and a faster look-up table for cross module CFI checks.

Bug: 67506682
Change-Id: Ic009f0a629b552a0eb16e6d89808c7029e91447d
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2018-01-24 08:09:47 -08:00
Babu Moger
b969a24044 kernel/watchdog.c: move hardlockup detector to separate file
[ Upstream commit 73ce0511c43686095efd2f65ef564aab952e07bc ]

Separate hardlockup code from watchdog.c and move it to watchdog_hld.c.
It is mostly straight forward.  Remove everything inside
CONFIG_HARDLOCKUP_DETECTORS.  This code will go to file watchdog_hld.c.
Also update the makefile accordigly.

Link: http://lkml.kernel.org/r/1478034826-43888-3-git-send-email-babu.moger@oracle.com
Signed-off-by: Babu Moger <babu.moger@oracle.com>
Acked-by: Don Zickus <dzickus@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
Cc: Aaron Tomlin <atomlin@redhat.com>
Cc: Ulrich Obergfell <uobergfe@redhat.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
Cc: Josh Hunt <johunt@akamai.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-17 06:41:57 +02:00
Eric W. Biederman
dbec28460a userns: Add per user namespace sysctls.
Limit per userns sysctls to only be opened for write by a holder
of CAP_SYS_RESOURCE.

Add all of the necessary boilerplate for having per user namespace
sysctls.

Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2016-08-08 13:18:58 -05:00
Ralf Baechle
f43edca7ed ELF/MIPS build fix
CONFIG_MIPS32_N32=y but CONFIG_BINFMT_ELF disabled results in the
following linker errors:

  arch/mips/built-in.o: In function `elf_core_dump':
  binfmt_elfn32.c:(.text+0x23dbc): undefined reference to `elf_core_extra_phdrs'
  binfmt_elfn32.c:(.text+0x246e4): undefined reference to `elf_core_extra_data_size'
  binfmt_elfn32.c:(.text+0x248d0): undefined reference to `elf_core_write_extra_phdrs'
  binfmt_elfn32.c:(.text+0x24ac4): undefined reference to `elf_core_write_extra_data'

CONFIG_MIPS32_O32=y but CONFIG_BINFMT_ELF disabled results in the following
linker errors:

  arch/mips/built-in.o: In function `elf_core_dump':
  binfmt_elfo32.c:(.text+0x28a04): undefined reference to `elf_core_extra_phdrs'
  binfmt_elfo32.c:(.text+0x29330): undefined reference to `elf_core_extra_data_size'
  binfmt_elfo32.c:(.text+0x2951c): undefined reference to `elf_core_write_extra_phdrs'
  binfmt_elfo32.c:(.text+0x29710): undefined reference to `elf_core_write_extra_data'

This is because binfmt_elfn32 and binfmt_elfo32 are using symbols from
elfcore but for these configurations elfcore will not be built.

Fixed by making elfcore selectable by a separate config symbol which
unlike the current mechanism can also be used from other directories
than kernel/, then having each flavor of ELF that relies on elfcore.o,
select it in Kconfig, including CONFIG_MIPS32_N32 and CONFIG_MIPS32_O32
which fixes this issue.

Link: http://lkml.kernel.org/r/20160520141705.GA1913@linux-mips.org
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Cc: "Maciej W. Rozycki" <macro@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-05-23 17:04:14 -07:00
Dmitry Vyukov
5c9a8750a6 kernel: add kcov code coverage
kcov provides code coverage collection for coverage-guided fuzzing
(randomized testing).  Coverage-guided fuzzing is a testing technique
that uses coverage feedback to determine new interesting inputs to a
system.  A notable user-space example is AFL
(http://lcamtuf.coredump.cx/afl/).  However, this technique is not
widely used for kernel testing due to missing compiler and kernel
support.

kcov does not aim to collect as much coverage as possible.  It aims to
collect more or less stable coverage that is function of syscall inputs.
To achieve this goal it does not collect coverage in soft/hard
interrupts and instrumentation of some inherently non-deterministic or
non-interesting parts of kernel is disbled (e.g.  scheduler, locking).

Currently there is a single coverage collection mode (tracing), but the
API anticipates additional collection modes.  Initially I also
implemented a second mode which exposes coverage in a fixed-size hash
table of counters (what Quentin used in his original patch).  I've
dropped the second mode for simplicity.

This patch adds the necessary support on kernel side.  The complimentary
compiler support was added in gcc revision 231296.

We've used this support to build syzkaller system call fuzzer, which has
found 90 kernel bugs in just 2 months:

  https://github.com/google/syzkaller/wiki/Found-Bugs

We've also found 30+ bugs in our internal systems with syzkaller.
Another (yet unexplored) direction where kcov coverage would greatly
help is more traditional "blob mutation".  For example, mounting a
random blob as a filesystem, or receiving a random blob over wire.

Why not gcov.  Typical fuzzing loop looks as follows: (1) reset
coverage, (2) execute a bit of code, (3) collect coverage, repeat.  A
typical coverage can be just a dozen of basic blocks (e.g.  an invalid
input).  In such context gcov becomes prohibitively expensive as
reset/collect coverage steps depend on total number of basic
blocks/edges in program (in case of kernel it is about 2M).  Cost of
kcov depends only on number of executed basic blocks/edges.  On top of
that, kernel requires per-thread coverage because there are always
background threads and unrelated processes that also produce coverage.
With inlined gcov instrumentation per-thread coverage is not possible.

kcov exposes kernel PCs and control flow to user-space which is
insecure.  But debugfs should not be mapped as user accessible.

Based on a patch by Quentin Casasnovas.

[akpm@linux-foundation.org: make task_struct.kcov_mode have type `enum kcov_mode']
[akpm@linux-foundation.org: unbreak allmodconfig]
[akpm@linux-foundation.org: follow x86 Makefile layout standards]
Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: syzkaller <syzkaller@googlegroups.com>
Cc: Vegard Nossum <vegard.nossum@oracle.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Tavis Ormandy <taviso@google.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: Kostya Serebryany <kcc@google.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Kees Cook <keescook@google.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: David Drysdale <drysdale@google.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-03-22 15:36:02 -07:00
Li Bin
e11b956e9e kernel/Makefile: remove the useless CFLAGS_REMOVE_cgroup-debug.o
The file cgroup-debug.c had been removed from commit fe6934354f
(cgroups: move the cgroup debug subsys into cgroup.c to access internal state).
Remain the CFLAGS_REMOVE_cgroup-debug.o = $(CC_FLAGS_FTRACE)
useless in kernel/Makefile.

Signed-off-by: Li Bin <huawei.libin@huawei.com>
Acked-by: Zefan Li <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2016-01-31 05:11:21 -05:00
Mathieu Desnoyers
5b25b13ab0 sys_membarrier(): system-wide memory barrier (generic, x86)
Here is an implementation of a new system call, sys_membarrier(), which
executes a memory barrier on all threads running on the system.  It is
implemented by calling synchronize_sched().  It can be used to
distribute the cost of user-space memory barriers asymmetrically by
transforming pairs of memory barriers into pairs consisting of
sys_membarrier() and a compiler barrier.  For synchronization primitives
that distinguish between read-side and write-side (e.g.  userspace RCU
[1], rwlocks), the read-side can be accelerated significantly by moving
the bulk of the memory barrier overhead to the write-side.

The existing applications of which I am aware that would be improved by
this system call are as follows:

* Through Userspace RCU library (http://urcu.so)
  - DNS server (Knot DNS) https://www.knot-dns.cz/
  - Network sniffer (http://netsniff-ng.org/)
  - Distributed object storage (https://sheepdog.github.io/sheepdog/)
  - User-space tracing (http://lttng.org)
  - Network storage system (https://www.gluster.org/)
  - Virtual routers (https://events.linuxfoundation.org/sites/events/files/slides/DPDK_RCU_0MQ.pdf)
  - Financial software (https://lkml.org/lkml/2015/3/23/189)

Those projects use RCU in userspace to increase read-side speed and
scalability compared to locking.  Especially in the case of RCU used by
libraries, sys_membarrier can speed up the read-side by moving the bulk of
the memory barrier cost to synchronize_rcu().

* Direct users of sys_membarrier
  - core dotnet garbage collector (https://github.com/dotnet/coreclr/issues/198)

Microsoft core dotnet GC developers are planning to use the mprotect()
side-effect of issuing memory barriers through IPIs as a way to implement
Windows FlushProcessWriteBuffers() on Linux.  They are referring to
sys_membarrier in their github thread, specifically stating that
sys_membarrier() is what they are looking for.

To explain the benefit of this scheme, let's introduce two example threads:

Thread A (non-frequent, e.g. executing liburcu synchronize_rcu())
Thread B (frequent, e.g. executing liburcu
rcu_read_lock()/rcu_read_unlock())

In a scheme where all smp_mb() in thread A are ordering memory accesses
with respect to smp_mb() present in Thread B, we can change each
smp_mb() within Thread A into calls to sys_membarrier() and each
smp_mb() within Thread B into compiler barriers "barrier()".

Before the change, we had, for each smp_mb() pairs:

Thread A                    Thread B
previous mem accesses       previous mem accesses
smp_mb()                    smp_mb()
following mem accesses      following mem accesses

After the change, these pairs become:

Thread A                    Thread B
prev mem accesses           prev mem accesses
sys_membarrier()            barrier()
follow mem accesses         follow mem accesses

As we can see, there are two possible scenarios: either Thread B memory
accesses do not happen concurrently with Thread A accesses (1), or they
do (2).

1) Non-concurrent Thread A vs Thread B accesses:

Thread A                    Thread B
prev mem accesses
sys_membarrier()
follow mem accesses
                            prev mem accesses
                            barrier()
                            follow mem accesses

In this case, thread B accesses will be weakly ordered. This is OK,
because at that point, thread A is not particularly interested in
ordering them with respect to its own accesses.

2) Concurrent Thread A vs Thread B accesses

Thread A                    Thread B
prev mem accesses           prev mem accesses
sys_membarrier()            barrier()
follow mem accesses         follow mem accesses

In this case, thread B accesses, which are ensured to be in program
order thanks to the compiler barrier, will be "upgraded" to full
smp_mb() by synchronize_sched().

* Benchmarks

On Intel Xeon E5405 (8 cores)
(one thread is calling sys_membarrier, the other 7 threads are busy
looping)

1000 non-expedited sys_membarrier calls in 33s =3D 33 milliseconds/call.

* User-space user of this system call: Userspace RCU library

Both the signal-based and the sys_membarrier userspace RCU schemes
permit us to remove the memory barrier from the userspace RCU
rcu_read_lock() and rcu_read_unlock() primitives, thus significantly
accelerating them. These memory barriers are replaced by compiler
barriers on the read-side, and all matching memory barriers on the
write-side are turned into an invocation of a memory barrier on all
active threads in the process. By letting the kernel perform this
synchronization rather than dumbly sending a signal to every process
threads (as we currently do), we diminish the number of unnecessary wake
ups and only issue the memory barriers on active threads. Non-running
threads do not need to execute such barrier anyway, because these are
implied by the scheduler context switches.

Results in liburcu:

Operations in 10s, 6 readers, 2 writers:

memory barriers in reader:    1701557485 reads, 2202847 writes
signal-based scheme:          9830061167 reads,    6700 writes
sys_membarrier:               9952759104 reads,     425 writes
sys_membarrier (dyn. check):  7970328887 reads,     425 writes

The dynamic sys_membarrier availability check adds some overhead to
the read-side compared to the signal-based scheme, but besides that,
sys_membarrier slightly outperforms the signal-based scheme. However,
this non-expedited sys_membarrier implementation has a much slower grace
period than signal and memory barrier schemes.

Besides diminishing the number of wake-ups, one major advantage of the
membarrier system call over the signal-based scheme is that it does not
need to reserve a signal. This plays much more nicely with libraries,
and with processes injected into for tracing purposes, for which we
cannot expect that signals will be unused by the application.

An expedited version of this system call can be added later on to speed
up the grace period. Its implementation will likely depend on reading
the cpu_curr()->mm without holding each CPU's rq lock.

This patch adds the system call to x86 and to asm-generic.

[1] http://urcu.so

membarrier(2) man page:

MEMBARRIER(2)              Linux Programmer's Manual             MEMBARRIER(2)

NAME
       membarrier - issue memory barriers on a set of threads

SYNOPSIS
       #include <linux/membarrier.h>

       int membarrier(int cmd, int flags);

DESCRIPTION
       The cmd argument is one of the following:

       MEMBARRIER_CMD_QUERY
              Query  the  set  of  supported commands. It returns a bitmask of
              supported commands.

       MEMBARRIER_CMD_SHARED
              Execute a memory barrier on all threads running on  the  system.
              Upon  return from system call, the caller thread is ensured that
              all running threads have passed through a state where all memory
              accesses  to  user-space  addresses  match program order between
              entry to and return from the system  call  (non-running  threads
              are de facto in such a state). This covers threads from all pro=E2=80=90
              cesses running on the system.  This command returns 0.

       The flags argument needs to be 0. For future extensions.

       All memory accesses performed  in  program  order  from  each  targeted
       thread is guaranteed to be ordered with respect to sys_membarrier(). If
       we use the semantic "barrier()" to represent a compiler barrier forcing
       memory  accesses  to  be performed in program order across the barrier,
       and smp_mb() to represent explicit memory barriers forcing full  memory
       ordering  across  the barrier, we have the following ordering table for
       each pair of barrier(), sys_membarrier() and smp_mb():

       The pair ordering is detailed as (O: ordered, X: not ordered):

                              barrier()   smp_mb() sys_membarrier()
              barrier()          X           X            O
              smp_mb()           X           O            O
              sys_membarrier()   O           O            O

RETURN VALUE
       On success, these system calls return zero.  On error, -1 is  returned,
       and errno is set appropriately. For a given command, with flags
       argument set to 0, this system call is guaranteed to always return the
       same value until reboot.

ERRORS
       ENOSYS System call is not implemented.

       EINVAL Invalid arguments.

Linux                             2015-04-15                     MEMBARRIER(2)

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Nicholas Miell <nmiell@comcast.net>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Pranith Kumar <bobby.prani@gmail.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-09-11 15:21:34 -07:00
Dave Young
2965faa5e0 kexec: split kexec_load syscall from kexec core code
There are two kexec load syscalls, kexec_load another and kexec_file_load.
 kexec_file_load has been splited as kernel/kexec_file.c.  In this patch I
split kexec_load syscall code to kernel/kexec.c.

And add a new kconfig option KEXEC_CORE, so we can disable kexec_load and
use kexec_file_load only, or vice verse.

The original requirement is from Ted Ts'o, he want kexec kernel signature
being checked with CONFIG_KEXEC_VERIFY_SIG enabled.  But kexec-tools use
kexec_load syscall can bypass the checking.

Vivek Goyal proposed to create a common kconfig option so user can compile
in only one syscall for loading kexec kernel.  KEXEC/KEXEC_FILE selects
KEXEC_CORE so that old config files still work.

Because there's general code need CONFIG_KEXEC_CORE, so I updated all the
architecture Kconfig with a new option KEXEC_CORE, and let KEXEC selects
KEXEC_CORE in arch Kconfig.  Also updated general kernel code with to
kexec_load syscall.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Dave Young <dyoung@redhat.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Petr Tesarik <ptesarik@suse.cz>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Josh Boyer <jwboyer@fedoraproject.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-09-10 13:29:01 -07:00
Dave Young
a43cac0d9d kexec: split kexec_file syscall code to kexec_file.c
Split kexec_file syscall related code to another file kernel/kexec_file.c
so that the #ifdef CONFIG_KEXEC_FILE in kexec.c can be dropped.

Sharing variables and functions are moved to kernel/kexec_internal.h per
suggestion from Vivek and Petr.

[akpm@linux-foundation.org: fix bisectability]
[akpm@linux-foundation.org: declare the various arch_kexec functions]
[akpm@linux-foundation.org: fix build]
Signed-off-by: Dave Young <dyoung@redhat.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Petr Tesarik <ptesarik@suse.cz>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Josh Boyer <jwboyer@fedoraproject.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-09-10 13:29:01 -07:00
Linus Torvalds
12f03ee606 Merge tag 'libnvdimm-for-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm updates from Dan Williams:
 "This update has successfully completed a 0day-kbuild run and has
  appeared in a linux-next release.  The changes outside of the typical
  drivers/nvdimm/ and drivers/acpi/nfit.[ch] paths are related to the
  removal of IORESOURCE_CACHEABLE, the introduction of memremap(), and
  the introduction of ZONE_DEVICE + devm_memremap_pages().

  Summary:

   - Introduce ZONE_DEVICE and devm_memremap_pages() as a generic
     mechanism for adding device-driver-discovered memory regions to the
     kernel's direct map.

     This facility is used by the pmem driver to enable pfn_to_page()
     operations on the page frames returned by DAX ('direct_access' in
     'struct block_device_operations').

     For now, the 'memmap' allocation for these "device" pages comes
     from "System RAM".  Support for allocating the memmap from device
     memory will arrive in a later kernel.

   - Introduce memremap() to replace usages of ioremap_cache() and
     ioremap_wt().  memremap() drops the __iomem annotation for these
     mappings to memory that do not have i/o side effects.  The
     replacement of ioremap_cache() with memremap() is limited to the
     pmem driver to ease merging the api change in v4.3.

     Completion of the conversion is targeted for v4.4.

   - Similar to the usage of memcpy_to_pmem() + wmb_pmem() in the pmem
     driver, update the VFS DAX implementation and PMEM api to provide
     persistence guarantees for kernel operations on a DAX mapping.

   - Convert the ACPI NFIT 'BLK' driver to map the block apertures as
     cacheable to improve performance.

   - Miscellaneous updates and fixes to libnvdimm including support for
     issuing "address range scrub" commands, clarifying the optimal
     'sector size' of pmem devices, a clarification of the usage of the
     ACPI '_STA' (status) property for DIMM devices, and other minor
     fixes"

* tag 'libnvdimm-for-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: (34 commits)
  libnvdimm, pmem: direct map legacy pmem by default
  libnvdimm, pmem: 'struct page' for pmem
  libnvdimm, pfn: 'struct page' provider infrastructure
  x86, pmem: clarify that ARCH_HAS_PMEM_API implies PMEM mapped WB
  add devm_memremap_pages
  mm: ZONE_DEVICE for "device memory"
  mm: move __phys_to_pfn and __pfn_to_phys to asm/generic/memory_model.h
  dax: drop size parameter to ->direct_access()
  nd_blk: change aperture mapping from WC to WB
  nvdimm: change to use generic kvfree()
  pmem, dax: have direct_access use __pmem annotation
  dax: update I/O path to do proper PMEM flushing
  pmem: add copy_from_iter_pmem() and clear_pmem()
  pmem, x86: clean up conditional pmem includes
  pmem: remove layer when calling arch_has_wmb_pmem()
  pmem, x86: move x86 PMEM API to new pmem.h header
  libnvdimm, e820: make CONFIG_X86_PMEM_LEGACY a tristate option
  pmem: switch to devm_ allocations
  devres: add devm_memremap
  libnvdimm, btt: write and validate parent_uuid
  ...
2015-09-08 14:35:59 -07:00
Linus Torvalds
425afcff13 Merge branch 'upstream' of git://git.infradead.org/users/pcmoore/audit
Pull audit update from Paul Moore:
 "This is one of the larger audit patchsets in recent history,
  consisting of eight patches and almost 400 lines of changes.

  The bulk of the patchset is the new "audit by executable"
  functionality which allows admins to set an audit watch based on the
  executable on disk.  Prior to this, admins could only track an
  application by PID, which has some obvious limitations.

  Beyond the new functionality we also have some refcnt fixes and a few
  minor cleanups"

* 'upstream' of git://git.infradead.org/users/pcmoore/audit:
  fixup: audit: implement audit by executable
  audit: implement audit by executable
  audit: clean simple fsnotify implementation
  audit: use macros for unset inode and device values
  audit: make audit_del_rule() more robust
  audit: fix uninitialized variable in audit_add_rule()
  audit: eliminate unnecessary extra layer of watch parent references
  audit: eliminate unnecessary extra layer of watch references
2015-09-08 13:34:59 -07:00
Linus Torvalds
b793c005ce Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull security subsystem updates from James Morris:
 "Highlights:

   - PKCS#7 support added to support signed kexec, also utilized for
     module signing.  See comments in 3f1e1bea.

     ** NOTE: this requires linking against the OpenSSL library, which
        must be installed, e.g.  the openssl-devel on Fedora **

   - Smack
      - add IPv6 host labeling; ignore labels on kernel threads
      - support smack labeling mounts which use binary mount data

   - SELinux:
      - add ioctl whitelisting (see
        http://kernsec.org/files/lss2015/vanderstoep.pdf)
      - fix mprotect PROT_EXEC regression caused by mm change

   - Seccomp:
      - add ptrace options for suspend/resume"

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (57 commits)
  PKCS#7: Add OIDs for sha224, sha284 and sha512 hash algos and use them
  Documentation/Changes: Now need OpenSSL devel packages for module signing
  scripts: add extract-cert and sign-file to .gitignore
  modsign: Handle signing key in source tree
  modsign: Use if_changed rule for extracting cert from module signing key
  Move certificate handling to its own directory
  sign-file: Fix warning about BIO_reset() return value
  PKCS#7: Add MODULE_LICENSE() to test module
  Smack - Fix build error with bringup unconfigured
  sign-file: Document dependency on OpenSSL devel libraries
  PKCS#7: Appropriately restrict authenticated attributes and content type
  KEYS: Add a name for PKEY_ID_PKCS7
  PKCS#7: Improve and export the X.509 ASN.1 time object decoder
  modsign: Use extract-cert to process CONFIG_SYSTEM_TRUSTED_KEYS
  extract-cert: Cope with multiple X.509 certificates in a single file
  sign-file: Generate CMS message as signature instead of PKCS#7
  PKCS#7: Support CMS messages also [RFC5652]
  X.509: Change recorded SKID & AKID to not include Subject or Issuer
  PKCS#7: Check content type and versions
  MAINTAINERS: The keyrings mailing list has moved
  ...
2015-09-08 12:41:25 -07:00
Dan Williams
92281dee82 arch: introduce memremap()
Existing users of ioremap_cache() are mapping memory that is known in
advance to not have i/o side effects.  These users are forced to cast
away the __iomem annotation, or otherwise neglect to fix the sparse
errors thrown when dereferencing pointers to this memory.  Provide
memremap() as a non __iomem annotated ioremap_*() in the case when
ioremap is otherwise a pointer to cacheable memory. Empirically,
ioremap_<cacheable-type>() call sites are seeking memory-like semantics
(e.g.  speculative reads, and prefetching permitted).

memremap() is a break from the ioremap implementation pattern of adding
a new memremap_<type>() for each mapping type and having silent
compatibility fall backs.  Instead, the implementation defines flags
that are passed to the central memremap() and if a mapping type is not
supported by an arch memremap returns NULL.

We introduce a memremap prototype as a trivial wrapper of
ioremap_cache() and ioremap_wt().  Later, once all ioremap_cache() and
ioremap_wt() usage has been removed from drivers we teach archs to
implement arch_memremap() with the ability to strictly enforce the
mapping type.

Cc: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2015-08-14 13:23:28 -04:00
David Howells
cfc411e7ff Move certificate handling to its own directory
Move certificate handling out of the kernel/ directory and into a certs/
directory to get all the weird stuff in one place and move the generated
signing keys into this directory.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: David Woodhouse <David.Woodhouse@intel.com>
2015-08-14 16:06:13 +01:00
David Woodhouse
770f2b9876 modsign: Use extract-cert to process CONFIG_SYSTEM_TRUSTED_KEYS
Fix up the dependencies somewhat too, while we're at it.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: David Howells <dhowells@redhat.com>
2015-08-12 17:01:01 +01:00
David Woodhouse
99d27b1b52 modsign: Add explicit CONFIG_SYSTEM_TRUSTED_KEYS option
Let the user explicitly provide a file containing trusted keys, instead of
just automatically finding files matching *.x509 in the build tree and
trusting whatever we find. This really ought to be an *explicit*
configuration, and the build rules for dealing with the files were
fairly painful too.

Fix applied from James Morris that removes an '=' from a macro definition
in kernel/Makefile as this is a feature that only exists from GNU make 3.82
onwards.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: David Howells <dhowells@redhat.com>
2015-08-07 16:26:14 +01:00
David Woodhouse
fb11794991 modsign: Use single PEM file for autogenerated key
The current rule for generating signing_key.priv and signing_key.x509 is
a classic example of a bad rule which has a tendency to break parallel
make. When invoked to create *either* target, it generates the other
target as a side-effect that make didn't predict.

So let's switch to using a single file signing_key.pem which contains
both key and certificate. That matches what we do in the case of an
external key specified by CONFIG_MODULE_SIG_KEY anyway, so it's also
slightly cleaner.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: David Howells <dhowells@redhat.com>
2015-08-07 16:26:14 +01:00
David Woodhouse
1329e8cc69 modsign: Extract signing cert from CONFIG_MODULE_SIG_KEY if needed
Where an external PEM file or PKCS#11 URI is given, we can get the cert
from it for ourselves instead of making the user drop signing_key.x509
in place for us.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: David Howells <dhowells@redhat.com>
2015-08-07 16:26:14 +01:00
David Woodhouse
19e91b69d7 modsign: Allow external signing key to be specified
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: David Howells <dhowells@redhat.com>
2015-08-07 16:26:14 +01:00
Richard Guy Briggs
7f49294282 audit: clean simple fsnotify implementation
This is to be used to audit by executable path rules, but audit watches should
be able to share this code eventually.

At the moment the audit watch code is a lot more complex.  That code only
creates one fsnotify watch per parent directory.  That 'audit_parent' in
turn has a list of 'audit_watches' which contain the name, ino, dev of
the specific object we care about.  This just creates one fsnotify watch
per object we care about.  So if you watch 100 inodes in /etc this code
will create 100 fsnotify watches on /etc.  The audit_watch code will
instead create 1 fsnotify watch on /etc (the audit_parent) and then 100
individual watches chained from that fsnotify mark.

We should be able to convert the audit_watch code to do one fsnotify
mark per watch and simplify things/remove a whole lot of code.  After
that conversion we should be able to convert the audit_fsnotify code to
support that hierarchy if the optimization is necessary.

Move the access to the entry for audit_match_signal() to the beginning of
the audit_del_rule() function in case the entry found is the same one passed
in.  This will enable it to be used by audit_autoremove_mark_rule(),
kill_rules() and audit_remove_parent_watches().

This is a heavily modified and merged version of two patches originally
submitted by Eric Paris.

Cc: Peter Moody <peter@hda3.com>
Cc: Eric Paris <eparis@redhat.com>
Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
[PM: added a space after a declaration to keep ./scripts/checkpatch happy]
Signed-off-by: Paul Moore <pmoore@redhat.com>
2015-08-06 16:14:53 -04:00
Aleksa Sarai
49b786ea14 cgroup: implement the PIDs subsystem
Adds a new single-purpose PIDs subsystem to limit the number of
tasks that can be forked inside a cgroup. Essentially this is an
implementation of RLIMIT_NPROC that applies to a cgroup rather than a
process tree.

However, it should be noted that organisational operations (adding and
removing tasks from a PIDs hierarchy) will *not* be prevented. Rather,
the number of tasks in the hierarchy cannot exceed the limit through
forking. This is due to the fact that, in the unified hierarchy, attach
cannot fail (and it is not possible for a task to overcome its PIDs
cgroup policy limit by attaching to a child cgroup -- even if migrating
mid-fork it must be able to fork in the parent first).

PIDs are fundamentally a global resource, and it is possible to reach
PID exhaustion inside a cgroup without hitting any reasonable kmemcg
policy. Once you've hit PID exhaustion, you're only in a marginally
better state than OOM. This subsystem allows PID exhaustion inside a
cgroup to be prevented.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2015-07-14 17:29:23 -04:00
Linus Torvalds
7df9ab845c make certificate list change message more useful
It's a bug in our Makefile rules, make it show what the changing
certificate list was, and make it a warning so that people actually see
it.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-07-02 16:42:13 -07:00
David Howells
9c4249c8e0 modsign: change default key details
Change default key details to be more obviously unspecified.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: James Morris <james.l.morris@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-04-30 09:35:41 -07:00
Iulia Manda
2813893f8b kernel: conditionally support non-root users, groups and capabilities
There are a lot of embedded systems that run most or all of their
functionality in init, running as root:root.  For these systems,
supporting multiple users is not necessary.

This patch adds a new symbol, CONFIG_MULTIUSER, that makes support for
non-root users, non-root groups, and capabilities optional.  It is enabled
under CONFIG_EXPERT menu.

When this symbol is not defined, UID and GID are zero in any possible case
and processes always have all capabilities.

The following syscalls are compiled out: setuid, setregid, setgid,
setreuid, setresuid, getresuid, setresgid, getresgid, setgroups,
getgroups, setfsuid, setfsgid, capget, capset.

Also, groups.c is compiled out completely.

In kernel/capability.c, capable function was moved in order to avoid
adding two ifdef blocks.

This change saves about 25 KB on a defconfig build.  The most minimal
kernels have total text sizes in the high hundreds of kB rather than
low MB.  (The 25k goes down a bit with allnoconfig, but not that much.

The kernel was booted in Qemu.  All the common functionalities work.
Adding users/groups is not possible, failing with -ENOSYS.

Bloat-o-meter output:
add/remove: 7/87 grow/shrink: 19/397 up/down: 1675/-26325 (-24650)

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Iulia Manda <iulia.manda21@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-04-15 16:35:22 -07:00
Linus Torvalds
8cc748aa76 Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull security layer updates from James Morris:
 "Highlights:

   - Smack adds secmark support for Netfilter
   - /proc/keys is now mandatory if CONFIG_KEYS=y
   - TPM gets its own device class
   - Added TPM 2.0 support
   - Smack file hook rework (all Smack users should review this!)"

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (64 commits)
  cipso: don't use IPCB() to locate the CIPSO IP option
  SELinux: fix error code in policydb_init()
  selinux: add security in-core xattr support for pstore and debugfs
  selinux: quiet the filesystem labeling behavior message
  selinux: Remove unused function avc_sidcmp()
  ima: /proc/keys is now mandatory
  Smack: Repair netfilter dependency
  X.509: silence asn1 compiler debug output
  X.509: shut up about included cert for silent build
  KEYS: Make /proc/keys unconditional if CONFIG_KEYS=y
  MAINTAINERS: email update
  tpm/tpm_tis: Add missing ifdef CONFIG_ACPI for pnp_acpi_device
  smack: fix possible use after frees in task_security() callers
  smack: Add missing logging in bidirectional UDS connect check
  Smack: secmark support for netfilter
  Smack: Rework file hooks
  tpm: fix format string error in tpm-chip.c
  char/tpm/tpm_crb: fix build error
  smack: Fix a bidirectional UDS connect check typo
  smack: introduce a special case for tmpfs in smack_d_instantiate()
  ...
2015-02-11 20:25:11 -08:00
Linus Torvalds
b3d6524ff7 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 updates from Martin Schwidefsky:

 - The remaining patches for the z13 machine support: kernel build
   option for z13, the cache synonym avoidance, SMT support,
   compare-and-delay for spinloops and the CES5S crypto adapater.

 - The ftrace support for function tracing with the gcc hotpatch option.
   This touches common code Makefiles, Steven is ok with the changes.

 - The hypfs file system gets an extension to access diagnose 0x0c data
   in user space for performance analysis for Linux running under z/VM.

 - The iucv hvc console gets wildcard spport for the user id filtering.

 - The cacheinfo code is converted to use the generic infrastructure.

 - Cleanup and bug fixes.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (42 commits)
  s390/process: free vx save area when releasing tasks
  s390/hypfs: Eliminate hypfs interval
  s390/hypfs: Add diagnose 0c support
  s390/cacheinfo: don't use smp_processor_id() in preemptible context
  s390/zcrypt: fixed domain scanning problem (again)
  s390/smp: increase maximum value of NR_CPUS to 512
  s390/jump label: use different nop instruction
  s390/jump label: add sanity checks
  s390/mm: correct missing space when reporting user process faults
  s390/dasd: cleanup profiling
  s390/dasd: add locking for global_profile access
  s390/ftrace: hotpatch support for function tracing
  ftrace: let notrace function attribute disable hotpatching if necessary
  ftrace: allow architectures to specify ftrace compile options
  s390: reintroduce diag 44 calls for cpu_relax()
  s390/zcrypt: Add support for new crypto express (CEX5S) adapter.
  s390/zcrypt: Number of supported ap domains is not retrievable.
  s390/spinlock: add compare-and-delay to lock wait loops
  s390/tape: remove redundant if statement
  s390/hvc_iucv: add simple wildcard matches to the iucv allow filter
  ...
2015-02-11 17:42:32 -08:00
Heiko Carstens
c0a80c0c27 ftrace: allow architectures to specify ftrace compile options
If the kernel is compiled with function tracer support the -pg compile option
is passed to gcc to generate extra code into the prologue of each function.

This patch replaces the "open-coded" -pg compile flag with a CC_FLAGS_FTRACE
makefile variable which architectures can override if a different option
should be used for code generation.

Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2015-01-29 09:19:19 +01:00
Arnd Bergmann
89f703f093 X.509: shut up about included cert for silent build
Every kernel build that includes X.509 support prints out
a message like

 - Including cert signing_key.x509

This may be useful for some cases, but when doing automated
build tests, it just means noise.

To hide the message, this uses '$(kecho)' for printing the
message, which means we still see it when building with V=1,
but not at the normal level or when building with 'make -s'.

Signed-off-by: Arnd Bergmann <arnd@arnd.de>
Signed-off-by: David Howells <dhowells@redhat.com>
2015-01-23 12:10:39 +00:00
Seth Jennings
b700e7f03d livepatch: kernel: add support for live patching
This commit introduces code for the live patching core.  It implements
an ftrace-based mechanism and kernel interface for doing live patching
of kernel and kernel module functions.

It represents the greatest common functionality set between kpatch and
kgraft and can accept patches built using either method.

This first version does not implement any consistency mechanism that
ensures that old and new code do not run together.  In practice, ~90% of
CVEs are safe to apply in this way, since they simply add a conditional
check.  However, any function change that can not execute safely with
the old version of the function can _not_ be safely applied in this
version.

[ jkosina@suse.cz: due to the number of contributions that got folded into
  this original patch from Seth Jennings, add SUSE's copyright as well, as
  discussed via e-mail ]

Signed-off-by: Seth Jennings <sjenning@redhat.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Reviewed-by: Petr Mladek <pmladek@suse.cz>
Reviewed-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Petr Mladek <pmladek@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-12-22 15:40:49 +01:00
Johannes Weiner
5b1efc027c kernel: res_counter: remove the unused API
All memory accounting and limiting has been switched over to the
lockless page counters.  Bye, res_counter!

[akpm@linux-foundation.org: update Documentation/cgroups/memory.txt]
[mhocko@suse.cz: ditch the last remainings of res_counter]
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Vladimir Davydov <vdavydov@parallels.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: Tejun Heo <tj@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-12-10 17:41:04 -08:00
Alexei Starovoitov
f89b7755f5 bpf: split eBPF out of NET
introduce two configs:
- hidden CONFIG_BPF to select eBPF interpreter that classic socket filters
  depend on
- visible CONFIG_BPF_SYSCALL (default off) that tracing and sockets can use

that solves several problems:
- tracing and others that wish to use eBPF don't need to depend on NET.
  They can use BPF_SYSCALL to allow loading from userspace or select BPF
  to use it directly from kernel in NET-less configs.
- in 3.18 programs cannot be attached to events yet, so don't force it on
- when the rest of eBPF infra is there in 3.19+, it's still useful to
  switch it off to minimize kernel size

bloat-o-meter on x64 shows:
add/remove: 0/60 grow/shrink: 0/2 up/down: 0/-15601 (-15601)

tested with many different config combinations. Hopefully didn't miss anything.

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Acked-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-10-27 19:09:59 -04:00
Vivek Goyal
8370edea81 bin2c: move bin2c in scripts/basic
This patch series does not do kernel signature verification yet.  I plan
to post another patch series for that.  Now distributions are already
signing PE/COFF bzImage with PKCS7 signature I plan to parse and verify
those signatures.

Primary goal of this patchset is to prepare groundwork so that kernel
image can be signed and signatures be verified during kexec load.  This
should help with two things.

- It should allow kexec/kdump on secureboot enabled machines.

- In general it can help even without secureboot. By being able to verify
  kernel image signature in kexec, it should help with avoiding module
  signing restrictions. Matthew Garret showed how to boot into a custom
  kernel, modify first kernel's memory and then jump back to old kernel and
  bypass any policy one wants to.

This patch (of 15):

Kexec wants to use bin2c and it wants to use it really early in the build
process. See arch/x86/purgatory/ code in later patches.

So move bin2c in scripts/basic so that it can be built very early and
be usable by arch/x86/purgatory/

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Greg Kroah-Hartman <greg@kroah.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: WANG Chao <chaowang@redhat.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-08-08 15:57:32 -07:00
Linus Torvalds
ae045e2455 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller:
 "Highlights:

   1) Steady transitioning of the BPF instructure to a generic spot so
      all kernel subsystems can make use of it, from Alexei Starovoitov.

   2) SFC driver supports busy polling, from Alexandre Rames.

   3) Take advantage of hash table in UDP multicast delivery, from David
      Held.

   4) Lighten locking, in particular by getting rid of the LRU lists, in
      inet frag handling.  From Florian Westphal.

   5) Add support for various RFC6458 control messages in SCTP, from
      Geir Ola Vaagland.

   6) Allow to filter bridge forwarding database dumps by device, from
      Jamal Hadi Salim.

   7) virtio-net also now supports busy polling, from Jason Wang.

   8) Some low level optimization tweaks in pktgen from Jesper Dangaard
      Brouer.

   9) Add support for ipv6 address generation modes, so that userland
      can have some input into the process.  From Jiri Pirko.

  10) Consolidate common TCP connection request code in ipv4 and ipv6,
      from Octavian Purdila.

  11) New ARP packet logger in netfilter, from Pablo Neira Ayuso.

  12) Generic resizable RCU hash table, with intial users in netlink and
      nftables.  From Thomas Graf.

  13) Maintain a name assignment type so that userspace can see where a
      network device name came from (enumerated by kernel, assigned
      explicitly by userspace, etc.) From Tom Gundersen.

  14) Automatic flow label generation on transmit in ipv6, from Tom
      Herbert.

  15) New packet timestamping facilities from Willem de Bruijn, meant to
      assist in measuring latencies going into/out-of the packet
      scheduler, latency from TCP data transmission to ACK, etc"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1536 commits)
  cxgb4 : Disable recursive mailbox commands when enabling vi
  net: reduce USB network driver config options.
  tg3: Modify tg3_tso_bug() to handle multiple TX rings
  amd-xgbe: Perform phy connect/disconnect at dev open/stop
  amd-xgbe: Use dma_set_mask_and_coherent to set DMA mask
  net: sun4i-emac: fix memory leak on bad packet
  sctp: fix possible seqlock seadlock in sctp_packet_transmit()
  Revert "net: phy: Set the driver when registering an MDIO bus device"
  cxgb4vf: Turn off SGE RX/TX Callback Timers and interrupts in PCI shutdown routine
  team: Simplify return path of team_newlink
  bridge: Update outdated comment on promiscuous mode
  net-timestamp: ACK timestamp for bytestreams
  net-timestamp: TCP timestamping
  net-timestamp: SCHED timestamp on entering packet scheduler
  net-timestamp: add key to disambiguate concurrent datagrams
  net-timestamp: move timestamp flags out of sk_flags
  net-timestamp: extend SCM_TIMESTAMPING ancillary data struct
  cxgb4i : Move stray CPL definitions to cxgb4 driver
  tcp: reduce spurious retransmits due to transient SACK reneging
  qlcnic: Initialize dcbnl_ops before register_netdev
  ...
2014-08-06 09:38:14 -07:00
Alexei Starovoitov
f5bffecda9 net: filter: split filter.c into two files
BPF is used in several kernel components. This split creates logical boundary
between generic eBPF core and the rest

kernel/bpf/core.c: eBPF interpreter

net/core/filter.c: classic->eBPF converter, classic verifiers, socket filters

This patch only moves functions.

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-07-23 21:06:22 -07:00