id
stringlengths
40
40
instruction
stringlengths
68
308
input
stringlengths
17
33.4k
output
stringlengths
100
30k
718e6b51298e0f254baca0d40ab52a00e004e014
Analyze and fix the following issue in the Linux kernel code: af_unix: Fix msg_controllen test in scm_pidfd_recv() for MSG_CMSG_COMPAT.
Problem Details: Heiko Carstens reported that SCM_PIDFD does not work with MSG_CMSG_COMPAT because scm_pidfd_recv() always checks msg_controllen against sizeof(struct cmsghdr). We need to use sizeof(struct compat_cmsghdr) for the compat case. Fixes: 5e2ff6704a27 ("scm: add SO_PASSPIDFD and SCM_PIDFD") Reported-by: He...
```diff diff --git a/include/net/scm.h b/include/net/scm.h index c5bcdf65f55c..e8c76b4be2fe 100644 --- a/include/net/scm.h +++ b/include/net/scm.h @@ -9,6 +9,7 @@ #include <linux/pid.h> #include <linux/nsproxy.h> #include <linux/sched/signal.h> +#include <net/compat.h> /* Well, we should have at least one descrip...
e1cd4004cde7c9b694bbdd8def0e02288ee58c74
Analyze and fix the following issue in the Linux kernel code: HID: sony: Fix a potential memory leak in sony_probe()
Problem Details: If an error occurs after a successful usb_alloc_urb() call, usb_free_urb() should be called. Fixes: fb1a79a6b6e1 ("HID: sony: fix freeze when inserting ghlive ps3/wii dongles") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
```diff diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index dd942061fd77..a02046a78b2d 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -2155,6 +2155,9 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id) return ret; err: + if (sc->ghl_urb) + usb_free...
edee62c0852aa7e107b9e9e7f1b3669a8d293ca2
Analyze and fix the following issue in the Linux kernel code: accel/ivpu: Add information about context on failure
Problem Details: Identify the mmu context that failed to initialize in the error messages. This allows the error to be correlated with a specific user during debug. Reviewed-by: Karol Wachowski <karol.wachowski@linux.intel.com> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Signed-off-by: Stanislaw Gruszka <stanis...
```diff diff --git a/drivers/accel/ivpu/ivpu_mmu_context.c b/drivers/accel/ivpu/ivpu_mmu_context.c index 8914e34fb54f..5b48983c7cf8 100644 --- a/drivers/accel/ivpu/ivpu_mmu_context.c +++ b/drivers/accel/ivpu/ivpu_mmu_context.c @@ -490,13 +490,13 @@ int ivpu_mmu_user_context_init(struct ivpu_device *vdev, struct ivpu_mm...
7583028d359db3cd0072badcc576b4f9455fd27a
Analyze and fix the following issue in the Linux kernel code: drm: gm12u320: Fix the timeout usage for usb_bulk_msg()
Problem Details: The timeout arg of usb_bulk_msg() is ms already, which has been converted to jiffies by msecs_to_jiffies() in usb_start_wait_urb(). So fix the usage by removing the redundant msecs_to_jiffies() in the macros. And as Hans suggested, also remove msecs_to_jiffies() for the IDLE_TIMEOUT macro to make it c...
```diff diff --git a/drivers/gpu/drm/tiny/gm12u320.c b/drivers/gpu/drm/tiny/gm12u320.c index c5bb683e440c..0187539ff5ea 100644 --- a/drivers/gpu/drm/tiny/gm12u320.c +++ b/drivers/gpu/drm/tiny/gm12u320.c @@ -70,10 +70,10 @@ MODULE_PARM_DESC(eco_mode, "Turn on Eco mode (less bright, more silent)"); #define READ_STATUS_S...
a454d84ee20baf7bd7be90721b9821f73c7d23d9
Analyze and fix the following issue in the Linux kernel code: bpf, sockmap: Fix skb refcnt race after locking changes
Problem Details: There is a race where skb's from the sk_psock_backlog can be referenced after userspace side has already skb_consumed() the sk_buff and its refcnt dropped to zer0 causing use after free. The flow is the following: while ((skb = skb_peek(&psock->ingress_skb)) sk_psock_handle_Skb(psock, skb, ...,...
```diff diff --git a/net/core/skmsg.c b/net/core/skmsg.c index a0659fc29bcc..6c31eefbd777 100644 --- a/net/core/skmsg.c +++ b/net/core/skmsg.c @@ -612,12 +612,18 @@ static int sk_psock_skb_ingress_self(struct sk_psock *psock, struct sk_buff *skb static int sk_psock_handle_skb(struct sk_psock *psock, struct sk_buff *sk...
45dc8fc07d01b6786db88b5b176c67f9e3487d1e
Analyze and fix the following issue in the Linux kernel code: fbdev/g364fb: fix build failure with mips
Problem Details: Fix the typo which resulted in the driver using FB_DEFAULT_IOMEM_HELPERS instead of FB_DEFAULT_IOMEM_OPS as the fbdev I/O helpers. Fixes: 501126083855 ("fbdev/g364fb: Use fbdev I/O helpers") Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@g...
```diff diff --git a/drivers/video/fbdev/g364fb.c b/drivers/video/fbdev/g364fb.c index 7a1013b22fa7..ee6fe51e0a6b 100644 --- a/drivers/video/fbdev/g364fb.c +++ b/drivers/video/fbdev/g364fb.c @@ -112,7 +112,7 @@ static int g364fb_blank(int blank, struct fb_info *info); static const struct fb_ops g364fb_ops = { .own...
719c5e37e99d2fd588d1c994284d17650a66354c
Analyze and fix the following issue in the Linux kernel code: net: phy: micrel: Correct bit assignments for phy_device flags
Problem Details: Previously, the defines for phy_device flags in the Micrel driver were ambiguous in their representation. They were intended to be bit masks but were mistakenly defined as bit positions. This led to the following issues: - MICREL_KSZ8_P1_ERRATA, designated for KSZ88xx switches, overlapped with MICRE...
```diff diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h index 8bef1ab62bba..322d87255984 100644 --- a/include/linux/micrel_phy.h +++ b/include/linux/micrel_phy.h @@ -41,9 +41,9 @@ #define PHY_ID_KSZ9477 0x00221631 /* struct phy_device dev_flags definitions */ -#define MICREL_PHY_50MHZ_CLK 0x00...
f31867d0d9d82af757c1e0178b659438f4c1ea3c
Analyze and fix the following issue in the Linux kernel code: net: ipv6/addrconf: avoid integer underflow in ipv6_create_tempaddr
Problem Details: The existing code incorrectly casted a negative value (the result of a subtraction) to an unsigned value without checking. For example, if /proc/sys/net/ipv6/conf/*/temp_prefered_lft was set to 1, the preferred lifetime would jump to 4 billion seconds. On my machine and network the shortest lifetime th...
```diff diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 47d1dd8501b7..85cdbc252654 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -1378,7 +1378,7 @@ retry: * idev->desync_factor if it's larger */ cnf_temp_preferred_lft = READ_ONCE(idev->cnf.temp_prefered_lft); - max_desync_factor = m...
151e887d8ff97e2e42110ffa1fb1e6a2128fb364
Analyze and fix the following issue in the Linux kernel code: veth: Fixing transmit return status for dropped packets
Problem Details: The veth_xmit function returns NETDEV_TX_OK even when packets are dropped. This behavior leads to incorrect calculations of statistics counts, as well as things like txq->trans_start updates. Fixes: e314dbdc1c0d ("[NET]: Virtual ethernet device driver.") Signed-off-by: Liang Chen <liangchen.linux@gmai...
```diff diff --git a/drivers/net/veth.c b/drivers/net/veth.c index d43e62ebc2fc..9c6f4f83f22b 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -344,6 +344,7 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev) { struct veth_priv *rcv_priv, *priv = netdev_priv(dev); struct veth_rq...
817c7cd2043a83a3d8147f40eea1505ac7300b62
Analyze and fix the following issue in the Linux kernel code: gve: fix frag_list chaining
Problem Details: gve_rx_append_frags() is able to build skbs chained with frag_list, like GRO engine. Problem is that shinfo->frag_list should only be used for the head of the chain. All other links should use skb->next pointer. Otherwise, built skbs are not valid and can cause crashes. Equivalent code in GRO (skb_...
```diff diff --git a/drivers/net/ethernet/google/gve/gve_rx_dqo.c b/drivers/net/ethernet/google/gve/gve_rx_dqo.c index ea0e38b4d9e9..f281e42a7ef9 100644 --- a/drivers/net/ethernet/google/gve/gve_rx_dqo.c +++ b/drivers/net/ethernet/google/gve/gve_rx_dqo.c @@ -570,7 +570,10 @@ static int gve_rx_append_frags(struct napi_s...
915d975b2ffa58a14bfcf16fafe00c41315949ff
Analyze and fix the following issue in the Linux kernel code: net: deal with integer overflows in kmalloc_reserve()
Problem Details: Blamed commit changed: ptr = kmalloc(size); if (ptr) size = ksize(ptr); to: size = kmalloc_size_roundup(size); ptr = kmalloc(size); This allowed various crash as reported by syzbot [1] and Kyle Zeng. Problem is that if @size is bigger than 0x80000001, kmalloc_size_roundup(size)...
```diff diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 17caf4ea67da..4eaf7ed0d1f4 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -550,7 +550,7 @@ static void *kmalloc_reserve(unsigned int *size, gfp_t flags, int node, bool *pfmemalloc) { bool ret_pfmemalloc = false; - unsigned int obj_s...
1acfe2c1225899eab5ab724c91b7e1eb2881b9ab
Analyze and fix the following issue in the Linux kernel code: virtio_ring: fix avail_wrap_counter in virtqueue_add_packed
Problem Details: In current packed virtqueue implementation, the avail_wrap_counter won't flip, in the case when the driver supplies a descriptor chain with a length equals to the queue size; total_sg == vq->packed.vring.num. Let’s assume the following situation: vq->packed.vring.num=4 vq->packed.next_avail_idx: 1 vq-...
```diff diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 81ecb29c88f1..51d8f3299c10 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -1499,7 +1499,7 @@ static inline int virtqueue_add_packed(struct virtqueue *_vq, } } - if (i < head) + if (i <= head) ...
ae15aceaa98ad9499763923f7890e345d9f46b60
Analyze and fix the following issue in the Linux kernel code: virtio_vdpa: build affinity masks conditionally
Problem Details: We try to build affinity mask via create_affinity_masks() unconditionally which may lead several issues: - the affinity mask is not used for parent without affinity support (only VDUSE support the affinity now) - the logic of create_affinity_masks() might not work for devices other than block. For...
```diff diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c index 961161da5900..06ce6d8c2e00 100644 --- a/drivers/virtio/virtio_vdpa.c +++ b/drivers/virtio/virtio_vdpa.c @@ -366,11 +366,14 @@ static int virtio_vdpa_find_vqs(struct virtio_device *vdev, unsigned int nvqs, struct irq_affinity defaul...
feec5e1f74f5b735c0c5c02ec70673db1334173f
Analyze and fix the following issue in the Linux kernel code: kbuild: Show marked Kconfig fragments in "help"
Problem Details: Currently the Kconfig fragments in kernel/configs and arch/*/configs that aren't used internally aren't discoverable through "make help", which consists of hard-coded lists of config fragments. Instead, list all the fragment targets that have a "# Help: " comment prefix so the targets can be generated ...
```diff diff --git a/Makefile b/Makefile index e21bf66af6fd..23cd62a5ff05 100644 --- a/Makefile +++ b/Makefile @@ -1552,7 +1552,6 @@ help: @echo ' mrproper - Remove all generated files + config + various backup files' @echo ' distclean - mrproper + remove editor backup and patch files' @echo '' - @echo ...
fa09bc40b21a33937872c4c4cf0f266ec9fa4869
Analyze and fix the following issue in the Linux kernel code: igb: disable virtualization features on 82580
Problem Details: Disable virtualization features on 82580 just as on i210/i211. This avoids that virt functions are acidentally called on 82850. Fixes: 55cac248caa4 ("igb: Add full support for 82580 devices") Signed-off-by: Corinna Vinschen <vinschen@redhat.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-...
```diff diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 1ab787ed254d..13ba9c74bd84 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -3933,8 +3933,9 @@ static void igb_probe_vfs(struct igb_adapter *adapter) ...
99e25b17d2a3e3b486b4f6f90a740d51245da1f2
Analyze and fix the following issue in the Linux kernel code: pcmcia: typo fix
Problem Details: themselfves -> themselves Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
```diff diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index d78091e79a0f..e9e31c638a67 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -684,7 +684,7 @@ EXPORT_SYMBOL(pcmcia_request_io); * pcmcia_request_irq() is a wrapper around request_irq() ...
99e1241049a92dd3e9a90a0f91e32ce390133278
Analyze and fix the following issue in the Linux kernel code: pcmcia: ds: fix possible name leak in error path in pcmcia_device_add()
Problem Details: Afer commit 1fa5ae857bb1 ("driver core: get rid of struct device's bus_id string array"), the name of device is allocated dynamically. Therefore, it needs to be freed, which is done by the driver core for us once all references to the device are gone. Therefore, move the dev_set_name() call immediately...
```diff diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index c90c68dee1e4..b4b8363d1de2 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -513,9 +513,6 @@ static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, /* by default don't allow DMA */ p_dev->dma_mask = 0; p_dev->dev.dm...
402ab979b29126068e0b596b641422ff7490214c
Analyze and fix the following issue in the Linux kernel code: pcmcia: ds: fix refcount leak in pcmcia_device_add()
Problem Details: As the comment of device_register() says, it should use put_device() to give up the reference in the error path. Then, insofar resources will be freed in pcmcia_release_dev(), the error path is no longer needed. In particular, this means that the (previously missing) dropping of the reference to &p_dev...
```diff diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index d500e5dbbc3f..c90c68dee1e4 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -573,8 +573,14 @@ static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, pcmcia_device_query(p_dev); - if (device_register(&p_dev->dev)) - ...
e3ea1b4847e49234e691c0d66bf030bd65bb7f2b
Analyze and fix the following issue in the Linux kernel code: pcmcia: cs: fix possible hung task and memory leak pccardd()
Problem Details: If device_register() returns error in pccardd(), it leads two issues: 1. The socket_released has never been completed, it will block pcmcia_unregister_socket(), because of waiting for completion of socket_released. 2. The device name allocated by dev_set_name() is leaked. Fix this two issues by...
```diff diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 5658745c398f..b33be1e63c98 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -605,6 +605,7 @@ static int pccardd(void *__skt) dev_warn(&skt->dev, "PCMCIA: unable to register socket\n"); skt->thread = NULL; complete(&skt->thread_do...
e68d343d2720779362cb7160cb7f4bd24979b2b4
Analyze and fix the following issue in the Linux kernel code: mm/kmemleak: move up cond_resched() call in page scanning loop
Problem Details: Commit bde5f6bc68db ("kmemleak: add scheduling point to kmemleak_scan()") added a cond_resched() call to the struct page scanning loop to prevent soft lockup from happening. However, soft lockup can still happen in that loop in some corner cases when the pages that satisfy the "!(pfn & 63)" check are ...
```diff diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 2918150e31bd..54c2c90d3abc 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -1584,6 +1584,9 @@ static void kmemleak_scan(void) for (pfn = start_pfn; pfn < end_pfn; pfn++) { struct page *page = pfn_to_online_page(pfn); + if (!(pfn & 63)) + cond_resc...
6ad11bc6ed37c6371e9e13619862709b6529b43a
Analyze and fix the following issue in the Linux kernel code: rmap: remove anon_vma_link() nommu stub
Problem Details: anon_vma_link() is unused since commit 5beb49305251 ("mm: change anon_vma linking to fix multi-process server scalability issue"). Link: https://lkml.kernel.org/r/cdce9b00c9ab15f6d02eddf40dcad537d3e9676f.1692877089.git.baruch@tkos.co.il Signed-off-by: Baruch Siach <baruch@tkos.co.il> Reviewed-by: Davi...
```diff diff --git a/include/linux/rmap.h b/include/linux/rmap.h index a3825ce81102..51cc21ebb568 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -479,7 +479,6 @@ struct anon_vma *folio_lock_anon_vma_read(struct folio *folio, #define anon_vma_init() do {} while (0) #define anon_vma_prepare(vma) (0)...
ee40d543e97d23d3392d8fb1ec9972eb4e9c7611
Analyze and fix the following issue in the Linux kernel code: mm/pagewalk: fix bootstopping regression from extra pte_unmap()
Problem Details: Mikhail reports early-6.6-based Fedora Rawhide not booting: "rcu_preempt detected expedited stalls", minutes wait, and then hung_task splat while kworker trying to synchronize_rcu_expedited(). Nothing logged to disk. He bisected to my 6.6 a349d72fd9ef ("mm/pgtable: add rcu_read_lock() and rcu_read_un...
```diff diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 9b2d23fbf4d3..b7d7e4fcfad7 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -58,7 +58,7 @@ static int walk_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, pte = pte_offset_map(pmd, addr); if (pte) { err = walk_pte_range_inner(pte, addr, e...
76be05d4fd6c91a3885298f1dc3efeef32846399
Analyze and fix the following issue in the Linux kernel code: cgroup: fix build when CGROUP_SCHED is not enabled
Problem Details: Sudip Mukherjee reports that the mips sb1250_swarm_defconfig build fails with the current kernel. It isn't actually MIPS-specific, it's just that that defconfig does not have CGROUP_SCHED enabled like most configs do, and as such shows this error: kernel/cgroup/cgroup.c: In function 'cgroup_local_s...
```diff diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index babb34a643ea..1fb7f562289d 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -3673,21 +3673,9 @@ static int cgroup_extra_stat_show(struct seq_file *seq, int ssid) css_put(css); return ret; } -#endif - -static int cpu_stat_...
8df0f84c3bb921f5aa1036223dd932bbc7df6df9
Analyze and fix the following issue in the Linux kernel code: fbdev/g364fb: fix build failure with mips
Problem Details: Fix the typo which resulted in the driver using FB_DEFAULT_IOMEM_HELPERS instead of FB_DEFAULT_IOMEM_OPS as the fbdev I/O helpers. Fixes: 501126083855 ("fbdev/g364fb: Use fbdev I/O helpers") Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@g...
```diff diff --git a/drivers/video/fbdev/g364fb.c b/drivers/video/fbdev/g364fb.c index 7a1013b22fa7..ee6fe51e0a6b 100644 --- a/drivers/video/fbdev/g364fb.c +++ b/drivers/video/fbdev/g364fb.c @@ -112,7 +112,7 @@ static int g364fb_blank(int blank, struct fb_info *info); static const struct fb_ops g364fb_ops = { .own...
9ea150a8d073c2f2987d7e9ea4c35856449c9cb2
Analyze and fix the following issue in the Linux kernel code: perf parse-events: Fixes relating to no_value terms
Problem Details: A term may have no value in which case it is assumed to have a value of 1. It doesn't just apply to alias/event terms so change the parse_events_term__to_strbuf assert. Commit 99e7138eb7897aa0 ("perf tools: Fail on using multiple bits long terms without value") made it so that no_value terms could onl...
```diff diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index d86076d575ed..d47f1f871164 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c @@ -2170,7 +2170,7 @@ static const struct evlist_test test__events[] = { static const struct evlist_test test__eve...
f8858d96061f5942216c6abb0194c3ea7b78e1e8
Analyze and fix the following issue in the Linux kernel code: sched/fair: Optimize should_we_balance() for large SMT systems
Problem Details: should_we_balance() is called in load_balance() to find out if the CPU that is trying to do the load balance is the right one or not. With commit: b1bfeab9b002("sched/fair: Consider the idle state of the whole core for load balance") the code tries to find an idle core to do the load balancing and...
```diff diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 8dbff6e7ad4f..33a2b6bba676 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6619,6 +6619,7 @@ dequeue_throttle: /* Working cpumask for: load_balance, load_balance_newidle. */ static DEFINE_PER_CPU(cpumask_var_t, load_balance_mask); st...
4cbc7d9cdfbed4c0ab65c3061af901fa8ec971ff
Analyze and fix the following issue in the Linux kernel code: ALSA: sb: Fix wrong argument in commented code
Problem Details: While rewriting the code from sockptr_t to iov_iter during the development, I forgot to replace one place in emu8000-pcm code. As it's in the disabled area (with ifdef), it's never built and overlooked. Replace with the proper argument NULL. Fixes: 9d0fdc602de9 ("ALSA: emu8000: Convert to generic PC...
```diff diff --git a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c index c05935c2edc4..9234d4fe8ada 100644 --- a/sound/isa/sb/emu8000_pcm.c +++ b/sound/isa/sb/emu8000_pcm.c @@ -456,7 +456,7 @@ static int emu8k_pcm_silence(struct snd_pcm_substream *subs, /* convert to word unit */ pos = (pos << 1) + rec->l...
e14ebde5df2ade7164b3adc3b8644d531a78a785
Analyze and fix the following issue in the Linux kernel code: ALSA: pcm: Fix error checks of default read/write copy ops
Problem Details: copy_from/to_iter() returns the actually copied bytes, and the more correct check should be to compare with the given bytes, instead of zero-check. Fixes: cf393babb37a ("ALSA: pcm: Add copy ops with iov_iter") Reported-by: Al Viro <viro@zeniv.linux.org.uk> Closes: https://lore.kernel.org/r/20230902053...
```diff diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index 4859fb1caec9..a11cd7d6295f 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c @@ -1992,8 +1992,8 @@ static int default_write_copy(struct snd_pcm_substream *substream, int channel, unsigned long hwoff, struct iov_iter *i...
cbb557ba92f08b945e2cb20b7ab37ef49ab53cdd
Analyze and fix the following issue in the Linux kernel code: tracing/filters: Fix coding style issues
Problem Details: Recent commits have introduced some coding style issues, fix those up. Link: https://lkml.kernel.org/r/20230901151039.125186-5-vschneid@redhat.com Cc: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Valentin Schneider <vschneid@redhat.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis...
```diff diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 09b4733a2933..33264e510d16 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c @@ -1360,7 +1360,7 @@ int filter_assign_type(const char *type) return FILTER_DYN_STRING; if (strst...
1caf7adb9e000479d2bd29c86b6d7eaeb24b1b05
Analyze and fix the following issue in the Linux kernel code: tracing/filters: Fix double-free of struct filter_pred.mask
Problem Details: When a cpulist filter is found to contain a single CPU, that CPU is saved as a scalar and the backing cpumask storage is freed. Also NULL the mask to avoid a double-free once we get down to free_predicate(). Link: https://lkml.kernel.org/r/20230901151039.125186-3-vschneid@redhat.com Cc: Masami Hiram...
```diff diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index c06e1d596f4b..eb331e8b00b6 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c @@ -1773,6 +1773,7 @@ static int parse_pred(const char *str, void *data, if (single) { pred->val =...
9af4058493c59721eccd90b7c40cad793e4e3c3b
Analyze and fix the following issue in the Linux kernel code: tracing/filters: Fix error-handling of cpulist parsing buffer
Problem Details: parse_pred() allocates a string buffer to parse the user-provided cpulist, but doesn't check the allocation result nor does it free the buffer once it is no longer needed. Add an allocation check, and free the buffer as soon as it is no longer needed. Link: https://lkml.kernel.org/r/20230901151039.12...
```diff diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c index 3a529214a21b..c06e1d596f4b 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c @@ -1744,17 +1744,23 @@ static int parse_pred(const char *str, void *data, /* Copy the cpulist betwe...
3d07fa1dd19035eb0b13ae6697efd5caa9033e74
Analyze and fix the following issue in the Linux kernel code: tracing: Zero the pipe cpumask on alloc to avoid spurious -EBUSY
Problem Details: The pipe cpumask used to serialize opens between the main and percpu trace pipes is not zeroed or initialized. This can result in spurious -EBUSY returns if underlying memory is not fully zeroed. This has been observed by immediate failure to read the main trace_pipe file on an otherwise newly booted a...
```diff diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 23579fba1a57..35783a7baf15 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -9474,7 +9474,7 @@ static struct trace_array *trace_array_create(const char *name) if (!alloc_cpumask_var(&tr->tracing_cpumask, GFP_KERNEL)) goto out_fre...
2933d3cd079d3bf6fded709de7d97c1dc71d9633
Analyze and fix the following issue in the Linux kernel code: tracing: Replace strlcpy with strscpy in trace/events/task.h
Problem Details: strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated [1]. In an effort to remove strlcpy() completely [2], replace strlcpy() here with strscpy(). No retur...
```diff diff --git a/include/trace/events/task.h b/include/trace/events/task.h index 64d160930b0d..47b527464d1a 100644 --- a/include/trace/events/task.h +++ b/include/trace/events/task.h @@ -47,7 +47,7 @@ TRACE_EVENT(task_rename, TP_fast_assign( __entry->pid = task->pid; memcpy(entry->oldcomm, task->comm, TASK_...
3163f635b20e9e1fb4659e74f47918c9dddfe64e
Analyze and fix the following issue in the Linux kernel code: tracing: Fix race issue between cpu buffer write and swap
Problem Details: Warning happened in rb_end_commit() at code: if (RB_WARN_ON(cpu_buffer, !local_read(&cpu_buffer->committing))) WARNING: CPU: 0 PID: 139 at kernel/trace/ring_buffer.c:3142 rb_commit+0x402/0x4a0 Call Trace: ring_buffer_unlock_commit+0x42/0x250 trace_buffer_unlock_commit_regs+0x3b/0x250 tr...
```diff diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 3e55375f47e0..23579fba1a57 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -7599,6 +7599,11 @@ out: return ret; } +static void tracing_swap_cpu_buffer(void *tr) +{ + update_max_tr_single((struct trace_array *)tr, current, smp_pr...
2cf0dee989a8b2501929eaab29473b6b1fa11057
Analyze and fix the following issue in the Linux kernel code: tracing: Remove extra space at the end of hwlat_detector/mode
Problem Details: Space is printed after each mode value including the last one: $ echo \"$(sudo cat /sys/kernel/tracing/hwlat_detector/mode)\" "none [round-robin] per-cpu " Found by Linux Verification Center (linuxtesting.org) with SVACE. Link: https://lore.kernel.org/linux-trace-kernel/20230825103432.7750-1-m.kobuk@...
```diff diff --git a/kernel/trace/trace_hwlat.c b/kernel/trace/trace_hwlat.c index 2f37a6e68aa9..b791524a6536 100644 --- a/kernel/trace/trace_hwlat.c +++ b/kernel/trace/trace_hwlat.c @@ -635,7 +635,7 @@ static int s_mode_show(struct seq_file *s, void *v) else seq_printf(s, "%s", thread_mode_str[mode]); - if (mod...
6ea7bb00c1ba180f8bf8320b8d59b532501c5271
Analyze and fix the following issue in the Linux kernel code: selftests/x86: Update map_shadow_stack syscall nr
Problem Details: Shadow stack's selftest utilizes the map_shadow_stack syscall. The syscall is new with the feature, but the selftests cannot automatically find the headers for the kernel source tree they are located in. This resulted in the shadow stack test failing to build until the brand new headers were installed....
```diff diff --git a/tools/testing/selftests/x86/test_shadow_stack.c b/tools/testing/selftests/x86/test_shadow_stack.c index 2188968674cb..757e6527f67e 100644 --- a/tools/testing/selftests/x86/test_shadow_stack.c +++ b/tools/testing/selftests/x86/test_shadow_stack.c @@ -40,7 +40,7 @@ * without building the headers. ...
32f5dea040ee6e3cc30ac52d23f1674fd5110d03
Analyze and fix the following issue in the Linux kernel code: io_uring/fdinfo: only print ->sq_array[] if it's there
Problem Details: If a ring is setup with IORING_SETUP_NO_SQARRAY, then we don't have the SQ array. Don't try to dump info from it through fdinfo if that is the case. Reported-by: syzbot+216e2ea6e0bf4a0acdd7@syzkaller.appspotmail.com Fixes: 2af89abda7d9 ("io_uring: add option to remove SQ indirection") Reviewed-by: Gab...
```diff diff --git a/io_uring/fdinfo.c b/io_uring/fdinfo.c index 300455b4bc12..c53678875416 100644 --- a/io_uring/fdinfo.c +++ b/io_uring/fdinfo.c @@ -93,6 +93,8 @@ __cold void io_uring_show_fdinfo(struct seq_file *m, struct file *f) struct io_uring_sqe *sqe; unsigned int sq_idx; + if (ctx->flags & IORING_SETU...
9300f00439743c4a34d735e1a27118eb68a1504e
Analyze and fix the following issue in the Linux kernel code: RISC-V: Add ptrace support for vectors
Problem Details: This patch add back the ptrace support with the following fix: - Define NT_RISCV_CSR and re-number NT_RISCV_VECTOR to prevent conflicting with gdb's NT_RISCV_CSR. - Use struct __riscv_v_regset_state to handle ptrace requests Since gdb does not directly include the note description header in Linux...
```diff diff --git a/arch/riscv/include/uapi/asm/ptrace.h b/arch/riscv/include/uapi/asm/ptrace.h index 283800130614..575e95bb1bc3 100644 --- a/arch/riscv/include/uapi/asm/ptrace.h +++ b/arch/riscv/include/uapi/asm/ptrace.h @@ -103,13 +103,18 @@ struct __riscv_v_ext_state { * In signal handler, datap will be set a co...
eb746180132a555da8cfb02d98cb6d0a9d58e870
Analyze and fix the following issue in the Linux kernel code: riscv: dma-mapping: only invalidate after DMA, not flush
Problem Details: No other architecture intentionally writes back dirty cache lines into a buffer that a device has just finished writing into. If the cache is clean, this has no effect at all, but if a cacheline in the buffer has actually been written by the CPU, there is a driver bug that is likely made worse by over...
```diff diff --git a/arch/riscv/mm/dma-noncoherent.c b/arch/riscv/mm/dma-noncoherent.c index d51a75864e53..94614cf61cdd 100644 --- a/arch/riscv/mm/dma-noncoherent.c +++ b/arch/riscv/mm/dma-noncoherent.c @@ -42,7 +42,7 @@ void arch_sync_dma_for_cpu(phys_addr_t paddr, size_t size, break; case DMA_FROM_DEVICE: case...
dce19a3fede254fd11e0013f1c6fe3bfc37a4d73
Analyze and fix the following issue in the Linux kernel code: kunit: test: Make filter strings in executor_test writable
Problem Details: KUnit's attribute filtering feature needs the filter strings passed in to be writable, as it modifies them in-place during parsing. This works for the filters passed on the kernel command line, but the string literals used in the executor tests are at least theoretically read-only (though they work on ...
```diff diff --git a/lib/kunit/executor_test.c b/lib/kunit/executor_test.c index 4084071d0eb5..b4f6f96b2844 100644 --- a/lib/kunit/executor_test.c +++ b/lib/kunit/executor_test.c @@ -119,7 +119,7 @@ static void parse_filter_attr_test(struct kunit *test) { int j, filter_count; struct kunit_attr_filter *parsed_filte...
5a26e45edb4690d58406178b5a9ea4c6dcf2c105
Analyze and fix the following issue in the Linux kernel code: null_blk: fix poll request timeout handling
Problem Details: When doing io_uring benchmark on /dev/nullb0, it's easy to crash the kernel if poll requests timeout triggered, as reported by David. [1] BUG: kernel NULL pointer dereference, address: 0000000000000008 Workqueue: kblockd blk_mq_timeout_work RIP: 0010:null_timeout_rq+0x4e/0x91 Call Trace: ? null_timeo...
```diff diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 864013019d6b..968090935eb2 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -1643,9 +1643,12 @@ static int null_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob) struct nullb_queue *nq =...
3888fa134eddac467b5a094949a8f0731ef6ffd5
Analyze and fix the following issue in the Linux kernel code: docs/bpf: Fix "file doesn't exist" warnings in {llvm_reloc,btf}.rst
Problem Details: scripts/documentation-file-ref-check reports warnings for (valid) cross-links of form: :ref:`Documentation/bpf/btf <BTF_Ext_Section>` Adding extension to the file name helps to avoid the warning, e.g: :ref:`Documentation/bpf/btf.rst <BTF_Ext_Section>` Fixes: be4033d36070 ("docs/bpf: Add descrip...
```diff diff --git a/Documentation/bpf/btf.rst b/Documentation/bpf/btf.rst index ffc11afee569..e43c2fdafcd7 100644 --- a/Documentation/bpf/btf.rst +++ b/Documentation/bpf/btf.rst @@ -803,7 +803,7 @@ structure when .BTF.ext is generated. All ``bpf_core_relo`` structures within a single ``btf_ext_info_sec`` describe rel...
b484a40dc1f16edb58e5430105a021e1916e6f27
Analyze and fix the following issue in the Linux kernel code: io_uring: fix IO hang in io_wq_put_and_exit from do_exit()
Problem Details: io_wq_put_and_exit() is called from do_exit(), but all FIXED_FILE requests in io_wq aren't canceled in io_uring_cancel_generic() called from do_exit(). Meantime io_wq IO code path may share resource with normal iopoll code path. So if any HIPRI request is submittd via io_wq, this request may not get r...
```diff diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index e7675355048d..c6d9e4677073 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -3290,6 +3290,37 @@ static s64 tctx_inflight(struct io_uring_task *tctx, bool tracked) return percpu_counter_sum(&tctx->inflight); } +static void io_uring_ca...
f7cf22424665043787a96a66a048ff6b2cfd473c
Analyze and fix the following issue in the Linux kernel code: s390/dasd: fix string length handling
Problem Details: Building dasd_eckd.o with latest clang reveals this bug: CC drivers/s390/block/dasd_eckd.o drivers/s390/block/dasd_eckd.c:1082:3: warning: 'snprintf' will always be truncated; specified size is 1, but format string expands to at least 11 [-Wfortify-source] 1082 | ...
```diff diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index 620fab01b710..c4e36650c426 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c @@ -1378,16 +1378,12 @@ static ssize_t dasd_vendor_show(struct device *dev, static DEVICE_ATTR(vendor, 0444, d...
ef98a4883298bc2ead30ade6b6a10c4ac4bc07c8
Analyze and fix the following issue in the Linux kernel code: ASoC: Name iov_iter argument as iterator instead of buffer
Problem Details: While transitioning ASoC code for iov_iter usages, I kept the argument name as "buf" as the original code. But, iov_iter is an iterator, and using the name "buf" may be misleading: the crucial difference is that iov_iter can be proceeded after the operation, hence it can't be passed twice, while a sim...
```diff diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index 17bea3144551..ceca69b46a82 100644 --- a/include/sound/soc-component.h +++ b/include/sound/soc-component.h @@ -139,7 +139,7 @@ struct snd_soc_component_driver { struct snd_pcm_audio_tstamp_report *audio_tstamp_report); int (*co...
69d0fd348d31977368defc3c0737c0ecb824732b
Analyze and fix the following issue in the Linux kernel code: ASoC: dmaengine: Drop unused iov_iter for process callback
Problem Details: Passing the iov_iter to the process callback is rather buggy, as the iterator has been already processed for playback. Similarly, it makes the copy for capture buggy after the process callback reading the iterator out. Moreover, all existing process callbacks don't refer to the passed iterator at all...
```diff diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h index c9a8bce9a785..d70c55f17df7 100644 --- a/include/sound/dmaengine_pcm.h +++ b/include/sound/dmaengine_pcm.h @@ -142,7 +142,7 @@ struct snd_dmaengine_pcm_config { struct snd_pcm_substream *substream); int (*process)(struct snd_p...
e2884fe84a83c562346eb9d92783a3576ce67177
Analyze and fix the following issue in the Linux kernel code: drm/amd: Make fence wait in suballocator uninterruptible
Problem Details: Commit c103a23f2f29 ("drm/amd: Convert amdgpu to use suballocation helper.") made the fence wait in amdgpu_sa_bo_new() interruptible but there is no code to handle an interrupt. This caused the kernel to randomly explode in high-VRAM-pressure situations so make it uninterruptible again. Signed-off-by:...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c index c6b4337eb20c..10df731998b2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c @@ -81,7 +81,7 @@ int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager, unsi...
c1970e26bdc1209974bb5cf31cc23f2b7ad6ce50
Analyze and fix the following issue in the Linux kernel code: selftests/bpf: Fix a CI failure caused by vsock write
Problem Details: While commit 90f0074cd9f9 ("selftests/bpf: fix a CI failure caused by vsock sockmap test") fixes a receive failure of vsock sockmap test, there is still a write failure: Error: #211/79 sockmap_listen/sockmap VSOCK test_vsock_redir Error: #211/79 sockmap_listen/sockmap VSOCK test_vsock_redir ./test_p...
```diff diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_helpers.h b/tools/testing/selftests/bpf/prog_tests/sockmap_helpers.h index d12665490a90..36d829a65aa4 100644 --- a/tools/testing/selftests/bpf/prog_tests/sockmap_helpers.h +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_helpers.h @@ -179,6 +179,32...
113cdddcded6d597b64d824a59d0186db150113a
Analyze and fix the following issue in the Linux kernel code: drm/cec: add drm_dp_cec_attach() as the non-edid version of set edid
Problem Details: Connectors have source physical address available in display info. There's no need to parse the EDID again for this. Add drm_dp_cec_attach() to do this. Seems like the set_edid/unset_edid naming is a bit specific now that there's no need to pass the EDID at all, so aim for attach/detach going forward....
```diff diff --git a/drivers/gpu/drm/display/drm_dp_cec.c b/drivers/gpu/drm/display/drm_dp_cec.c index ae39dc794190..007ceb281d00 100644 --- a/drivers/gpu/drm/display/drm_dp_cec.c +++ b/drivers/gpu/drm/display/drm_dp_cec.c @@ -14,6 +14,7 @@ #include <drm/display/drm_dp_helper.h> #include <drm/drm_connector.h> #inclu...
bfb41e46d0b040ae83c1c4a50292298208b10f73
Analyze and fix the following issue in the Linux kernel code: kbuild: dummy-tools: make MPROFILE_KERNEL checks work on BE
Problem Details: Commit 2eab791f940b ("kbuild: dummy-tools: support MPROFILE_KERNEL checks for ppc") added support for ppc64le's checks for -mprofile-kernel. Now, commit aec0ba7472a7 ("powerpc/64: Use -mprofile-kernel for big endian ELFv2 kernels") added support for -mprofile-kernel even on big-endian ppc. So lift th...
```diff diff --git a/scripts/dummy-tools/gcc b/scripts/dummy-tools/gcc index 1db1889f6d81..07f6dc4c5cf6 100755 --- a/scripts/dummy-tools/gcc +++ b/scripts/dummy-tools/gcc @@ -85,8 +85,7 @@ if arg_contain -S "$@"; then fi # For arch/powerpc/tools/gcc-check-mprofile-kernel.sh - if arg_contain -m64 "$@" && arg_conta...
ae074e2b2fd410bf54d56509a7e48fb83873af3b
Analyze and fix the following issue in the Linux kernel code: sfc: check for zero length in EF10 RX prefix
Problem Details: When EF10 RXDP firmware is operating in cut-through mode, packet length is not known at the time the RX prefix is generated, so it is left as zero and RX event merging is inhibited to ensure that the length is available in the RX event. However, it has been found that in certain circumstances the ...
```diff diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c index 2375cef577e4..f77a2d3ef37e 100644 --- a/drivers/net/ethernet/sfc/rx.c +++ b/drivers/net/ethernet/sfc/rx.c @@ -359,26 +359,36 @@ static bool efx_do_xdp(struct efx_nic *efx, struct efx_channel *channel, /* Handle a received packet. ...
8423be8926aa82cd2e28bba5cc96ccb72c7ce6be
Analyze and fix the following issue in the Linux kernel code: ipv6: ignore dst hint for multipath routes
Problem Details: Route hints when the nexthop is part of a multipath group causes packets in the same receive batch to be sent to the same nexthop irrespective of the multipath hash of the packet. So, do not extract route hint for packets whose destination is part of a multipath group. A new SKB flag IP6SKB_MULTIPATH ...
```diff diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 5883551b1ee8..af8a771a053c 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -147,6 +147,7 @@ struct inet6_skb_parm { #define IP6SKB_JUMBOGRAM 128 #define IP6SKB_SEG6 256 #define IP6SKB_FAKEJUMBO 512 +#define IP6SKB_...
6ac66cb03ae306c2e288a9be18226310529f5b25
Analyze and fix the following issue in the Linux kernel code: ipv4: ignore dst hint for multipath routes
Problem Details: Route hints when the nexthop is part of a multipath group causes packets in the same receive batch to be sent to the same nexthop irrespective of the multipath hash of the packet. So, do not extract route hint for packets whose destination is part of a multipath group. A new SKB flag IPSKB_MULTIPATH i...
```diff diff --git a/include/net/ip.h b/include/net/ip.h index 9276cea775cc..3489a1cca5e7 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -57,6 +57,7 @@ struct inet_skb_parm { #define IPSKB_FRAG_PMTU BIT(6) #define IPSKB_L3SLAVE BIT(7) #define IPSKB_NOPOLICY BIT(8) +#define IPSKB_MULTIPATH BIT(9) u16...
2ea35288c83b3d501a88bc17f2df8f176b5cc96f
Analyze and fix the following issue in the Linux kernel code: skbuff: skb_segment, Call zero copy functions before using skbuff frags
Problem Details: Commit bf5c25d60861 ("skbuff: in skb_segment, call zerocopy functions once per nskb") added the call to zero copy functions in skb_segment(). The change introduced a bug in skb_segment() because skb_orphan_frags() may possibly change the number of fragments or allocate new fragments altogether leaving ...
```diff diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 24f26e816184..17caf4ea67da 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -4423,21 +4423,20 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb, struct sk_buff *segs = NULL; struct sk_buff *tail = NULL; struct sk_buff *list_skb = skb_...
a3c6bfba4429123533e9ae96ee50ba45ff8a63f2
Analyze and fix the following issue in the Linux kernel code: Documentation/llvm: refresh docs
Problem Details: Recent fixes for an embargoed hardware security vulnerability failed to link with ld.lld (LLVM's linker). [0] To be fair, our documentation mentions ``CC=clang`` foremost with ``LLVM=1`` being buried "below the fold." We want to encourage the use of ``LLVM=1`` rather than just ``CC=clang``. Make tha...
```diff diff --git a/Documentation/kbuild/llvm.rst b/Documentation/kbuild/llvm.rst index c3851fe1900d..b1d97fafddcf 100644 --- a/Documentation/kbuild/llvm.rst +++ b/Documentation/kbuild/llvm.rst @@ -25,50 +25,38 @@ objects <https://www.aosabook.org/en/llvm.html>`_. Clang is a front-end to LLVM that supports C and the ...
1ef061a4e2648f23ab9bd996a7656675933f1c1f
Analyze and fix the following issue in the Linux kernel code: modpost: Skip .llvm.call-graph-profile section check
Problem Details: .llvm.call-graph-profile section is added by clang when the kernel is built with profiles (e.g. -fprofile-sample-use= or -fprofile-use=). Note that .llvm.call-graph-profile intentionally uses REL relocations to decrease the object size, for more details see https://reviews.llvm.org/D104080. The sectio...
```diff diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 9761f9d0eec0..34a5386d444a 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -762,6 +762,7 @@ static const char *const section_white_list[] = ".fmt_slot*", /* EZchip */ ".gnu.lto*", ".discard.*", + ".llvm.call-graph-profile...
0b30d57acafcaa5374756d314ee54f80d0bcc860
Analyze and fix the following issue in the Linux kernel code: drm/debugfs: rework debugfs directory creation v5
Problem Details: Instead of the per minor directories only create a single debugfs directory for the whole device directly when the device is initialized. For DRM devices each minor gets a symlink to the per device directory for now until we can be sure that this isn't useful any more in any way. Accel devices create...
```diff diff --git a/drivers/accel/drm_accel.c b/drivers/accel/drm_accel.c index 01edf2c00b5a..8ba3db2ec5bb 100644 --- a/drivers/accel/drm_accel.c +++ b/drivers/accel/drm_accel.c @@ -79,26 +79,32 @@ static const struct drm_info_list accel_debugfs_list[] = { #define ACCEL_DEBUGFS_ENTRIES ARRAY_SIZE(accel_debugfs_list) ...
251cd405a9e6e70b92fe5afbdd17fd5caf9d3266
Analyze and fix the following issue in the Linux kernel code: net: annotate data-races around sk->sk_bind_phc
Problem Details: sk->sk_bind_phc is read locklessly. Add corresponding annotations. Fixes: d463126e23f1 ("net: sock: extend SO_TIMESTAMPING for PHC binding") Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Yangbo Lu <yangbo.lu@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
```diff diff --git a/net/core/sock.c b/net/core/sock.c index d05a290300b6..d3c7b53368d2 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -894,7 +894,7 @@ static int sock_timestamping_bind_phc(struct sock *sk, int phc_index) if (!match) return -EINVAL; - sk->sk_bind_phc = phc_index; + WRITE_ONCE(sk->sk_bind_...
e3390b30a5dfb112e8e802a59c0f68f947b638b2
Analyze and fix the following issue in the Linux kernel code: net: annotate data-races around sk->sk_tsflags
Problem Details: sk->sk_tsflags can be read locklessly, add corresponding annotations. Fixes: b9f40e21ef42 ("net-timestamp: move timestamp flags out of sk_flags") Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
```diff diff --git a/include/net/ip.h b/include/net/ip.h index 19adacd5ece0..9276cea775cc 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -94,7 +94,7 @@ static inline void ipcm_init_sk(struct ipcm_cookie *ipcm, ipcm_init(ipcm); ipcm->sockc.mark = READ_ONCE(inet->sk.sk_mark); - ipcm->sockc.tsflags = inet->...
9531e4a83febc3fb47ac77e24cfb5ea97e50034d
Analyze and fix the following issue in the Linux kernel code: mptcp: annotate data-races around msk->rmem_fwd_alloc
Problem Details: msk->rmem_fwd_alloc can be read locklessly. Add mptcp_rmem_fwd_alloc_add(), similar to sk_forward_alloc_add(), and appropriate READ_ONCE()/WRITE_ONCE() annotations. Fixes: 6511882cdd82 ("mptcp: allocate fwd memory separately on the rx and tx path") Signed-off-by: Eric Dumazet <edumazet@google.com> Cc...
```diff diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 625df3a36c46..a7fc16f5175d 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -134,9 +134,15 @@ static void mptcp_drop(struct sock *sk, struct sk_buff *skb) __kfree_skb(skb); } +static void mptcp_rmem_fwd_alloc_add(struct sock *sk,...
5e6300e7b3a4ab5b72a82079753868e91fbf9efc
Analyze and fix the following issue in the Linux kernel code: net: annotate data-races around sk->sk_forward_alloc
Problem Details: Every time sk->sk_forward_alloc is read locklessly, add a READ_ONCE(). Add sk_forward_alloc_add() helper to centralize updates, to reduce number of WRITE_ONCE(). Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft....
```diff diff --git a/include/net/sock.h b/include/net/sock.h index 11d503417591..f04869ac1d92 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1053,6 +1053,12 @@ static inline void sk_wmem_queued_add(struct sock *sk, int val) WRITE_ONCE(sk->sk_wmem_queued, sk->sk_wmem_queued + val); } +static inline vo...
66d58f046c9d3a8f996b7138d02e965fd0617de0
Analyze and fix the following issue in the Linux kernel code: net: use sk_forward_alloc_get() in sk_get_meminfo()
Problem Details: inet_sk_diag_fill() has been changed to use sk_forward_alloc_get(), but sk_get_meminfo() was forgotten. Fixes: 292e6077b040 ("net: introduce sk_forward_alloc_get()") Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
```diff diff --git a/net/core/sock.c b/net/core/sock.c index b0dd501dabd6..a61ec97098ad 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -3743,7 +3743,7 @@ void sk_get_meminfo(const struct sock *sk, u32 *mem) mem[SK_MEMINFO_RCVBUF] = READ_ONCE(sk->sk_rcvbuf); mem[SK_MEMINFO_WMEM_ALLOC] = sk_wmem_alloc_get(sk);...
82ba0ff7bf0483d962e592017bef659ae022d754
Analyze and fix the following issue in the Linux kernel code: net/handshake: fix null-ptr-deref in handshake_nl_done_doit()
Problem Details: We should not call trace_handshake_cmd_done_err() if socket lookup has failed. Also we should call trace_handshake_cmd_done_err() before releasing the file, otherwise dereferencing sock->sk can return garbage. This also reverts 7afc6d0a107f ("net/handshake: Fix uninitialized local variable") Unable ...
```diff diff --git a/net/handshake/netlink.c b/net/handshake/netlink.c index 1086653e1fad..d0bc1dd8e65a 100644 --- a/net/handshake/netlink.c +++ b/net/handshake/netlink.c @@ -157,26 +157,24 @@ out_status: int handshake_nl_done_doit(struct sk_buff *skb, struct genl_info *info) { struct net *net = sock_net(skb->sk); ...
4a9762aa358ee0e3deb6e759959f092a3cea86be
Analyze and fix the following issue in the Linux kernel code: fbdev: Update fbdev source file paths
Problem Details: The files fbmem.c, fb_defio.c, fbsysfs.c, fbmon.c, modedb.c, and fbcmap.c were moved. Drop the path and just keep the file name. Reported by kalekale in #kernel (Libera IRC). Fixes: f7018c213502 ("video: move fbdev to drivers/video/fbdev") Fixes: 19757fc8432a ("fbdev: move fbdev core files to separat...
```diff diff --git a/include/linux/fb.h b/include/linux/fb.h index 16c3e6d6c55d..c14576458228 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -588,7 +588,7 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, .fb_copyarea = sys_copyarea, \ .fb_imageblit = sys_imageblit -/* driv...
35588314e963938dfdcdb792c9170108399377d6
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: fix amdgpu_cs_p1_user_fence
Problem Details: The offset is just 32bits here so this can potentially overflow if somebody specifies a large value. Instead reduce the size to calculate the last possible offset. The error handling path incorrectly drops the reference to the user fence BO resulting in potential reference count underflow. Signed-off...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 49dd9aa8da70..efdb1c48f431 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -127,7 +127,6 @@ static int amdgpu_cs_p1_user_fence(struct amdgpu_cs_parser *p, { s...
e9dca969b2426702a73719ab9207e43c6d80b581
Analyze and fix the following issue in the Linux kernel code: drm/amdkfd: Add missing gfx11 MQD manager callbacks
Problem Details: mqd_stride function was introduced in commit 2f77b9a242a2 ("drm/amdkfd: Update MQD management on multi XCC setup") but not assigned for gfx11. Fixes a NULL dereference in debugfs. Signed-off-by: Jay Cornwall <jay.cornwall@amd.com> Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> ...
```diff diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c index 2319467d2d95..0bbf0edbabd4 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c @@ -457,6 +457,7 @@ struct mqd_manager *mqd_manag...
49a30c3d1a2258fc93cfe6eea8e4951dabadc824
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: always switch off ODM before committing more streams
Problem Details: ODM power optimization is only supported with single stream. When ODM power optimization is enabled, we might not have enough free pipes for enabling other stream. So when we are committing more than 1 stream we should first switch off ODM power optimization to make room for new stream and then allocat...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index 54da304b38f0..3a9077b60029 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -2073,12 +2073,12 @@ enum dc_status dc_commit_streams(struct dc *dc, } } ...
5a3ccb1400339268c5e3dc1fa044a7f6c7f59a02
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Remove wait while locked
Problem Details: [Why] We wait for mpc idle while in a locked state, leading to potential deadlock. [What] Move the wait_for_idle call to outside of HW lock. This and a call to wait_drr_doublebuffer_pending_clear are moved added to a new static helper function called wait_for_outstanding_hw_updates, to make the interf...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/Makefile b/drivers/gpu/drm/amd/display/dc/Makefile index 69ffd4424dc7..1b8c2aef4633 100644 --- a/drivers/gpu/drm/amd/display/dc/Makefile +++ b/drivers/gpu/drm/amd/display/dc/Makefile @@ -78,3 +78,4 @@ DC_EDID += dc_edid_parser.o AMD_DISPLAY_DMUB = $(addprefix $(AMDDA...
1482650bc7ef01ebb24ec2c3a2e4d50e45da4d8c
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: update blank state on ODM changes
Problem Details: When we are dynamically adding new ODM slices, we didn't update blank state, if the pipe used by new ODM slice is previously blanked, we will continue outputting blank pixel data on that slice causing right half of the screen showing blank image. The previous fix was a temporary hack to directly updat...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c index 65fa9e21ad9c..87c1ac40240b 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c @@ -1106,29 +1106,6 @@ void dcn20_blank_p...
72105dcfa3d12b5af49311f857e3490baa225135
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Add smu write msg id fail retry process
Problem Details: A benchmark stress test (12-40 machines x 48hours) found that DCN315 has cases where DC writes to an indirect register to set the smu clock msg id, but when we go to read the same indirect register the returned msg id doesn't match with what we just set it to. So, to fix this retry the write until the ...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c index 3e0da873cf4c..1042cf1a3ab0 100644 --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_smu.c @@ -32,6 ...
39c8b93a105678821cbf1674d56bd58d775b932f
Analyze and fix the following issue in the Linux kernel code: Partially revert "drm/amd/display: update add plane to context logic with a new algorithm"
Problem Details: This partially reverts commit 460ea8980511 ("drm/amd/display: update add plane to context logic with a new algorithm"). The new secondary pipe allocation logic triggers an issue with a specific hardware state transition and causes a frame of corruption when toggling between windowed MPO and ODM deskto...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c index 935cd23e6a01..f9d601c8c721 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c @@ -2564,18 +2564,128 @@ stat...
1611917f39bee1abfc01501238db8ac19649042d
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: register edp_backlight_control() for DCN301
Problem Details: As made mention of in commit 099303e9a9bd ("drm/amd/display: eDP intermittent black screen during PnP"), we need to turn off the display's backlight before powering off an eDP display. Not doing so will result in undefined behaviour according to the eDP spec. So, set DCN301's edp_backlight_control() fu...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c b/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c index 257df8660b4c..61205cdbe2d5 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c +++ b/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_init.c @@ -75,6 +75,7 @@ static const struct...
a7dd9b97fd5b12549721bbdc7977b5671870f4bb
Analyze and fix the following issue in the Linux kernel code: drm/amd/pm: fix debugfs pm_info output
Problem Details: Print both input and avg power. Fixes: 47f1724db4fe ("drm/amd: Introduce `AMDGPU_PP_SENSOR_GPU_INPUT_POWER`") Reviewed-by: Guchun Chen <guchun.chen@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
```diff diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c index f03647fa3df6..41147da54458 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c @@ -3471,6 +3471,9 @@ static int amdgpu_debugfs_pm_info_pp(struct seq_file *m, struct amdgpu_device *a ...
7d4424373daacf3b0938d6278136678060690096
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: Fix the return for gpu mode1_reset
Problem Details: amdgpu_device_mode1_reset will return gpu mode1_reset succeed (ret = 0) as long as wait_for_bootloader call succeed, regardless of the status reported by smu or psp firmware. This results to driver continue executing recovery even smu or psp fail to perform mode1 reset. Signed-off-by: Hawking Zhang <H...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 5586146b8c76..533daba2accb 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -4701,12 +4701,12 @@ int amdgpu_device_mode1_reset(struct amdgpu_devic...
a9366b944bfdca3c60e463869c8bdb7136b5b6ec
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: fix static screen detection setting
Problem Details: [WHY] OTG_STATIC_SCREEN_EVENT_MASK is changed in DCN3, but we still follow DCN2 to apply setting for OTG_STATIC_SCREEN_EVENT_MASK. [How] Add new function to apply correct settings for DCN3 series. Reviewed-by: Anthony Koo <anthony.koo@amd.com> Acked-by: Wayne Lin <wayne.lin@amd.com> Signed-off-by: Su...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c index 6cef62d7a2e5..255713ec29bb 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c @@ -987,3 +987,20 @@ void dcn30_prepare_b...
ea7971af7a911a7a388b4c47db2a231a6b8dcc29
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: fix mode scaling (RMX_.*)
Problem Details: As made mention of in commit 4a2df0d1f28e ("drm/amd/display: Fixed non-native modes not lighting up"), we shouldn't call drm_mode_set_crtcinfo() once the crtc timings have been decided. Since, it can cause settings to be unintentionally overwritten. So, since dm_state is never NULL now, we can use old_...
```diff diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index f2b4f1720abd..88ba8b66de1f 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -6026,7 +6026,7 @@ create_stream_for_sink(...
e1c0d2e7066b5675cb62daa2f7cb3899756f789c
Analyze and fix the following issue in the Linux kernel code: drm/amd/pm: Fix critical temp unit of SMU v13.0.6
Problem Details: Critical Temperature needs to be reported in millidegree Celsius. Signed-off-by: Asad Kamal <asad.kamal@amd.com> Reviewed-by: Yang Wang <kevinyang.wang@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
```diff diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c index 7d8af9b309b7..d3b578e6bc2a 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c @@ -2086,7 +2086,7 @@ static int ...
bab9bec6b6fb6d24f6c9205628cd9c46d768e5c1
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Roll back unit correction
Problem Details: [why] This Unit correction exposes a Replay corruption. [how] This reverts commit: commit dbd29029c7b5 ("drm/amd/display: Correct unit conversion for vstartup") Roll back unit conversion until Replay can fix their corruption. Fixes: dbd29029c7b5 ("drm/amd/display: Correct unit conversion for vstartu...
```diff diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c index 07adb614366e..ed8ddb75b333 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c @@ -31,7 +31,6 @@ #inclu...
44e60b14d5a72f91fd0bdeae8da59ae37a3ca8e5
Analyze and fix the following issue in the Linux kernel code: drm/amd/display: Enable Replay for static screen use cases
Problem Details: - Setup replay config on device init. - Enable replay if feature is enabled (prioritize replay over PSR, since it can be enabled in more usecases) - Add debug masks to enable replay on supported ASICs Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com> Reviewed-by: Harry Wentland <harry.wentl...
```diff diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 268cb99a4c4b..f2b4f1720abd 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -65,6 +65,7 @@ #include "amdgpu_dm_debugf...
f441ff73f1ec568acef03f0ce4d5088c7e65c106
Analyze and fix the following issue in the Linux kernel code: powerpc: Fix pud_mkwrite() definition after pte_mkwrite() API changes
Problem Details: Fix up missed semantic mis-merge between commits 161e393c0f63 ("mm: Make pte_mkwrite() take a VMA") 27af67f35631 ("powerpc/book3s64/mm: enable transparent pud hugepage") where the newly introduced powerpc use of 'pte_mkwrite()' needs to use the 'novma()' versions as per commit 2f0584f3f4bd ("mm: ...
```diff diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index 136232a89739..5c497c862d75 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h @@ -931,7 +931,7 @@ static inline pte_t *pudp_ptep(pud_t *pud) #...
18032b47adf1db7b7f5fb2d1344e65aafe6417df
Analyze and fix the following issue in the Linux kernel code: x86/fpu/xstate: Fix PKRU covert channel
Problem Details: When XCR0[9] is set, PKRU can be read and written from userspace with XSAVE and XRSTOR, even when CR4.PKE is clear. Clear XCR0[9] when protection keys are disabled. Reported-by: Tavis Ormandy <taviso@google.com> Signed-off-by: Jim Mattson <jmattson@google.com> Signed-off-by: Ingo Molnar <mingo@kernel...
```diff diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c index 1afbc4866b10..a27b4f7b9365 100644 --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c @@ -71,7 +71,7 @@ static unsigned short xsave_cpuid_features[] __initdata = { [XFEATURE_ZMM_Hi256] = X86_FEATURE_AVX512F, [...
94160062396d7e7cff4ed69320ffc5e22d51a0ab
Analyze and fix the following issue in the Linux kernel code: pstore: Base compression input buffer size on estimated compressed size
Problem Details: Commit 1756ddea6916 ("pstore: Remove worst-case compression size logic") removed some clunky per-algorithm worst case size estimation routines on the basis that we can always store pstore records uncompressed, and these worst case estimations are about how much the size might inadvertently *increase* d...
```diff diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c index 62356d542ef6..e5bca9a004cc 100644 --- a/fs/pstore/platform.c +++ b/fs/pstore/platform.c @@ -98,7 +98,14 @@ MODULE_PARM_DESC(kmsg_bytes, "amount of kernel log to snapshot (in bytes)"); static void *compress_workspace; +/* + * Compression is only...
a5492fe27ff9684d901b2829584ea186fbecd71e
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: fix amdgpu_cs_p1_user_fence
Problem Details: The offset is just 32bits here so this can potentially overflow if somebody specifies a large value. Instead reduce the size to calculate the last possible offset. The error handling path incorrectly drops the reference to the user fence BO resulting in potential reference count underflow. Signed-off...
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index fe78796f0407..4de6f53aea38 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -127,7 +127,6 @@ static int amdgpu_cs_p1_user_fence(struct amdgpu_cs_parser *p, { s...
f9ecae9a4ec19c2a7b3ac132411af1ee9940a0f5
Analyze and fix the following issue in the Linux kernel code: drm/amdgpu: fix VPE front door loading issue
Problem Details: Implement proper front door loading for vpe 6.1. Signed-off-by: Lang Yu <Lang.Yu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
```diff diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index 46295c8c4557..d8bdcaf8c4db 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -2396,6 +2396,9 @@ static int psp_get_fw_type(struct amdgpu_firmware_info *ucode, ...
b137b9d60b8add5620a06c687a71ce18776730b0
Analyze and fix the following issue in the Linux kernel code: parisc: drivers: Fix sparse warning
Problem Details: Fix "warning: directive in macro's argument list" warning. Signed-off-by: Helge Deller <deller@gmx.de>
```diff diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c index 8f4b77648491..ed8b75948061 100644 --- a/arch/parisc/kernel/drivers.c +++ b/arch/parisc/kernel/drivers.c @@ -925,9 +925,9 @@ static __init void qemu_header(void) pr_info("#define PARISC_MODEL \"%s\"\n\n", boot_cpu_data.pdc.sys_m...
6a86b5b5cd76d2734304a0173f5f01aa8aa2025e
Analyze and fix the following issue in the Linux kernel code: bpf: Annotate bpf_long_memcpy with data_race
Problem Details: syzbot reported a data race splat between two processes trying to update the same BPF map value via syscall on different CPUs: BUG: KCSAN: data-race in bpf_percpu_array_update / bpf_percpu_array_update write to 0xffffe8fffe7425d8 of 8 bytes by task 8257 on cpu 1: bpf_long_memcpy include/linux/...
```diff diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 12596af59c00..024e8b28c34b 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -438,7 +438,7 @@ static inline void bpf_long_memcpy(void *dst, const void *src, u32 size) size /= sizeof(long); while (size--) - *ldst++ = *lsrc++; + data...
927c6c8aa27c284a799b8c18784e37d3373af908
Analyze and fix the following issue in the Linux kernel code: parisc: iosapic.c: Fix sparse warnings
Problem Details: Signed-off-by: Helge Deller <deller@gmx.de>
```diff diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index a7df764f1a72..a4011461189b 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c @@ -202,9 +202,9 @@ static inline void iosapic_write(void __iomem *iosapic, unsigned int reg, u32 va static DEFINE_SPINLOCK(iosapic_lock); -...
9a47a710cf517801a8b4fff9949c4cecb5fd019a
Analyze and fix the following issue in the Linux kernel code: parisc: ccio-dma: Fix sparse warnings
Problem Details: Signed-off-by: Helge Deller <deller@gmx.de>
```diff diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c index 509a4072d50a..9ce0d20a6c58 100644 --- a/drivers/parisc/ccio-dma.c +++ b/drivers/parisc/ccio-dma.c @@ -214,7 +214,7 @@ struct ioa_registers { struct ioc { struct ioa_registers __iomem *ioc_regs; /* I/O MMU base address */ u8 *res_map...
c1ebb94071cb4455177bafa619423acb3494d15d
Analyze and fix the following issue in the Linux kernel code: parisc: sba-iommu: Fix sparse warnigs
Problem Details: Fix sparse warnings, as pdir is __le64 *. Signed-off-by: Helge Deller <deller@gmx.de>
```diff diff --git a/arch/parisc/include/asm/ropes.h b/arch/parisc/include/asm/ropes.h index d7b941cfbccd..e2d2d7e9bfde 100644 --- a/arch/parisc/include/asm/ropes.h +++ b/arch/parisc/include/asm/ropes.h @@ -29,7 +29,7 @@ struct ioc { void __iomem *ioc_hpa; /* I/O MMU base address */ char *res_map; /* resource map...
eb3255ee8f6f4691471a28fbf22db5e8901116cd
Analyze and fix the following issue in the Linux kernel code: parisc: sba: Fix compile warning wrt list of SBA devices
Problem Details: Fix this makecheck warning: drivers/parisc/sba_iommu.c:98:19: warning: symbol 'sba_list' was not declared. Should it be static? Signed-off-by: Helge Deller <deller@gmx.de>
```diff diff --git a/arch/parisc/include/asm/ropes.h b/arch/parisc/include/asm/ropes.h index fd96706c7234..d7b941cfbccd 100644 --- a/arch/parisc/include/asm/ropes.h +++ b/arch/parisc/include/asm/ropes.h @@ -86,6 +86,9 @@ struct sba_device { struct ioc ioc[MAX_IOC]; }; +/* list of SBA's in system, see drivers/pari...
6428bc7bd3f35e43c8cb7359cb89d83248d339d2
Analyze and fix the following issue in the Linux kernel code: parisc: sba_iommu: Fix build warning if procfs if disabled
Problem Details: Clean up the code, e.g. make proc_mckinley_root static, drop the now empty mckinley header file and remove some unneeded ifdefs around procfs functions. Signed-off-by: Helge Deller <deller@gmx.de> Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202308300800...
```diff diff --git a/arch/parisc/include/asm/mckinley.h b/arch/parisc/include/asm/mckinley.h deleted file mode 100644 index 1314390b9034..000000000000 --- a/arch/parisc/include/asm/mckinley.h +++ /dev/null @@ -1,8 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef ASM_PARISC_MCKINLEY_H -#define ASM_PARISC_MCKINLE...
64199ae4b8a36038dd5b69904a29bd48ef11ca8b
Analyze and fix the following issue in the Linux kernel code: perf parse-events: Fix propagation of term's no_value when cloning
Problem Details: The no_value field in 'struct parse_events_term' indicates that the val variable isn't used, the case for an event name. Cloning wasn't propagating this, making cloned event name terms appearing to have a constant assinged to them. Working around the bug would check for a value of 1 assigned to value...
```diff diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 51b73207e9f4..68fe2c4ff49f 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1510,8 +1510,8 @@ int parse_events_multi_pmu_add(struct parse_events_state *parse_state, if (parse_events_term__n...
58d3a4cea4a45414a21a712078d95b39dcdda10d
Analyze and fix the following issue in the Linux kernel code: perf parse-events: Name the two term enums
Problem Details: Name the enums used by 'struct parse_events_term' to parse_events__term_val_type and parse_events__term_type. This allows greater compile time error checking. Fix -Wswitch related issues by explicitly listing all enum values prior to default. Add config_term_name to safely look up a parse_events__te...
```diff diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 0b941b58bdc0..51b73207e9f4 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -153,7 +153,7 @@ const char *event_type(int type) return "unknown"; } -static char *get_config_str(struct list_he...
478c3f5dcd8ca7eb1ef0c7a7022cca80b528325c
Analyze and fix the following issue in the Linux kernel code: perf list: Don't print Unit for "default_core"
Problem Details: "default_core" was added as a way to demark JSON events whose PMU should be whatever the default core PMU is, previously this had been assumed to be "cpu" but that fails on s390 and ARM. 'perf list' displays the PMU in the event description to save storing it in JSON, but was still comparing against "...
```diff diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index 1ac47db4d66a..a343823c8ddf 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c @@ -148,7 +148,7 @@ static void default_print_event(void *ps, const char *pmu_name, const char *topi char *desc_with_unit = NULL; int d...
d87e89c2735772fbed933be0d19e032c1910a51f
Analyze and fix the following issue in the Linux kernel code: x86/irq/i8259: Fix kernel-doc annotation warning
Problem Details: Fix this warning: arch/x86/kernel/i8259.c:235: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * ELCR registers (0x4d0, 0x4d1) control edge/level of IRQ CC arch/x86/kernel/irqinit.o Signed-off-by: Vincenzo Palazzo <vi...
```diff diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c index 4d8aff05a509..30a55207c000 100644 --- a/arch/x86/kernel/i8259.c +++ b/arch/x86/kernel/i8259.c @@ -231,9 +231,7 @@ struct irq_chip i8259A_chip = { }; static char irq_trigger[2]; -/** - * ELCR registers (0x4d0, 0x4d1) control edge/level of I...
c9f4c45c8ec3f07f4f083f9750032a1ec3eab6b2
Analyze and fix the following issue in the Linux kernel code: x86/speculation: Mark all Skylake CPUs as vulnerable to GDS
Problem Details: The Gather Data Sampling (GDS) vulnerability is common to all Skylake processors. However, the "client" Skylakes* are now in this list: https://www.intel.com/content/www/us/en/support/articles/000022396/processors.html which means they are no longer included for new vulnerabilities here: https://...
```diff diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index e3a65e9fc750..00f043a094fc 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1265,11 +1265,11 @@ static const struct x86_cpu_id cpu_vuln_blacklist[] __initconst = { VULNBL_INTEL_STEPPINGS(BROADWELL_G,...
d10f3780bc2f80744d291e118c0c8bade54ed3b8
Analyze and fix the following issue in the Linux kernel code: KVM: x86/mmu: Include mmu.h in spte.h
Problem Details: Explicitly include mmu.h in spte.h instead of relying on the "parent" to include mmu.h. spte.h references a variety of macros and variables that are defined/declared in mmu.h, and so including spte.h before (or instead of) mmu.h will result in build errors, e.g. arch/x86/kvm/mmu/spte.h: In function...
```diff diff --git a/arch/x86/kvm/mmu/spte.h b/arch/x86/kvm/mmu/spte.h index d4e45de13da0..a129951c9a88 100644 --- a/arch/x86/kvm/mmu/spte.h +++ b/arch/x86/kvm/mmu/spte.h @@ -3,6 +3,7 @@ #ifndef KVM_X86_MMU_SPTE_H #define KVM_X86_MMU_SPTE_H +#include "mmu.h" #include "mmu_internal.h" /* ```
0e3223d8d00ac05849661f1b8b476d3caca251cf
Analyze and fix the following issue in the Linux kernel code: KVM: x86/mmu: Use dummy root, backed by zero page, for !visible guest roots
Problem Details: When attempting to allocate a shadow root for a !visible guest root gfn, e.g. that resides in MMIO space, load a dummy root that is backed by the zero page instead of immediately synthesizing a triple fault shutdown (using the zero page ensures any attempt to translate memory will generate a !PRESENT f...
```diff diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index de73d986a282..e1d011c67cc6 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -3589,7 +3589,9 @@ void kvm_mmu_free_roots(struct kvm *kvm, struct kvm_mmu *mmu, &invalid_list); if (free_active_root) { - if (root_to_s...
2c6d4c27b92d729a2831df2a873ba6b5f682f435
Analyze and fix the following issue in the Linux kernel code: KVM: x86/mmu: Harden TDP MMU iteration against root w/o shadow page
Problem Details: Explicitly check that tdp_iter_start() is handed a valid shadow page to harden KVM against bugs, e.g. if KVM calls into the TDP MMU with an invalid or shadow MMU root (which would be a fatal KVM bug), the shadow page pointer will be NULL. Opportunistically stop the TDP MMU iteration instead of continu...
```diff diff --git a/arch/x86/kvm/mmu/tdp_iter.c b/arch/x86/kvm/mmu/tdp_iter.c index 5bb09f8d9fc6..bd30ebfb2f2c 100644 --- a/arch/x86/kvm/mmu/tdp_iter.c +++ b/arch/x86/kvm/mmu/tdp_iter.c @@ -39,13 +39,14 @@ void tdp_iter_restart(struct tdp_iter *iter) void tdp_iter_start(struct tdp_iter *iter, struct kvm_mmu_page *roo...
c30e000e690af74f61a161fa60be140f23948cb1
Analyze and fix the following issue in the Linux kernel code: KVM: x86/mmu: Harden new PGD against roots without shadow pages
Problem Details: Harden kvm_mmu_new_pgd() against NULL pointer dereference bugs by sanity checking that the target root has an associated shadow page prior to dereferencing said shadow page. The code in question is guaranteed to only see roots with shadow pages as fast_pgd_switch() explicitly frees the current root if...
```diff diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 61b67a7d61e0..de73d986a282 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -4527,9 +4527,19 @@ static void nonpaging_init_context(struct kvm_mmu *context) static inline bool is_root_usable(struct kvm_mmu_root_info *root, gpa...