From nobody Mon Apr 20 01:10:17 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1BDDC433EF for ; Thu, 23 Jun 2022 18:24:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234002AbiFWSYr (ORCPT ); Thu, 23 Jun 2022 14:24:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237262AbiFWSW0 (ORCPT ); Thu, 23 Jun 2022 14:22:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EC1D94111; Thu, 23 Jun 2022 10:25:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 37DC0B824B9; Thu, 23 Jun 2022 17:25:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B7D4C3411B; Thu, 23 Jun 2022 17:25:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656005117; bh=+nvytMqtTtci6gABy5twLEudAIRM9zbaQ8qcRBWOT7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UB050du7w19qelk4neUKmEGRnFSROSaYRKDN5k151Ktwni+k01cTllRGcrHj8IECv I0ie8ca7CBr4fIIwuVrcdNJLAzNABceW2EENmGLRATwm10oW1Mg2z7uuTkCphv8DPr kojIS0RdP/dhMKW0wk8xdZHgiRfJao7jADckOzHY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Borntraeger , Janis Schoetterl-Glausch , Claudio Imbrenda , Heiko Carstens Subject: [PATCH 5.18 01/11] s390/mm: use non-quiescing sske for KVM switch to keyed guest Date: Thu, 23 Jun 2022 18:45:13 +0200 Message-Id: <20220623164322.359407032@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164322.315085512@linuxfoundation.org> References: <20220623164322.315085512@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Borntraeger commit 3ae11dbcfac906a8c3a480e98660a823130dc16a upstream. The switch to a keyed guest does not require a classic sske as the other guest CPUs are not accessing the key before the switch is complete. By using the NQ SSKE things are faster especially with multiple guests. Signed-off-by: Christian Borntraeger Suggested-by: Janis Schoetterl-Glausch Reviewed-by: Claudio Imbrenda Link: https://lore.kernel.org/r/20220530092706.11637-3-borntraeger@linux.ib= m.com Signed-off-by: Christian Borntraeger Signed-off-by: Heiko Carstens Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/s390/mm/pgtable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/s390/mm/pgtable.c +++ b/arch/s390/mm/pgtable.c @@ -748,7 +748,7 @@ void ptep_zap_key(struct mm_struct *mm, pgste_val(pgste) |=3D PGSTE_GR_BIT | PGSTE_GC_BIT; ptev =3D pte_val(*ptep); if (!(ptev & _PAGE_INVALID) && (ptev & _PAGE_WRITE)) - page_set_storage_key(ptev & PAGE_MASK, PAGE_DEFAULT_KEY, 1); + page_set_storage_key(ptev & PAGE_MASK, PAGE_DEFAULT_KEY, 0); pgste_set_unlock(ptep, pgste); preempt_enable(); } From nobody Mon Apr 20 01:10:17 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E619CCA47F for ; Thu, 23 Jun 2022 18:24:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234489AbiFWSYA (ORCPT ); Thu, 23 Jun 2022 14:24:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237432AbiFWSWm (ORCPT ); Thu, 23 Jun 2022 14:22:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC3F7C228E; Thu, 23 Jun 2022 10:25:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 417EB61EDC; Thu, 23 Jun 2022 17:25:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F2FBC3411B; Thu, 23 Jun 2022 17:25:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656005126; bh=HEEZ8FxHLtysK9flu47T6VVosykVCYfgUWGJVfxf+hM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TQGId9EsJLVo1L9W/kB7dUpru5cnnk8WXpqN4f5Bst+cryfXJ+Thni3CPgzbz1Q1D xT2H0cLrCLhPLrRv5ng6+uQKQMuCiOh8eR52dXn2wMKkLkpsydib7T6ZfFwRSEmrQq p6L8KT/3l+oaCBs1ctEYMLH58dtw3mZYBA0NVBkc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jorgen Hansen , Damien Le Moal , Christoph Hellwig , Johannes Thumshirn Subject: [PATCH 5.18 02/11] zonefs: fix zonefs_iomap_begin() for reads Date: Thu, 23 Jun 2022 18:45:14 +0200 Message-Id: <20220623164322.387694481@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164322.315085512@linuxfoundation.org> References: <20220623164322.315085512@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Damien Le Moal commit c1c1204c0d0c1dccc1310b9277fb2bd8b663d8fe upstream. If a readahead is issued to a sequential zone file with an offset exactly equal to the current file size, the iomap type is set to IOMAP_UNWRITTEN, which will prevent an IO, but the iomap length is calculated as 0. This causes a WARN_ON() in iomap_iter(): [17309.548939] WARNING: CPU: 3 PID: 2137 at fs/iomap/iter.c:34 iomap_iter+0= x9cf/0xe80 [...] [17309.650907] RIP: 0010:iomap_iter+0x9cf/0xe80 [...] [17309.754560] Call Trace: [17309.757078] [17309.759240] ? lock_is_held_type+0xd8/0x130 [17309.763531] iomap_readahead+0x1a8/0x870 [17309.767550] ? iomap_read_folio+0x4c0/0x4c0 [17309.771817] ? lockdep_hardirqs_on_prepare+0x400/0x400 [17309.778848] ? lock_release+0x370/0x750 [17309.784462] ? folio_add_lru+0x217/0x3f0 [17309.790220] ? reacquire_held_locks+0x4e0/0x4e0 [17309.796543] read_pages+0x17d/0xb60 [17309.801854] ? folio_add_lru+0x238/0x3f0 [17309.807573] ? readahead_expand+0x5f0/0x5f0 [17309.813554] ? policy_node+0xb5/0x140 [17309.819018] page_cache_ra_unbounded+0x27d/0x450 [17309.825439] filemap_get_pages+0x500/0x1450 [17309.831444] ? filemap_add_folio+0x140/0x140 [17309.837519] ? lock_is_held_type+0xd8/0x130 [17309.843509] filemap_read+0x28c/0x9f0 [17309.848953] ? zonefs_file_read_iter+0x1ea/0x4d0 [zonefs] [17309.856162] ? trace_contention_end+0xd6/0x130 [17309.862416] ? __mutex_lock+0x221/0x1480 [17309.868151] ? zonefs_file_read_iter+0x166/0x4d0 [zonefs] [17309.875364] ? filemap_get_pages+0x1450/0x1450 [17309.881647] ? __mutex_unlock_slowpath+0x15e/0x620 [17309.888248] ? wait_for_completion_io_timeout+0x20/0x20 [17309.895231] ? lock_is_held_type+0xd8/0x130 [17309.901115] ? lock_is_held_type+0xd8/0x130 [17309.906934] zonefs_file_read_iter+0x356/0x4d0 [zonefs] [17309.913750] new_sync_read+0x2d8/0x520 [17309.919035] ? __x64_sys_lseek+0x1d0/0x1d0 Furthermore, this causes iomap_readahead() to loop forever as iomap_readahead_iter() always returns 0, making no progress. Fix this by treating reads after the file size as access to holes, setting the iomap type to IOMAP_HOLE, the iomap addr to IOMAP_NULL_ADDR and using the length argument as is for the iomap length. To simplify the code with this change, zonefs_iomap_begin() is split into the read variant, zonefs_read_iomap_begin() and zonefs_read_iomap_ops, and the write variant, zonefs_write_iomap_begin() and zonefs_write_iomap_ops. Reported-by: Jorgen Hansen Fixes: 8dcc1a9d90c1 ("fs: New zonefs file system") Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Reviewed-by: Jorgen Hansen Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/zonefs/super.c | 94 ++++++++++++++++++++++++++++++++++++-------------= ----- 1 file changed, 64 insertions(+), 30 deletions(-) --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -72,15 +72,51 @@ static inline void zonefs_i_size_write(s zi->i_flags &=3D ~ZONEFS_ZONE_OPEN; } =20 -static int zonefs_iomap_begin(struct inode *inode, loff_t offset, loff_t l= ength, - unsigned int flags, struct iomap *iomap, - struct iomap *srcmap) +static int zonefs_read_iomap_begin(struct inode *inode, loff_t offset, + loff_t length, unsigned int flags, + struct iomap *iomap, struct iomap *srcmap) { struct zonefs_inode_info *zi =3D ZONEFS_I(inode); struct super_block *sb =3D inode->i_sb; loff_t isize; =20 - /* All I/Os should always be within the file maximum size */ + /* + * All blocks are always mapped below EOF. If reading past EOF, + * act as if there is a hole up to the file maximum size. + */ + mutex_lock(&zi->i_truncate_mutex); + iomap->bdev =3D inode->i_sb->s_bdev; + iomap->offset =3D ALIGN_DOWN(offset, sb->s_blocksize); + isize =3D i_size_read(inode); + if (iomap->offset >=3D isize) { + iomap->type =3D IOMAP_HOLE; + iomap->addr =3D IOMAP_NULL_ADDR; + iomap->length =3D length; + } else { + iomap->type =3D IOMAP_MAPPED; + iomap->addr =3D (zi->i_zsector << SECTOR_SHIFT) + iomap->offset; + iomap->length =3D isize - iomap->offset; + } + mutex_unlock(&zi->i_truncate_mutex); + + trace_zonefs_iomap_begin(inode, iomap); + + return 0; +} + +static const struct iomap_ops zonefs_read_iomap_ops =3D { + .iomap_begin =3D zonefs_read_iomap_begin, +}; + +static int zonefs_write_iomap_begin(struct inode *inode, loff_t offset, + loff_t length, unsigned int flags, + struct iomap *iomap, struct iomap *srcmap) +{ + struct zonefs_inode_info *zi =3D ZONEFS_I(inode); + struct super_block *sb =3D inode->i_sb; + loff_t isize; + + /* All write I/Os should always be within the file maximum size */ if (WARN_ON_ONCE(offset + length > zi->i_max_size)) return -EIO; =20 @@ -90,7 +126,7 @@ static int zonefs_iomap_begin(struct ino * operation. */ if (WARN_ON_ONCE(zi->i_ztype =3D=3D ZONEFS_ZTYPE_SEQ && - (flags & IOMAP_WRITE) && !(flags & IOMAP_DIRECT))) + !(flags & IOMAP_DIRECT))) return -EIO; =20 /* @@ -99,47 +135,44 @@ static int zonefs_iomap_begin(struct ino * write pointer) and unwriten beyond. */ mutex_lock(&zi->i_truncate_mutex); + iomap->bdev =3D inode->i_sb->s_bdev; + iomap->offset =3D ALIGN_DOWN(offset, sb->s_blocksize); + iomap->addr =3D (zi->i_zsector << SECTOR_SHIFT) + iomap->offset; isize =3D i_size_read(inode); - if (offset >=3D isize) + if (iomap->offset >=3D isize) { iomap->type =3D IOMAP_UNWRITTEN; - else + iomap->length =3D zi->i_max_size - iomap->offset; + } else { iomap->type =3D IOMAP_MAPPED; - if (flags & IOMAP_WRITE) - length =3D zi->i_max_size - offset; - else - length =3D min(length, isize - offset); + iomap->length =3D isize - iomap->offset; + } mutex_unlock(&zi->i_truncate_mutex); =20 - iomap->offset =3D ALIGN_DOWN(offset, sb->s_blocksize); - iomap->length =3D ALIGN(offset + length, sb->s_blocksize) - iomap->offset; - iomap->bdev =3D inode->i_sb->s_bdev; - iomap->addr =3D (zi->i_zsector << SECTOR_SHIFT) + iomap->offset; - trace_zonefs_iomap_begin(inode, iomap); =20 return 0; } =20 -static const struct iomap_ops zonefs_iomap_ops =3D { - .iomap_begin =3D zonefs_iomap_begin, +static const struct iomap_ops zonefs_write_iomap_ops =3D { + .iomap_begin =3D zonefs_write_iomap_begin, }; =20 static int zonefs_readpage(struct file *unused, struct page *page) { - return iomap_readpage(page, &zonefs_iomap_ops); + return iomap_readpage(page, &zonefs_read_iomap_ops); } =20 static void zonefs_readahead(struct readahead_control *rac) { - iomap_readahead(rac, &zonefs_iomap_ops); + iomap_readahead(rac, &zonefs_read_iomap_ops); } =20 /* * Map blocks for page writeback. This is used only on conventional zone f= iles, * which implies that the page range can only be within the fixed inode si= ze. */ -static int zonefs_map_blocks(struct iomap_writepage_ctx *wpc, - struct inode *inode, loff_t offset) +static int zonefs_write_map_blocks(struct iomap_writepage_ctx *wpc, + struct inode *inode, loff_t offset) { struct zonefs_inode_info *zi =3D ZONEFS_I(inode); =20 @@ -153,12 +186,12 @@ static int zonefs_map_blocks(struct ioma offset < wpc->iomap.offset + wpc->iomap.length) return 0; =20 - return zonefs_iomap_begin(inode, offset, zi->i_max_size - offset, - IOMAP_WRITE, &wpc->iomap, NULL); + return zonefs_write_iomap_begin(inode, offset, zi->i_max_size - offset, + IOMAP_WRITE, &wpc->iomap, NULL); } =20 static const struct iomap_writeback_ops zonefs_writeback_ops =3D { - .map_blocks =3D zonefs_map_blocks, + .map_blocks =3D zonefs_write_map_blocks, }; =20 static int zonefs_writepage(struct page *page, struct writeback_control *w= bc) @@ -188,7 +221,8 @@ static int zonefs_swap_activate(struct s return -EINVAL; } =20 - return iomap_swapfile_activate(sis, swap_file, span, &zonefs_iomap_ops); + return iomap_swapfile_activate(sis, swap_file, span, + &zonefs_read_iomap_ops); } =20 static const struct address_space_operations zonefs_file_aops =3D { @@ -607,7 +641,7 @@ static vm_fault_t zonefs_filemap_page_mk =20 /* Serialize against truncates */ filemap_invalidate_lock_shared(inode->i_mapping); - ret =3D iomap_page_mkwrite(vmf, &zonefs_iomap_ops); + ret =3D iomap_page_mkwrite(vmf, &zonefs_write_iomap_ops); filemap_invalidate_unlock_shared(inode->i_mapping); =20 sb_end_pagefault(inode->i_sb); @@ -860,7 +894,7 @@ static ssize_t zonefs_file_dio_write(str if (append) ret =3D zonefs_file_dio_append(iocb, from); else - ret =3D iomap_dio_rw(iocb, from, &zonefs_iomap_ops, + ret =3D iomap_dio_rw(iocb, from, &zonefs_write_iomap_ops, &zonefs_write_dio_ops, 0, 0); if (zi->i_ztype =3D=3D ZONEFS_ZTYPE_SEQ && (ret > 0 || ret =3D=3D -EIOCBQUEUED)) { @@ -902,7 +936,7 @@ static ssize_t zonefs_file_buffered_writ if (ret <=3D 0) goto inode_unlock; =20 - ret =3D iomap_file_buffered_write(iocb, from, &zonefs_iomap_ops); + ret =3D iomap_file_buffered_write(iocb, from, &zonefs_write_iomap_ops); if (ret > 0) iocb->ki_pos +=3D ret; else if (ret =3D=3D -EIO) @@ -995,7 +1029,7 @@ static ssize_t zonefs_file_read_iter(str goto inode_unlock; } file_accessed(iocb->ki_filp); - ret =3D iomap_dio_rw(iocb, to, &zonefs_iomap_ops, + ret =3D iomap_dio_rw(iocb, to, &zonefs_read_iomap_ops, &zonefs_read_dio_ops, 0, 0); } else { ret =3D generic_file_read_iter(iocb, to); From nobody Mon Apr 20 01:10:17 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3928C43334 for ; Thu, 23 Jun 2022 18:24:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236973AbiFWSYH (ORCPT ); Thu, 23 Jun 2022 14:24:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237535AbiFWSWu (ORCPT ); Thu, 23 Jun 2022 14:22:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE736C22AB; Thu, 23 Jun 2022 10:25:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B4578B824BC; Thu, 23 Jun 2022 17:25:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E749C3411B; Thu, 23 Jun 2022 17:25:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656005129; bh=3x+JCMeCi8QARQ9Mf6ADOAWXzW1kT+BjrjIMMS63i3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cUYJKiypfYzweWnaQM3uDx429kmWCynJp9I8xI5ibGGsFkFipL6NG1ImvkJSistrw OOSxhZEDe/xLJ5DF0G0kT5X+qGCVu92yzXNirW5yMiKaPF/Z4HIiMkdRa0RChQ6aws qzVayTrUaAioUUo38QhPjIaO73vboB7wOa6CbXkY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kalle Valo , Jakub Kicinski , Sudip Mukherjee Subject: [PATCH 5.18 03/11] wifi: rtlwifi: remove always-true condition pointed out by GCC 12 Date: Thu, 23 Jun 2022 18:45:15 +0200 Message-Id: <20220623164322.416091456@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164322.315085512@linuxfoundation.org> References: <20220623164322.315085512@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jakub Kicinski commit ee3db469dd317e82f57b13aa3bc61be5cb60c2b4 upstream. The .value is a two-dim array, not a pointer. struct iqk_matrix_regs { bool iqk_done; long value[1][IQK_MATRIX_REG_NUM]; }; Acked-by: Kalle Valo Signed-off-by: Jakub Kicinski Cc: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/phy.c @@ -2386,10 +2386,7 @@ void rtl92d_phy_reload_iqk_setting(struc rtl_dbg(rtlpriv, COMP_SCAN, DBG_LOUD, "Just Read IQK Matrix reg for channel:%d....\n", channel); - if ((rtlphy->iqk_matrix[indexforchannel]. - value[0] !=3D NULL) - /*&&(regea4 !=3D 0) */) - _rtl92d_phy_patha_fill_iqk_matrix(hw, true, + _rtl92d_phy_patha_fill_iqk_matrix(hw, true, rtlphy->iqk_matrix[ indexforchannel].value, 0, (rtlphy->iqk_matrix[ From nobody Mon Apr 20 01:10:17 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCC47C43334 for ; Thu, 23 Jun 2022 18:24:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235915AbiFWSYZ (ORCPT ); Thu, 23 Jun 2022 14:24:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237608AbiFWSXC (ORCPT ); Thu, 23 Jun 2022 14:23:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04FA4C2C41; Thu, 23 Jun 2022 10:25:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 48D3061DC6; Thu, 23 Jun 2022 17:25:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D8AEC3411B; Thu, 23 Jun 2022 17:25:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656005132; bh=jBL5LPWzIe5LTcpmUu/vq8dj06VeJFEUWnOKZtuluVI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aGB3Qvrj7MLD4qVt6r7yfJ8Vit1uUOiv9hb5TFTrMop9bdnJWbg41f2VDtl9z/z6W 8YsyxONI0wBJiT/nV89dGF/7IjTAmPhbawkmAfDcy1CMifHiqXc8JhBGg4FYe/C61r cse/q33sPiM4nfbul/YvA+y9MjsVDX5gv5hkmLR4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Liska , "David S. Miller" , Sudip Mukherjee Subject: [PATCH 5.18 04/11] eth: sun: cassini: remove dead code Date: Thu, 23 Jun 2022 18:45:16 +0200 Message-Id: <20220623164322.444430614@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164322.315085512@linuxfoundation.org> References: <20220623164322.315085512@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Li=C5=A1ka commit 32329216ca1d6ee29c41215f18b3053bb6158541 upstream. Fixes the following GCC warning: drivers/net/ethernet/sun/cassini.c:1316:29: error: comparison between two a= rrays [-Werror=3Darray-compare] drivers/net/ethernet/sun/cassini.c:3783:34: error: comparison between two a= rrays [-Werror=3Darray-compare] Note that 2 arrays should be compared by comparing of their addresses: note: use =E2=80=98&cas_prog_workaroundtab[0] =3D=3D &cas_prog_null[0]=E2= =80=99 to compare the addresses Signed-off-by: Martin Liska Signed-off-by: David S. Miller Cc: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/sun/cassini.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/sun/cassini.c +++ b/drivers/net/ethernet/sun/cassini.c @@ -1313,7 +1313,7 @@ static void cas_init_rx_dma(struct cas * writel(val, cp->regs + REG_RX_PAGE_SIZE); =20 /* enable the header parser if desired */ - if (CAS_HP_FIRMWARE =3D=3D cas_prog_null) + if (&CAS_HP_FIRMWARE[0] =3D=3D &cas_prog_null[0]) return; =20 val =3D CAS_BASE(HP_CFG_NUM_CPU, CAS_NCPUS > 63 ? 0 : CAS_NCPUS); @@ -3780,7 +3780,7 @@ static void cas_reset(struct cas *cp, in =20 /* program header parser */ if ((cp->cas_flags & CAS_FLAG_TARGET_ABORT) || - (CAS_HP_ALT_FIRMWARE =3D=3D cas_prog_null)) { + (&CAS_HP_ALT_FIRMWARE[0] =3D=3D &cas_prog_null[0])) { cas_load_firmware(cp, CAS_HP_FIRMWARE); } else { cas_load_firmware(cp, CAS_HP_ALT_FIRMWARE); From nobody Mon Apr 20 01:10:17 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19F0AC43334 for ; Thu, 23 Jun 2022 18:24:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237068AbiFWSYL (ORCPT ); Thu, 23 Jun 2022 14:24:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237585AbiFWSW4 (ORCPT ); Thu, 23 Jun 2022 14:22:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85FE269F9D; Thu, 23 Jun 2022 10:25:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C3AF1B824B8; Thu, 23 Jun 2022 17:25:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27316C3411B; Thu, 23 Jun 2022 17:25:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656005135; bh=Myr/K1diHuAlbtpy15kf7/p4zZiJit0fn5QkUHtEsmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W/7e7CiIDq1Qvn8idHGAoUlwj3RvHHHYKqNFjL8OYgoSGUN4Pn6c1CzEiOfy0SrMm 6OrvxO7SVzzeVw5Swev7JuOGeyt5+qaUoRms4GBeKS8eW9/o6CcUETnLPOuks8wfD7 QqbvL2FgojCfw3fqZ4cbPhF6NVL3Jtcp5u3iWZog= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, M Chetan Kumar , Jakub Kicinski , Sudip Mukherjee Subject: [PATCH 5.18 05/11] net: wwan: iosm: remove pointless null check Date: Thu, 23 Jun 2022 18:45:17 +0200 Message-Id: <20220623164322.472090999@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164322.315085512@linuxfoundation.org> References: <20220623164322.315085512@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jakub Kicinski commit dbbc7d04c549a43ad343c69e17b27a57e2102041 upstream. GCC 12 warns: drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c: In function =E2=80=98ipc_pro= tocol_dl_td_process=E2=80=99: drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c:406:13: warning: the comparis= on will always evaluate as =E2=80=98true=E2=80=99 for the address of =E2=80= =98cb=E2=80=99 will never be NULL [-Waddress] 406 | if (!IPC_CB(skb)) { | ^ Indeed the check seems entirely pointless. Hopefully the other validation checks will catch if the cb is bad, but it can't be NULL. Reviewed-by: M Chetan Kumar Link: https://lore.kernel.org/r/20220519004342.2109832-1-kuba@kernel.org Signed-off-by: Jakub Kicinski Cc: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c | 10 ---------- 1 file changed, 10 deletions(-) --- a/drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c +++ b/drivers/net/wwan/iosm/iosm_ipc_protocol_ops.c @@ -372,8 +372,6 @@ bool ipc_protocol_dl_td_prepare(struct i struct sk_buff *ipc_protocol_dl_td_process(struct iosm_protocol *ipc_proto= col, struct ipc_pipe *pipe) { - u32 tail =3D - le32_to_cpu(ipc_protocol->p_ap_shm->tail_array[pipe->pipe_nr]); struct ipc_protocol_td *p_td; struct sk_buff *skb; =20 @@ -401,14 +399,6 @@ struct sk_buff *ipc_protocol_dl_td_proce ipc_pcie_kfree_skb(ipc_protocol->pcie, skb); skb =3D NULL; goto ret; - } - - if (!IPC_CB(skb)) { - dev_err(ipc_protocol->dev, "pipe# %d, tail: %d skb_cb is NULL", - pipe->pipe_nr, tail); - ipc_pcie_kfree_skb(ipc_protocol->pcie, skb); - skb =3D NULL; - goto ret; } =20 if (p_td->buffer.address !=3D IPC_CB(skb)->mapping) { From nobody Mon Apr 20 01:10:17 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D55EC43334 for ; Thu, 23 Jun 2022 18:24:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237218AbiFWSY4 (ORCPT ); Thu, 23 Jun 2022 14:24:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237598AbiFWSXA (ORCPT ); Thu, 23 Jun 2022 14:23:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17F4569FA4; Thu, 23 Jun 2022 10:25:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2E40561BFA; Thu, 23 Jun 2022 17:25:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4C55C3411B; Thu, 23 Jun 2022 17:25:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656005138; bh=/1LJG4oZTcqnV2VpWU4XssJhTWNruaNMjNv7eQ7ewtk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dqyPnI6jiquPq31wdOIaZzjY3cjge2djvxCc2FI48wwBmykoMyFhGuIJJIaHPQDf1 ZtgVIPe3TtXGSmpBo0oTN3uQJxSvulno3EdyoYEAXUro4kJvXp5uIDVgw9VyAp1w4l EwxCACtdKdmPYA6RFh6pWOWsTOqEJO+bMROZ0EG0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , Borislav Petkov , Guenter Roeck , Jiri Slaby Subject: [PATCH 5.18 06/11] x86/boot: Wrap literal addresses in absolute_pointer() Date: Thu, 23 Jun 2022 18:45:18 +0200 Message-Id: <20220623164322.500778833@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164322.315085512@linuxfoundation.org> References: <20220623164322.315085512@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kees Cook commit aeb84412037b89e06f45e382f044da6f200e12f8 upstream. GCC 11 (incorrectly[1]) assumes that literal values cast to (void *) should be treated like a NULL pointer with an offset, and raises diagnostics when doing bounds checking under -Warray-bounds. GCC 12 got "smarter" about finding these: In function 'rdfs8', inlined from 'vga_recalc_vertical' at /srv/code/arch/x86/boot/video-m= ode.c:124:29, inlined from 'set_mode' at /srv/code/arch/x86/boot/video-mode.c:163:3: /srv/code/arch/x86/boot/boot.h:114:9: warning: array subscript 0 is outsi= de array bounds of 'u8[0]' {aka 'unsigned char[]'} [-Warray-bounds] 114 | asm volatile("movb %%fs:%1,%0" : "=3Dq" (v) : "m" (*(u8 *= )addr)); | ^~~ This has been solved in other places[2] already by using the recently added absolute_pointer() macro. Do the same here. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99578 [2] https://lore.kernel.org/all/20210912160149.2227137-1-linux@roeck-us.n= et/ Signed-off-by: Kees Cook Signed-off-by: Borislav Petkov Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220227195918.705219-1-keescook@chromium.o= rg Cc: Jiri Slaby Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/x86/boot/boot.h | 36 ++++++++++++++++++++++++------------ arch/x86/boot/main.c | 2 +- 2 files changed, 25 insertions(+), 13 deletions(-) --- a/arch/x86/boot/boot.h +++ b/arch/x86/boot/boot.h @@ -110,66 +110,78 @@ typedef unsigned int addr_t; =20 static inline u8 rdfs8(addr_t addr) { + u8 *ptr =3D (u8 *)absolute_pointer(addr); u8 v; - asm volatile("movb %%fs:%1,%0" : "=3Dq" (v) : "m" (*(u8 *)addr)); + asm volatile("movb %%fs:%1,%0" : "=3Dq" (v) : "m" (*ptr)); return v; } static inline u16 rdfs16(addr_t addr) { + u16 *ptr =3D (u16 *)absolute_pointer(addr); u16 v; - asm volatile("movw %%fs:%1,%0" : "=3Dr" (v) : "m" (*(u16 *)addr)); + asm volatile("movw %%fs:%1,%0" : "=3Dr" (v) : "m" (*ptr)); return v; } static inline u32 rdfs32(addr_t addr) { + u32 *ptr =3D (u32 *)absolute_pointer(addr); u32 v; - asm volatile("movl %%fs:%1,%0" : "=3Dr" (v) : "m" (*(u32 *)addr)); + asm volatile("movl %%fs:%1,%0" : "=3Dr" (v) : "m" (*ptr)); return v; } =20 static inline void wrfs8(u8 v, addr_t addr) { - asm volatile("movb %1,%%fs:%0" : "+m" (*(u8 *)addr) : "qi" (v)); + u8 *ptr =3D (u8 *)absolute_pointer(addr); + asm volatile("movb %1,%%fs:%0" : "+m" (*ptr) : "qi" (v)); } static inline void wrfs16(u16 v, addr_t addr) { - asm volatile("movw %1,%%fs:%0" : "+m" (*(u16 *)addr) : "ri" (v)); + u16 *ptr =3D (u16 *)absolute_pointer(addr); + asm volatile("movw %1,%%fs:%0" : "+m" (*ptr) : "ri" (v)); } static inline void wrfs32(u32 v, addr_t addr) { - asm volatile("movl %1,%%fs:%0" : "+m" (*(u32 *)addr) : "ri" (v)); + u32 *ptr =3D (u32 *)absolute_pointer(addr); + asm volatile("movl %1,%%fs:%0" : "+m" (*ptr) : "ri" (v)); } =20 static inline u8 rdgs8(addr_t addr) { + u8 *ptr =3D (u8 *)absolute_pointer(addr); u8 v; - asm volatile("movb %%gs:%1,%0" : "=3Dq" (v) : "m" (*(u8 *)addr)); + asm volatile("movb %%gs:%1,%0" : "=3Dq" (v) : "m" (*ptr)); return v; } static inline u16 rdgs16(addr_t addr) { + u16 *ptr =3D (u16 *)absolute_pointer(addr); u16 v; - asm volatile("movw %%gs:%1,%0" : "=3Dr" (v) : "m" (*(u16 *)addr)); + asm volatile("movw %%gs:%1,%0" : "=3Dr" (v) : "m" (*ptr)); return v; } static inline u32 rdgs32(addr_t addr) { + u32 *ptr =3D (u32 *)absolute_pointer(addr); u32 v; - asm volatile("movl %%gs:%1,%0" : "=3Dr" (v) : "m" (*(u32 *)addr)); + asm volatile("movl %%gs:%1,%0" : "=3Dr" (v) : "m" (*ptr)); return v; } =20 static inline void wrgs8(u8 v, addr_t addr) { - asm volatile("movb %1,%%gs:%0" : "+m" (*(u8 *)addr) : "qi" (v)); + u8 *ptr =3D (u8 *)absolute_pointer(addr); + asm volatile("movb %1,%%gs:%0" : "+m" (*ptr) : "qi" (v)); } static inline void wrgs16(u16 v, addr_t addr) { - asm volatile("movw %1,%%gs:%0" : "+m" (*(u16 *)addr) : "ri" (v)); + u16 *ptr =3D (u16 *)absolute_pointer(addr); + asm volatile("movw %1,%%gs:%0" : "+m" (*ptr) : "ri" (v)); } static inline void wrgs32(u32 v, addr_t addr) { - asm volatile("movl %1,%%gs:%0" : "+m" (*(u32 *)addr) : "ri" (v)); + u32 *ptr =3D (u32 *)absolute_pointer(addr); + asm volatile("movl %1,%%gs:%0" : "+m" (*ptr) : "ri" (v)); } =20 /* Note: these only return true/false, not a signed return value! */ --- a/arch/x86/boot/main.c +++ b/arch/x86/boot/main.c @@ -33,7 +33,7 @@ static void copy_boot_params(void) u16 cl_offset; }; const struct old_cmdline * const oldcmd =3D - (const struct old_cmdline *)OLD_CL_ADDRESS; + absolute_pointer(OLD_CL_ADDRESS); =20 BUILD_BUG_ON(sizeof(boot_params) !=3D 4096); memcpy(&boot_params.hdr, &hdr, sizeof(hdr)); From nobody Mon Apr 20 01:10:17 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF65ACCA47F for ; Thu, 23 Jun 2022 18:24:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237093AbiFWSYd (ORCPT ); Thu, 23 Jun 2022 14:24:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237686AbiFWSXS (ORCPT ); Thu, 23 Jun 2022 14:23:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A04B6B8C2; Thu, 23 Jun 2022 10:25:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B8088B824B8; Thu, 23 Jun 2022 17:25:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 289D8C3411B; Thu, 23 Jun 2022 17:25:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656005141; bh=inJZUrPnHHEGjWTpz138mTmKDGvf6TZCpzaMn1aHwWg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wCTGxyy+K0L1i86Yq8jcwOQ/LT8LdmiVs814VIwcmenGM3yfSNfhcsI4WNEb4iFKJ H4tUSEGA+2hG3l9PW1r5cr9Oz7+HPkC/c8W5B99G3MnLj2+z/1t90N5Jz0AM4KvTXx E0A5btm8kYsPL98d767dGKZn1tscbuss8s48l3uE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Amir Goldstein , Jan Kara Subject: [PATCH 5.18 07/11] fsnotify: introduce mark type iterator Date: Thu, 23 Jun 2022 18:45:19 +0200 Message-Id: <20220623164322.529798143@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164322.315085512@linuxfoundation.org> References: <20220623164322.315085512@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Amir Goldstein commit 14362a2541797cf9df0e86fb12dcd7950baf566e upstream. fsnotify_foreach_iter_mark_type() is used to reduce boilerplate code of iterating all marks of a specific group interested in an event by consulting the iterator report_mask. Use an open coded version of that iterator in fsnotify_iter_next() that collects all marks of the current iteration group without consulting the iterator report_mask. At the moment, the two iterator variants are the same, but this decoupling will allow us to exclude some of the group's marks from reporting the event, for example for event on child and inode marks on parent did not request to watch events on children. Fixes: 2f02fd3fa13e ("fanotify: fix ignore mask logic for events on child a= nd on dir") Reported-by: Jan Kara Signed-off-by: Amir Goldstein Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220511190213.831646-2-amir73il@gmail.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/notify/fanotify/fanotify.c | 14 ++-------- fs/notify/fsnotify.c | 53 +++++++++++++++++++---------------= ----- include/linux/fsnotify_backend.h | 31 +++++++++++++++++----- 3 files changed, 54 insertions(+), 44 deletions(-) --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c @@ -319,11 +319,7 @@ static u32 fanotify_group_event_mask(str return 0; } =20 - fsnotify_foreach_iter_type(type) { - if (!fsnotify_iter_should_report_type(iter_info, type)) - continue; - mark =3D iter_info->marks[type]; - + fsnotify_foreach_iter_mark_type(iter_info, mark, type) { /* Apply ignore mask regardless of ISDIR and ON_CHILD flags */ marks_ignored_mask |=3D mark->ignored_mask; =20 @@ -849,16 +845,14 @@ out: */ static __kernel_fsid_t fanotify_get_fsid(struct fsnotify_iter_info *iter_i= nfo) { + struct fsnotify_mark *mark; int type; __kernel_fsid_t fsid =3D {}; =20 - fsnotify_foreach_iter_type(type) { + fsnotify_foreach_iter_mark_type(iter_info, mark, type) { struct fsnotify_mark_connector *conn; =20 - if (!fsnotify_iter_should_report_type(iter_info, type)) - continue; - - conn =3D READ_ONCE(iter_info->marks[type]->connector); + conn =3D READ_ONCE(mark->connector); /* Mark is just getting destroyed or created? */ if (!conn) continue; --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c @@ -335,31 +335,23 @@ static int send_to_group(__u32 mask, con struct fsnotify_mark *mark; int type; =20 - if (WARN_ON(!iter_info->report_mask)) + if (!iter_info->report_mask) return 0; =20 /* clear ignored on inode modification */ if (mask & FS_MODIFY) { - fsnotify_foreach_iter_type(type) { - if (!fsnotify_iter_should_report_type(iter_info, type)) - continue; - mark =3D iter_info->marks[type]; - if (mark && - !(mark->flags & FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY)) + fsnotify_foreach_iter_mark_type(iter_info, mark, type) { + if (!(mark->flags & + FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY)) mark->ignored_mask =3D 0; } } =20 - fsnotify_foreach_iter_type(type) { - if (!fsnotify_iter_should_report_type(iter_info, type)) - continue; - mark =3D iter_info->marks[type]; - /* does the object mark tell us to do something? */ - if (mark) { - group =3D mark->group; - marks_mask |=3D mark->mask; - marks_ignored_mask |=3D mark->ignored_mask; - } + /* Are any of the group marks interested in this event? */ + fsnotify_foreach_iter_mark_type(iter_info, mark, type) { + group =3D mark->group; + marks_mask |=3D mark->mask; + marks_ignored_mask |=3D mark->ignored_mask; } =20 pr_debug("%s: group=3D%p mask=3D%x marks_mask=3D%x marks_ignored_mask=3D%= x data=3D%p data_type=3D%d dir=3D%p cookie=3D%d\n", @@ -403,11 +395,11 @@ static struct fsnotify_mark *fsnotify_ne =20 /* * iter_info is a multi head priority queue of marks. - * Pick a subset of marks from queue heads, all with the - * same group and set the report_mask for selected subset. - * Returns the report_mask of the selected subset. + * Pick a subset of marks from queue heads, all with the same group + * and set the report_mask to a subset of the selected marks. + * Returns false if there are no more groups to iterate. */ -static unsigned int fsnotify_iter_select_report_types( +static bool fsnotify_iter_select_report_types( struct fsnotify_iter_info *iter_info) { struct fsnotify_group *max_prio_group =3D NULL; @@ -423,30 +415,37 @@ static unsigned int fsnotify_iter_select } =20 if (!max_prio_group) - return 0; + return false; =20 /* Set the report mask for marks from same group as max prio group */ + iter_info->current_group =3D max_prio_group; iter_info->report_mask =3D 0; fsnotify_foreach_iter_type(type) { mark =3D iter_info->marks[type]; - if (mark && - fsnotify_compare_groups(max_prio_group, mark->group) =3D=3D 0) + if (mark && mark->group =3D=3D iter_info->current_group) fsnotify_iter_set_report_type(iter_info, type); } =20 - return iter_info->report_mask; + return true; } =20 /* - * Pop from iter_info multi head queue, the marks that were iterated in the + * Pop from iter_info multi head queue, the marks that belong to the group= of * current iteration step. */ static void fsnotify_iter_next(struct fsnotify_iter_info *iter_info) { + struct fsnotify_mark *mark; int type; =20 + /* + * We cannot use fsnotify_foreach_iter_mark_type() here because we + * may need to advance a mark of type X that belongs to current_group + * but was not selected for reporting. + */ fsnotify_foreach_iter_type(type) { - if (fsnotify_iter_should_report_type(iter_info, type)) + mark =3D iter_info->marks[type]; + if (mark && mark->group =3D=3D iter_info->current_group) iter_info->marks[type] =3D fsnotify_next_mark(iter_info->marks[type]); } --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h @@ -370,6 +370,7 @@ static inline bool fsnotify_valid_obj_ty =20 struct fsnotify_iter_info { struct fsnotify_mark *marks[FSNOTIFY_ITER_TYPE_COUNT]; + struct fsnotify_group *current_group; unsigned int report_mask; int srcu_idx; }; @@ -386,20 +387,31 @@ static inline void fsnotify_iter_set_rep iter_info->report_mask |=3D (1U << iter_type); } =20 -static inline void fsnotify_iter_set_report_type_mark( - struct fsnotify_iter_info *iter_info, int iter_type, - struct fsnotify_mark *mark) +static inline struct fsnotify_mark *fsnotify_iter_mark( + struct fsnotify_iter_info *iter_info, int iter_type) { - iter_info->marks[iter_type] =3D mark; - iter_info->report_mask |=3D (1U << iter_type); + if (fsnotify_iter_should_report_type(iter_info, iter_type)) + return iter_info->marks[iter_type]; + return NULL; +} + +static inline int fsnotify_iter_step(struct fsnotify_iter_info *iter, int = type, + struct fsnotify_mark **markp) +{ + while (type < FSNOTIFY_ITER_TYPE_COUNT) { + *markp =3D fsnotify_iter_mark(iter, type); + if (*markp) + break; + type++; + } + return type; } =20 #define FSNOTIFY_ITER_FUNCS(name, NAME) \ static inline struct fsnotify_mark *fsnotify_iter_##name##_mark( \ struct fsnotify_iter_info *iter_info) \ { \ - return (iter_info->report_mask & (1U << FSNOTIFY_ITER_TYPE_##NAME)) ? \ - iter_info->marks[FSNOTIFY_ITER_TYPE_##NAME] : NULL; \ + return fsnotify_iter_mark(iter_info, FSNOTIFY_ITER_TYPE_##NAME); \ } =20 FSNOTIFY_ITER_FUNCS(inode, INODE) @@ -409,6 +421,11 @@ FSNOTIFY_ITER_FUNCS(sb, SB) =20 #define fsnotify_foreach_iter_type(type) \ for (type =3D 0; type < FSNOTIFY_ITER_TYPE_COUNT; type++) +#define fsnotify_foreach_iter_mark_type(iter, mark, type) \ + for (type =3D 0; \ + type =3D fsnotify_iter_step(iter, type, &mark), \ + type < FSNOTIFY_ITER_TYPE_COUNT; \ + type++) =20 /* * fsnotify_connp_t is what we embed in objects which connector can be att= ached From nobody Mon Apr 20 01:10:17 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4696FC433EF for ; Thu, 23 Jun 2022 18:25:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237244AbiFWSY6 (ORCPT ); Thu, 23 Jun 2022 14:24:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237695AbiFWSXT (ORCPT ); Thu, 23 Jun 2022 14:23:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 429A9C2C52; Thu, 23 Jun 2022 10:25:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CBD80B824BC; Thu, 23 Jun 2022 17:25:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20BF6C341C7; Thu, 23 Jun 2022 17:25:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656005144; bh=fktVbGTudoPPT+gPcMTm5EPC1UpCzHAWbOUnYQ07HBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B/VnkOzYYUwnuXVTKHD7CZJlUhPJdMsU24+1drSP+qo/WwqGH+9SrznXLP8wUf33L VHhiW9a+apynP2hQLFLRhdLca884TT7msThNMfzktxW7B30gS2Gn5cFqg9xWvC78q7 Wj8x3sjXr6W5piI1G+gNUvK1MxWOHzM4IGK7RFh8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Amir Goldstein , Jan Kara Subject: [PATCH 5.18 08/11] fsnotify: consistent behavior for parent not watching children Date: Thu, 23 Jun 2022 18:45:20 +0200 Message-Id: <20220623164322.557676906@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164322.315085512@linuxfoundation.org> References: <20220623164322.315085512@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Amir Goldstein commit e730558adffb88a52e562db089e969ee9510184a upstream. The logic for handling events on child in groups that have a mark on the parent inode, but without FS_EVENT_ON_CHILD flag in the mask is duplicated in several places and inconsistent. Move the logic into the preparation of mark type iterator, so that the parent mark type will be excluded from all mark type iterations in that case. This results in several subtle changes of behavior, hopefully all desired changes of behavior, for example: - Group A has a mount mark with FS_MODIFY in mask - Group A has a mark with ignore mask that does not survive FS_MODIFY and does not watch children on directory D. - Group B has a mark with FS_MODIFY in mask that does watch children on directory D. - FS_MODIFY event on file D/foo should not clear the ignore mask of group A, but before this change it does And if group A ignore mask was set to survive FS_MODIFY: - FS_MODIFY event on file D/foo should be reported to group A on account of the mount mark, but before this change it is wrongly ignored Fixes: 2f02fd3fa13e ("fanotify: fix ignore mask logic for events on child a= nd on dir") Reported-by: Jan Kara Link: https://lore.kernel.org/linux-fsdevel/20220314113337.j7slrb5srxukztje= @quack3.lan/ Signed-off-by: Amir Goldstein Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220511190213.831646-3-amir73il@gmail.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/notify/fanotify/fanotify.c | 10 +--------- fs/notify/fsnotify.c | 34 +++++++++++++++++++--------------- 2 files changed, 20 insertions(+), 24 deletions(-) --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c @@ -320,7 +320,7 @@ static u32 fanotify_group_event_mask(str } =20 fsnotify_foreach_iter_mark_type(iter_info, mark, type) { - /* Apply ignore mask regardless of ISDIR and ON_CHILD flags */ + /* Apply ignore mask regardless of mark's ISDIR flag */ marks_ignored_mask |=3D mark->ignored_mask; =20 /* @@ -330,14 +330,6 @@ static u32 fanotify_group_event_mask(str if (event_mask & FS_ISDIR && !(mark->mask & FS_ISDIR)) continue; =20 - /* - * If the event is on a child and this mark is on a parent not - * watching children, don't send it! - */ - if (type =3D=3D FSNOTIFY_ITER_TYPE_PARENT && - !(mark->mask & FS_EVENT_ON_CHILD)) - continue; - marks_mask |=3D mark->mask; =20 /* Record the mark types of this group that matched the event */ --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c @@ -290,22 +290,15 @@ static int fsnotify_handle_event(struct } =20 if (parent_mark) { - /* - * parent_mark indicates that the parent inode is watching - * children and interested in this event, which is an event - * possible on child. But is *this mark* watching children and - * interested in this event? - */ - if (parent_mark->mask & FS_EVENT_ON_CHILD) { - ret =3D fsnotify_handle_inode_event(group, parent_mark, mask, - data, data_type, dir, name, 0); - if (ret) - return ret; - } - if (!inode_mark) - return 0; + ret =3D fsnotify_handle_inode_event(group, parent_mark, mask, + data, data_type, dir, name, 0); + if (ret) + return ret; } =20 + if (!inode_mark) + return 0; + if (mask & FS_EVENT_ON_CHILD) { /* * Some events can be sent on both parent dir and child marks @@ -422,8 +415,19 @@ static bool fsnotify_iter_select_report_ iter_info->report_mask =3D 0; fsnotify_foreach_iter_type(type) { mark =3D iter_info->marks[type]; - if (mark && mark->group =3D=3D iter_info->current_group) + if (mark && mark->group =3D=3D iter_info->current_group) { + /* + * FSNOTIFY_ITER_TYPE_PARENT indicates that this inode + * is watching children and interested in this event, + * which is an event possible on child. + * But is *this mark* watching children? + */ + if (type =3D=3D FSNOTIFY_ITER_TYPE_PARENT && + !(mark->mask & FS_EVENT_ON_CHILD)) + continue; + fsnotify_iter_set_report_type(iter_info, type); + } } =20 return true; From nobody Mon Apr 20 01:10:17 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53540C43334 for ; Thu, 23 Jun 2022 18:24:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237126AbiFWSYh (ORCPT ); Thu, 23 Jun 2022 14:24:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237715AbiFWSXV (ORCPT ); Thu, 23 Jun 2022 14:23:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68622C2C5F; Thu, 23 Jun 2022 10:25:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A94C2B824C1; Thu, 23 Jun 2022 17:25:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EBF3C341C7; Thu, 23 Jun 2022 17:25:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656005147; bh=2JmOFGewJ4ZB7dxdcwRFUX2CBNPWpL4Q3bPJdpAazwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gODA1EaRzQ5QoYnXwnoWkESemA4D4HtaLZgYnadBOfcmxa3xxd0tvo+zerWaupJr5 AOboKkizQv+l6YkJKwMGBrnRs5opP7sP5T08+xOFM/jz2Cc7kxs9muo9JzlpFCOJ6C ZxOV13NBpuaU+zu8m4uX9RKPztyJ3zFgplLGTIEM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Simon Sundberg , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Alexei Starovoitov Subject: [PATCH 5.18 09/11] bpf: Fix calling global functions from BPF_PROG_TYPE_EXT programs Date: Thu, 23 Jun 2022 18:45:21 +0200 Message-Id: <20220623164322.585696427@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164322.315085512@linuxfoundation.org> References: <20220623164322.315085512@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Toke H=C3=B8iland-J=C3=B8rgensen commit f858c2b2ca04fc7ead291821a793638ae120c11d upstream. The verifier allows programs to call global functions as long as their argument types match, using BTF to check the function arguments. One of the allowed argument types to such global functions is PTR_TO_CTX; however the check for this fails on BPF_PROG_TYPE_EXT functions because the verifier uses the wrong type to fetch the vmlinux BTF ID for the program context type. This failure is seen when an XDP program is loaded using libxdp (which loads it as BPF_PROG_TYPE_EXT and attaches it to a global XDP type program). Fix the issue by passing in the target program type instead of the BPF_PROG_TYPE_EXT type to bpf_prog_get_ctx() when checking function argument compatibility. The first Fixes tag refers to the latest commit that touched the code in question, while the second one points to the code that first introduced the global function call verification. v2: - Use resolve_prog_type() Fixes: 3363bd0cfbb8 ("bpf: Extend kfunc with PTR_TO_CTX, PTR_TO_MEM argumen= t support") Fixes: 51c39bb1d5d1 ("bpf: Introduce function-by-function verification") Reported-by: Simon Sundberg Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen Link: https://lore.kernel.org/r/20220606075253.28422-1-toke@redhat.com Signed-off-by: Alexei Starovoitov [ backport: resolve conflict due to kptr series missing ] Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- kernel/bpf/btf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -5769,6 +5769,7 @@ static int btf_check_func_arg_match(stru struct bpf_reg_state *regs, bool ptr_to_mem_ok) { + enum bpf_prog_type prog_type =3D resolve_prog_type(env->prog); struct bpf_verifier_log *log =3D &env->log; u32 i, nargs, ref_id, ref_obj_id =3D 0; bool is_kfunc =3D btf_is_kernel(btf); @@ -5834,8 +5835,7 @@ static int btf_check_func_arg_match(stru if (ret < 0) return ret; =20 - if (btf_get_prog_ctx_type(log, btf, t, - env->prog->type, i)) { + if (btf_get_prog_ctx_type(log, btf, t, prog_type, i)) { /* If function expects ctx type in BTF check that caller * is passing PTR_TO_CTX. */ From nobody Mon Apr 20 01:10:17 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4107C43334 for ; Thu, 23 Jun 2022 18:24:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237202AbiFWSYy (ORCPT ); Thu, 23 Jun 2022 14:24:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237386AbiFWSWj (ORCPT ); Thu, 23 Jun 2022 14:22:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 426589413A; Thu, 23 Jun 2022 10:25:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B29B0B824BE; Thu, 23 Jun 2022 17:25:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A68C5C3411B; Thu, 23 Jun 2022 17:25:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656005120; bh=Dgo+qeo1tTgFj4A8Mf0R41+TzFQaiRkWV6tvtPg3G+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QQHZsMGIk+Ag6TCol8TjqaS/nYkAkLH25od+8GzA4uhhkF2vCq1rkMynk2p353dju g1Kv3c/pHc2sGU5TkaeNGHbZTMMtvXUnqAgXoKcVip/fQQoJ80kJ47qiFWYs1AWtlJ 0QTNSpt2p6kq3PwvxF4JDRkee1/Sugox4HGhBlY4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Alexei Starovoitov Subject: [PATCH 5.18 10/11] selftests/bpf: Add selftest for calling global functions from freplace Date: Thu, 23 Jun 2022 18:45:22 +0200 Message-Id: <20220623164322.614224121@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164322.315085512@linuxfoundation.org> References: <20220623164322.315085512@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Toke H=C3=B8iland-J=C3=B8rgensen commit 2cf7b7ffdae519b284f1406012b52e2282fa36bf upstream. Add a selftest that calls a global function with a context object parameter from an freplace function to check that the program context type is correctly converted to the freplace target when fetching the context type from the kernel BTF. v2: - Trim includes - Get rid of global function - Use __noinline Signed-off-by: Toke H=C3=B8iland-J=C3=B8rgensen Link: https://lore.kernel.org/r/20220606075253.28422-2-toke@redhat.com Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c | 14 +++++++++++ tools/testing/selftests/bpf/progs/freplace_global_func.c | 18 ++++++++++= +++++ 2 files changed, 32 insertions(+) create mode 100644 tools/testing/selftests/bpf/progs/freplace_global_func.c --- a/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c +++ b/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c @@ -395,6 +395,18 @@ static void test_func_map_prog_compatibi "./test_attach_probe.o"); } =20 +static void test_func_replace_global_func(void) +{ + const char *prog_name[] =3D { + "freplace/test_pkt_access", + }; + + test_fexit_bpf2bpf_common("./freplace_global_func.o", + "./test_pkt_access.o", + ARRAY_SIZE(prog_name), + prog_name, false, NULL); +} + /* NOTE: affect other tests, must run in serial mode */ void serial_test_fexit_bpf2bpf(void) { @@ -416,4 +428,6 @@ void serial_test_fexit_bpf2bpf(void) test_func_replace_multi(); if (test__start_subtest("fmod_ret_freplace")) test_fmod_ret_freplace(); + if (test__start_subtest("func_replace_global_func")) + test_func_replace_global_func(); } --- /dev/null +++ b/tools/testing/selftests/bpf/progs/freplace_global_func.c @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0 +#include +#include + +__noinline +int test_ctx_global_func(struct __sk_buff *skb) +{ + volatile int retval =3D 1; + return retval; +} + +SEC("freplace/test_pkt_access") +int new_test_pkt_access(struct __sk_buff *skb) +{ + return test_ctx_global_func(skb); +} + +char _license[] SEC("license") =3D "GPL"; From nobody Mon Apr 20 01:10:17 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47BA0C43334 for ; Thu, 23 Jun 2022 18:24:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236862AbiFWSYE (ORCPT ); Thu, 23 Jun 2022 14:24:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237347AbiFWSWb (ORCPT ); Thu, 23 Jun 2022 14:22:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54AC768C79; Thu, 23 Jun 2022 10:25:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3E4FD61DC6; Thu, 23 Jun 2022 17:25:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CA58C3411B; Thu, 23 Jun 2022 17:25:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656005123; bh=G8RvLNKUb/5NcSJr+pWqANeKbiDipPRXt8onOMoUFNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DVWavz+i9wBxZBsRbl2Zfygn4y9zAZ3xnubHA2IqyymPneVmGBuoJyDBMXYW+2Wow v0DKa9Rcxs3F/qQiBf0181hBlr3o1gZuDz8QCBDfvppSATYTmB7wDHYf3FhvlEQqc8 lD6QrcYr5uH0SCGaBoBvvN9VA7XUx7+crgFJ+9uU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Anderson , Srinivas Kandagatla , Michael Walle Subject: [PATCH 5.18 11/11] dt-bindings: nvmem: sfp: Add clock properties Date: Thu, 23 Jun 2022 18:45:23 +0200 Message-Id: <20220623164322.643045783@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164322.315085512@linuxfoundation.org> References: <20220623164322.315085512@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Anderson commit 8cb0cd68bef75af5ac8ef93f3314d4f8dc8767a3 upstream. To program fuses, it is necessary to set the fuse programming time. This is determined based on the value of the platform clock. Add a clock property. Because this property is necessary for programming, it is made mandatory. Since these bindings have not yet been present in a stable release (though they are on track for 5.18), it is not an ABI break to change them in this manner. Signed-off-by: Sean Anderson Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220429162701.2222-13-srinivas.kandagatla@= linaro.org Cc: Michael Walle Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- Documentation/devicetree/bindings/nvmem/fsl,layerscape-sfp.yaml | 14 +++= +++++++ 1 file changed, 14 insertions(+) --- a/Documentation/devicetree/bindings/nvmem/fsl,layerscape-sfp.yaml +++ b/Documentation/devicetree/bindings/nvmem/fsl,layerscape-sfp.yaml @@ -24,15 +24,29 @@ properties: reg: maxItems: 1 =20 + clocks: + maxItems: 1 + description: + The SFP clock. Typically, this is the platform clock divided by 4. + + clock-names: + const: sfp + required: - compatible - reg + - clock-names + - clocks =20 unevaluatedProperties: false =20 examples: - | + #include efuse@1e80000 { compatible =3D "fsl,ls1028a-sfp"; reg =3D <0x1e80000 0x8000>; + clocks =3D <&clockgen QORIQ_CLK_PLATFORM_PLL + QORIQ_CLK_PLL_DIV(4)>; + clock-names =3D "sfp"; };