* 'linux-4.14.y' of github.com:openela/kernel-lts:
LTS: Update to 4.14.348
docs: kernel_include.py: Cope with docutils 0.21
serial: kgdboc: Fix NMI-safety problems from keyboard reset code
btrfs: add missing mutex_unlock in btrfs_relocate_sys_chunks()
dm: limit the number of targets and parameter size area
Revert "selftests: mm: fix map_hugetlb failure on 64K page size systems"
LTS: Update to 4.14.347
rds: Fix build regression.
RDS: IB: Use DEFINE_PER_CPU_SHARED_ALIGNED for rds_ib_stats
af_unix: Suppress false-positive lockdep splat for spin_lock() in __unix_gc().
net: fix out-of-bounds access in ops_init
drm/vmwgfx: Fix invalid reads in fence signaled events
dyndbg: fix old BUG_ON in >control parser
tipc: fix UAF in error path
usb: gadget: f_fs: Fix a race condition when processing setup packets.
usb: gadget: composite: fix OS descriptors w_value logic
firewire: nosy: ensure user_length is taken into account when fetching packet contents
af_unix: Fix garbage collector racing against connect()
af_unix: Do not use atomic ops for unix_sk(sk)->inflight.
ipv6: fib6_rules: avoid possible NULL dereference in fib6_rule_action()
net/ipv6: Refactor fib6_rule_action
net: bridge: fix corrupted ethernet header on multicast-to-unicast
net: bridge: use DEV_STATS_INC()
phonet: fix rtm_phonet_notify() skb allocation
rtnetlink: Correct nested IFLA_VF_VLAN_LIST attribute validation
Bluetooth: l2cap: fix null-ptr-deref in l2cap_chan_timeout
Bluetooth: Fix use-after-free bugs caused by sco_sock_timeout
tcp: defer shutdown(SEND_SHUTDOWN) for TCP_SYN_RECV sockets
tcp: remove redundant check on tskb
net:usb:qmi_wwan: support Rolling modules
fs/9p: drop inodes immediately on non-.L too
gpio: crystalcove: Use -ENOTSUPP consistently
gpio: wcove: Use -ENOTSUPP consistently
9p: explicitly deny setlease attempts
fs/9p: translate O_TRUNC into OTRUNC
fs/9p: only translate RWX permissions for plain 9P2000
selftests: timers: Fix valid-adjtimex signed left-shift undefined behavior
scsi: target: Fix SELinux error when systemd-modules loads the target module
tools/power turbostat: Fix Bzy_MHz documentation typo
tools/power turbostat: Fix added raw MSR output
firewire: ohci: mask bus reset interrupts between ISR and bottom half
ata: sata_gemini: Check clk_enable() result
net: bcmgenet: Reset RBUF on first open
ALSA: line6: Zero-initialize message buffers
scsi: bnx2fc: Remove spin_lock_bh while releasing resources after upload
net: mark racy access on sk->sk_rcvbuf
wifi: mac80211: fix ieee80211_bss_*_flags kernel-doc
scsi: lpfc: Update lpfc_ramp_down_queue_handler() logic
tipc: fix a possible memleak in tipc_buf_append
net: bridge: fix multicast-to-unicast with fraglist GSO
net: dsa: mv88e6xxx: Fix number of databases for 88E6141 / 88E6341
net: dsa: mv88e6xxx: Fix name of switch 88E6141
net: dsa: mv88e6xxx: Add number of MACs in the ATU
net l2tp: drop flow hash on forward
nsh: Restore skb->{protocol,data,mac_header} for outer header in nsh_gso_segment().
bna: ensure the copied buf is NUL terminated
pinctrl: devicetree: fix refcount leak in pinctrl_dt_to_map()
power: rt9455: hide unused rt9455_boost_voltage_values
pinctrl: core: delete incorrect free in pinctrl_enable()
ethernet: Add helper for assigning packet type when dest address does not match device address
ethernet: add a helper for assigning port addresses
net: create netdev->dev_addr assignment helpers
net: slightly optimize eth_type_trans
wifi: nl80211: don't free NULL coalescing rule
dmaengine: Revert "dmaengine: pl330: issue_pending waits until WFP state"
dmaengine: pl330: issue_pending waits until WFP state
LTS: Update to 4.14.346
Simplify major/minor non-dynamic logic
net: fix unused variable warning in do_tcp_setsockopt()
serial: core: fix kernel-doc for uart_port_unlock_irqrestore()
HID: i2c-hid: remove I2C_HID_READ_PENDING flag to prevent lock-up
i2c: smbus: fix NULL function pointer dereference
i2c: add param sanity check to i2c_transfer()
idma64: Don't try to serve interrupts when device is powered off
mtd: diskonchip: work around ubsan link failure
stackdepot: respect __GFP_NOLOCKDEP allocation flag
net: b44: set pause params only when interface is up
irqchip/gic-v3-its: Prevent double free on error
arm64: dts: rockchip: enable internal pull-up for Q7_THRM# on RK3399 Puma
btrfs: fix information leak in btrfs_ioctl_logical_to_ino()
Bluetooth: Fix type of len in {l2cap,sco}_sock_getsockopt_old()
tracing: Increase PERF_MAX_TRACE_SIZE to handle Sentinel1 and docker together
tracing: Show size of requested perf buffer
Revert "crypto: api - Disallow identical driver names"
drm/amdgpu: validate the parameters of bo mapping operations more clearly
amdgpu: validate offset_in_bo of drm_amdgpu_gem_va
drm/amdgpu: restrict bo mapping within gpu address limits
serial: mxs-auart: add spinlock around changing cts state
serial: core: Provide port lock wrappers
i40e: Do not use WQ_MEM_RECLAIM flag for workqueue
ipvs: Fix checksumming on GSO of SCTP packets
bpf: fix bpf_skb_adjust_net/bpf_skb_proto_xlat to deal with gso sctp skbs
docs: segmentation-offloads.txt: add SCTP info
net: gtp: Fix Use-After-Free in gtp_dellink
net: usb: ax88179_178a: stop lying about skb->truesize
NFC: trf7970a: disable all regulators on removal
mlxsw: core: Unregister EMAD trap using FORWARD action
vxlan: drop packets from invalid src-address
ARC: [plat-hsdk]: Remove misplaced interrupt-cells property
arm64: dts: rockchip: enable internal pull-up on PCIE_WAKE# for RK3399 Puma
arm64: dts: rockchip: fix alphabetical ordering RK3399 puma
nilfs2: fix OOB in nilfs_set_de_type
fs: sysfs: Fix reference leak in sysfs_break_active_protection()
speakup: Avoid crash on very long word
usb: dwc2: host: Fix dereference issue in DDMA completion flow.
Revert "usb: cdc-wdm: close race between read and workqueue"
USB: serial: option: add Telit FN920C04 rmnet compositions
USB: serial: option: add Rolling RW101-GL and RW135-GL support
USB: serial: option: support Quectel EM060K sub-models
USB: serial: option: add Lonsung U8300/U9300 product
USB: serial: option: add support for Fibocom FM650/FG650
USB: serial: option: add Fibocom FM135-GL variants
serial/pmac_zilog: Remove flawed mitigation for rx irq flood
comedi: vmk80xx: fix incomplete endpoint checking
drm: nv04: Fix out of bounds access
tun: limit printing rate when illegal packet received by tun dev
netfilter: nf_tables: Fix potential data-race in __nft_expr_type_get()
netfilter: nf_tables: __nft_expr_type_get() selects specific family type
Revert "tracing/trigger: Fix to return error if failed to alloc snapshot"
kprobes: Fix possible use-after-free issue on kprobe registration
selftests/ftrace: Limit length in subsystem-enable tests
x86/apic: Force native_apic_mem_read() to use the MOV instruction
selftests: timers: Fix abs() warning in posix_timers test
vhost: Add smp_rmb() in vhost_vq_avail_empty()
tracing: hide unused ftrace_event_id_fops
net/mlx5: Properly link new fs rules into the tree
ipv6: fix race condition between ipv6_get_ifaddr and ipv6_del_addr
ipv4/route: avoid unused-but-set-variable warning
geneve: fix header validation in geneve[6]_xmit_skb
nouveau: fix function cast warning
Bluetooth: Fix memory leak in hci_req_sync_complete()
batman-adv: Avoid infinite loop trying to resize local TT
LTS: Update to 4.14.345
net: check vlan filter feature in vlan_vids_add_by_dev() and vlan_vids_del_by_dev()
Revert "net: check vlan filter feature in vlan_vids_add_by_dev() and vlan_vids_del_by_dev()"
netfilter: nftables: exthdr: fix 4-byte stack OOB write
ext4: fix to check return value of freeze_bdev() in ext4_shutdown()
Revert "ext4: fix to check return value of freeze_bdev() in ext4_shutdown()"
VMCI: Fix possible memcpy() run-time warning in vmci_datagram_invoke_guest_handler()
Bluetooth: btintel: Fixe build regression
x86/mm/pat: fix VM_PAT handling in COW mappings
virtio: reenable config if freezing device failed
tty: n_gsm: require CAP_NET_ADMIN to attach N_GSM0710 ldisc
fbmon: prevent division by zero in fb_videomode_from_videomode()
fbdev: viafb: fix typo in hw_bitblt_1 and hw_bitblt_2
usb: sl811-hcd: only defined function checkdone if QUIRK2 is defined
tools: iio: replace seekdir() in iio_generic_buffer
block: prevent division by zero in blk_rq_stat_sum()
SUNRPC: increase size of rpc_wait_queue.qlen from unsigned short to unsigned int
media: sta2x11: fix irq handler cast
isofs: handle CDs with bad root inode but good Joliet root directory
scsi: lpfc: Fix possible memory leak in lpfc_rcv_padisc()
sysv: don't call sb_bread() with pointers_lock held
Input: synaptics-rmi4 - fail probing if memory allocation for "phys" fails
Bluetooth: btintel: Fix null ptr deref in btintel_read_version
btrfs: send: handle path ref underflow in header iterate_inode_ref()
btrfs: export: handle invalid inode or root reference in btrfs_get_parent()
btrfs: handle chunk tree lookup error in btrfs_relocate_sys_chunks()
tools/power x86_energy_perf_policy: Fix file leak in get_pkg_num()
arm64: dts: rockchip: fix rk3399 hdmi ports node
VMCI: Fix memcpy() run-time warning in dg_dispatch_as_host()
wifi: ath9k: fix LNA selection in ath_ant_try_scan()
ALSA: hda/realtek: Update Panasonic CF-SZ6 quirk to support headset with microphone
ata: sata_mv: Fix PCI device ID table declaration compilation warning
ata: sata_sx4: fix pdc20621_get_from_dimm() on 64-bit
ASoC: ops: Fix wraparound for mask in snd_soc_get_volsw
init: open /initrd.image with O_LARGEFILE
staging: vc04_services: fix information leak in create_component()
staging: vc04_services: changen strncpy() to strscpy_pad()
staging: mmal-vchiq: Fix client_component for 64 bit kernel
staging: mmal-vchiq: Allocate and free components as required
staging: mmal-vchiq: Avoid use of bool in structures
ipv6: Fix infinite recursion in fib6_dump_done().
selftests: reuseaddr_conflict: add missing new line at the end of the output
net/sched: act_skbmod: prevent kernel-infoleak
net: stmmac: fix rx queue priority assignment
net: stmmac: Fix issues when number of Queues >= 4
mm, vmscan: prevent infinite loop for costly GFP_NOIO | __GFP_RETRY_MAYFAIL allocations
Revert "x86/mm/ident_map: Use gbpages only where full GB page should be mapped."
netfilter: nf_tables: disallow timeout for anonymous sets
Bluetooth: Fix TOCTOU in HCI debugfs implementation
Bluetooth: hci_event: set the conn encrypted before conn establishes
tcp: properly terminate timers for kernel sockets
mptcp: add sk_stop_timer_sync helper
nfc: nci: Fix uninit-value in nci_dev_up and nci_ntf_packet
USB: core: Fix deadlock in usb_deauthorize_interface()
scsi: lpfc: Correct size for wqe for memset()
x86/cpu: Enable STIBP on AMD if Automatic IBRS is enabled
scsi: qla2xxx: Fix command flush on cable pull
usb: udc: remove warning when queue disabled ep
usb: dwc2: host: Fix ISOC flow in DDMA mode
usb: dwc2: host: Fix hibernation flow
powerpc: xor_vmx: Add '-mhard-float' to CFLAGS
efivarfs: Request at most 512 bytes for variable names
perf/core: Fix reentry problem in perf_output_read_group()
loop: Call loop_config_discard() only after new config is applied
Revert "loop: Check for overflow while configuring loop"
btrfs: allocate btrfs_ioctl_defrag_range_args on stack
btrfs: add define for oldest generation
printk: Update @console_may_schedule in console_trylock_spinning()
fs/aio: Check IOCB_AIO_RW before the struct aio_kiocb conversion
ALSA: sh: aica: reorder cleanup operations to avoid UAF bugs
ALSA: aica: Fix a long-time build breakage
ALSA: sh: aica: Convert timers to use timer_setup()
usb: cdc-wdm: close race between read and workqueue
USB: cdc-wdm: Fix use after free in service_outstanding_interrupt().
exec: Fix NOMMU linux_binprm::exec in transfer_args_to_stack()
wifi: mac80211: check/clear fast rx for non-4addr sta VLAN changes
mm/migrate: set swap entry values of THP tail pages properly.
mm/memory-failure: fix an incorrect use of tail pages
vt: fix memory overlapping when deleting chars in the buffer
tty: serial: fsl_lpuart: avoid idle preamble pending if CTS is enabled
usb: port: Don't try to peer unused USB ports based on location
usb: gadget: ncm: Fix handling of zero block length packets
USB: usb-storage: Prevent divide-by-0 error in isd200_ata_command
ALSA: hda/realtek - Fix headset Mic no show at resume back for Lenovo ALC897 platform
xfrm: Avoid clang fortify warning in copy_to_user_tmpl()
netfilter: nf_tables: reject constant set with timeout
netfilter: nf_tables: disallow anonymous set with timeout flag
comedi: comedi_test: Prevent timers rescheduling during deletion
ahci: asm1064: asm1166: don't limit reported ports
ahci: asm1064: correct count of reported ports
nilfs2: prevent kernel bug at submit_bh_wbc()
nilfs2: use a more common logging style
nilfs2: fix failure to detect DAT corruption in btree and direct mappings
memtest: use {READ,WRITE}_ONCE in memory scanning
drm/vc4: hdmi: do not return negative values from .get_modes()
drm/imx/ipuv3: do not return negative values from .get_modes()
s390/zcrypt: fix reference counting on zcrypt card objects
soc: fsl: qbman: Use raw spinlock for cgr_lock
soc: fsl: qbman: Add CGR update function
soc: fsl: qbman: Add helper for sanity checking cgr ops
soc: fsl: qbman: Always disable interrupts when taking cgr_lock
vfio/platform: Disable virqfds on cleanup
kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1
speakup: Fix 8bit characters from direct synth
ext4: fix corruption during on-line resize
hwmon: (amc6821) add of_match table
mmc: core: Fix switch on gp3 partition
dm-raid: fix lockdep waring in "pers->hot_add_disk"
Revert "Revert "md/raid5: Wait for MD_SB_CHANGE_PENDING in raid5d""
PCI/PM: Drain runtime-idle callbacks before driver removal
PCI: Drop pci_device_remove() test of pci_dev->driver
fuse: don't unhash root
mmc: tmio: avoid concurrent runs of mmc_request_done()
PM: sleep: wakeirq: fix wake irq warning in system suspend
USB: serial: cp210x: add pid/vid for TDK NC0110013M and MM0110113M
USB: serial: option: add MeiG Smart SLM320 product
USB: serial: cp210x: add ID for MGP Instruments PDS100
USB: serial: add device ID for VeriFone adapter
USB: serial: ftdi_sio: add support for GMC Z216C Adapter IR-USB
powerpc/fsl: Fix mfpmr build errors with newer binutils
clk: qcom: mmcc-msm8974: fix terminating of frequency table arrays
clk: qcom: mmcc-apq8084: fix terminating of frequency table arrays
PM: suspend: Set mem_sleep_current during kernel command line setup
parisc: Strip upper 32 bit of sum in csum_ipv6_magic for 64-bit builds
parisc: Fix csum_ipv6_magic on 64-bit systems
parisc: Fix csum_ipv6_magic on 32-bit systems
parisc: Fix ip_fast_csum
parisc: Do not hardcode registers in checksum functions
ubi: correct the calculation of fastmap size
ubi: Check for too small LEB size in VTBL code
ubifs: Set page uptodate in the correct place
fat: fix uninitialized field in nostale filehandles
crypto: qat - resolve race condition during AER recovery
crypto: qat - fix double free during reset
sparc64: NMI watchdog: fix return value of __setup handler
KVM: Always flush async #PF workqueue when vCPU is being destroyed
media: xc4000: Fix atomicity violation in xc4000_get_frequency
arm: dts: marvell: Fix maxium->maxim typo in brownstone dts
ARM: dts: mmp2-brownstone: Don't redeclare phandle references
smack: Handle SMACK64TRANSMUTE in smack_inode_setsecurity()
smack: Set SMACK64TRANSMUTE only for dirs in smack_inode_setxattr()
wifi: brcmfmac: Fix use-after-free bug in brcmf_cfg80211_detach
x86/bugs: Use sysfs_emit()
x86/pti: Don't report XenPV as vulnerable
x86/cpu: Support AMD Automatic IBRS
Documentation/hw-vuln: Update spectre doc
LTS: Update to 4.14.344
binder: signal epoll threads of self-work
ANDROID: binder: Add thread->process_todo flag.
scsi: bnx2fc: Fix skb double free in bnx2fc_rcv()
scsi: bnx2fc: Remove set but not used variable 'oxid'
net: check dev->gso_max_size in gso_features_check()
driver: staging: count ashmem_range into SLAB_RECLAIMBLE
net: warn if gso_type isn't set for a GSO SKB
staging: android: ashmem: Remove use of unlikely()
ALSA: hda/realtek: Enable headset on Lenovo M90 Gen5
ALSA: hda/realtek: Enable headset onLenovo M70/M90
ALSA: hda/realtek: Add quirk for Lenovo TianYi510Pro-14IOB
ALSA: hda/realtek - ALC897 headset MIC no sound
ALSA: hda/realtek - Add headset Mic support for Lenovo ALC897 platform
ALSA: hda/realtek: Fix the mic type detection issue for ASUS G551JW
ALSA: hda/realtek - The front Mic on a HP machine doesn't work
ALSA: hda/realtek - Enable the headset of Acer N50-600 with ALC662
ALSA: hda/realtek - Enable headset mic of Acer X2660G with ALC662
ALSA: hda/realtek - Add Headset Mic supported for HP cPC
ALSA: hda/realtek - More constifications
Add Acer Aspire Ethos 8951G model quirk
devcoredump: Send uevent once devcd is ready
devcoredump : Serialize devcd_del work
netfilter: xt_owner: Fix for unsafe access of sk->sk_socket
netfilter: xt_owner: Add supplementary groups option
mtd: cfi_cmdset_0001: Byte swap OTP info
mtd: cfi_cmdset_0001: Support the absence of protection registers
s390/cmma: fix detection of DAT pages
s390/mm: fix phys vs virt confusion in mark_kernel_pXd() functions family
ALSA: hda/realtek: Headset Mic VREF to 100%
hfsplus: unmap the page in the "fail_page" label
ALSA: hda/realtek - Fix microphone noise on ASUS TUF B550M-PLUS
ALSA: hda/realtek: Enable audio jacks of ASUS D700SA with ALC887
ALSA: hda/realtek - Add quirk for Tuxedo XC 1509
ALSA: hda/realtek - Headset microphone and internal speaker support for System76 oryp5
ALSA: hda/realtek - Clevo P950ER ALC1220 Fixup
ALSA: hda/realtek - Add support for ALC1220
hv_netvsc: Fix race of register_netdevice_notifier and VF register
hv_netvsc: use reciprocal divide to speed up percent calculation
pwm: sti: Reduce number of allocations and drop usage of chip_data
pwm: sti: Avoid conditional gotos
tools: iio: iio_generic_buffer ensure alignment
tools: iio: iio_generic_buffer: Fix some integer type and calculation
tools: iio: privatize globals and functions in iio_generic_buffer.c file
leds: trigger: ledtrig-cpu:: Fix 'output may be truncated' issue for 'cpu'
ledtrig-cpu: Limit to 8 CPUs
leds: pwm: Don't disable the PWM when the LED should be off
leds: pwm: convert to atomic PWM API
leds: pwm: simplify if condition
regmap: debugfs: Fix a erroneous check after snprintf()
regmap: Allow missing device in regmap_name_read_file()
tcp_metrics: add missing barriers on delete
tcp: batch tcp_net_metrics_exit
tcp: fix excessive TLP and RACK timeouts from HZ rounding
tcp: Namespace-ify sysctl_tcp_early_retrans
net: nfc: fix races in nfc_llcp_sock_get() and nfc_llcp_sock_get_sn()
ata: libata-core: Do not register PM operations for SAS ports
libata: make ata_port_type const
libata: Add new med_power_with_dipm link_power_management_policy setting
ALSA: hda: Disable power save for solving pop issue on Lenovo ThinkCentre M70q
ALSA: hda - add Lenovo IdeaCentre B550 to the power_save_blacklist
ALSA: hda: Add Intel NUC7i3BNB to the power_save blacklist
ext4: mark group as trimmed only if it was fully scanned
ext4: add new helper interface ext4_try_to_trim_range()
ext4: remove the 'group' parameter of ext4_trim_extent
scsi: qla2xxx: Remove unsupported ql2xenabledif option
scsi: qla2xxx: Add protection mask module parameters
scsi: qla2xxx: Add option for use reserve exch for ELS
scsi: qla2xxx: Reinstate module parameter ql2xenablemsix
scsi: lpfc: remove redundant null check on eqe
usb: typec: tcpci: clear the fault status bit
usb: typec: add fwnode to tcpc
staging: typec: fix endianness mismatch identified by sparse
staging: typec: tcpm: Document data structures
serial: sc16is7xx: fix broken port 0 uart init
sc16is7xx: Set iobase to device index
dlm: fix plock lookup when using multiple lockspaces
drm/tegra: dpaux: Fix incorrect return value of platform_get_irq
drm/tegra: Remove superfluous error messages around platform_get_irq()
ARM: dts: BCM53573: Drop nonexistent #usb-cells
ARM: dts: BCM5301X: Harmonize EHCI/OHCI DT nodes name
wifi: ath9k: fix races between ath9k_wmi_cmd and ath9k_wmi_ctrl_rx
ath9k: use irqsave() in USB's complete callback
wifi: mwifiex: fix error recovery in PCIE buffer descriptor management
mwifiex: switch from 'pci_' to 'dma_' API
mwifiex: drop 'set_consistent_dma_mask' log message
bonding: fix macvlan over alb bond support
net: remove bond_slave_has_mac_rcu()
fbdev: fix potential OOB read in fast_imageblit()
fbdev: Fix sys_imageblit() for arbitrary image widths
fbdev: Improve performance of sys_imageblit()
tty: serial: fsl_lpuart: add earlycon for imx8ulp platform
Revert "tty: serial: fsl_lpuart: drop earlycon entry for i.MX8QXP"
MIPS: cpu-features: Use boot_cpu_type for CPU type based features
MIPS: cpu-features: Enable octeon_cache by cpu_type
fs: dlm: fix mismatch of plock results from userspace
fs: dlm: use dlm_plock_info for do_unlock_close
fs: dlm: change plock interrupted message to debug again
fs: dlm: add pid to debug log
dlm: replace usage of found with dedicated list iterator variable
dlm: improve plock logging if interrupted
nfsd: Remove incorrect check in nfsd4_validate_stateid
nfsd4: kill warnings on testing stateids with mismatched clientids
mmc: meson-gx: remove redundant mmc_request_done() call from irq context
mmc: meson-gx: remove useless lock
PM: sleep: wakeirq: fix wake irq arming
PM / wakeirq: support enabling wake-up irq after runtime_suspend called
scsi: zfcp: Defer fc_rport blocking until after ADISC response
scsi: zfcp: workqueue: set description for port work items with their WWPN as context
btrfs: check for commit error at btrfs_attach_transaction_barrier()
btrfs: simplify IS_ERR/PTR_ERR checks
fs: dlm: interrupt posix locks only when process is killed
dlm: rearrange async condition return
dlm: cleanup plock_op vs plock_xop
ext4: Fix reusing stale buffer heads from last failed mounting
ext4: rename journal_dev to s_journal_dev inside ext4_sb_info
tcp: annotate data-races around tp->linger2
net: Replace the limit of TCP_LINGER2 with TCP_FIN_TIMEOUT_MAX
ceph: don't let check_caps skip sending responses for revoke msgs
ceph: define argument structure for handle_cap_grant
net: bcmgenet: Ensure MDIO unregistration has clocks enabled
net: bcmgenet: Avoid calling platform_device_put() twice in bcmgenet_mii_exit()
net: tcp_input: Neaten DBGUNDO
i2c: xiic: Don't try to handle more interrupt events after error
i2c: xiic: Defer xiic_wakeup() and __xiic_start_xfer() in xiic_process()
i2c: xiic: Fix broken locking on tx_msg
i2c: xiic: Change code alignment to 1 space only
i2c: xiic: Add timeout to the rx fifo wait loop
i2c: xiic: Fix kerneldoc warnings
hwrng: virtio - Fix race on data_avail and actual data
hwrng: virtio - always add a pending request
hwrng: virtio - don't waste entropy
hwrng: virtio - don't wait on cleanup
hwrng: virtio - add an internal buffer
nfc: llcp: fix possible use of uninitialized variable in nfc_llcp_send_connect()
nfc: constify several pointers to u8, char and sk_buff
irqchip/jcore-aic: Fix missing allocation of IRQ descriptors
irqchip/jcore-aic: Kill use of irq_create_strict_mappings()
Documentation: fix little inconsistencies
usb: musb: fix MUSB_QUIRK_B_DISCONNECT_99 handling
net/rose: fix races in rose_kill_by_device()
reset: Fix crash when freeing non-existent optional resets
ksmbd: fix wrong name of SMB2_CREATE_ALLOCATION_SIZE
PCI: keystone: Don't discard .probe() callback
PCI: keystone: Don't discard .remove() callback
can: dev: can_restart(): fix race condition between controller restart and netif_carrier_on()
can: dev: can_restart(): don't crash kernel if carrier is OK
r8169: fix the KCSAN reported data-race in rtl_tx while reading TxDescArray[entry].opts1
xen-netback: use default TX queue size for vifs
MIPS: Alchemy: only build mmc support helpers if au1xmmc is enabled
arm64: dts: qcom: msm8996: Add missing interrupt to the USB2 controller
sched/rt: pick_next_rt_entity(): check list_entry
regmap: Account for register length in SMBus I/O limits
x86/topology: Fix erroneous smp_num_siblings on Intel Hybrid platforms
ASoC: cs42l51: fix driver to properly autoload with automatic module loading
PCI: qcom: Disable write access to read only registers for IP v2.3.3
pinctrl: amd: Only use special debounce behavior for GPIO 0
IB/hfi1: Fix sdma.h tx->num_descs off-by-one error
usb: fotg210-hcd: delete an incorrect bounds test
smb: client: fix OOB in smbCalcSize()
btrfs: do not allow non subvolume root targets for snapshot
pinctrl: at91-pio4: use dedicated lock class for IRQ
net: check vlan filter feature in vlan_vids_add_by_dev() and vlan_vids_del_by_dev()
arm64: dts: mediatek: mt8173-evb: Fix regulator-fixed node names
IB/isert: Fix unaligned immediate-data handling
fbdev: stifb: Make the STI next font pointer a 32-bit signed offset
smb3: fix touch -h of symlink
MIPS: KVM: Fix a build warning about variable set but not used
cifs: spnego: add ';' in HOST_KEY_LEN
macvlan: Don't propagate promisc change to lower dev in passthru
ppp: limit MRU to 64K
ptp: annotate data-race around q->head and q->tail
xen/events: fix delayed eoi list handling
tipc: Fix kernel-infoleak due to uninitialized TLV value
tty: Fix uninit-value access in ppp_sync_receive()
iio: exynos-adc: request second interupt only when touchscreen mode is used
selftests/ftrace: Add new test case which checks non unique symbol
media: v4l2-fwnode: fix v4l2_fwnode_parse_link handling
block: fix signed int overflow in Amiga partition support
iio: addac: stx104: Fix race condition for stx104_write_raw()
ext4: fix to check return value of freeze_bdev() in ext4_shutdown()
btrfs: fix extent buffer leak after tree mod log failure at split_node()
pinctrl: amd: Detect internal GPIO0 debounce handling
ALSA: jack: Fix mutex call in snd_jack_report()
IB/hfi1: Fix sdma.h tx->num_descs off-by-one errors
ARM: 9303/1: kprobes: avoid missing-declaration warnings
LTS: Update to 4.14.343
crypto: af_alg - Work around empty control messages without MSG_MORE
crypto: af_alg - Fix regression on empty requests
spi: spi-mt65xx: Fix NULL pointer access in interrupt handler
net/bnx2x: Prevent access to a freed page in page_pool
hsr: Handle failures in module init
rds: introduce acquire/release ordering in acquire/release_in_xmit()
hsr: Fix uninit-value access in hsr_get_node()
net: hsr: fix placement of logical operator in a multi-line statement
usb: gadget: net2272: Use irqflags in the call to net2272_probe_fin
staging: greybus: fix get_channel_from_mode() failure path
serial: 8250_exar: Don't remove GPIO device on suspend
rtc: mt6397: select IRQ_DOMAIN instead of depending on it
rtc: mediatek: enhance the description for MediaTek PMIC based RTC
tty: serial: samsung: fix tx_empty() to return TIOCSER_TEMT
serial: max310x: fix syntax error in IRQ error message
clk: qcom: gdsc: Add support to update GDSC transition delay
NFS: Fix an off by one in root_nfs_cat()
net: sunrpc: Fix an off by one in rpc_sockaddr2uaddr()
scsi: bfa: Fix function pointer type mismatch for hcb_qe->cbfn
scsi: csiostor: Avoid function pointer casts
ALSA: usb-audio: Stop parsing channels bits when all channels are found.
sparc32: Fix section mismatch in leon_pci_grpci
backlight: lp8788: Fully initialize backlight_properties during probe
backlight: lm3639: Fully initialize backlight_properties during probe
backlight: da9052: Fully initialize backlight_properties during probe
backlight: lm3630a: Don't set bl->props.brightness in get_brightness
backlight: lm3630a: Initialize backlight_properties on init
powerpc/embedded6xx: Fix no previous prototype for avr_uart_send() etc.
powerpc/hv-gpci: Fix the H_GET_PERF_COUNTER_INFO hcall return value checks
drm/mediatek: Fix a null pointer crash in mtk_drm_crtc_finish_page_flip
media: go7007: fix a memleak in go7007_load_encoder
media: dvb-frontends: avoid stack overflow warnings with clang
media: pvrusb2: fix uaf in pvr2_context_set_notify
drm/amdgpu: Fix missing break in ATOM_ARG_IMM Case of atom_get_src_int()
mtd: rawnand: lpc32xx_mlc: fix irq handler prototype
crypto: arm/sha - fix function cast warnings
crypto: arm - Rename functions to avoid conflict with crypto/sha256.h
mfd: syscon: Call of_node_put() only when of_parse_phandle() takes a ref
drm/tegra: put drm_gem_object ref on error in tegra_fb_create
clk: hisilicon: hi3519: Release the correct number of gates in hi3519_clk_unregister()
PCI: Mark 3ware-9650SE Root Port Extended Tags as broken
drm/mediatek: dsi: Fix DSI RGB666 formats and definitions
media: pvrusb2: fix pvr2_stream_callback casts
media: go7007: add check of return value of go7007_read_addr()
ALSA: seq: fix function cast warnings
drm/radeon/ni: Fix wrong firmware size logging in ni_init_microcode()
perf thread_map: Free strlist on normal path in thread_map__new_by_tid_str()
quota: Fix rcu annotations of inode dquot pointers
quota: Fix potential NULL pointer dereference
quota: simplify drop_dquot_ref()
quota: check time limit when back out space/inode change
fs/quota: erase unused but set variable warning
quota: code cleanup for __dquot_alloc_space()
clk: qcom: reset: Ensure write completion on reset de/assertion
clk: qcom: reset: Commonize the de/assert functions
clk: qcom: reset: support resetting multiple bits
clk: qcom: reset: Allow specifying custom reset delay
media: edia: dvbdev: fix a use-after-free
media: dvb-core: Fix use-after-free due to race at dvb_register_device()
media: dvbdev: convert DVB device types into an enum
media: dvbdev: fix error logic at dvb_register_device()
media: dvbdev: Fix memleak in dvb_register_device
media: media/dvb: Use kmemdup rather than duplicating its implementation
media: dvbdev: remove double-unlock
media: v4l2-tpg: fix some memleaks in tpg_alloc
media: em28xx: annotate unchecked call to media_device_register()
media: tc358743: register v4l2 async device only after successful setup
drm: Don't treat 0 as -1 in drm_fixp2int_ceil
drm/rockchip: inno_hdmi: Fix video timing
drm/tegra: dsi: Fix missing pm_runtime_disable() in the error handling path of tegra_dsi_probe()
drm/tegra: dsi: Fix some error handling paths in tegra_dsi_probe()
drm/tegra: dsi: Make use of the helper function dev_err_probe()
gpu: host1x: mipi: Update tegra_mipi_request() to be node based
drm/tegra: dsi: Add missing check for of_find_device_by_node
dm: call the resume method on internal suspend
dm raid: fix false positive for requeue needed during reshape
net/x25: fix incorrect parameter validation in the x25_getsockopt() function
net: kcm: fix incorrect parameter validation in the kcm_getsockopt) function
udp: fix incorrect parameter validation in the udp_lib_getsockopt() function
l2tp: fix incorrect parameter validation in the pppol2tp_getsockopt() function
tcp: fix incorrect parameter validation in the do_tcp_getsockopt() function
ipv6: fib6_rules: flush route cache when rule is changed
bpf: Fix stackmap overflow check on 32-bit arches
bpf: Fix hashtab overflow check on 32-bit arches
sr9800: Add check for usbnet_get_endpoints
Bluetooth: hci_core: Fix possible buffer overflow
Bluetooth: Remove superfluous call to hci_conn_check_pending()
igb: Fix missing time sync events
igb: move PEROUT and EXTTS isr logic to separate functions
mmc: wmt-sdmmc: remove an incorrect release_mem_region() call in the .remove function
SUNRPC: fix some memleaks in gssx_dec_option_array
x86, relocs: Ignore relocations in .notes section
ACPI: scan: Fix device check notification handling
ARM: dts: arm: realview: Fix development chip ROM compatible value
wifi: brcmsmac: avoid function pointer casts
iommu/amd: Mark interrupt as managed
bus: tegra-aconnect: Update dependency to ARCH_TEGRA
ACPI: processor_idle: Fix memory leak in acpi_processor_power_exit()
wifi: libertas: fix some memleaks in lbs_allocate_cmd_buffer()
af_unix: Annotate data-race of gc_in_progress in wait_for_unix_gc().
sock_diag: annotate data-races around sock_diag_handlers[family]
sock_diag: request _diag module only when the family or proto has been registered
wifi: mwifiex: debugfs: Drop unnecessary error check for debugfs_create_dir()
wifi: b43: Disable QoS for bcm4331
wifi: b43: Stop correct queue in DMA worker when QoS is disabled
b43: main: Fix use true/false for bool type
wifi: b43: Stop/wake correct queue in PIO Tx path when QoS is disabled
wifi: b43: Stop/wake correct queue in DMA Tx path when QoS is disabled
b43: dma: Fix use true/false for bool type variable
timekeeping: Fix cross-timestamp interpolation for non-x86
timekeeping: Fix cross-timestamp interpolation corner case decision
timekeeping: Fix cross-timestamp interpolation on counter wrap
aoe: fix the potential use-after-free problem in aoecmd_cfg_pkts
md: Don't clear MD_CLOSING when the raid is about to stop
md: implement ->set_read_only to hook into BLKROSET processing
block: add a new set_read_only method
md: switch to ->check_events for media change notifications
fs/select: rework stack allocation hack for clang
do_sys_name_to_handle(): use kzalloc() to fix kernel-infoleak
crypto: algif_aead - Only wake up when ctx->more is zero
crypto: af_alg - make some functions static
ASoC: wm8962: Fix up incorrect error message in wm8962_set_fll
ASoC: wm8962: Enable both SPKOUTR_ENA and SPKOUTL_ENA in mono mode
ASoC: wm8962: Enable oscillator if selecting WM8962_FLL_OSC
Input: gpio_keys_polled - suppress deferred probe error for gpio
firewire: core: use long bus reset on gap count error
Bluetooth: rfcomm: Fix null-ptr-deref in rfcomm_check_security
scsi: mpt3sas: Prevent sending diag_reset when the controller is ready
dm-verity, dm-crypt: align "struct bvec_iter" correctly
block: sed-opal: handle empty atoms when parsing response
net/iucv: fix the allocation size of iucv_path_table array
MIPS: Clear Cause.BD in instruction_pointer_set
x86/xen: Add some null pointer checking to smp.c
x86/xen: Fix memory leak in xen_smp_intr_init{_pv}()
xen/events: only register debug interrupt for 2-level events
LTS: Update to 4.14.342
selftests/vm: fix map_hugetlb length used for testing read and write
selftests/vm: fix display of page size in map_hugetlb
getrusage: use sig->stats_lock rather than lock_task_sighand()
getrusage: use __for_each_thread()
getrusage: move thread_group_cputime_adjusted() outside of lock_task_sighand()
getrusage: add the "signal_struct *sig" local variable
hv_netvsc: use netif_is_bond_master() instead of open code
um: allow not setting extra rpaths in the linux binary
selftests: mm: fix map_hugetlb failure on 64K page size systems
tools/selftest/vm: allow choosing mem size and page size in map_hugetlb
netrom: Fix data-races around sysctl_net_busy_read
netrom: Fix a data-race around sysctl_netrom_link_fails_count
netrom: Fix a data-race around sysctl_netrom_routing_control
netrom: Fix a data-race around sysctl_netrom_transport_no_activity_timeout
netrom: Fix a data-race around sysctl_netrom_transport_requested_window_size
netrom: Fix a data-race around sysctl_netrom_transport_busy_delay
netrom: Fix a data-race around sysctl_netrom_transport_acknowledge_delay
netrom: Fix a data-race around sysctl_netrom_transport_maximum_tries
netrom: Fix a data-race around sysctl_netrom_transport_timeout
netrom: Fix data-races around sysctl_netrom_network_ttl_initialiser
netrom: Fix a data-race around sysctl_netrom_obsolescence_count_initialiser
netrom: Fix a data-race around sysctl_netrom_default_path_quality
netfilter: nf_conntrack_h323: Add protection for bmp length out of range
netfilter: nf_ct_h323: Extend nf_h323_error_boundary to work on bits as well
netfilter: nf_ct_h323: Convert CHECK_BOUND macro to function
netfilter: nf_ct_h323: Out Of Bound Read in Netfilter Conntrack
netfilter: nf_conntrack_h323: Remove typedef struct
geneve: make sure to pull inner header in geneve_rx()
net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb
net: move definition of pcpu_lstats to header file
net: lan78xx: fix runtime PM count underflow on link stop
lan78xx: Fix race conditions in suspend/resume handling
lan78xx: Fix partial packet errors on suspend/resume
lan78xx: Add missing return code checks
lan78xx: Fix white space and style issues
net: usb: lan78xx: Remove lots of set but unused 'ret' variables
net: usb: lan78xx: Disable interrupts before calling generic_handle_irq()
net: lan78xx: Allow for VLAN headers in timeout calcs
ip: validate header length on virtual device xmit
LTS: Update to 4.14.341
gpio: 74x164: Enable output pins after registers are reset
cachefiles: fix memory leak in cachefiles_add_cache()
mmc: core: Fix eMMC initialization with 1-bit bus connection
btrfs: dev-replace: properly validate device names
wifi: nl80211: reject iftype change with mesh ID change
gtp: fix use-after-free and null-ptr-deref in gtp_newlink()
ALSA: Drop leftover snd-rtctimer stuff from Makefile
power: supply: bq27xxx-i2c: Do not free non existing IRQ
efi/capsule-loader: fix incorrect allocation size
Bluetooth: Enforce validation on max value of connection interval
Bluetooth: hci_event: Fix handling of HCI_EV_IO_CAPA_REQUEST
Bluetooth: Avoid potential use-after-free in hci_error_reset
net: usb: dm9601: fix wrong return value in dm9601_mdio_read
lan78xx: enable auto speed configuration for LAN7850 if no EEPROM is detected
netlink: Fix kernel-infoleak-after-free in __skb_datagram_iter
Conflicts:
drivers/android/binder.c
drivers/block/loop.c
drivers/mmc/host/meson-gx-mmc.c
drivers/staging/typec/tcpm.h
drivers/usb/typec/tcpm/tcpm.c
fs/aio.c
fs/select.c
include/net/netns/ipv4.h
mm/page_alloc.c
net/core/filter.c
net/ipv4/sysctl_net_ipv4.c
net/ipv4/tcp_ipv4.c
sound/usb/stream.c
Change-Id: I90aff1a1b88379a959c6dda1c89e5efb48af5450
1060 lines
26 KiB
C
1060 lines
26 KiB
C
/*
|
|
* lib/dynamic_debug.c
|
|
*
|
|
* make pr_debug()/dev_dbg() calls runtime configurable based upon their
|
|
* source module.
|
|
*
|
|
* Copyright (C) 2008 Jason Baron <jbaron@redhat.com>
|
|
* By Greg Banks <gnb@melbourne.sgi.com>
|
|
* Copyright (c) 2008 Silicon Graphics Inc. All Rights Reserved.
|
|
* Copyright (C) 2011 Bart Van Assche. All Rights Reserved.
|
|
* Copyright (C) 2013 Du, Changbin <changbin.du@gmail.com>
|
|
*/
|
|
|
|
#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
#include <linux/moduleparam.h>
|
|
#include <linux/kallsyms.h>
|
|
#include <linux/types.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/proc_fs.h>
|
|
#include <linux/seq_file.h>
|
|
#include <linux/list.h>
|
|
#include <linux/sysctl.h>
|
|
#include <linux/ctype.h>
|
|
#include <linux/string.h>
|
|
#include <linux/parser.h>
|
|
#include <linux/string_helpers.h>
|
|
#include <linux/uaccess.h>
|
|
#include <linux/dynamic_debug.h>
|
|
#include <linux/debugfs.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/jump_label.h>
|
|
#include <linux/hardirq.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/device.h>
|
|
#include <linux/netdevice.h>
|
|
|
|
extern struct _ddebug __start___verbose[];
|
|
extern struct _ddebug __stop___verbose[];
|
|
|
|
struct ddebug_table {
|
|
struct list_head link;
|
|
const char *mod_name;
|
|
unsigned int num_ddebugs;
|
|
struct _ddebug *ddebugs;
|
|
};
|
|
|
|
struct ddebug_query {
|
|
const char *filename;
|
|
const char *module;
|
|
const char *function;
|
|
const char *format;
|
|
unsigned int first_lineno, last_lineno;
|
|
};
|
|
|
|
struct ddebug_iter {
|
|
struct ddebug_table *table;
|
|
unsigned int idx;
|
|
};
|
|
|
|
static DEFINE_MUTEX(ddebug_lock);
|
|
static LIST_HEAD(ddebug_tables);
|
|
static int verbose;
|
|
module_param(verbose, int, 0644);
|
|
|
|
/* Return the path relative to source root */
|
|
static inline const char *trim_prefix(const char *path)
|
|
{
|
|
int skip = strlen(__FILE__) - strlen("lib/dynamic_debug.c");
|
|
|
|
if (strncmp(path, __FILE__, skip))
|
|
skip = 0; /* prefix mismatch, don't skip */
|
|
|
|
return path + skip;
|
|
}
|
|
|
|
static struct { unsigned flag:8; char opt_char; } opt_array[] = {
|
|
{ _DPRINTK_FLAGS_PRINT, 'p' },
|
|
{ _DPRINTK_FLAGS_INCL_MODNAME, 'm' },
|
|
{ _DPRINTK_FLAGS_INCL_FUNCNAME, 'f' },
|
|
{ _DPRINTK_FLAGS_INCL_LINENO, 'l' },
|
|
{ _DPRINTK_FLAGS_INCL_TID, 't' },
|
|
{ _DPRINTK_FLAGS_NONE, '_' },
|
|
};
|
|
|
|
struct flagsbuf { char buf[ARRAY_SIZE(opt_array)+1]; };
|
|
|
|
/* format a string into buf[] which describes the _ddebug's flags */
|
|
static char *ddebug_describe_flags(unsigned int flags, struct flagsbuf *fb)
|
|
{
|
|
char *p = fb->buf;
|
|
int i;
|
|
|
|
for (i = 0; i < ARRAY_SIZE(opt_array); ++i)
|
|
if (flags & opt_array[i].flag)
|
|
*p++ = opt_array[i].opt_char;
|
|
if (p == fb->buf)
|
|
*p++ = '_';
|
|
*p = '\0';
|
|
|
|
return fb->buf;
|
|
}
|
|
|
|
#define vpr_info(fmt, ...) \
|
|
do { \
|
|
if (verbose) \
|
|
pr_info(fmt, ##__VA_ARGS__); \
|
|
} while (0)
|
|
|
|
static void vpr_info_dq(const struct ddebug_query *query, const char *msg)
|
|
{
|
|
/* trim any trailing newlines */
|
|
int fmtlen = 0;
|
|
|
|
if (query->format) {
|
|
fmtlen = strlen(query->format);
|
|
while (fmtlen && query->format[fmtlen - 1] == '\n')
|
|
fmtlen--;
|
|
}
|
|
|
|
vpr_info("%s: func=\"%s\" file=\"%s\" module=\"%s\" format=\"%.*s\" lineno=%u-%u\n",
|
|
msg,
|
|
query->function ? query->function : "",
|
|
query->filename ? query->filename : "",
|
|
query->module ? query->module : "",
|
|
fmtlen, query->format ? query->format : "",
|
|
query->first_lineno, query->last_lineno);
|
|
}
|
|
|
|
/*
|
|
* Search the tables for _ddebug's which match the given `query' and
|
|
* apply the `flags' and `mask' to them. Returns number of matching
|
|
* callsites, normally the same as number of changes. If verbose,
|
|
* logs the changes. Takes ddebug_lock.
|
|
*/
|
|
static int ddebug_change(const struct ddebug_query *query,
|
|
unsigned int flags, unsigned int mask)
|
|
{
|
|
int i;
|
|
struct ddebug_table *dt;
|
|
unsigned int newflags;
|
|
unsigned int nfound = 0;
|
|
struct flagsbuf fbuf;
|
|
|
|
/* search for matching ddebugs */
|
|
mutex_lock(&ddebug_lock);
|
|
list_for_each_entry(dt, &ddebug_tables, link) {
|
|
|
|
/* match against the module name */
|
|
if (query->module &&
|
|
!match_wildcard(query->module, dt->mod_name))
|
|
continue;
|
|
|
|
for (i = 0; i < dt->num_ddebugs; i++) {
|
|
struct _ddebug *dp = &dt->ddebugs[i];
|
|
|
|
/* match against the source filename */
|
|
if (query->filename &&
|
|
!match_wildcard(query->filename, dp->filename) &&
|
|
!match_wildcard(query->filename,
|
|
kbasename(dp->filename)) &&
|
|
!match_wildcard(query->filename,
|
|
trim_prefix(dp->filename)))
|
|
continue;
|
|
|
|
/* match against the function */
|
|
if (query->function &&
|
|
!match_wildcard(query->function, dp->function))
|
|
continue;
|
|
|
|
/* match against the format */
|
|
if (query->format &&
|
|
!strstr(dp->format, query->format))
|
|
continue;
|
|
|
|
/* match against the line number range */
|
|
if (query->first_lineno &&
|
|
dp->lineno < query->first_lineno)
|
|
continue;
|
|
if (query->last_lineno &&
|
|
dp->lineno > query->last_lineno)
|
|
continue;
|
|
|
|
nfound++;
|
|
|
|
newflags = (dp->flags & mask) | flags;
|
|
if (newflags == dp->flags)
|
|
continue;
|
|
#ifdef HAVE_JUMP_LABEL
|
|
if (dp->flags & _DPRINTK_FLAGS_PRINT) {
|
|
if (!(flags & _DPRINTK_FLAGS_PRINT))
|
|
static_branch_disable(&dp->key.dd_key_true);
|
|
} else if (flags & _DPRINTK_FLAGS_PRINT)
|
|
static_branch_enable(&dp->key.dd_key_true);
|
|
#endif
|
|
dp->flags = newflags;
|
|
vpr_info("changed %s:%d [%s]%s =%s\n",
|
|
trim_prefix(dp->filename), dp->lineno,
|
|
dt->mod_name, dp->function,
|
|
ddebug_describe_flags(dp->flags, &fbuf));
|
|
}
|
|
}
|
|
mutex_unlock(&ddebug_lock);
|
|
|
|
if (!nfound && verbose)
|
|
pr_info("no matches for query\n");
|
|
|
|
return nfound;
|
|
}
|
|
|
|
/*
|
|
* Split the buffer `buf' into space-separated words.
|
|
* Handles simple " and ' quoting, i.e. without nested,
|
|
* embedded or escaped \". Return the number of words
|
|
* or <0 on error.
|
|
*/
|
|
static int ddebug_tokenize(char *buf, char *words[], int maxwords)
|
|
{
|
|
int nwords = 0;
|
|
|
|
while (*buf) {
|
|
char *end;
|
|
|
|
/* Skip leading whitespace */
|
|
buf = skip_spaces(buf);
|
|
if (!*buf)
|
|
break; /* oh, it was trailing whitespace */
|
|
if (*buf == '#')
|
|
break; /* token starts comment, skip rest of line */
|
|
|
|
/* find `end' of word, whitespace separated or quoted */
|
|
if (*buf == '"' || *buf == '\'') {
|
|
int quote = *buf++;
|
|
for (end = buf; *end && *end != quote; end++)
|
|
;
|
|
if (!*end) {
|
|
pr_err("unclosed quote: %s\n", buf);
|
|
return -EINVAL; /* unclosed quote */
|
|
}
|
|
} else {
|
|
for (end = buf; *end && !isspace(*end); end++)
|
|
;
|
|
if (end == buf) {
|
|
pr_err("parse err after word:%d=%s\n", nwords,
|
|
nwords ? words[nwords - 1] : "<none>");
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
|
|
/* `buf' is start of word, `end' is one past its end */
|
|
if (nwords == maxwords) {
|
|
pr_err("too many words, legal max <=%d\n", maxwords);
|
|
return -EINVAL; /* ran out of words[] before bytes */
|
|
}
|
|
if (*end)
|
|
*end++ = '\0'; /* terminate the word */
|
|
words[nwords++] = buf;
|
|
buf = end;
|
|
}
|
|
|
|
if (verbose) {
|
|
int i;
|
|
pr_info("split into words:");
|
|
for (i = 0; i < nwords; i++)
|
|
pr_cont(" \"%s\"", words[i]);
|
|
pr_cont("\n");
|
|
}
|
|
|
|
return nwords;
|
|
}
|
|
|
|
/*
|
|
* Parse a single line number. Note that the empty string ""
|
|
* is treated as a special case and converted to zero, which
|
|
* is later treated as a "don't care" value.
|
|
*/
|
|
static inline int parse_lineno(const char *str, unsigned int *val)
|
|
{
|
|
BUG_ON(str == NULL);
|
|
if (*str == '\0') {
|
|
*val = 0;
|
|
return 0;
|
|
}
|
|
if (kstrtouint(str, 10, val) < 0) {
|
|
pr_err("bad line-number: %s\n", str);
|
|
return -EINVAL;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
static int check_set(const char **dest, char *src, char *name)
|
|
{
|
|
int rc = 0;
|
|
|
|
if (*dest) {
|
|
rc = -EINVAL;
|
|
pr_err("match-spec:%s val:%s overridden by %s\n",
|
|
name, *dest, src);
|
|
}
|
|
*dest = src;
|
|
return rc;
|
|
}
|
|
|
|
/*
|
|
* Parse words[] as a ddebug query specification, which is a series
|
|
* of (keyword, value) pairs chosen from these possibilities:
|
|
*
|
|
* func <function-name>
|
|
* file <full-pathname>
|
|
* file <base-filename>
|
|
* module <module-name>
|
|
* format <escaped-string-to-find-in-format>
|
|
* line <lineno>
|
|
* line <first-lineno>-<last-lineno> // where either may be empty
|
|
*
|
|
* Only 1 of each type is allowed.
|
|
* Returns 0 on success, <0 on error.
|
|
*/
|
|
static int ddebug_parse_query(char *words[], int nwords,
|
|
struct ddebug_query *query, const char *modname)
|
|
{
|
|
unsigned int i;
|
|
int rc = 0;
|
|
|
|
/* check we have an even number of words */
|
|
if (nwords % 2 != 0) {
|
|
pr_err("expecting pairs of match-spec <value>\n");
|
|
return -EINVAL;
|
|
}
|
|
memset(query, 0, sizeof(*query));
|
|
|
|
for (i = 0; i < nwords; i += 2) {
|
|
if (!strcmp(words[i], "func")) {
|
|
rc = check_set(&query->function, words[i+1], "func");
|
|
} else if (!strcmp(words[i], "file")) {
|
|
rc = check_set(&query->filename, words[i+1], "file");
|
|
} else if (!strcmp(words[i], "module")) {
|
|
rc = check_set(&query->module, words[i+1], "module");
|
|
} else if (!strcmp(words[i], "format")) {
|
|
string_unescape_inplace(words[i+1], UNESCAPE_SPACE |
|
|
UNESCAPE_OCTAL |
|
|
UNESCAPE_SPECIAL);
|
|
rc = check_set(&query->format, words[i+1], "format");
|
|
} else if (!strcmp(words[i], "line")) {
|
|
char *first = words[i+1];
|
|
char *last = strchr(first, '-');
|
|
if (query->first_lineno || query->last_lineno) {
|
|
pr_err("match-spec: line used 2x\n");
|
|
return -EINVAL;
|
|
}
|
|
if (last)
|
|
*last++ = '\0';
|
|
if (parse_lineno(first, &query->first_lineno) < 0)
|
|
return -EINVAL;
|
|
if (last) {
|
|
/* range <first>-<last> */
|
|
if (parse_lineno(last, &query->last_lineno) < 0)
|
|
return -EINVAL;
|
|
|
|
/* special case for last lineno not specified */
|
|
if (query->last_lineno == 0)
|
|
query->last_lineno = UINT_MAX;
|
|
|
|
if (query->last_lineno < query->first_lineno) {
|
|
pr_err("last-line:%d < 1st-line:%d\n",
|
|
query->last_lineno,
|
|
query->first_lineno);
|
|
return -EINVAL;
|
|
}
|
|
} else {
|
|
query->last_lineno = query->first_lineno;
|
|
}
|
|
} else {
|
|
pr_err("unknown keyword \"%s\"\n", words[i]);
|
|
return -EINVAL;
|
|
}
|
|
if (rc)
|
|
return rc;
|
|
}
|
|
if (!query->module && modname)
|
|
/*
|
|
* support $modname.dyndbg=<multiple queries>, when
|
|
* not given in the query itself
|
|
*/
|
|
query->module = modname;
|
|
|
|
vpr_info_dq(query, "parsed");
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Parse `str' as a flags specification, format [-+=][p]+.
|
|
* Sets up *maskp and *flagsp to be used when changing the
|
|
* flags fields of matched _ddebug's. Returns 0 on success
|
|
* or <0 on error.
|
|
*/
|
|
static int ddebug_parse_flags(const char *str, unsigned int *flagsp,
|
|
unsigned int *maskp)
|
|
{
|
|
unsigned flags = 0;
|
|
int op = '=', i;
|
|
|
|
switch (*str) {
|
|
case '+':
|
|
case '-':
|
|
case '=':
|
|
op = *str++;
|
|
break;
|
|
default:
|
|
pr_err("bad flag-op %c, at start of %s\n", *str, str);
|
|
return -EINVAL;
|
|
}
|
|
vpr_info("op='%c'\n", op);
|
|
|
|
for (; *str ; ++str) {
|
|
for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) {
|
|
if (*str == opt_array[i].opt_char) {
|
|
flags |= opt_array[i].flag;
|
|
break;
|
|
}
|
|
}
|
|
if (i < 0) {
|
|
pr_err("unknown flag '%c' in \"%s\"\n", *str, str);
|
|
return -EINVAL;
|
|
}
|
|
}
|
|
vpr_info("flags=0x%x\n", flags);
|
|
|
|
/* calculate final *flagsp, *maskp according to mask and op */
|
|
switch (op) {
|
|
case '=':
|
|
*maskp = 0;
|
|
*flagsp = flags;
|
|
break;
|
|
case '+':
|
|
*maskp = ~0U;
|
|
*flagsp = flags;
|
|
break;
|
|
case '-':
|
|
*maskp = ~flags;
|
|
*flagsp = 0;
|
|
break;
|
|
}
|
|
vpr_info("*flagsp=0x%x *maskp=0x%x\n", *flagsp, *maskp);
|
|
return 0;
|
|
}
|
|
|
|
static int ddebug_exec_query(char *query_string, const char *modname)
|
|
{
|
|
unsigned int flags = 0, mask = 0;
|
|
struct ddebug_query query;
|
|
#define MAXWORDS 9
|
|
int nwords, nfound;
|
|
char *words[MAXWORDS];
|
|
|
|
nwords = ddebug_tokenize(query_string, words, MAXWORDS);
|
|
if (nwords <= 0) {
|
|
pr_err("tokenize failed\n");
|
|
return -EINVAL;
|
|
}
|
|
/* check flags 1st (last arg) so query is pairs of spec,val */
|
|
if (ddebug_parse_flags(words[nwords-1], &flags, &mask)) {
|
|
pr_err("flags parse failed\n");
|
|
return -EINVAL;
|
|
}
|
|
if (ddebug_parse_query(words, nwords-1, &query, modname)) {
|
|
pr_err("query parse failed\n");
|
|
return -EINVAL;
|
|
}
|
|
/* actually go and implement the change */
|
|
nfound = ddebug_change(&query, flags, mask);
|
|
vpr_info_dq(&query, nfound ? "applied" : "no-match");
|
|
|
|
return nfound;
|
|
}
|
|
|
|
/* handle multiple queries in query string, continue on error, return
|
|
last error or number of matching callsites. Module name is either
|
|
in param (for boot arg) or perhaps in query string.
|
|
*/
|
|
static int ddebug_exec_queries(char *query, const char *modname)
|
|
{
|
|
char *split;
|
|
int i, errs = 0, exitcode = 0, rc, nfound = 0;
|
|
|
|
for (i = 0; query; query = split) {
|
|
split = strpbrk(query, ";\n");
|
|
if (split)
|
|
*split++ = '\0';
|
|
|
|
query = skip_spaces(query);
|
|
if (!query || !*query || *query == '#')
|
|
continue;
|
|
|
|
vpr_info("query %d: \"%s\"\n", i, query);
|
|
|
|
rc = ddebug_exec_query(query, modname);
|
|
if (rc < 0) {
|
|
errs++;
|
|
exitcode = rc;
|
|
} else {
|
|
nfound += rc;
|
|
}
|
|
i++;
|
|
}
|
|
vpr_info("processed %d queries, with %d matches, %d errs\n",
|
|
i, nfound, errs);
|
|
|
|
if (exitcode)
|
|
return exitcode;
|
|
return nfound;
|
|
}
|
|
|
|
#define PREFIX_SIZE 64
|
|
|
|
static int remaining(int wrote)
|
|
{
|
|
if (PREFIX_SIZE - wrote > 0)
|
|
return PREFIX_SIZE - wrote;
|
|
return 0;
|
|
}
|
|
|
|
static char *dynamic_emit_prefix(const struct _ddebug *desc, char *buf)
|
|
{
|
|
int pos_after_tid;
|
|
int pos = 0;
|
|
|
|
*buf = '\0';
|
|
|
|
if (desc->flags & _DPRINTK_FLAGS_INCL_TID) {
|
|
if (in_interrupt())
|
|
pos += snprintf(buf + pos, remaining(pos), "<intr> ");
|
|
else
|
|
pos += snprintf(buf + pos, remaining(pos), "[%d] ",
|
|
task_pid_vnr(current));
|
|
}
|
|
pos_after_tid = pos;
|
|
if (desc->flags & _DPRINTK_FLAGS_INCL_MODNAME)
|
|
pos += snprintf(buf + pos, remaining(pos), "%s:",
|
|
desc->modname);
|
|
if (desc->flags & _DPRINTK_FLAGS_INCL_FUNCNAME)
|
|
pos += snprintf(buf + pos, remaining(pos), "%s:",
|
|
desc->function);
|
|
if (desc->flags & _DPRINTK_FLAGS_INCL_LINENO)
|
|
pos += snprintf(buf + pos, remaining(pos), "%d:",
|
|
desc->lineno);
|
|
if (pos - pos_after_tid)
|
|
pos += snprintf(buf + pos, remaining(pos), " ");
|
|
if (pos >= PREFIX_SIZE)
|
|
buf[PREFIX_SIZE - 1] = '\0';
|
|
|
|
return buf;
|
|
}
|
|
|
|
void __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
|
|
{
|
|
va_list args;
|
|
struct va_format vaf;
|
|
char buf[PREFIX_SIZE];
|
|
|
|
BUG_ON(!descriptor);
|
|
BUG_ON(!fmt);
|
|
|
|
va_start(args, fmt);
|
|
|
|
vaf.fmt = fmt;
|
|
vaf.va = &args;
|
|
|
|
printk(KERN_DEBUG "%s%pV", dynamic_emit_prefix(descriptor, buf), &vaf);
|
|
|
|
va_end(args);
|
|
}
|
|
EXPORT_SYMBOL(__dynamic_pr_debug);
|
|
|
|
void __dynamic_dev_dbg(struct _ddebug *descriptor,
|
|
const struct device *dev, const char *fmt, ...)
|
|
{
|
|
struct va_format vaf;
|
|
va_list args;
|
|
|
|
BUG_ON(!descriptor);
|
|
BUG_ON(!fmt);
|
|
|
|
va_start(args, fmt);
|
|
|
|
vaf.fmt = fmt;
|
|
vaf.va = &args;
|
|
|
|
if (!dev) {
|
|
printk(KERN_DEBUG "(NULL device *): %pV", &vaf);
|
|
} else {
|
|
char buf[PREFIX_SIZE];
|
|
|
|
dev_printk_emit(LOGLEVEL_DEBUG, dev, "%s%s %s: %pV",
|
|
dynamic_emit_prefix(descriptor, buf),
|
|
dev_driver_string(dev), dev_name(dev),
|
|
&vaf);
|
|
}
|
|
|
|
va_end(args);
|
|
}
|
|
EXPORT_SYMBOL(__dynamic_dev_dbg);
|
|
|
|
#ifdef CONFIG_NET
|
|
|
|
void __dynamic_netdev_dbg(struct _ddebug *descriptor,
|
|
const struct net_device *dev, const char *fmt, ...)
|
|
{
|
|
struct va_format vaf;
|
|
va_list args;
|
|
|
|
BUG_ON(!descriptor);
|
|
BUG_ON(!fmt);
|
|
|
|
va_start(args, fmt);
|
|
|
|
vaf.fmt = fmt;
|
|
vaf.va = &args;
|
|
|
|
if (dev && dev->dev.parent) {
|
|
char buf[PREFIX_SIZE];
|
|
|
|
dev_printk_emit(LOGLEVEL_DEBUG, dev->dev.parent,
|
|
"%s%s %s %s%s: %pV",
|
|
dynamic_emit_prefix(descriptor, buf),
|
|
dev_driver_string(dev->dev.parent),
|
|
dev_name(dev->dev.parent),
|
|
netdev_name(dev), netdev_reg_state(dev),
|
|
&vaf);
|
|
} else if (dev) {
|
|
printk(KERN_DEBUG "%s%s: %pV", netdev_name(dev),
|
|
netdev_reg_state(dev), &vaf);
|
|
} else {
|
|
printk(KERN_DEBUG "(NULL net_device): %pV", &vaf);
|
|
}
|
|
|
|
va_end(args);
|
|
}
|
|
EXPORT_SYMBOL(__dynamic_netdev_dbg);
|
|
|
|
#endif
|
|
|
|
#define DDEBUG_STRING_SIZE 1024
|
|
static __initdata char ddebug_setup_string[DDEBUG_STRING_SIZE];
|
|
|
|
static __init int ddebug_setup_query(char *str)
|
|
{
|
|
if (strlen(str) >= DDEBUG_STRING_SIZE) {
|
|
pr_warn("ddebug boot param string too large\n");
|
|
return 0;
|
|
}
|
|
strlcpy(ddebug_setup_string, str, DDEBUG_STRING_SIZE);
|
|
return 1;
|
|
}
|
|
|
|
__setup("ddebug_query=", ddebug_setup_query);
|
|
|
|
/*
|
|
* File_ops->write method for <debugfs>/dynamic_debug/control. Gathers the
|
|
* command text from userspace, parses and executes it.
|
|
*/
|
|
#define USER_BUF_PAGE 4096
|
|
static ssize_t ddebug_proc_write(struct file *file, const char __user *ubuf,
|
|
size_t len, loff_t *offp)
|
|
{
|
|
char *tmpbuf;
|
|
int ret;
|
|
|
|
if (len == 0)
|
|
return 0;
|
|
if (len > USER_BUF_PAGE - 1) {
|
|
pr_warn("expected <%d bytes into control\n", USER_BUF_PAGE);
|
|
return -E2BIG;
|
|
}
|
|
tmpbuf = memdup_user_nul(ubuf, len);
|
|
if (IS_ERR(tmpbuf))
|
|
return PTR_ERR(tmpbuf);
|
|
vpr_info("read %d bytes from userspace\n", (int)len);
|
|
|
|
ret = ddebug_exec_queries(tmpbuf, NULL);
|
|
kfree(tmpbuf);
|
|
if (ret < 0)
|
|
return ret;
|
|
|
|
*offp += len;
|
|
return len;
|
|
}
|
|
|
|
/*
|
|
* Set the iterator to point to the first _ddebug object
|
|
* and return a pointer to that first object. Returns
|
|
* NULL if there are no _ddebugs at all.
|
|
*/
|
|
static struct _ddebug *ddebug_iter_first(struct ddebug_iter *iter)
|
|
{
|
|
if (list_empty(&ddebug_tables)) {
|
|
iter->table = NULL;
|
|
iter->idx = 0;
|
|
return NULL;
|
|
}
|
|
iter->table = list_entry(ddebug_tables.next,
|
|
struct ddebug_table, link);
|
|
iter->idx = 0;
|
|
return &iter->table->ddebugs[iter->idx];
|
|
}
|
|
|
|
/*
|
|
* Advance the iterator to point to the next _ddebug
|
|
* object from the one the iterator currently points at,
|
|
* and returns a pointer to the new _ddebug. Returns
|
|
* NULL if the iterator has seen all the _ddebugs.
|
|
*/
|
|
static struct _ddebug *ddebug_iter_next(struct ddebug_iter *iter)
|
|
{
|
|
if (iter->table == NULL)
|
|
return NULL;
|
|
if (++iter->idx == iter->table->num_ddebugs) {
|
|
/* iterate to next table */
|
|
iter->idx = 0;
|
|
if (list_is_last(&iter->table->link, &ddebug_tables)) {
|
|
iter->table = NULL;
|
|
return NULL;
|
|
}
|
|
iter->table = list_entry(iter->table->link.next,
|
|
struct ddebug_table, link);
|
|
}
|
|
return &iter->table->ddebugs[iter->idx];
|
|
}
|
|
|
|
/*
|
|
* Seq_ops start method. Called at the start of every
|
|
* read() call from userspace. Takes the ddebug_lock and
|
|
* seeks the seq_file's iterator to the given position.
|
|
*/
|
|
static void *ddebug_proc_start(struct seq_file *m, loff_t *pos)
|
|
{
|
|
struct ddebug_iter *iter = m->private;
|
|
struct _ddebug *dp;
|
|
int n = *pos;
|
|
|
|
vpr_info("called m=%p *pos=%lld\n", m, (unsigned long long)*pos);
|
|
|
|
mutex_lock(&ddebug_lock);
|
|
|
|
if (!n)
|
|
return SEQ_START_TOKEN;
|
|
if (n < 0)
|
|
return NULL;
|
|
dp = ddebug_iter_first(iter);
|
|
while (dp != NULL && --n > 0)
|
|
dp = ddebug_iter_next(iter);
|
|
return dp;
|
|
}
|
|
|
|
/*
|
|
* Seq_ops next method. Called several times within a read()
|
|
* call from userspace, with ddebug_lock held. Walks to the
|
|
* next _ddebug object with a special case for the header line.
|
|
*/
|
|
static void *ddebug_proc_next(struct seq_file *m, void *p, loff_t *pos)
|
|
{
|
|
struct ddebug_iter *iter = m->private;
|
|
struct _ddebug *dp;
|
|
|
|
vpr_info("called m=%p p=%p *pos=%lld\n",
|
|
m, p, (unsigned long long)*pos);
|
|
|
|
if (p == SEQ_START_TOKEN)
|
|
dp = ddebug_iter_first(iter);
|
|
else
|
|
dp = ddebug_iter_next(iter);
|
|
++*pos;
|
|
return dp;
|
|
}
|
|
|
|
/*
|
|
* Seq_ops show method. Called several times within a read()
|
|
* call from userspace, with ddebug_lock held. Formats the
|
|
* current _ddebug as a single human-readable line, with a
|
|
* special case for the header line.
|
|
*/
|
|
static int ddebug_proc_show(struct seq_file *m, void *p)
|
|
{
|
|
struct ddebug_iter *iter = m->private;
|
|
struct _ddebug *dp = p;
|
|
struct flagsbuf flags;
|
|
|
|
vpr_info("called m=%p p=%p\n", m, p);
|
|
|
|
if (p == SEQ_START_TOKEN) {
|
|
seq_puts(m,
|
|
"# filename:lineno [module]function flags format\n");
|
|
return 0;
|
|
}
|
|
|
|
seq_printf(m, "%s:%u [%s]%s =%s \"",
|
|
trim_prefix(dp->filename), dp->lineno,
|
|
iter->table->mod_name, dp->function,
|
|
ddebug_describe_flags(dp->flags, &flags));
|
|
seq_escape(m, dp->format, "\t\r\n\"");
|
|
seq_puts(m, "\"\n");
|
|
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* Seq_ops stop method. Called at the end of each read()
|
|
* call from userspace. Drops ddebug_lock.
|
|
*/
|
|
static void ddebug_proc_stop(struct seq_file *m, void *p)
|
|
{
|
|
vpr_info("called m=%p p=%p\n", m, p);
|
|
mutex_unlock(&ddebug_lock);
|
|
}
|
|
|
|
static const struct seq_operations ddebug_proc_seqops = {
|
|
.start = ddebug_proc_start,
|
|
.next = ddebug_proc_next,
|
|
.show = ddebug_proc_show,
|
|
.stop = ddebug_proc_stop
|
|
};
|
|
|
|
/*
|
|
* File_ops->open method for <debugfs>/dynamic_debug/control. Does
|
|
* the seq_file setup dance, and also creates an iterator to walk the
|
|
* _ddebugs. Note that we create a seq_file always, even for O_WRONLY
|
|
* files where it's not needed, as doing so simplifies the ->release
|
|
* method.
|
|
*/
|
|
static int ddebug_proc_open(struct inode *inode, struct file *file)
|
|
{
|
|
vpr_info("called\n");
|
|
return seq_open_private(file, &ddebug_proc_seqops,
|
|
sizeof(struct ddebug_iter));
|
|
}
|
|
|
|
static const struct file_operations ddebug_proc_fops = {
|
|
.owner = THIS_MODULE,
|
|
.open = ddebug_proc_open,
|
|
.read = seq_read,
|
|
.llseek = seq_lseek,
|
|
.release = seq_release_private,
|
|
.write = ddebug_proc_write
|
|
};
|
|
|
|
/*
|
|
* Allocate a new ddebug_table for the given module
|
|
* and add it to the global list.
|
|
*/
|
|
int ddebug_add_module(struct _ddebug *tab, unsigned int n,
|
|
const char *name)
|
|
{
|
|
struct ddebug_table *dt;
|
|
const char *new_name;
|
|
|
|
dt = kzalloc(sizeof(*dt), GFP_KERNEL);
|
|
if (dt == NULL)
|
|
return -ENOMEM;
|
|
new_name = kstrdup_const(name, GFP_KERNEL);
|
|
if (new_name == NULL) {
|
|
kfree(dt);
|
|
return -ENOMEM;
|
|
}
|
|
dt->mod_name = new_name;
|
|
dt->num_ddebugs = n;
|
|
dt->ddebugs = tab;
|
|
|
|
mutex_lock(&ddebug_lock);
|
|
list_add_tail(&dt->link, &ddebug_tables);
|
|
mutex_unlock(&ddebug_lock);
|
|
|
|
vpr_info("%u debug prints in module %s\n", n, dt->mod_name);
|
|
return 0;
|
|
}
|
|
EXPORT_SYMBOL_GPL(ddebug_add_module);
|
|
|
|
/* helper for ddebug_dyndbg_(boot|module)_param_cb */
|
|
static int ddebug_dyndbg_param_cb(char *param, char *val,
|
|
const char *modname, int on_err)
|
|
{
|
|
char *sep;
|
|
|
|
sep = strchr(param, '.');
|
|
if (sep) {
|
|
/* needed only for ddebug_dyndbg_boot_param_cb */
|
|
*sep = '\0';
|
|
modname = param;
|
|
param = sep + 1;
|
|
}
|
|
if (strcmp(param, "dyndbg"))
|
|
return on_err; /* determined by caller */
|
|
|
|
ddebug_exec_queries((val ? val : "+p"), modname);
|
|
|
|
return 0; /* query failure shouldnt stop module load */
|
|
}
|
|
|
|
/* handle both dyndbg and $module.dyndbg params at boot */
|
|
static int ddebug_dyndbg_boot_param_cb(char *param, char *val,
|
|
const char *unused, void *arg)
|
|
{
|
|
vpr_info("%s=\"%s\"\n", param, val);
|
|
return ddebug_dyndbg_param_cb(param, val, NULL, 0);
|
|
}
|
|
|
|
/*
|
|
* modprobe foo finds foo.params in boot-args, strips "foo.", and
|
|
* passes them to load_module(). This callback gets unknown params,
|
|
* processes dyndbg params, rejects others.
|
|
*/
|
|
int ddebug_dyndbg_module_param_cb(char *param, char *val, const char *module)
|
|
{
|
|
vpr_info("module: %s %s=\"%s\"\n", module, param, val);
|
|
return ddebug_dyndbg_param_cb(param, val, module, -ENOENT);
|
|
}
|
|
|
|
static void ddebug_table_free(struct ddebug_table *dt)
|
|
{
|
|
list_del_init(&dt->link);
|
|
kfree_const(dt->mod_name);
|
|
kfree(dt);
|
|
}
|
|
|
|
/*
|
|
* Called in response to a module being unloaded. Removes
|
|
* any ddebug_table's which point at the module.
|
|
*/
|
|
int ddebug_remove_module(const char *mod_name)
|
|
{
|
|
struct ddebug_table *dt, *nextdt;
|
|
int ret = -ENOENT;
|
|
|
|
vpr_info("removing module \"%s\"\n", mod_name);
|
|
|
|
mutex_lock(&ddebug_lock);
|
|
list_for_each_entry_safe(dt, nextdt, &ddebug_tables, link) {
|
|
if (!strcmp(dt->mod_name, mod_name)) {
|
|
ddebug_table_free(dt);
|
|
ret = 0;
|
|
}
|
|
}
|
|
mutex_unlock(&ddebug_lock);
|
|
return ret;
|
|
}
|
|
EXPORT_SYMBOL_GPL(ddebug_remove_module);
|
|
|
|
static void ddebug_remove_all_tables(void)
|
|
{
|
|
mutex_lock(&ddebug_lock);
|
|
while (!list_empty(&ddebug_tables)) {
|
|
struct ddebug_table *dt = list_entry(ddebug_tables.next,
|
|
struct ddebug_table,
|
|
link);
|
|
ddebug_table_free(dt);
|
|
}
|
|
mutex_unlock(&ddebug_lock);
|
|
}
|
|
|
|
static __initdata int ddebug_init_success;
|
|
|
|
static int __init dynamic_debug_init_control(void)
|
|
{
|
|
struct proc_dir_entry *procfs_dir;
|
|
struct dentry *debugfs_dir;
|
|
|
|
if (!ddebug_init_success)
|
|
return -ENODEV;
|
|
|
|
/* Create the control file in debugfs if it is enabled */
|
|
if (debugfs_initialized()) {
|
|
debugfs_dir = debugfs_create_dir("dynamic_debug", NULL);
|
|
debugfs_create_file("control", 0644, debugfs_dir, NULL,
|
|
&ddebug_proc_fops);
|
|
}
|
|
|
|
/* Also create the control file in procfs */
|
|
procfs_dir = proc_mkdir("dynamic_debug", NULL);
|
|
if (procfs_dir)
|
|
proc_create("control", 0644, procfs_dir, &ddebug_proc_fops);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int __init dynamic_debug_init(void)
|
|
{
|
|
struct _ddebug *iter, *iter_start;
|
|
const char *modname = NULL;
|
|
char *cmdline;
|
|
int ret = 0;
|
|
int n = 0, entries = 0, modct = 0;
|
|
int verbose_bytes = 0;
|
|
|
|
if (&__start___verbose == &__stop___verbose) {
|
|
pr_warn("_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build\n");
|
|
return 1;
|
|
}
|
|
iter = __start___verbose;
|
|
modname = iter->modname;
|
|
iter_start = iter;
|
|
for (; iter < __stop___verbose; iter++) {
|
|
entries++;
|
|
verbose_bytes += strlen(iter->modname) + strlen(iter->function)
|
|
+ strlen(iter->filename) + strlen(iter->format);
|
|
|
|
if (strcmp(modname, iter->modname)) {
|
|
modct++;
|
|
ret = ddebug_add_module(iter_start, n, modname);
|
|
if (ret)
|
|
goto out_err;
|
|
n = 0;
|
|
modname = iter->modname;
|
|
iter_start = iter;
|
|
}
|
|
n++;
|
|
}
|
|
ret = ddebug_add_module(iter_start, n, modname);
|
|
if (ret)
|
|
goto out_err;
|
|
|
|
ddebug_init_success = 1;
|
|
vpr_info("%d modules, %d entries and %d bytes in ddebug tables, %d bytes in (readonly) verbose section\n",
|
|
modct, entries, (int)(modct * sizeof(struct ddebug_table)),
|
|
verbose_bytes + (int)(__stop___verbose - __start___verbose));
|
|
|
|
/* apply ddebug_query boot param, dont unload tables on err */
|
|
if (ddebug_setup_string[0] != '\0') {
|
|
pr_warn("ddebug_query param name is deprecated, change it to dyndbg\n");
|
|
ret = ddebug_exec_queries(ddebug_setup_string, NULL);
|
|
if (ret < 0)
|
|
pr_warn("Invalid ddebug boot param %s\n",
|
|
ddebug_setup_string);
|
|
else
|
|
pr_info("%d changes by ddebug_query\n", ret);
|
|
}
|
|
/* now that ddebug tables are loaded, process all boot args
|
|
* again to find and activate queries given in dyndbg params.
|
|
* While this has already been done for known boot params, it
|
|
* ignored the unknown ones (dyndbg in particular). Reusing
|
|
* parse_args avoids ad-hoc parsing. This will also attempt
|
|
* to activate queries for not-yet-loaded modules, which is
|
|
* slightly noisy if verbose, but harmless.
|
|
*/
|
|
cmdline = kstrdup(saved_command_line, GFP_KERNEL);
|
|
parse_args("dyndbg params", cmdline, NULL,
|
|
0, 0, 0, NULL, &ddebug_dyndbg_boot_param_cb);
|
|
kfree(cmdline);
|
|
return 0;
|
|
|
|
out_err:
|
|
ddebug_remove_all_tables();
|
|
return 0;
|
|
}
|
|
/* Allow early initialization for boot messages via boot param */
|
|
early_initcall(dynamic_debug_init);
|
|
|
|
/* Debugfs setup must be done later */
|
|
fs_initcall(dynamic_debug_init_control);
|