Linux 5.15.2
Greg Kroah-Hartman
maintainerDocumentation/dev-tools/kfence.rst +8 -4
@@ -231,10 +231,14 @@ Guarded allocations are set up based on the sample interval. After expiration of the sample interval, the next allocation through the main allocator (SLAB or SLUB) returns a guarded allocation from the KFENCE object pool (allocation sizes up to PAGE_SIZE are supported). At this point, the timer is reset, and -the next allocation is set up after the expiration of the interval. To "gate" a -KFENCE allocation through the main allocator's fast-path without overhead, -KFENCE relies on static branches via the static keys infrastructure. The static -branch is toggled to redirect the allocation to KFENCE. +the next allocation is set up after the expiration of the interval. + +When using ``CONFIG_KFENCE_STATIC_KEYS=y``, KFENCE allocations are "gated" +through the main allocator's fast-path by relying on static branches via the +static keys infrastructure. The static branch is toggled to redirect the +allocation to KFENCE. Depending on sample interval, target workloads, and +system architecture, this may perform better than the simple dynamic branch. +Careful benchmarking is recommended. KFENCE objects each reside on a dedicated page, at either the left or right page boundaries selected at random. The pages to the left and right of the
Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 5 PATCHLEVEL = 15 -SUBLEVEL = 1 +SUBLEVEL = 2 EXTRAVERSION = NAME = Trick or Treat
arch/x86/kvm/ioapic.c +1 -1
@@ -96,7 +96,7 @@ static unsigned long ioapic_read_indirect(struct kvm_ioapic *ioapic,static void rtc_irq_eoi_tracking_reset (struct kvm_ioapic *ioapic) { ioapic->rtc_status.pending_eoi =0 ; -bitmap_zero (ioapic->rtc_status.dest_map.map,KVM_MAX_VCPU_ID +1 ); +bitmap_zero (ioapic->rtc_status.dest_map.map,KVM_MAX_VCPU_ID ); }static void kvm_rtc_eoi_tracking_restore_all (struct kvm_ioapic *ioapic);
arch/x86/kvm/ioapic.h +2 -2
@@ -39,13 +39,13 @@ struct kvm_vcpu;struct dest_map {/* vcpu bitmap where IRQ has been sent */ - DECLARE_BITMAP(map, KVM_MAX_VCPU_ID + 1); + DECLARE_BITMAP(map, KVM_MAX_VCPU_ID);/* * Vector sent to a given vcpu, only valid when * the vcpu's bit in map is set */ -u8 vectors[KVM_MAX_VCPU_ID +1 ]; +u8 vectors[KVM_MAX_VCPU_ID ]; };
arch/x86/kvm/mmu/spte.h +1 -6
@@ -310,12 +310,7 @@ static inline bool __is_bad_mt_xwr(struct rsvd_bits_validate *rsvd_check, static __always_inline bool is_rsvd_spte(struct rsvd_bits_validate *rsvd_check,u64 spte,int level) { -/* -* Use a bitwise-OR instead of a logical-OR to aggregate the reserved -* bits and EPT's invalid memtype/XWR checks to avoid an extra Jcc -* (this is extremely unlikely to be short-circuited as true). -*/ -return __is_bad_mt_xwr (rsvd_check, spte) | +return __is_bad_mt_xwr (rsvd_check, spte) ||__is_rsvd_bits_set (rsvd_check, spte, level); }
drivers/android/binder.c +17 -24
138 lines not on this page · raw message
drivers/android/binder_internal.h +4 -0
@@ -364,6 +364,9 @@ struct binder_ref {* (invariant after initialized) * @tsk task_struct for group_leader of process * (invariant after initialized) +* @cred struct cred associated with the `struct file` +* in binder_open() +* (invariant after initialized) * @deferred_work_node: element for binder_deferred_list * (protected by binder_deferred_lock) * @deferred_work: bitmap of deferred work to perform
@@ -426,6 +429,7 @@ struct binder_proc {struct list_head waiting_threads;int pid;struct task_struct *tsk; +const struct cred *cred;struct hlist_node deferred_work_node;int deferred_work;int outstanding_txns;
drivers/comedi/drivers/dt9812.c +86 -29
172 lines not on this page · raw message
drivers/comedi/drivers/ni_usb6501.c +10 -0
@@ -144,6 +144,10 @@ static const u8 READ_COUNTER_RESPONSE[] = {0x00, 0x01, 0x00, 0x10,0x00 ,0x00 ,0x00 ,0x02 , 0x00, 0x00, 0x00, 0x00}; +/* Largest supported packets */ +static const size_t TX_MAX_SIZE =sizeof (SET_PORT_DIR_REQUEST ); +static const size_t RX_MAX_SIZE =sizeof (READ_PORT_RESPONSE ); +enum commands {READ_PORT , WRITE_PORT,
@@ -501,6 +505,12 @@ static int ni6501_find_endpoints(struct comedi_device *dev)if (!devpriv->ep_rx || !devpriv->ep_tx)return -ENODEV ; +if (usb_endpoint_maxp (devpriv->ep_rx) <RX_MAX_SIZE ) +return -ENODEV ; + +if (usb_endpoint_maxp (devpriv->ep_tx) <TX_MAX_SIZE ) +return -ENODEV ; +return 0 ; }
drivers/comedi/drivers/vmk80xx.c +15 -13
@@ -90,6 +90,9 @@ enum {#define IC3_VERSION BIT(0)#define IC6_VERSION BIT(1) +#define MIN_BUF_SIZE 64 +#define PACKET_TIMEOUT 10000/* ms */ +enum vmk80xx_model {VMK8055_MODEL ,VMK8061_MODEL
@@ -157,22 +160,21 @@ static void vmk80xx_do_bulk_msg(struct comedi_device *dev)__u8 rx_addr;unsigned int tx_pipe;unsigned int rx_pipe; -size_t size; +size_t tx_size; +size_t rx_size; tx_addr = devpriv->ep_tx->bEndpointAddress; rx_addr = devpriv->ep_rx->bEndpointAddress; tx_pipe =usb_sndbulkpipe (usb, tx_addr); rx_pipe =usb_rcvbulkpipe (usb, rx_addr); + tx_size =usb_endpoint_maxp (devpriv->ep_tx); + rx_size =usb_endpoint_maxp (devpriv->ep_rx); -/* -* The max packet size attributes of the K8061 -* input/output endpoints are identical -*/ - size =usb_endpoint_maxp (devpriv->ep_tx); +usb_bulk_msg (usb, tx_pipe, devpriv->usb_tx_buf, tx_size,NULL , +PACKET_TIMEOUT ); -usb_bulk_msg (usb, tx_pipe, devpriv->usb_tx_buf, - size,NULL , devpriv->ep_tx->bInterval); -usb_bulk_msg (usb, rx_pipe, devpriv->usb_rx_buf, size,NULL ,HZ *10 ); +usb_bulk_msg (usb, rx_pipe, devpriv->usb_rx_buf, rx_size,NULL , +PACKET_TIMEOUT ); }static int vmk80xx_read_packet (struct comedi_device *dev)
@@ -191,7 +193,7 @@ static int vmk80xx_read_packet(struct comedi_device *dev) pipe =usb_rcvintpipe (usb, ep->bEndpointAddress);return usb_interrupt_msg (usb, pipe, devpriv->usb_rx_buf,usb_endpoint_maxp (ep),NULL , -HZ *10 ); +PACKET_TIMEOUT ); }static int vmk80xx_write_packet (struct comedi_device *dev,int cmd)
@@ -212,7 +214,7 @@ static int vmk80xx_write_packet(struct comedi_device *dev, int cmd) pipe =usb_sndintpipe (usb, ep->bEndpointAddress);return usb_interrupt_msg (usb, pipe, devpriv->usb_tx_buf,usb_endpoint_maxp (ep),NULL , -HZ *10 ); +PACKET_TIMEOUT ); }static int vmk80xx_reset_device (struct comedi_device *dev)
@@ -678,12 +680,12 @@ static int vmk80xx_alloc_usb_buffers(struct comedi_device *dev)struct vmk80xx_private *devpriv = dev->private;size_t size; - size =usb_endpoint_maxp (devpriv->ep_rx); + size =max (usb_endpoint_maxp (devpriv->ep_rx),MIN_BUF_SIZE ); devpriv->usb_rx_buf =kzalloc (size,GFP_KERNEL );if (!devpriv->usb_rx_buf)return -ENOMEM ; - size =usb_endpoint_maxp (devpriv->ep_tx); + size =max (usb_endpoint_maxp (devpriv->ep_rx),MIN_BUF_SIZE ); devpriv->usb_tx_buf =kzalloc (size,GFP_KERNEL );if (!devpriv->usb_tx_buf)return -ENOMEM ;
drivers/net/wireless/rsi/rsi_91x_usb.c +1 -1
@@ -61,7 +61,7 @@ static int rsi_usb_card_write(struct rsi_hw *adapter, (void *)seg, (int )len, &transfer, - HZ * 5); + USB_CTRL_SET_TIMEOUT);if (status <0 ) { rsi_dbg(ERR_ZONE,
drivers/staging/media/ipu3/ipu3-css-fw.c +3 -4
@@ -124,12 +124,11 @@ int imgu_css_fw_init(struct imgu_css *css)/* Check and display fw header info */ css->fwp = (struct imgu_fw_header *)css->fw->data; -if (css->fw->size <sizeof (struct imgu_fw_header *) || +if (css->fw->size <struct_size (css->fwp, binary_header,1 ) || css->fwp->file_header.h_size !=sizeof (struct imgu_fw_bi_file_h )) goto bad_fw; -if (sizeof (struct imgu_fw_bi_file_h ) + - css->fwp->file_header.binary_nr *sizeof (struct imgu_fw_info ) > - css->fw->size) +if (struct_size (css->fwp, binary_header, + css->fwp->file_header.binary_nr) > css->fw->size) goto bad_fw; dev_info(dev, "loaded firmware version %.64s, %u binaries, %zu bytes\n",
drivers/staging/media/ipu3/ipu3-css-fw.h +1 -1
@@ -171,7 +171,7 @@ struct imgu_fw_bi_file_h {struct imgu_fw_header {struct imgu_fw_bi_file_h file_header; -struct imgu_fw_info binary_header[1 ];/* binary_nr items */ +struct imgu_fw_info binary_header[];/* binary_nr items */ };/******************* Firmware functions *******************/
drivers/staging/r8188eu/os_dep/ioctl_linux.c +3 -2
@@ -1978,7 +1978,7 @@ static int rtw_wx_set_enc_ext(struct net_device *dev,struct ieee_param *param =NULL ;struct iw_point *pencoding = &wrqu->encoding;struct iw_encode_ext *pext = (struct iw_encode_ext *)extra; -int ret =0 ; +int ret =-1 ; param_len =sizeof (struct ieee_param ) + pext->key_len; param =kzalloc (param_len,GFP_KERNEL );
@@ -2004,7 +2004,7 @@ static int rtw_wx_set_enc_ext(struct net_device *dev, alg_name ="CCMP" ;break ;default : -return -1 ; + goto out; }strncpy ((char *)param->u.crypt.alg, alg_name,IEEE_CRYPT_ALG_NAME_LEN );
@@ -2031,6 +2031,7 @@ static int rtw_wx_set_enc_ext(struct net_device *dev, ret =wpa_set_encryption (dev, param, param_len); +out:kfree (param);return ret; }
drivers/staging/rtl8192u/r8192U_core.c +9 -9
@@ -229,7 +229,7 @@ int write_nic_byte_E(struct net_device *dev, int indx, u8 data) status =usb_control_msg (udev,usb_sndctrlpipe (udev,0 ),RTL8187_REQ_SET_REGS ,RTL8187_REQT_WRITE , - indx |0xfe00 ,0 , usbdata,1 ,HZ /2 ); + indx |0xfe00 ,0 , usbdata,1 ,500 );kfree (usbdata);if (status <0 ) {
@@ -251,7 +251,7 @@ int read_nic_byte_E(struct net_device *dev, int indx, u8 *data) status =usb_control_msg (udev,usb_rcvctrlpipe (udev,0 ),RTL8187_REQ_GET_REGS ,RTL8187_REQT_READ , - indx |0xfe00 ,0 , usbdata,1 ,HZ /2 ); + indx |0xfe00 ,0 , usbdata,1 ,500 ); *data = *usbdata;kfree (usbdata);
@@ -279,7 +279,7 @@ int write_nic_byte(struct net_device *dev, int indx, u8 data) status =usb_control_msg (udev,usb_sndctrlpipe (udev,0 ),RTL8187_REQ_SET_REGS ,RTL8187_REQT_WRITE , (indx &0xff ) |0xff00 , (indx >>8 ) &0x0f , - usbdata,1 ,HZ /2 ); + usbdata,1 ,500 );kfree (usbdata);if (status <0 ) {
@@ -305,7 +305,7 @@ int write_nic_word(struct net_device *dev, int indx, u16 data) status =usb_control_msg (udev,usb_sndctrlpipe (udev,0 ),RTL8187_REQ_SET_REGS ,RTL8187_REQT_WRITE , (indx &0xff ) |0xff00 , (indx >>8 ) &0x0f , - usbdata,2 ,HZ /2 ); + usbdata,2 ,500 );kfree (usbdata);if (status <0 ) {
@@ -331,7 +331,7 @@ int write_nic_dword(struct net_device *dev, int indx, u32 data) status =usb_control_msg (udev,usb_sndctrlpipe (udev,0 ),RTL8187_REQ_SET_REGS ,RTL8187_REQT_WRITE , (indx &0xff ) |0xff00 , (indx >>8 ) &0x0f , - usbdata,4 ,HZ /2 ); + usbdata,4 ,500 );kfree (usbdata);if (status <0 ) {
@@ -355,7 +355,7 @@ int read_nic_byte(struct net_device *dev, int indx, u8 *data) status =usb_control_msg (udev,usb_rcvctrlpipe (udev,0 ),RTL8187_REQ_GET_REGS ,RTL8187_REQT_READ , (indx &0xff ) |0xff00 , (indx >>8 ) &0x0f , - usbdata,1 ,HZ /2 ); + usbdata,1 ,500 ); *data = *usbdata;kfree (usbdata);
@@ -380,7 +380,7 @@ int read_nic_word(struct net_device *dev, int indx, u16 *data) status =usb_control_msg (udev,usb_rcvctrlpipe (udev,0 ),RTL8187_REQ_GET_REGS ,RTL8187_REQT_READ , (indx &0xff ) |0xff00 , (indx >>8 ) &0x0f , - usbdata,2 ,HZ /2 ); + usbdata,2 ,500 ); *data = *usbdata;kfree (usbdata);
@@ -404,7 +404,7 @@ static int read_nic_word_E(struct net_device *dev, int indx, u16 *data) status =usb_control_msg (udev,usb_rcvctrlpipe (udev,0 ),RTL8187_REQ_GET_REGS ,RTL8187_REQT_READ , - indx |0xfe00 ,0 , usbdata,2 ,HZ /2 ); + indx |0xfe00 ,0 , usbdata,2 ,500 ); *data = *usbdata;kfree (usbdata);
@@ -430,7 +430,7 @@ int read_nic_dword(struct net_device *dev, int indx, u32 *data) status =usb_control_msg (udev,usb_rcvctrlpipe (udev,0 ),RTL8187_REQ_GET_REGS ,RTL8187_REQT_READ , (indx &0xff ) |0xff00 , (indx >>8 ) &0x0f , - usbdata,4 ,HZ /2 ); + usbdata,4 ,500 ); *data = *usbdata;kfree (usbdata);
drivers/staging/rtl8712/usb_intf.c +2 -2
@@ -595,12 +595,12 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf)/* never exit with a firmware callback pending */ wait_for_completion (&padapter->rtl8712_fw_ready); +if (pnetdev->reg_state !=NETREG_UNINITIALIZED ) +unregister_netdev (pnetdev);/* will call netdev_close() */ usb_set_intfdata (pusb_intf,NULL );release_firmware (padapter->fw);if (drvpriv.drv_registered) padapter->surprise_removed = true; -if (pnetdev->reg_state !=NETREG_UNINITIALIZED ) -unregister_netdev (pnetdev);/* will call netdev_close() */ r8712_flush_rwctrl_works (padapter);r8712_flush_led_works (padapter);udelay (1 );
drivers/staging/rtl8712/usb_ops_linux.c +1 -1
@@ -494,7 +494,7 @@ int r8712_usbctrl_vendorreq(struct intf_priv *pintfpriv, u8 request, u16 value,memcpy (pIo_buf, pdata, len); } status =usb_control_msg (udev, pipe, request, reqtype, value, index, - pIo_buf, len,HZ /2 ); + pIo_buf, len,500 );if (status >0 ) {/* Success this control transfer. */ if (requesttype ==0x01 ) {/* For Control read transfer, we have to copy the read
drivers/usb/gadget/udc/Kconfig +1 -0
@@ -330,6 +330,7 @@ config USB_AMD5536UDC config USB_FSL_QE tristate "Freescale QE/CPM USB Device Controller" depends on FSL_SOC && (QUICC_ENGINE || CPM) + depends on !64BIT || BROKEN help Some of Freescale PowerPC processors have a Full Speed QE/CPM2 USB controller, which support device mode with 4
drivers/usb/host/ehci-hcd.c +10 -1
@@ -635,7 +635,16 @@ static int ehci_run (struct usb_hcd *hcd)/* Wait until HC become operational */ ehci_readl (ehci, &ehci->regs->command);/* unblock posted writes */ msleep (5 ); - rc =ehci_handshake (ehci, &ehci->regs->status,STS_HALT ,0 ,100 *1000 ); + +/* For Aspeed, STS_HALT also depends on ASS/PSS status. +* Check CMD_RUN instead. +*/ +if (ehci->is_aspeed) + rc =ehci_handshake (ehci, &ehci->regs->command,CMD_RUN , +1 ,100 *1000 ); +else + rc =ehci_handshake (ehci, &ehci->regs->status,STS_HALT , +0 ,100 *1000 );up_write (&ehci_cf_port_reset_rwsem);
drivers/usb/host/ehci-platform.c +6 -0
@@ -297,6 +297,12 @@ static int ehci_platform_probe(struct platform_device *dev) "has-transaction-translator")) hcd->has_tt =1 ; +if (of_device_is_compatible (dev->dev.of_node, +"aspeed,ast2500-ehci" ) || +of_device_is_compatible (dev->dev.of_node, +"aspeed,ast2600-ehci" )) + ehci->is_aspeed =1 ; +if (soc_device_match (quirk_poll_match)) priv->quirk_poll = true;
drivers/usb/host/ehci.h +1 -0
@@ -219,6 +219,7 @@ struct ehci_hcd { /* one per controller */ unsigned need_oc_pp_cycle:1; /* MPC834X port power */ unsigned imx28_write_fix:1; /* For Freescale i.MX28 */ unsigned spurious_oc:1; + unsigned is_aspeed:1;/* required for usb32 quirk */ #define OHCI_CTRL_HCFS (3 << 6)
drivers/usb/musb/musb_gadget.c +3 -1
@@ -1247,9 +1247,11 @@ static int musb_gadget_queue(struct usb_ep *ep, struct usb_request *req, status =musb_queue_resume_work (musb, musb_ep_restart_resume_work, request); -if (status <0 ) +if (status <0 ) {dev_err (musb->controller,"%s resume work: %i\n" , __func__, status); +list_del (&request->list); + } } unlock:
drivers/usb/storage/unusual_devs.h +10 -0
@@ -406,6 +406,16 @@ UNUSUAL_DEV( 0x04b8, 0x0602, 0x0110, 0x0110, "785EPX Storage", USB_SC_SCSI, USB_PR_BULK, NULL, US_FL_SINGLE_LUN), +/* +* Reported by James Buren <[email protected]> +* Virtual ISOs cannot be remounted if ejected while the device is locked +* Disable locking to mimic Windows behavior that bypasses the issue +*/ +UNUSUAL_DEV (0x04c5 ,0x2028 ,0x0001 ,0x0001 , +"iODD" , +"2531/2541" , + USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE), +/* * Not sure who reported this originally but * Pavel Machek <[email protected]> reported that the extra US_FL_SINGLE_LUN
fs/btrfs/lzo.c +2 -1
@@ -357,9 +357,10 @@ int lzo_decompress_bio(struct list_head *ws, struct compressed_bio *cb)ASSERT (cur_in / sectorsize == (cur_in +LZO_LEN -1 ) / sectorsize); cur_page = cb->compressed_pages[cur_in /PAGE_SIZE ]; - kaddr =kmap (cur_page);ASSERT (cur_page); + kaddr =kmap (cur_page); seg_len =read_compress_length (kaddr +offset_in_page (cur_in)); +kunmap (cur_page); cur_in +=LZO_LEN ;/* Copy the compressed segment payload into workspace */
fs/isofs/inode.c +2 -0
@@ -1322,6 +1322,8 @@ static int isofs_read_inode(struct inode *inode, int relocated) de = (struct iso_directory_record *) (bh->b_data + offset); de_len = *(unsigned char *) de; +if (de_len <sizeof (struct iso_directory_record )) + goto fail;if (offset + de_len > bufsize) {int frag1 = bufsize - offset;
fs/proc/base.c +11 -8
@@ -67,6 +67,7 @@#include <linux/mm.h> #include <linux/swap.h> #include <linux/rcupdate.h> +#include <linux/kallsyms.h> #include <linux/stacktrace.h> #include <linux/resource.h> #include <linux/module.h>
@@ -386,17 +387,19 @@ static int proc_pid_wchan(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *task) { unsigned long wchan; +char symname[KSYM_NAME_LEN ]; -if (ptrace_may_access (task,PTRACE_MODE_READ_FSCREDS )) - wchan =get_wchan (task); -else - wchan =0 ; +if (!ptrace_may_access (task,PTRACE_MODE_READ_FSCREDS )) + goto print0; -if (wchan) -seq_printf (m,"%ps" , (void *) wchan); -else -seq_putc (m,'0' ); + wchan =get_wchan (task); +if (wchan && !lookup_symbol_name (wchan, symname)) { +seq_puts (m, symname); +return 0 ; + } +print0: +seq_putc (m,'0' );return 0 ; }#endif /* CONFIG_KALLSYMS */
include/linux/kfence.h +11 -10
@@ -14,6 +14,9 @@#ifdef CONFIG_KFENCE +#include <linux/atomic.h> +#include <linux/static_key.h> +/* * We allocate an even number of pages, as it simplifies calculations to map * address to metadata indices; effectively, the very first page serves as an
@@ -22,13 +25,8 @@#define KFENCE_POOL_SIZE ((CONFIG_KFENCE_NUM_OBJECTS + 1) * 2 * PAGE_SIZE)extern char *__kfence_pool; -#ifdef CONFIG_KFENCE_STATIC_KEYS -#include <linux/static_key.h> DECLARE_STATIC_KEY_FALSE (kfence_allocation_key); -#else -#include <linux/atomic.h> extern atomic_t kfence_allocation_gate; -#endif /** * is_kfence_address() - check if an address belongs to KFENCE pool
@@ -116,13 +114,16 @@ void *__kfence_alloc(struct kmem_cache *s, size_t size, gfp_t flags);*/ static __always_inline void *kfence_alloc(struct kmem_cache *s, size_t size, gfp_t flags) { -#ifdef CONFIG_KFENCE_STATIC_KEYS -if (static_branch_unlikely (&kfence_allocation_key)) +#if defined(CONFIG_KFENCE_STATIC_KEYS ) ||CONFIG_KFENCE_SAMPLE_INTERVAL ==0 +if (!static_branch_unlikely (&kfence_allocation_key)) +return NULL ;#else - if (unlikely(!atomic_read(&kfence_allocation_gate))) +if (!static_branch_likely (&kfence_allocation_key)) +return NULL ;#endif -return __kfence_alloc (s, size, flags); -return NULL ; +if (likely (atomic_read (&kfence_allocation_gate))) +return NULL ; +return __kfence_alloc (s, size, flags); }/**
include/linux/lsm_hook_defs.h +7 -7
@@ -26,13 +26,13 @@* #undef LSM_HOOK * }; */ -LSM_HOOK(int, 0, binder_set_context_mgr, struct task_struct *mgr) -LSM_HOOK(int, 0, binder_transaction, struct task_struct *from, - struct task_struct *to) -LSM_HOOK(int, 0, binder_transfer_binder, struct task_struct *from, - struct task_struct *to) -LSM_HOOK(int, 0, binder_transfer_file, struct task_struct *from, - struct task_struct *to, struct file *file) +LSM_HOOK(int, 0, binder_set_context_mgr, const struct cred *mgr) +LSM_HOOK(int, 0, binder_transaction, const struct cred *from, + const struct cred *to) +LSM_HOOK(int, 0, binder_transfer_binder, const struct cred *from, + const struct cred *to) +LSM_HOOK(int, 0, binder_transfer_file, const struct cred *from, + const struct cred *to, struct file *file) LSM_HOOK(int, 0, ptrace_access_check, struct task_struct *child, unsigned int mode) LSM_HOOK(int, 0, ptrace_traceme, struct task_struct *parent)
include/linux/lsm_hooks.h +7 -7
@@ -1313,22 +1313,22 @@* * @binder_set_context_mgr: * Check whether @mgr is allowed to be the binder context manager. -* @mgr contains the task_struct for the task being registered. +* @mgr contains the struct cred for the current binder process. * Return 0 if permission is granted. * @binder_transaction: * Check whether @from is allowed to invoke a binder transaction call * to @to. -* @from contains the task_struct for the sending task. -* @to contains the task_struct for the receiving task. +* @from contains the struct cred for the sending process. +* @to contains the struct cred for the receiving process. * @binder_transfer_binder: * Check whether @from is allowed to transfer a binder reference to @to. -* @from contains the task_struct for the sending task. -* @to contains the task_struct for the receiving task. +* @from contains the struct cred for the sending process. +* @to contains the struct cred for the receiving process. * @binder_transfer_file: * Check whether @from is allowed to transfer @file to @to. -* @from contains the task_struct for the sending task. +* @from contains the struct cred for the sending process. * @file contains the struct file being transferred. -* @to contains the task_struct for the receiving task. +* @to contains the struct cred for the receiving process. * * @ptrace_access_check: * Check permission before allowing the current process to trace the
include/linux/security.h +19 -14
@@ -258,13 +258,13 @@ extern int security_init(void);extern int early_security_init (void );/* Security operations */ -int security_binder_set_context_mgr (struct task_struct *mgr); -int security_binder_transaction (struct task_struct *from, -struct task_struct *to); -int security_binder_transfer_binder (struct task_struct *from, -struct task_struct *to); -int security_binder_transfer_file (struct task_struct *from, -struct task_struct *to,struct file *file); +int security_binder_set_context_mgr (const struct cred *mgr); +int security_binder_transaction (const struct cred *from, +const struct cred *to); +int security_binder_transfer_binder (const struct cred *from, +const struct cred *to); +int security_binder_transfer_file (const struct cred *from, +const struct cred *to,struct file *file);int security_ptrace_access_check (struct task_struct *child,unsigned int mode);int security_ptrace_traceme (struct task_struct *parent); int security_capget(struct task_struct *target,
@@ -508,25 +508,25 @@ static inline int early_security_init(void)return 0 ; } -static inline int security_binder_set_context_mgr (struct task_struct *mgr) +static inline int security_binder_set_context_mgr (const struct cred *mgr) {return 0 ; } -static inline int security_binder_transaction (struct task_struct *from, -struct task_struct *to) +static inline int security_binder_transaction (const struct cred *from, +const struct cred *to) {return 0 ; } -static inline int security_binder_transfer_binder (struct task_struct *from, -struct task_struct *to) +static inline int security_binder_transfer_binder (const struct cred *from, +const struct cred *to) {return 0 ; } -static inline int security_binder_transfer_file (struct task_struct *from, -struct task_struct *to, +static inline int security_binder_transfer_file (const struct cred *from, +const struct cred *to,struct file *file) {return 0 ;
@@ -1041,6 +1041,11 @@ static inline void security_transfer_creds(struct cred *new, { } +static inline void security_cred_getsecid (const struct cred *c,u32 *secid) +{ + *secid =0 ; +} +static inline int security_kernel_act_as (struct cred *cred,u32 secid) {return 0 ;
lib/Kconfig.kfence +15 -11
@@ -25,17 +25,6 @@ menuconfig KFENCE if KFENCE -config KFENCE_STATIC_KEYS - bool "Use static keys to set up allocations" - default y - depends on JUMP_LABEL # To ensure performance, require jump labels - help - Use static keys (static branches) to set up KFENCE allocations. Using - static keys is normally recommended, because it avoids a dynamic - branch in the allocator's fast path. However, with very low sample - intervals, or on systems that do not support jump labels, a dynamic - branch may still be an acceptable performance trade-off. - config KFENCE_SAMPLE_INTERVAL int "Default sample interval in milliseconds" default 100
@@ -56,6 +45,21 @@ config KFENCE_NUM_OBJECTS pages are required; with one containing the object and two adjacent ones used as guard pages. +config KFENCE_STATIC_KEYS + bool "Use static keys to set up allocations" if EXPERT + depends on JUMP_LABEL + help + Use static keys (static branches) to set up KFENCE allocations. This + option is only recommended when using very large sample intervals, or + performance has carefully been evaluated with this option. + + Using static keys comes with trade-offs that need to be carefully + evaluated given target workloads and system architectures. Notably, + enabling and disabling static keys invoke IPI broadcasts, the latency + and impact of which is much harder to predict than a dynamic branch. + + Say N if you are unsure. + config KFENCE_STRESS_TEST_FAULTS int "Stress testing of fault handling and error reporting" if EXPERT default 0
mm/kfence/core.c +7 -9
@@ -97,10 +97,11 @@ struct kfence_metadata kfence_metadata[CONFIG_KFENCE_NUM_OBJECTS];static struct list_head kfence_freelist =LIST_HEAD_INIT (kfence_freelist);static DEFINE_RAW_SPINLOCK (kfence_freelist_lock);/* Lock protecting freelist. */ -#ifdef CONFIG_KFENCE_STATIC_KEYS -/* The static key to set up a KFENCE allocation. */ +/* +* The static key to set up a KFENCE allocation; or if static keys are not used +* to gate allocations, to avoid a load and compare if KFENCE is disabled. +*/ DEFINE_STATIC_KEY_FALSE (kfence_allocation_key); -#endif /* Gates the allocation, ensuring only one succeeds in a given period. */ atomic_t kfence_allocation_gate =ATOMIC_INIT (1 );
@@ -668,6 +669,8 @@ void __init kfence_init(void)return ; } +if (!IS_ENABLED (CONFIG_KFENCE_STATIC_KEYS )) +static_branch_enable (&kfence_allocation_key);WRITE_ONCE (kfence_enabled, true);queue_delayed_work (system_unbound_wq, &kfence_timer,0 ); pr_info("initialized - using %lu bytes for %d objects at 0x%p-0x%p\n", KFENCE_POOL_SIZE,
@@ -752,12 +755,7 @@ void *__kfence_alloc(struct kmem_cache *s, size_t size, gfp_t flags) (s->flags & (SLAB_CACHE_DMA | SLAB_CACHE_DMA32)))return NULL ; -/* -* allocation_gate only needs to become non-zero, so it doesn't make -* sense to continue writing to it and pay the associated contention -* cost, in case we have a large number of concurrent allocations. -*/ -if (atomic_read (&kfence_allocation_gate) ||atomic_inc_return (&kfence_allocation_gate) >1 ) +if (atomic_inc_return (&kfence_allocation_gate) >1 )return NULL ;#ifdef CONFIG_KFENCE_STATIC_KEYS /*
security/security.c +7 -7
@@ -747,25 +747,25 @@ static int lsm_superblock_alloc(struct super_block *sb)/* Security operations */ -int security_binder_set_context_mgr (struct task_struct *mgr) +int security_binder_set_context_mgr (const struct cred *mgr) {return call_int_hook (binder_set_context_mgr,0 , mgr); } -int security_binder_transaction (struct task_struct *from, -struct task_struct *to) +int security_binder_transaction (const struct cred *from, +const struct cred *to) {return call_int_hook (binder_transaction,0 , from, to); } -int security_binder_transfer_binder (struct task_struct *from, -struct task_struct *to) +int security_binder_transfer_binder (const struct cred *from, +const struct cred *to) {return call_int_hook (binder_transfer_binder,0 , from, to); } -int security_binder_transfer_file (struct task_struct *from, -struct task_struct *to,struct file *file) +int security_binder_transfer_file (const struct cred *from, +const struct cred *to,struct file *file) {return call_int_hook (binder_transfer_file,0 , from, to, file); }
security/selinux/hooks.c +13 -35
84 lines not on this page · raw message
Greg Kroah-Hartman
maintainerI'm announcing the release of the 5.15.2 kernel.
All users of the 5.15 kernel series must upgrade.
The updated 5.15.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-5.15.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Documentation/dev-tools/kfence.rst | 12 +- Makefile | 2 arch/x86/kvm/ioapic.c | 2 arch/x86/kvm/ioapic.h | 4 arch/x86/kvm/mmu/spte.h | 7 - drivers/android/binder.c | 41 +++------ drivers/android/binder_internal.h | 4 drivers/comedi/drivers/dt9812.c | 115 ++++++++++++++++++++------- drivers/comedi/drivers/ni_usb6501.c | 10 ++ drivers/comedi/drivers/vmk80xx.c | 28 +++--- drivers/net/wireless/rsi/rsi_91x_usb.c | 2 drivers/staging/media/ipu3/ipu3-css-fw.c | 7 - drivers/staging/media/ipu3/ipu3-css-fw.h | 2 drivers/staging/r8188eu/os_dep/ioctl_linux.c | 5 - drivers/staging/rtl8192u/r8192U_core.c | 18 ++-- drivers/staging/rtl8712/usb_intf.c | 4 drivers/staging/rtl8712/usb_ops_linux.c | 2 drivers/usb/gadget/udc/Kconfig | 1 drivers/usb/host/ehci-hcd.c | 11 ++ drivers/usb/host/ehci-platform.c | 6 + drivers/usb/host/ehci.h | 1 drivers/usb/musb/musb_gadget.c | 4 drivers/usb/storage/unusual_devs.h | 10 ++ fs/btrfs/lzo.c | 3 fs/isofs/inode.c | 2 fs/proc/base.c | 19 ++-- include/linux/kfence.h | 21 ++-- include/linux/lsm_hook_defs.h | 14 +-- include/linux/lsm_hooks.h | 14 +-- include/linux/security.h | 33 ++++--- lib/Kconfig.kfence | 26 +++--- mm/kfence/core.c | 16 +-- security/security.c | 14 +-- security/selinux/hooks.c | 48 +++-------- 34 files changed, 297 insertions(+), 211 deletions(-)
Geert Uytterhoeven (1):
usb: gadget: Mark USB_FSL_QE broken on 64-bit
Greg Kroah-Hartman (1):
Linux 5.15.2
Gustavo A. R. Silva (1):
media: staging/intel-ipu3: css: Fix wrong size comparison imgu_css_fw_init
James Buren (1):
usb-storage: Add compatibility quirk flags for iODD 2531/2541
Jan Kara (1):
isofs: Fix out of bound access for corrupted isofs image
Johan Hovold (8):
comedi: dt9812: fix DMA buffers on stack
comedi: ni_usb6501: fix NULL-deref in command paths
comedi: vmk80xx: fix transfer-buffer overflows
comedi: vmk80xx: fix bulk-buffer overflow
comedi: vmk80xx: fix bulk and interrupt message timeouts
staging: r8712u: fix control-message timeout
staging: rtl8192u: fix control-message timeouts
rsi: fix control-message timeout
Juergen Gross (1):
Revert "x86/kvm: fix vcpu-id indexed array sizes"
Kees Cook (1):
Revert "proc/wchan: use printk format instead of lookup_symbol_name()"
Linus Torvalds (1):
btrfs: fix lzo_decompress_bio() kmap leakage
Marco Elver (2):
kfence: always use static branches to guard kfence_alloc()
kfence: default to dynamic branch instead of static keys mode
Martin Kaiser (1):
staging: r8188eu: fix memleak in rtw_wx_set_enc_ext
Neal Liu (1):
usb: ehci: handshake CMD_RUN instead of STS_HALT
Paolo Bonzini (1):
KVM: x86: avoid warning with -Wbitwise-instead-of-logical
Pavel Skripkin (1):
staging: rtl8712: fix use-after-free in rtl8712_dl_fw
Todd Kjos (4):
binder: use euid from cred instead of using task
binder: use cred instead of task for selinux checks
binder: use cred instead of task for getsecid
binder: don't detect sender/target during buffer cleanup
Viraj Shah (1):
usb: musb: Balance list entry in musb_gadget_queue