Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: remove audit_log_string() from kernel's internal audit API #84

Closed
stevegrubb opened this issue May 21, 2018 · 4 comments
Closed

RFE: remove audit_log_string() from kernel's internal audit API #84

stevegrubb opened this issue May 21, 2018 · 4 comments

Comments

@stevegrubb
Copy link
Member

The function, audit_log_string, is a helper to audit_log_untrustedstring. It cannot be used alone without understanding the rules for untrusted strings. So, any use of it is simply going to be either wrong or will re-invent audit_log_untrustedstring. The current list of files which calls it are:

security/apparmor/ipc.c
security/apparmor/audit.c
security/apparmor/file.c
security/integrity/integrity_audit.c

@pcmoore pcmoore self-assigned this May 21, 2018
@pcmoore pcmoore changed the title Remove audit_log_string() from kernel's internal audit API RFE: remove audit_log_string() from kernel's internal audit API May 21, 2018
@nefigtut
Copy link
Contributor

This is a simple audit_log_string() -> audit_log_untrustedstring() replacement. I'm not 100% sure about this. Probably we can leave audit_log_string() in the API and use it for hard-coded obviously fine strings like: audit_log_string(ab, "trace").

The drawback is that some caller still could use audit_log_string() for some untrusted string in the future.

@pcmoore pcmoore removed their assignment Apr 1, 2020
@rgbriggs
Copy link
Member

rgbriggs commented Jul 3, 2020

fengguang pushed a commit to 0day-ci/linux that referenced this issue Jul 3, 2020
audit_log_string() was inteded to be an internal audit function and
since there are only two internal uses, remove them.  Purge all external
uses of it by restructuring code to use an existing audit_log_format()
or using audit_log_format().

Please see the upstream issue
linux-audit/audit-kernel#84

Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
@rgbriggs
Copy link
Member

rgbriggs commented Jul 3, 2020

kernel test robot generated two warnings:
security/apparmor/ipc.c:39:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
security/apparmor/ipc.c:153:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]

Post v3
https://www.redhat.com/archives/linux-audit/2020-July/msg00012.html
https://lkml.org/lkml/2020/7/3/875

fengguang pushed a commit to 0day-ci/linux that referenced this issue Jul 3, 2020
audit_log_string() was inteded to be an internal audit function and
since there are only two internal uses, remove them.  Purge all external
uses of it by restructuring code to use an existing audit_log_format()
or using audit_log_format().

Please see the upstream issue
linux-audit/audit-kernel#84

Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
fengguang pushed a commit to 0day-ci/linux that referenced this issue Jul 13, 2020
audit_log_string() was inteded to be an internal audit function and
since there are only two internal uses, remove them.  Purge all external
uses of it by restructuring code to use an existing audit_log_format()
or using audit_log_format().

Please see the upstream issue
linux-audit/audit-kernel#84

Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
pcmoore pushed a commit that referenced this issue Jul 21, 2020
audit_log_string() was inteded to be an internal audit function and
since there are only two internal uses, remove them.  Purge all external
uses of it by restructuring code to use an existing audit_log_format()
or using audit_log_format().

Please see the upstream issue
#84

Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
@rgbriggs
Copy link
Member

This can be closed since it is upstream in v5.9-rc1
f1d9b23 audit: purge audit_log_string from the intra-kernel audit API

@pcmoore pcmoore closed this as completed Dec 17, 2020
pcmoore pushed a commit that referenced this issue May 17, 2022
IPv6 addresses which are used for tunnels are stored in a hash table
with reference counting. When a new GRE tunnel is configured, the driver
is notified and configures it in hardware.

Currently, any change in the tunnel is not applied in the driver. It
means that if the remote address is changed, the driver is not aware of
this change and the first address will be used.

This behavior results in a warning [1] in scenarios such as the
following:

 # ip link add name gre1 type ip6gre local 2000::3 remote 2000::fffe tos inherit ttl inherit
 # ip link set name gre1 type ip6gre local 2000::3 remote 2000::ffff ttl inherit
 # ip link delete gre1

The change of the address is not applied in the driver. Currently, the
driver uses the remote address which is stored in the 'parms' of the
overlay device. When the tunnel is removed, the new IPv6 address is
used, the driver tries to release it, but as it is not aware of the
change, this address is not configured and it warns about releasing non
existing IPv6 address.

Fix it by using the IPv6 address which is cached in the IPIP entry, this
address is the last one that the driver used, so even in cases such the
above, the first address will be released, without any warning.

[1]:

WARNING: CPU: 1 PID: 2197 at drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2920 mlxsw_sp_ipv6_addr_put+0x146/0x220 [mlxsw_spectrum]
...
CPU: 1 PID: 2197 Comm: ip Not tainted 5.17.0-rc8-custom-95062-gc1e5ded51a9a #84
Hardware name: Mellanox Technologies Ltd. MSN4700/VMOD0010, BIOS 5.11 07/12/2021
RIP: 0010:mlxsw_sp_ipv6_addr_put+0x146/0x220 [mlxsw_spectrum]
...
Call Trace:
 <TASK>
 mlxsw_sp2_ipip_rem_addr_unset_gre6+0xf1/0x120 [mlxsw_spectrum]
 mlxsw_sp_netdevice_ipip_ol_event+0xdb/0x640 [mlxsw_spectrum]
 mlxsw_sp_netdevice_event+0xc4/0x850 [mlxsw_spectrum]
 raw_notifier_call_chain+0x3c/0x50
 call_netdevice_notifiers_info+0x2f/0x80
 unregister_netdevice_many+0x311/0x6d0
 rtnl_dellink+0x136/0x360
 rtnetlink_rcv_msg+0x12f/0x380
 netlink_rcv_skb+0x49/0xf0
 netlink_unicast+0x233/0x340
 netlink_sendmsg+0x202/0x440
 ____sys_sendmsg+0x1f3/0x220
 ___sys_sendmsg+0x70/0xb0
 __sys_sendmsg+0x54/0xa0
 do_syscall_64+0x35/0x80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Fixes: e846efe ("mlxsw: spectrum: Add hash table for IPv6 address mapping")
Reported-by: Maksym Yaremchuk <maksymy@nvidia.com>
Signed-off-by: Amit Cohen <amcohen@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Link: https://lore.kernel.org/r/20220511115747.238602-1-idosch@nvidia.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants