* Re: [PATCH net] net/smc: sync err code when tcp connection was refused
From: patchwork-bot+netdevbpf @ 2022-04-25 10:20 UTC (permalink / raw)
To: None; +Cc: kgraul, davem, kuba, pabeni, linux-s390, netdev, linux-kernel,
tonylu
In-Reply-To: <20220421094027.683992-1-liuyacan@corp.netease.com>
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:
On Thu, 21 Apr 2022 17:40:27 +0800 you wrote:
> From: liuyacan <liuyacan@corp.netease.com>
>
> In the current implementation, when TCP initiates a connection
> to an unavailable [ip,port], ECONNREFUSED will be stored in the
> TCP socket, but SMC will not. However, some apps (like curl) use
> getsockopt(,,SO_ERROR,,) to get the error information, which makes
> them miss the error message and behave strangely.
>
> [...]
Here is the summary with links:
- [net] net/smc: sync err code when tcp connection was refused
https://git.kernel.org/netdev/net/c/4e2e65e2e56c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply
* [net-next: PATCH] net: dsa: remove unused headers
From: Marcin Wojtas @ 2022-04-25 10:11 UTC (permalink / raw)
To: linux-kernel, netdev
Cc: davem, kuba, andrew, vivien.didelot, f.fainelli, olteanv,
upstream, Marcin Wojtas
Reduce a number of included headers to a necessary minimum.
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
net/dsa/dsa.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 89c6c86e746f..0c6ae32742ec 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -7,19 +7,10 @@
#include <linux/device.h>
#include <linux/list.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
#include <linux/module.h>
-#include <linux/notifier.h>
-#include <linux/of.h>
-#include <linux/of_mdio.h>
-#include <linux/of_platform.h>
-#include <linux/of_net.h>
#include <linux/netdevice.h>
#include <linux/sysfs.h>
-#include <linux/phy_fixed.h>
#include <linux/ptp_classify.h>
-#include <linux/etherdevice.h>
#include "dsa_priv.h"
--
2.29.0
^ permalink raw reply related
* Re: [PATCH] net: hns: Add missing fwnode_handle_put in hns_mac_init
From: patchwork-bot+netdevbpf @ 2022-04-25 10:10 UTC (permalink / raw)
To: Peng Wu
Cc: yisen.zhuang, salil.mehta, huangguangbin2, shenyang39, lipeng321,
netdev, linux-kernel, liwei391
In-Reply-To: <20220421055344.8102-1-wupeng58@huawei.com>
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:
On Thu, 21 Apr 2022 05:53:44 +0000 you wrote:
> In one of the error paths of the device_for_each_child_node() loop
> in hns_mac_init, add missing call to fwnode_handle_put.
>
> Signed-off-by: Peng Wu <wupeng58@huawei.com>
> ---
> drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
Here is the summary with links:
- net: hns: Add missing fwnode_handle_put in hns_mac_init
https://git.kernel.org/netdev/net/c/e85f8a9f1625
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply
* Re: [PATCH net-next 1/3] ipv4: Don't reset ->flowi4_scope in ip_rt_fix_tos().
From: Guillaume Nault @ 2022-04-25 10:04 UTC (permalink / raw)
To: David Ahern
Cc: David Miller, Jakub Kicinski, Paolo Abeni, netdev,
Hideaki YOSHIFUJI, dccp
In-Reply-To: <96b6dc1f-cf7b-73fe-d069-7ae16b3dcda2@kernel.org>
On Fri, Apr 22, 2022 at 08:40:01AM -0600, David Ahern wrote:
> On 4/22/22 4:53 AM, Guillaume Nault wrote:
> > On Thu, Apr 21, 2022 at 08:30:52PM -0600, David Ahern wrote:
> >> On 4/20/22 5:21 PM, Guillaume Nault wrote:
> >>> All callers already initialise ->flowi4_scope with RT_SCOPE_UNIVERSE,
> >>> either by manual field assignment, memset(0) of the whole structure or
> >>> implicit structure initialisation of on-stack variables
> >>> (RT_SCOPE_UNIVERSE actually equals 0).
> >>>
> >>> Therefore, we don't need to always initialise ->flowi4_scope in
> >>> ip_rt_fix_tos(). We only need to reduce the scope to RT_SCOPE_LINK when
> >>> the special RTO_ONLINK flag is present in the tos.
> >>>
> >>> This will allow some code simplification, like removing
> >>> ip_rt_fix_tos(). Also, the long term idea is to remove RTO_ONLINK
> >>> entirely by properly initialising ->flowi4_scope, instead of
> >>> overloading ->flowi4_tos with a special flag. Eventually, this will
> >>> allow to convert ->flowi4_tos to dscp_t.
> >>>
> >>> Signed-off-by: Guillaume Nault <gnault@redhat.com>
> >>> ---
> >>> It's important for the correctness of this patch that all callers
> >>> initialise ->flowi4_scope to 0 (in one way or another). Auditing all of
> >>> them is long, although each case is pretty trivial.
> >>>
> >>> If it helps, I can send a patch series that converts implicit
> >>> initialisation of ->flowi4_scope with an explicit assignment to
> >>> RT_SCOPE_UNIVERSE. This would also have the advantage of making it
> >>> clear to future readers that ->flowi4_scope _has_ to be initialised. I
> >>> haven't sent such patch series to not overwhelm reviewers with trivial
> >>> and not technically-required changes (there are 40+ places to modify,
> >>> scattered over 30+ different files). But if anyone prefers explicit
> >>> initialisation everywhere, then just let me know and I'll send such
> >>> patches.
> >>
> >> There are a handful of places that open code the initialization of the
> >> flow struct. I *think* I found all of them in 40867d74c374.
> >
> > By open code, do you mean "doesn't use flowi4_init_output() nor
> > ip_tunnel_init_flow()"? If so, I think there are many more.
> >
>
> no, you made a comment about flow struct being initialized to 0 which
> implicitly initializes scope. My comment is that there are only a few
> places that do not use either `memset(flow, 0, sizeof())` or `struct
> flowi4 fl4 = {}` to fully initialize the struct.
Yes, that's right. But I've only audited the call paths that lead to
ip_route_output_key_hash() (plus the ICMP error handlers), as these are
the ones that were relevant for this patch series. So I haven't looked
at flow initialisation in the ip_route_input*() or IPv6 call paths.
^ permalink raw reply
* [PATCH net V2] nfc: nfcmrvl: main: reorder destructive operations in nfcmrvl_nci_unregister_dev to avoid bugs
From: Duoming Zhou @ 2022-04-25 9:58 UTC (permalink / raw)
To: krzysztof.kozlowski, linux-kernel
Cc: davem, gregkh, alexander.deucher, broonie, akpm, netdev, linma,
Duoming Zhou
There are destructive operations such as nfcmrvl_fw_dnld_abort and
gpio_free in nfcmrvl_nci_unregister_dev. The resources such as firmware,
gpio and so on could be destructed while the upper layer functions such as
nfcmrvl_fw_dnld_start and nfcmrvl_nci_recv_frame is executing, which leads
to double-free, use-after-free and null-ptr-deref bugs.
There are three situations that could lead to double-free bugs.
The first situation is shown below:
(Thread 1) | (Thread 2)
nfcmrvl_fw_dnld_start |
... | nfcmrvl_nci_unregister_dev
release_firmware() | nfcmrvl_fw_dnld_abort
kfree(fw) //(1) | fw_dnld_over
| release_firmware
... | kfree(fw) //(2)
| ...
The second situation is shown below:
(Thread 1) | (Thread 2)
nfcmrvl_fw_dnld_start |
... |
mod_timer |
(wait a time) |
fw_dnld_timeout | nfcmrvl_nci_unregister_dev
fw_dnld_over | nfcmrvl_fw_dnld_abort
release_firmware | fw_dnld_over
kfree(fw) //(1) | release_firmware
... | kfree(fw) //(2)
The third situation is shown below:
(Thread 1) | (Thread 2)
nfcmrvl_nci_recv_frame |
if(..->fw_download_in_progress)|
nfcmrvl_fw_dnld_recv_frame |
queue_work |
|
fw_dnld_rx_work | nfcmrvl_nci_unregister_dev
fw_dnld_over | nfcmrvl_fw_dnld_abort
release_firmware | fw_dnld_over
kfree(fw) //(1) | release_firmware
| kfree(fw) //(2)
The firmware struct is deallocated in position (1) and deallocated
in position (2) again.
The crash trace triggered by POC is like below:
[ 122.640457] BUG: KASAN: double-free or invalid-free in fw_dnld_over+0x28/0xf0
[ 122.640457] Call Trace:
[ 122.640457] <TASK>
[ 122.640457] kfree+0xb0/0x330
[ 122.640457] fw_dnld_over+0x28/0xf0
[ 122.640457] nfcmrvl_nci_unregister_dev+0x61/0x70
[ 122.640457] nci_uart_tty_close+0x87/0xd0
[ 122.640457] tty_ldisc_kill+0x3e/0x80
[ 122.640457] tty_ldisc_hangup+0x1b2/0x2c0
[ 122.640457] __tty_hangup.part.0+0x316/0x520
[ 122.640457] tty_release+0x200/0x670
[ 122.640457] __fput+0x110/0x410
[ 122.640457] task_work_run+0x86/0xd0
[ 122.640457] exit_to_user_mode_prepare+0x1aa/0x1b0
[ 122.640457] syscall_exit_to_user_mode+0x19/0x50
[ 122.640457] do_syscall_64+0x48/0x90
[ 122.640457] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 122.640457] RIP: 0033:0x7f68433f6beb
What's more, there are also use-after-free and null-ptr-deref bugs
in nfcmrvl_fw_dnld_start. If we deallocate firmware struct, gpio or
set null to the members of priv->fw_dnld in nfcmrvl_nci_unregister_dev,
then, we dereference firmware, gpio or the members of priv->fw_dnld in
nfcmrvl_fw_dnld_start, the UAF or NPD bugs will happen.
This patch reorders destructive operations after nci_unregister_device
to avoid the double-free, UAF and NPD bugs, as nci_unregister_device
is well synchronized and won't return if there is a running routine.
This was mentioned in commit 3e3b5dfcd16a ("NFC: reorder the logic in
nfc_{un,}register_device").
Fixes: 3194c6870158 ("NFC: nfcmrvl: add firmware download support")
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
---
Changes in V2:
- Correct the subject prefix.
drivers/nfc/nfcmrvl/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c
index 2fcf545012b..1a5284de434 100644
--- a/drivers/nfc/nfcmrvl/main.c
+++ b/drivers/nfc/nfcmrvl/main.c
@@ -183,6 +183,7 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv)
{
struct nci_dev *ndev = priv->ndev;
+ nci_unregister_device(ndev);
if (priv->ndev->nfc_dev->fw_download_in_progress)
nfcmrvl_fw_dnld_abort(priv);
@@ -191,7 +192,6 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv)
if (gpio_is_valid(priv->config.reset_n_io))
gpio_free(priv->config.reset_n_io);
- nci_unregister_device(ndev);
nci_free_device(ndev);
kfree(priv);
}
--
2.17.1
^ permalink raw reply related
* Re: [PATCH net-next 00/11] mlxsw: extend line card model by devices and info
From: patchwork-bot+netdevbpf @ 2022-04-25 9:50 UTC (permalink / raw)
To: Ido Schimmel
Cc: netdev, davem, kuba, pabeni, jiri, petrm, dsahern, andrew, mlxsw
In-Reply-To: <20220425034431.3161260-1-idosch@nvidia.com>
Hello:
This series was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:
On Mon, 25 Apr 2022 06:44:20 +0300 you wrote:
> Jiri says:
>
> This patchset is extending the line card model by three items:
> 1) line card devices
> 2) line card info
> 3) line card device info
>
> [...]
Here is the summary with links:
- [net-next,01/11] devlink: introduce line card devices support
https://git.kernel.org/netdev/net-next/c/8d92e4fbcf0f
- [net-next,02/11] devlink: introduce line card info get message
https://git.kernel.org/netdev/net-next/c/276910aecc6a
- [net-next,03/11] devlink: introduce line card device info infrastructure
https://git.kernel.org/netdev/net-next/c/28b2d1f1ac41
- [net-next,04/11] mlxsw: reg: Extend MDDQ by device_info
https://git.kernel.org/netdev/net-next/c/798e2df5067c
- [net-next,05/11] mlxsw: core_linecards: Probe provisioned line cards for devices and attach them
https://git.kernel.org/netdev/net-next/c/8e2e10f65112
- [net-next,06/11] selftests: mlxsw: Check devices on provisioned line card
https://git.kernel.org/netdev/net-next/c/5e2229891825
- [net-next,07/11] mlxsw: core_linecards: Expose HW revision and INI version
https://git.kernel.org/netdev/net-next/c/3b37130f4855
- [net-next,08/11] selftests: mlxsw: Check line card info on provisioned line card
https://git.kernel.org/netdev/net-next/c/08682c9e58cd
- [net-next,09/11] mlxsw: reg: Extend MDDQ device_info by FW version fields
https://git.kernel.org/netdev/net-next/c/c38e9bf33812
- [net-next,10/11] mlxsw: core_linecards: Expose device FW version over device info
https://git.kernel.org/netdev/net-next/c/e932b4bdbd7c
- [net-next,11/11] selftests: mlxsw: Check device info on activated line card
https://git.kernel.org/netdev/net-next/c/002defd576a3
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply
* Re: [PATCH net 0/6] net: hns3: add some fixes for -net
From: patchwork-bot+netdevbpf @ 2022-04-25 9:50 UTC (permalink / raw)
To: Guangbin Huang; +Cc: davem, kuba, netdev, linux-kernel, lipeng321, chenhao288
In-Reply-To: <20220424125725.43232-1-huangguangbin2@huawei.com>
Hello:
This series was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:
On Sun, 24 Apr 2022 20:57:19 +0800 you wrote:
> This series adds some fixes for the HNS3 ethernet driver.
>
> Hao Chen (1):
> net: hns3: align the debugfs output to the left
>
> Jian Shen (3):
> net: hns3: clear inited state and stop client after failed to register
> netdev
> net: hns3: add validity check for message data length
> net: hns3: add return value for mailbox handling in PF
>
> [...]
Here is the summary with links:
- [net,1/6] net: hns3: clear inited state and stop client after failed to register netdev
https://git.kernel.org/netdev/net/c/e98365afc1e9
- [net,2/6] net: hns3: align the debugfs output to the left
https://git.kernel.org/netdev/net/c/1ec1968e4e43
- [net,3/6] net: hns3: fix error log of tx/rx tqps stats
https://git.kernel.org/netdev/net/c/123521b6b260
- [net,4/6] net: hns3: modify the return code of hclge_get_ring_chain_from_mbx
https://git.kernel.org/netdev/net/c/48009e997297
- [net,5/6] net: hns3: add validity check for message data length
https://git.kernel.org/netdev/net/c/7d413735cb18
- [net,6/6] net: hns3: add return value for mailbox handling in PF
https://git.kernel.org/netdev/net/c/c59d60629684
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply
* Re: [PATCH net 1/4] ipvs: correctly print the memory size of ip_vs_conn_tab
From: patchwork-bot+netdevbpf @ 2022-04-25 9:50 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel, davem, netdev, kuba
In-Reply-To: <20220425091631.109320-2-pablo@netfilter.org>
Hello:
This series was applied to netdev/net.git (master)
by Pablo Neira Ayuso <pablo@netfilter.org>:
On Mon, 25 Apr 2022 11:16:28 +0200 you wrote:
> From: Pengcheng Yang <yangpc@wangsu.com>
>
> The memory size of ip_vs_conn_tab changed after we use hlist
> instead of list.
>
> Fixes: 731109e78415 ("ipvs: use hlist instead of list")
> Signed-off-by: Pengcheng Yang <yangpc@wangsu.com>
> Acked-by: Julian Anastasov <ja@ssi.bg>
> Acked-by: Simon Horman <horms@verge.net.au>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
>
> [...]
Here is the summary with links:
- [net,1/4] ipvs: correctly print the memory size of ip_vs_conn_tab
https://git.kernel.org/netdev/net/c/eba1a872cb73
- [net,2/4] netfilter: nft_set_rbtree: overlap detection with element re-addition after deletion
https://git.kernel.org/netdev/net/c/babc3dc9524f
- [net,3/4] netfilter: flowtable: Remove the empty file
https://git.kernel.org/netdev/net/c/b9b1e0da5800
- [net,4/4] netfilter: Update ip6_route_me_harder to consider L3 domain
https://git.kernel.org/netdev/net/c/8ddffdb9442a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply
* [net: PATCH] net: dsa: add missing refcount decrementation
From: Marcin Wojtas @ 2022-04-25 9:47 UTC (permalink / raw)
To: linux-kernel, netdev
Cc: davem, kuba, andrew, vivien.didelot, f.fainelli, olteanv,
upstream, Marcin Wojtas
After obtaining the "phy-handle" node, decrementing
refcount is required. Fix that.
Fixes: a20f997010c4 ("net: dsa: Don't instantiate phylink for CPU/DSA ports unless needed")
Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
net/dsa/port.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/dsa/port.c b/net/dsa/port.c
index 32d472a82241..cdc56ba11f52 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -1620,8 +1620,10 @@ int dsa_port_link_register_of(struct dsa_port *dp)
if (ds->ops->phylink_mac_link_down)
ds->ops->phylink_mac_link_down(ds, port,
MLO_AN_FIXED, PHY_INTERFACE_MODE_NA);
+ of_node_put(phy_np);
return dsa_port_phylink_register(dp);
}
+ of_node_put(phy_np);
return 0;
}
--
2.29.0
^ permalink raw reply related
* Re: [patch iproute2-next] devlink: introduce -h[ex] cmdline option to allow dumping numbers in hex format
From: Jiri Pirko @ 2022-04-25 9:31 UTC (permalink / raw)
To: David Ahern; +Cc: Shannon Nelson, netdev, sthemmin
In-Reply-To: <b386dcb4-6c1e-c615-f737-e2bb3026b976@gmail.com>
Sat, Apr 23, 2022 at 02:20:06AM CEST, dsahern@gmail.com wrote:
>On 4/22/22 3:36 PM, Shannon Nelson wrote:
>>> @@ -9053,6 +9056,7 @@ int main(int argc, char **argv)
>>> { "statistics", no_argument, NULL, 's' },
>>> { "Netns", required_argument, NULL, 'N' },
>>> { "iec", no_argument, NULL, 'i' },
>>> + { "hex", no_argument, NULL, 'h' },
>>
>> Can we use 'x' instead of 'h' here? Most times '-h' means 'help', and
>> might surprise unsuspecting users when it isn't a help flag.
>>
>
>agreed. -h almost always means help
Changed in v2.
^ permalink raw reply
* Re: [patch iproute2-next] devlink: introduce -h[ex] cmdline option to allow dumping numbers in hex format
From: Jiri Pirko @ 2022-04-25 9:31 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Shannon Nelson, netdev, sthemmin, dsahern
In-Reply-To: <20220422161054.1db3c836@hermes.local>
Sat, Apr 23, 2022 at 01:10:54AM CEST, stephen@networkplumber.org wrote:
>On Fri, 22 Apr 2022 14:36:21 -0700
>Shannon Nelson <snelson@pensando.io> wrote:
>
>> > static int fmsg_value_show(struct dl *dl, int type, struct nlattr *nl_data)
>> > {
>> > + const char *num_fmt = dl->hex ? "%x" : "%u";
>> > + const char *num64_fmt = dl->hex ? "%"PRIx64 : "%"PRIu64;
>>
>> Can we get a leading "0x" on these to help identify that they are hex
>> digits?
>
>Yes use %#x
Changed in v2.
^ permalink raw reply
* [patch iproute2-next v2] devlink: introduce -h[ex] cmdline option to allow dumping numbers in hex format
From: Jiri Pirko @ 2022-04-25 9:30 UTC (permalink / raw)
To: netdev; +Cc: sthemmin, dsahern, snelson
From: Jiri Pirko <jiri@nvidia.com>
For health reporter dumps it is quite convenient to have the numbers in
hexadecimal format. Introduce a command line option to allow user to
achieve that output.
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
v1->v2:
- changed the hex output option to "-x"
- added "0x" prefix to hex numbers
---
devlink/devlink.c | 19 +++++++++++++------
man/man8/devlink.8 | 4 ++++
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index da9f97788bcf..7ace968ca081 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -367,6 +367,7 @@ struct dl {
bool pretty_output;
bool verbose;
bool stats;
+ bool hex;
struct {
bool present;
char *bus_name;
@@ -8044,6 +8045,8 @@ static int cmd_health_dump_clear(struct dl *dl)
static int fmsg_value_show(struct dl *dl, int type, struct nlattr *nl_data)
{
+ const char *num_fmt = dl->hex ? "%#x" : "%u";
+ const char *num64_fmt = dl->hex ? "%#"PRIx64 : "%"PRIu64;
uint8_t *data;
uint32_t len;
@@ -8053,16 +8056,16 @@ static int fmsg_value_show(struct dl *dl, int type, struct nlattr *nl_data)
print_bool(PRINT_ANY, NULL, "%s", mnl_attr_get_u8(nl_data));
break;
case MNL_TYPE_U8:
- print_uint(PRINT_ANY, NULL, "%u", mnl_attr_get_u8(nl_data));
+ print_uint(PRINT_ANY, NULL, num_fmt, mnl_attr_get_u8(nl_data));
break;
case MNL_TYPE_U16:
- print_uint(PRINT_ANY, NULL, "%u", mnl_attr_get_u16(nl_data));
+ print_uint(PRINT_ANY, NULL, num_fmt, mnl_attr_get_u16(nl_data));
break;
case MNL_TYPE_U32:
- print_uint(PRINT_ANY, NULL, "%u", mnl_attr_get_u32(nl_data));
+ print_uint(PRINT_ANY, NULL, num_fmt, mnl_attr_get_u32(nl_data));
break;
case MNL_TYPE_U64:
- print_u64(PRINT_ANY, NULL, "%"PRIu64, mnl_attr_get_u64(nl_data));
+ print_u64(PRINT_ANY, NULL, num64_fmt, mnl_attr_get_u64(nl_data));
break;
case MNL_TYPE_NUL_STRING:
print_string(PRINT_ANY, NULL, "%s", mnl_attr_get_str(nl_data));
@@ -8928,7 +8931,7 @@ static void help(void)
pr_err("Usage: devlink [ OPTIONS ] OBJECT { COMMAND | help }\n"
" devlink [ -f[orce] ] -b[atch] filename -N[etns] netnsname\n"
"where OBJECT := { dev | port | sb | monitor | dpipe | resource | region | health | trap }\n"
- " OPTIONS := { -V[ersion] | -n[o-nice-names] | -j[son] | -p[retty] | -v[erbose] -s[tatistics] }\n");
+ " OPTIONS := { -V[ersion] | -n[o-nice-names] | -j[son] | -p[retty] | -v[erbose] -s[tatistics] -[he]x }\n");
}
static int dl_cmd(struct dl *dl, int argc, char **argv)
@@ -9042,6 +9045,7 @@ int main(int argc, char **argv)
{ "statistics", no_argument, NULL, 's' },
{ "Netns", required_argument, NULL, 'N' },
{ "iec", no_argument, NULL, 'i' },
+ { "hex", no_argument, NULL, 'x' },
{ NULL, 0, NULL, 0 }
};
const char *batch_file = NULL;
@@ -9057,7 +9061,7 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
- while ((opt = getopt_long(argc, argv, "Vfb:njpvsN:i",
+ while ((opt = getopt_long(argc, argv, "Vfb:njpvsN:ix",
long_options, NULL)) >= 0) {
switch (opt) {
@@ -9095,6 +9099,9 @@ int main(int argc, char **argv)
case 'i':
use_iec = true;
break;
+ case 'x':
+ dl->hex = true;
+ break;
default:
pr_err("Unknown option.\n");
help();
diff --git a/man/man8/devlink.8 b/man/man8/devlink.8
index 840cf44cf97b..de53061bc880 100644
--- a/man/man8/devlink.8
+++ b/man/man8/devlink.8
@@ -63,6 +63,10 @@ Switches to the specified network namespace.
.BR "\-i", " --iec"
Print human readable rates in IEC units (e.g. 1Ki = 1024).
+.TP
+.BR "\-x", " --hex"
+Print dump numbers in hexadecimal format.
+
.SS
.I OBJECT
--
2.35.1
^ permalink raw reply related
* Re: linux 5.17.1 disregarding ACK values resulting in stalled TCP connections
From: Florian Westphal @ 2022-04-25 9:29 UTC (permalink / raw)
To: Eric Dumazet
Cc: Jozsef Kadlecsik, Florian Westphal, Neal Cardwell, Jaco Kroon,
netfilter-devel, netdev
In-Reply-To: <CANn89i+v8niaz5ijpkd_XAbRqXSRBUt-nb43HN=11jkPZmOWog@mail.gmail.com>
Eric Dumazet <edumazet@google.com> wrote:
> Hi Jozsef and Florian
>
> Any updates for this issue ?
Sorry, I was away for a while. I will send the patch formally in a few
minutes.
^ permalink raw reply
* [PATCH net 0/4] Netfilter fixes for net
From: Pablo Neira Ayuso @ 2022-04-25 9:16 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev, kuba
Hi,
The following patchset contains Netfilter fixes for net:
1) Fix incorrect printing of memory size of IPVS connection hash table,
from Pengcheng Yang.
2) Fix spurious EEXIST errors in nft_set_rbtree.
3) Remove leftover empty flowtable file, from Rongguang Wei.
4) Fix ip6_route_me_harder() with vrf driver, from Martin Willi.
Please, pull these changes from:
git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git
Thanks.
----------------------------------------------------------------
The following changes since commit 4cf35a2b627a020fe1a6b6fc7a6a12394644e474:
net: mscc: ocelot: fix broken IP multicast flooding (2022-04-19 10:33:33 +0200)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git HEAD
for you to fetch changes up to 8ddffdb9442a9d60b4a6e679ac48d7d21403a674:
netfilter: Update ip6_route_me_harder to consider L3 domain (2022-04-25 11:09:20 +0200)
----------------------------------------------------------------
Martin Willi (1):
netfilter: Update ip6_route_me_harder to consider L3 domain
Pablo Neira Ayuso (1):
netfilter: nft_set_rbtree: overlap detection with element re-addition after deletion
Pengcheng Yang (1):
ipvs: correctly print the memory size of ip_vs_conn_tab
Rongguang Wei (1):
netfilter: flowtable: Remove the empty file
net/ipv4/netfilter/nf_flow_table_ipv4.c | 0
net/ipv6/netfilter.c | 10 ++++++++--
net/netfilter/ipvs/ip_vs_conn.c | 2 +-
net/netfilter/nft_set_rbtree.c | 6 +++++-
4 files changed, 14 insertions(+), 4 deletions(-)
delete mode 100644 net/ipv4/netfilter/nf_flow_table_ipv4.c
^ permalink raw reply
* [PATCH net 1/4] ipvs: correctly print the memory size of ip_vs_conn_tab
From: Pablo Neira Ayuso @ 2022-04-25 9:16 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev, kuba
In-Reply-To: <20220425091631.109320-1-pablo@netfilter.org>
From: Pengcheng Yang <yangpc@wangsu.com>
The memory size of ip_vs_conn_tab changed after we use hlist
instead of list.
Fixes: 731109e78415 ("ipvs: use hlist instead of list")
Signed-off-by: Pengcheng Yang <yangpc@wangsu.com>
Acked-by: Julian Anastasov <ja@ssi.bg>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/ipvs/ip_vs_conn.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/ipvs/ip_vs_conn.c b/net/netfilter/ipvs/ip_vs_conn.c
index 2c467c422dc6..fb67f1ca2495 100644
--- a/net/netfilter/ipvs/ip_vs_conn.c
+++ b/net/netfilter/ipvs/ip_vs_conn.c
@@ -1495,7 +1495,7 @@ int __init ip_vs_conn_init(void)
pr_info("Connection hash table configured "
"(size=%d, memory=%ldKbytes)\n",
ip_vs_conn_tab_size,
- (long)(ip_vs_conn_tab_size*sizeof(struct list_head))/1024);
+ (long)(ip_vs_conn_tab_size*sizeof(*ip_vs_conn_tab))/1024);
IP_VS_DBG(0, "Each connection entry needs %zd bytes at least\n",
sizeof(struct ip_vs_conn));
--
2.30.2
^ permalink raw reply related
* [PATCH net 3/4] netfilter: flowtable: Remove the empty file
From: Pablo Neira Ayuso @ 2022-04-25 9:16 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev, kuba
In-Reply-To: <20220425091631.109320-1-pablo@netfilter.org>
From: Rongguang Wei <weirongguang@kylinos.cn>
CONFIG_NF_FLOW_TABLE_IPV4 is already removed and the real user is also
removed(nf_flow_table_ipv4.c is empty).
Fixes: c42ba4290b2147aa ("netfilter: flowtable: remove ipv4/ipv6 modules")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/ipv4/netfilter/nf_flow_table_ipv4.c | 0
1 file changed, 0 insertions(+), 0 deletions(-)
delete mode 100644 net/ipv4/netfilter/nf_flow_table_ipv4.c
diff --git a/net/ipv4/netfilter/nf_flow_table_ipv4.c b/net/ipv4/netfilter/nf_flow_table_ipv4.c
deleted file mode 100644
index e69de29bb2d1..000000000000
--
2.30.2
^ permalink raw reply
* [PATCH net 2/4] netfilter: nft_set_rbtree: overlap detection with element re-addition after deletion
From: Pablo Neira Ayuso @ 2022-04-25 9:16 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev, kuba
In-Reply-To: <20220425091631.109320-1-pablo@netfilter.org>
This patch fixes spurious EEXIST errors.
Extend d2df92e98a34 ("netfilter: nft_set_rbtree: handle element
re-addition after deletion") to deal with elements with same end flags
in the same transation.
Reset the overlap flag as described by 7c84d41416d8 ("netfilter:
nft_set_rbtree: Detect partial overlaps on insertion").
Fixes: 7c84d41416d8 ("netfilter: nft_set_rbtree: Detect partial overlaps on insertion")
Fixes: d2df92e98a34 ("netfilter: nft_set_rbtree: handle element re-addition after deletion")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/nft_set_rbtree.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c
index d600a566da32..7325bee7d144 100644
--- a/net/netfilter/nft_set_rbtree.c
+++ b/net/netfilter/nft_set_rbtree.c
@@ -349,7 +349,11 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set,
*ext = &rbe->ext;
return -EEXIST;
} else {
- p = &parent->rb_left;
+ overlap = false;
+ if (nft_rbtree_interval_end(rbe))
+ p = &parent->rb_left;
+ else
+ p = &parent->rb_right;
}
}
--
2.30.2
^ permalink raw reply related
* [PATCH net 4/4] netfilter: Update ip6_route_me_harder to consider L3 domain
From: Pablo Neira Ayuso @ 2022-04-25 9:16 UTC (permalink / raw)
To: netfilter-devel; +Cc: davem, netdev, kuba
In-Reply-To: <20220425091631.109320-1-pablo@netfilter.org>
From: Martin Willi <martin@strongswan.org>
The commit referenced below fixed packet re-routing if Netfilter mangles
a routing key property of a packet and the packet is routed in a VRF L3
domain. The fix, however, addressed IPv4 re-routing, only.
This commit applies the same behavior for IPv6. While at it, untangle
the nested ternary operator to make the code more readable.
Fixes: 6d8b49c3a3a3 ("netfilter: Update ip_route_me_harder to consider L3 domain")
Cc: stable@vger.kernel.org
Signed-off-by: Martin Willi <martin@strongswan.org>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/ipv6/netfilter.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index 1da332450d98..8ce60ab89015 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -24,14 +24,13 @@ int ip6_route_me_harder(struct net *net, struct sock *sk_partial, struct sk_buff
{
const struct ipv6hdr *iph = ipv6_hdr(skb);
struct sock *sk = sk_to_full_sk(sk_partial);
+ struct net_device *dev = skb_dst(skb)->dev;
struct flow_keys flkeys;
unsigned int hh_len;
struct dst_entry *dst;
int strict = (ipv6_addr_type(&iph->daddr) &
(IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL));
struct flowi6 fl6 = {
- .flowi6_oif = sk && sk->sk_bound_dev_if ? sk->sk_bound_dev_if :
- strict ? skb_dst(skb)->dev->ifindex : 0,
.flowi6_mark = skb->mark,
.flowi6_uid = sock_net_uid(net, sk),
.daddr = iph->daddr,
@@ -39,6 +38,13 @@ int ip6_route_me_harder(struct net *net, struct sock *sk_partial, struct sk_buff
};
int err;
+ if (sk && sk->sk_bound_dev_if)
+ fl6.flowi6_oif = sk->sk_bound_dev_if;
+ else if (strict)
+ fl6.flowi6_oif = dev->ifindex;
+ else
+ fl6.flowi6_oif = l3mdev_master_ifindex(dev);
+
fib6_rules_early_flow_dissect(net, skb, &fl6, &flkeys);
dst = ip6_route_output(net, sk, &fl6);
err = dst->error;
--
2.30.2
^ permalink raw reply related
* RE: [Intel-wired-lan] [PATCH net v2] ice: Protect vf_state check by cfg_lock in ice_vc_process_vf_msg()
From: Jankowski, Konrad0 @ 2022-04-25 9:14 UTC (permalink / raw)
To: Keller, Jacob E, ivecera, netdev@vger.kernel.org
Cc: Fei Liu, mschmidt, Brett Creeley, open list,
moderated list:INTEL ETHERNET DRIVERS, Jakub Kicinski,
Paolo Abeni, David S. Miller
In-Reply-To: <CO1PR11MB5089EDB8FE93BA8B8905E889D6F49@CO1PR11MB5089.namprd11.prod.outlook.com>
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Keller, Jacob E
> Sent: Thursday, April 21, 2022 6:41 PM
> To: ivecera <ivecera@redhat.com>; netdev@vger.kernel.org
> Cc: Fei Liu <feliu@redhat.com>; mschmidt <mschmidt@redhat.com>; Brett
> Creeley <brett.creeley@intel.com>; open list <linux-
> kernel@vger.kernel.org>; moderated list:INTEL ETHERNET DRIVERS <intel-
> wired-lan@lists.osuosl.org>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
> <pabeni@redhat.com>; David S. Miller <davem@davemloft.net>
> Subject: Re: [Intel-wired-lan] [PATCH net v2] ice: Protect vf_state check by
> cfg_lock in ice_vc_process_vf_msg()
>
>
>
> > -----Original Message-----
> > From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf
> > Of Ivan Vecera
> > Sent: Tuesday, April 19, 2022 7:22 AM
> > To: netdev@vger.kernel.org
> > Cc: Fei Liu <feliu@redhat.com>; moderated list:INTEL ETHERNET DRIVERS
> > <intel- wired-lan@lists.osuosl.org>; mschmidt <mschmidt@redhat.com>;
> > Brett Creeley <brett.creeley@intel.com>; open list
> > <linux-kernel@vger.kernel.org>; Jakub Kicinski <kuba@kernel.org>;
> > Paolo Abeni <pabeni@redhat.com>; David S. Miller
> <davem@davemloft.net>
> > Subject: [Intel-wired-lan] [PATCH net v2] ice: Protect vf_state check
> > by cfg_lock in
> > ice_vc_process_vf_msg()
> >
> > Previous patch labelled "ice: Fix incorrect locking in
> > ice_vc_process_vf_msg()" fixed an issue with ignored messages sent by
> > VF driver but a small race window still left.
> >
> > Recently caught trace during 'ip link set ... vf 0 vlan ...' operation:
> >
> > [ 7332.995625] ice 0000:3b:00.0: Clearing port VLAN on VF 0 [
> > 7333.001023] iavf 0000:3b:01.0: Reset indication received from the PF
> > [ 7333.007391] iavf 0000:3b:01.0: Scheduling reset task [ 7333.059575]
> > iavf 0000:3b:01.0: PF returned error -5 (IAVF_ERR_PARAM) to our
> > request 3 [ 7333.059626] ice 0000:3b:00.0: Invalid message from VF 0,
> > opcode 3, len 4, error -1
> >
> > Setting of VLAN for VF causes a reset of the affected VF using
> > ice_reset_vf() function that runs with cfg_lock taken:
> >
> > 1. ice_notify_vf_reset() informs IAVF driver that reset is needed and
> > IAVF schedules its own reset procedure 2. Bit ICE_VF_STATE_DIS is
> > set in vf->vf_state 3. Misc initialization steps 4.
> > ice_sriov_post_vsi_rebuild() -> ice_vf_set_initialized() and that
> > clears ICE_VF_STATE_DIS in vf->vf_state
> >
> > Step 3 is mentioned race window because IAVF reset procedure runs in
> > parallel and one of its step is sending of
> > VIRTCHNL_OP_GET_VF_RESOURCES message (opcode==3). This message
> is
> > handled in ice_vc_process_vf_msg() and if it is received during the
> > mentioned race window then it's marked as invalid and error is returned to
> VF driver.
> >
> > Protect vf_state check in ice_vc_process_vf_msg() by cfg_lock to avoid
> > this race condition.
> >
> > Fixes: e6ba5273d4ed ("ice: Fix race conditions between virtchnl
> > handling and VF ndo ops")
> > Tested-by: Fei Liu <feliu@redhat.com>
> > Signed-off-by: Ivan Vecera <ivecera@redhat.com>
>
> Thanks, this looks good to me.
>
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
>
> > ---
> > drivers/net/ethernet/intel/ice/ice_virtchnl.c | 12 +++++-------
> > 1 file changed, 5 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl.c
> > b/drivers/net/ethernet/intel/ice/ice_virtchnl.c
> > index 5612c032f15a..b72606c9e6d0 100644
> > --- a/drivers/net/ethernet/intel/ice/ice_virtchnl.c
> > +++ b/drivers/net/ethernet/intel/ice/ice_virtchnl.c
> > @@ -3625,6 +3625,8 @@ void ice_vc_process_vf_msg(struct ice_pf *pf,
> > struct ice_rq_event_info *event)
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
^ permalink raw reply
* Re: Re: [PATCH] drivers: nfc: nfcmrvl: reorder destructive operations in nfcmrvl_nci_unregister_dev to avoid bugs
From: duoming @ 2022-04-25 9:09 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: linux-kernel, netdev, broonie, akpm, alexander.deucher, gregkh,
davem, linma
In-Reply-To: <d7aefec5-a51d-00ba-10d6-79c90fbc8eb4@linaro.org>
Hello,
On Mon, 25 Apr 2022 09:59:32 +0200 Krzysztof wrote:
> > There are destructive operations such as nfcmrvl_fw_dnld_abort and
> > gpio_free in nfcmrvl_nci_unregister_dev. The resources such as firmware,
> > gpio and so on could be destructed while the upper layer functions such as
> > nfcmrvl_fw_dnld_start and nfcmrvl_nci_recv_frame is executing, which leads
> > to double-free, use-after-free and null-ptr-deref bugs.
>
> You need to correct the subject prefix because it does not describe the
> subsystem (git log oneline --).
I will change the subject prefix to "nfc: nfcmrvl: uart: ".
> >
> > There are three situations that could lead to double-free bugs.
> >
> > The first situation is shown below:
> >
> > (Thread 1) | (Thread 2)
> > nfcmrvl_fw_dnld_start |
> > ... | nfcmrvl_nci_unregister_dev
> > release_firmware() | nfcmrvl_fw_dnld_abort
> > kfree(fw) //(1) | fw_dnld_over
> > | release_firmware
> > ... | kfree(fw) //(2)
> > | ...
> >
> > The second situation is shown below:
> >
> > (Thread 1) | (Thread 2)
> > nfcmrvl_fw_dnld_start |
> > ... |
> > mod_timer |
> > (wait a time) |
> > fw_dnld_timeout | nfcmrvl_nci_unregister_dev
> > fw_dnld_over | nfcmrvl_fw_dnld_abort
> > release_firmware | fw_dnld_over
> > kfree(fw) //(1) | release_firmware
> > ... | kfree(fw) //(2)
> >
> > The third situation is shown below:
> >
> > (Thread 1) | (Thread 2)
> > nfcmrvl_nci_recv_frame |
> > if(..->fw_download_in_progress)|
> > nfcmrvl_fw_dnld_recv_frame |
> > queue_work |
> > |
> > fw_dnld_rx_work | nfcmrvl_nci_unregister_dev
> > fw_dnld_over | nfcmrvl_fw_dnld_abort
> > release_firmware | fw_dnld_over
> > kfree(fw) //(1) | release_firmware
> > | kfree(fw) //(2)
> >
> > The firmware struct is deallocated in position (1) and deallocated
> > in position (2) again.
> >
> > The crash trace triggered by POC is like below:
> >
> > [ 122.640457] BUG: KASAN: double-free or invalid-free in fw_dnld_over+0x28/0xf0
> > [ 122.640457] Call Trace:
> > [ 122.640457] <TASK>
> > [ 122.640457] kfree+0xb0/0x330
> > [ 122.640457] fw_dnld_over+0x28/0xf0
> > [ 122.640457] nfcmrvl_nci_unregister_dev+0x61/0x70
> > [ 122.640457] nci_uart_tty_close+0x87/0xd0
> > [ 122.640457] tty_ldisc_kill+0x3e/0x80
> > [ 122.640457] tty_ldisc_hangup+0x1b2/0x2c0
> > [ 122.640457] __tty_hangup.part.0+0x316/0x520
> > [ 122.640457] tty_release+0x200/0x670
> > [ 122.640457] __fput+0x110/0x410
> > [ 122.640457] task_work_run+0x86/0xd0
> > [ 122.640457] exit_to_user_mode_prepare+0x1aa/0x1b0
> > [ 122.640457] syscall_exit_to_user_mode+0x19/0x50
> > [ 122.640457] do_syscall_64+0x48/0x90
> > [ 122.640457] entry_SYSCALL_64_after_hwframe+0x44/0xae
> > [ 122.640457] RIP: 0033:0x7f68433f6beb
> >
> > What's more, there are also use-after-free and null-ptr-deref bugs
> > in nfcmrvl_fw_dnld_start. If we deallocate firmware struct, gpio or
> > set null to the members of priv->fw_dnld in nfcmrvl_nci_unregister_dev,
> > then, we dereference firmware, gpio or the members of priv->fw_dnld in
> > nfcmrvl_fw_dnld_start, the UAF or NPD bugs will happen.
> >
> > This patch reorders destructive operations after nci_unregister_device
> > to avoid the double-free, UAF and NPD bugs, as nci_unregister_device
> > is well synchronized and won't return if there is a running routine.
> > This was mentioned in commit 3e3b5dfcd16a ("NFC: reorder the logic in
> > nfc_{un,}register_device").
> >
> > Fixes: 3194c6870158 ("NFC: nfcmrvl: add firmware download support")
> > Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
> > Reviewed-by: Lin Ma <linma@zju.edu.cn>
>
> It's the first submission, how this review appeared?
I will remove the review tag.
> On the other hand, you already sent something similar, so is it a v2? I
> am sorry but this is very confusing. Looks like
> https://lore.kernel.org/all/20220425005718.33639-1-duoming@zju.edu.cn/
> but there is no changelog and commit description is different.
I am sorry the above link is just a test, I forget to remove "Cc: stable@vger.kernel.org".
> Please read:
> https://elixir.bootlin.com/linux/v5.18-rc4/source/Documentation/process/submitting-patches.rst
>
I will send "[PATCH net V2] nfc: nfcmrvl: uart: reorder destructive operations in nfcmrvl_nci_unregister_dev to avoid bugs".
Best regards,
Duoming Zhou
^ permalink raw reply
* Re: [PATCH 2/3] perf: arm-spe: Fix SPE events with phys addresses
From: James Clark @ 2022-04-25 9:12 UTC (permalink / raw)
To: Leo Yan, Timothy Hayes
Cc: linux-kernel, linux-perf-users, acme, John Garry, Will Deacon,
Mathieu Poirier, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Namhyung Kim, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, linux-arm-kernel, netdev, bpf
In-Reply-To: <20220424125951.GD978927@leoy-ThinkPad-X240s>
On 24/04/2022 13:59, Leo Yan wrote:
> Hi Timothy,
>
> On Thu, Apr 21, 2022 at 05:52:04PM +0100, Timothy Hayes wrote:
>> This patch corrects a bug whereby SPE collection is invoked with
>> pa_enable=1 but synthesized events fail to show physical addresses.
>>
>> Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>
>> ---
>> tools/perf/arch/arm64/util/arm-spe.c | 10 ++++++++++
>> tools/perf/util/arm-spe.c | 3 ++-
>> 2 files changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
>> index af4d63af8072..e8b577d33e53 100644
>> --- a/tools/perf/arch/arm64/util/arm-spe.c
>> +++ b/tools/perf/arch/arm64/util/arm-spe.c
>> @@ -148,6 +148,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
>> bool privileged = perf_event_paranoid_check(-1);
>> struct evsel *tracking_evsel;
>> int err;
>> + u64 bit;
>>
>> sper->evlist = evlist;
>>
>> @@ -245,6 +246,15 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
>> */
>> evsel__set_sample_bit(arm_spe_evsel, DATA_SRC);
>>
>> + /*
>> + * The PHYS_ADDR flag does not affect the driver behaviour, it is used to
>> + * inform that the resulting output's SPE samples contain physical addresses
>> + * where applicable.
>> + */
>> + bit = perf_pmu__format_bits(&arm_spe_pmu->format, "pa_enable");
>> + if (arm_spe_evsel->core.attr.config & bit)
>> + evsel__set_sample_bit(arm_spe_evsel, PHYS_ADDR);
>> +
>> /* Add dummy event to keep tracking */
>> err = parse_events(evlist, "dummy:u", NULL);
>> if (err)
>> diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
>> index 151cc38a171c..1a80151baed9 100644
>> --- a/tools/perf/util/arm-spe.c
>> +++ b/tools/perf/util/arm-spe.c
>> @@ -1033,7 +1033,8 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
>> memset(&attr, 0, sizeof(struct perf_event_attr));
>> attr.size = sizeof(struct perf_event_attr);
>> attr.type = PERF_TYPE_HARDWARE;
>> - attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
>> + attr.sample_type = evsel->core.attr.sample_type &
>> + (PERF_SAMPLE_MASK | PERF_SAMPLE_PHYS_ADDR);
>
> I verified this patch and I can confirm the physical address can be
> dumped successfully.
>
> I have a more general question, seems to me, we need to change the
> macro PERF_SAMPLE_MASK in the file util/event.h as below, so
> here doesn't need to 'or' the flag PERF_SAMPLE_PHYS_ADDR anymore.
>
> @Arnaldo, @Jiri, could you confirm if this is the right way to move
> forward? I am not sure why PERF_SAMPLE_MASK doesn't contain the bit
> PERF_SAMPLE_PHYS_ADDR in current code.
I think there is a reason that PERF_SAMPLE_MASK is a subset of all the
bits. This comment below suggests it. Is it so the mask only includes fields
that are 64bits? That makes the __evsel__sample_size() function a simple
multiplication of a count of all the fields that are 64bits.
static int
perf_event__check_size(union perf_event *event, unsigned int sample_size)
{
/*
* The evsel's sample_size is based on PERF_SAMPLE_MASK which includes
* up to PERF_SAMPLE_PERIOD. After that overflow() must be used to
* check the format does not go past the end of the event.
*/
if (sample_size + sizeof(event->header) > event->header.size)
return -EFAULT;
return 0;
}
Having said that, the mask was updated once to add PERF_SAMPLE_IDENTIFIER to
it, so that comment is slightly out of date now.
>
> diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
> index cdd72e05fd28..c905ac32ebad 100644
> --- a/tools/perf/util/event.h
> +++ b/tools/perf/util/event.h
> @@ -39,7 +39,7 @@ struct perf_event_attr;
> PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR | \
> PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID | \
> PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD | \
> - PERF_SAMPLE_IDENTIFIER)
> + PERF_SAMPLE_IDENTIFIER | PERF_SAMPLE_PHYS_ADDR)
>
> Thanks,
> Leo
>
>> attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
>> PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC |
>> PERF_SAMPLE_WEIGHT | PERF_SAMPLE_ADDR;
>> --
>> 2.25.1
>>
^ permalink raw reply
* Re: [PATCH nf v2 1/2] netfilter: Update ip6_route_me_harder to consider L3 domain
From: Pablo Neira Ayuso @ 2022-04-25 9:09 UTC (permalink / raw)
To: Martin Willi; +Cc: Florian Westphal, David Ahern, netfilter-devel, netdev
In-Reply-To: <20220419134701.153090-2-martin@strongswan.org>
On Tue, Apr 19, 2022 at 03:47:00PM +0200, Martin Willi wrote:
> The commit referenced below fixed packet re-routing if Netfilter mangles
> a routing key property of a packet and the packet is routed in a VRF L3
> domain. The fix, however, addressed IPv4 re-routing, only.
>
> This commit applies the same behavior for IPv6. While at it, untangle
> the nested ternary operator to make the code more readable.
Applied to nf.git
^ permalink raw reply
* Re: ctcm: rename READ/WRITE defines to avoid redefinitions
From: Colin King (gmail) @ 2022-04-25 9:01 UTC (permalink / raw)
To: Alexandra Winter, Wenjia Zhang, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev
Cc: Christian Borntraeger, linux-s390, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
In-Reply-To: <3572a765-17b4-b2df-e3d5-0d30485c4c67@linux.ibm.com>
On 25/04/2022 09:38, Alexandra Winter wrote:
>
>
> On 24.04.22 20:58, Colin King (gmail) wrote:
>> Hi,
>>
>> static analysis with cppcheck detected a potential null pointer deference with the following commit:
>>
>> commit 3c09e2647b5e1f1f9fd383971468823c2505e1b0
>> Author: Ursula Braun <ursula.braun@de.ibm.com>
>> Date: Thu Aug 12 01:58:28 2010 +0000
>>
>> ctcm: rename READ/WRITE defines to avoid redefinitions
>>
>>
>> The analysis is as follows:
>>
>> drivers/s390/net/ctcm_sysfs.c:43:8: note: Assuming that condition 'priv' is not redundant
>> if (!(priv && priv->channel[CTCM_READ] && ndev)) {
>> ^
>> drivers/s390/net/ctcm_sysfs.c:42:9: note: Null pointer dereference
>> ndev = priv->channel[CTCM_READ]->netdev;
>>
>> The code in question is as follows:
>>
>> ndev = priv->channel[CTCM_READ]->netdev;
>>
>> ^^ priv may be null, as per check below but it is being dereferenced when assigning ndev
>>
>> if (!(priv && priv->channel[CTCM_READ] && ndev)) {
>> CTCM_DBF_TEXT(SETUP, CTC_DBF_ERROR, "bfnondev");
>> return -ENODEV;
>> }
>>
>> Colin
>
> Thank you very much for reporting this, we will provide a patch.
Thanks for working on a fix. Much appreciated.
>
> Do you have any special requests for the Reported-by flag? Or is
> Reported-by: Colin King (gmail) <colin.i.king@gmail.com>
> fine with you?
>
Can I have:
Reported by: Colin Ian King <colin.i.king@gmail.com>
Thank you!
Colin
> Kind regards
> Alexandra
^ permalink raw reply
* Re: [PATCH] net: phy: marvell10g: fix return value on error
From: Marek Behún @ 2022-04-25 8:57 UTC (permalink / raw)
To: Baruch Siach; +Cc: Russell King, netdev, Baruch Siach
In-Reply-To: <f47cb031aeae873bb008ba35001607304a171a20.1650868058.git.baruch@tkos.co.il>
On Mon, 25 Apr 2022 09:27:38 +0300
Baruch Siach <baruch@tkos.co.il> wrote:
> From: Baruch Siach <baruch.siach@siklu.com>
>
> Return back the error value that we get from phy_read_mmd().
>
> Fixes: c84786fa8f91 ("net: phy: marvell10g: read copper results from CSSR1")
> Signed-off-by: Baruch Siach <baruch.siach@siklu.com>
Reviewed-by: Marek Behún <kabel@kernel.org>
^ permalink raw reply
* Re: ctcm: rename READ/WRITE defines to avoid redefinitions
From: Alexandra Winter @ 2022-04-25 8:38 UTC (permalink / raw)
To: Colin King (gmail), Wenjia Zhang, Heiko Carstens, Vasily Gorbik,
Alexander Gordeev
Cc: Christian Borntraeger, linux-s390, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
In-Reply-To: <ae612043-0252-e8c3-0773-912f116421c1@gmail.com>
On 24.04.22 20:58, Colin King (gmail) wrote:
> Hi,
>
> static analysis with cppcheck detected a potential null pointer deference with the following commit:
>
> commit 3c09e2647b5e1f1f9fd383971468823c2505e1b0
> Author: Ursula Braun <ursula.braun@de.ibm.com>
> Date: Thu Aug 12 01:58:28 2010 +0000
>
> ctcm: rename READ/WRITE defines to avoid redefinitions
>
>
> The analysis is as follows:
>
> drivers/s390/net/ctcm_sysfs.c:43:8: note: Assuming that condition 'priv' is not redundant
> if (!(priv && priv->channel[CTCM_READ] && ndev)) {
> ^
> drivers/s390/net/ctcm_sysfs.c:42:9: note: Null pointer dereference
> ndev = priv->channel[CTCM_READ]->netdev;
>
> The code in question is as follows:
>
> ndev = priv->channel[CTCM_READ]->netdev;
>
> ^^ priv may be null, as per check below but it is being dereferenced when assigning ndev
>
> if (!(priv && priv->channel[CTCM_READ] && ndev)) {
> CTCM_DBF_TEXT(SETUP, CTC_DBF_ERROR, "bfnondev");
> return -ENODEV;
> }
>
> Colin
Thank you very much for reporting this, we will provide a patch.
Do you have any special requests for the Reported-by flag? Or is
Reported-by: Colin King (gmail) <colin.i.king@gmail.com>
fine with you?
Kind regards
Alexandra
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox