From: Ingo Molnar <mingo@kernel.org>
To: Paul Moore <paul@paul-moore.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Dmitry Vyukov <dvyukov@google.com>,
linux-audit@redhat.com, Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 4.10 070/111] audit: fix auditd/kernel connection state tracking
Date: Wed, 21 Feb 2018 09:46:02 +0100 [thread overview]
Message-ID: <20180221084601.scnvgiiv32s2pgye@gmail.com> (raw)
In-Reply-To: <CAHC9VhQUGF+W0sZemeCstPDUHxwQrD7Pmbu5SnAHZVdkCPdMwg@mail.gmail.com>
* Paul Moore <paul@paul-moore.com> wrote:
> On Tue, Feb 20, 2018 at 10:18 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> > On Tue, Feb 20, 2018 at 09:51:08AM -0500, Paul Moore wrote:
> >> On Tue, Feb 20, 2018 at 9:06 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> >
> >> > It's not at all clear to me what that code does, I just stumbled upon
> >> > __mutex_owner() outside of the mutex code itself and went WTF.
> >>
> >> If you don't want people to use __mutex_owner() outside of the mutex
> >> code I might suggest adding a rather serious comment at the top of the
> >> function, because right now I don't see anything suggesting that
> >> function shouldn't be used. Yes, there is the double underscore
> >> prefix, but that can mean a few different things these days.
> >
> > Find below.
> >
> >> > The comment (aside from having the most horribly style) ...
> >>
> >> Yeah, your dog is ugly too. Notice how neither comment is constructive?
> >
> > I'm sure you've seen this one:
> >
> > https://lkml.org/lkml/2016/7/8/625
>
> Yep. I stand behind my earlier comment in this thread.
>
> >> > Maybe if you could explain how that code is supposed to work and why it
> >> > doesn't know if it holds a lock I could make a suggestion...
> >>
> >> I just spent a few minutes looking back over the bits available in
> >> include/linux/mutex.h and I'm not seeing anything beyond
> >> __mutex_owner() which would allow us to determine the mutex owning
> >> task. It's probably easiest for us to just track ownership ourselves.
> >> I'll put together a patch later today.
> >
> > Note that up until recently the mutex implementation didn't even have a
> > consistent owner field. And the thing is, it's very easy to use wrong,
> > only today I've seen a patch do: "__mutex_owner() == task", where task
> > was allowed to be !current, which is just wrong.
>
> Arguably all the more reason why a strongly worded warning is
> important (which I see you've included below, feel free to include my
> Reviewed-by).
>
> > Looking through kernel/audit.c I'm not even sure I see how you would end
> > up in audit_log_start() with audit_cmd_mutex held.
> >
> > Can you give me a few code paths that trigger this? Simple git-grep is
> > failing me.
>
> Basically look at the code in audit_receive_msg(), but I wasn't asking
> your opinion on how we should rewrite the audit subsystem, I was just
> asking how one could determine if the current task was holding a given
> mutex in a way that was acceptable to you. Based on your comments,
> and some further inspection of the mutex code, it appears that is/was
> not something that the core mutex code wants to support/make-visible.
> Which is perfectly fine, I just wanted to make sure I wasn't missing
> something before I went ahead and wrote a wrapper around the mutex
> code for use by audit.
>
> FWIW, I just put together the following patch which removes the
> __mutex_owner() call from audit and doesn't appear to break anything
> on the audit side (you're CC'd on the patch). It has only been
> lightly tested, but I'm going to bang on it for a day or so and if I
> hear no objections I'll merge it into audit/next.
>
> * https://www.redhat.com/archives/linux-audit/2018-February/msg00066.html
Could you please explain the audit_ctl_lock()/unlock() primitive you are
introducing there? You seem to be implementing some sort of recursive locking
primitive, but in a strange way.
AFAICS the primary problem appears to be this code path:
audit_receive() -> audit_receive_msg() -> AUDIT_TTY_SET -> audit_log_common_recv_msg() -> audit_log_start()
where we can arrive already holding the lock.
I.e. recursive mutex, kinda.
What's the thinking there? Neither the changelog nor the code explains this.
Thanks,
Ingo
next prev parent reply other threads:[~2018-02-21 8:46 UTC|newest]
Thread overview: 123+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-28 12:29 [PATCH 4.10 000/111] 4.10.7-stable review Greg Kroah-Hartman
2017-03-28 12:29 ` [PATCH 4.10 001/111] net/openvswitch: Set the ipv6 source tunnel key address attribute correctly Greg Kroah-Hartman
2017-03-28 12:29 ` [PATCH 4.10 002/111] net: bcmgenet: Do not suspend PHY if Wake-on-LAN is enabled Greg Kroah-Hartman
2017-03-28 12:29 ` [PATCH 4.10 003/111] net: properly release sk_frag.page Greg Kroah-Hartman
2017-03-28 12:29 ` [PATCH 4.10 004/111] amd-xgbe: Fix jumbo MTU processing on newer hardware Greg Kroah-Hartman
2017-03-28 12:29 ` [PATCH 4.10 005/111] openvswitch: Add missing case OVS_TUNNEL_KEY_ATTR_PAD Greg Kroah-Hartman
2017-03-28 12:29 ` [PATCH 4.10 006/111] net: unix: properly re-increment inflight counter of GC discarded candidates Greg Kroah-Hartman
2017-03-28 12:29 ` [PATCH 4.10 008/111] net: vrf: Reset rt6i_idev in local dst after put Greg Kroah-Hartman
2017-03-28 12:29 ` [PATCH 4.10 009/111] net/mlx5: Add missing entries for set/query rate limit commands Greg Kroah-Hartman
2017-03-28 12:29 ` [PATCH 4.10 010/111] net/mlx5e: Change the TC offload rule add/del code path to be per NIC or E-Switch Greg Kroah-Hartman
2017-03-28 12:29 ` [PATCH 4.10 011/111] net/mlx5: E-Switch, Dont allow changing inline mode when flows are configured Greg Kroah-Hartman
2017-03-28 12:29 ` [PATCH 4.10 012/111] net/mlx5e: Use the proper UAPI values when offloading TC vlan actions Greg Kroah-Hartman
2017-03-28 12:29 ` [PATCH 4.10 013/111] net/mlx5e: Avoid supporting udp tunnel port ndo for VF reps Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 014/111] net/mlx5: Increase number of max QPs in default profile Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 015/111] net/mlx5e: Count GSO packets correctly Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 016/111] net/mlx5e: Count LRO " Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 017/111] ipv6: make sure to initialize sockc.tsflags before first use Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 018/111] net: bcmgenet: remove bcmgenet_internal_phy_setup() Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 019/111] ipv4: provide stronger user input validation in nl_fib_input() Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 020/111] socket, bpf: fix sk_filter use after free in sk_clone_lock Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 021/111] genetlink: fix counting regression on ctrl_dumpfamily() Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 022/111] tcp: initialize icsk_ack.lrcvtime at session start time Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 023/111] amd-xgbe: Fix the ECC-related bit position definitions Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 024/111] net: solve a NAPI race Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 025/111] HID: sony: Fix input device leak when connecting a DS4 twice using USB/BT Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 026/111] Input: ALPS - fix V8+ protocol handling (73 03 28) Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 027/111] Input: ALPS - fix trackstick button handling on V8 devices Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 028/111] Input: elan_i2c - add ASUS EeeBook X205TA special touchpad fw Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 029/111] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 030/111] Input: iforce - validate number of endpoints before using them Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 031/111] Input: ims-pcu " Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 032/111] Input: hanwang " Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 033/111] Input: yealink " Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 034/111] Input: cm109 " Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 035/111] Input: kbtab " Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 036/111] Input: sur40 " Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 037/111] ALSA: seq: Fix racy cell insertions during snd_seq_pool_done() Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 038/111] ALSA: ctxfi: Fix the incorrect check of dma_set_mask() call Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 039/111] ALSA: hda - Adding a group of pin definition to fix headset problem Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 040/111] USB: serial: option: add Quectel UC15, UC20, EC21, and EC25 modems Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 043/111] usb: gadget: f_uvc: Fix SuperSpeed companion descriptors wBytesPerInterval Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 045/111] usb-core: Add LINEAR_FRAME_INTR_BINTERVAL USB quirk Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 046/111] USB: uss720: fix NULL-deref at probe Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 047/111] USB: lvtest: " Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 048/111] USB: idmouse: " Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 049/111] USB: wusbcore: " Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 050/111] usb: musb: cppi41: dont check early-TX-interrupt for Isoch transfer Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 051/111] usb: hub: Fix crash after failure to read BOS descriptor Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 052/111] USB: usbtmc: add missing endpoint sanity check Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 053/111] USB: usbtmc: fix probe error path Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 054/111] uwb: i1480-dfu: fix NULL-deref at probe Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 055/111] uwb: hwa-rc: " Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 056/111] mmc: ushc: " Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 057/111] nl80211: fix dumpit error path RTNL deadlocks Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 058/111] mmc: core: Fix access to HS400-ES devices Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 059/111] iio: adc: ti_am335x_adc: fix fifo overrun recovery Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 060/111] iio: sw-device: Fix config group initialization Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 061/111] iio: hid-sensor-trigger: Change get poll value function order to avoid sensor properties losing after resume from S3 Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 062/111] iio: magnetometer: ak8974: remove incorrect __exit markups Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 063/111] mei: fix deadlock on mei reset Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 064/111] mei: dont wait for os version message reply Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 065/111] parport: fix attempt to write duplicate procfiles Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 066/111] ppdev: fix registering same device name Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 067/111] ext4: mark inode dirty after converting inline directory Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 068/111] ext4: lock the xattr block before checksuming it Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 069/111] powerpc/64s: Fix idle wakeup potential to clobber registers Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 070/111] audit: fix auditd/kernel connection state tracking Greg Kroah-Hartman
2018-02-20 12:37 ` Peter Zijlstra
2018-02-20 13:25 ` Paul Moore
2018-02-20 14:06 ` Peter Zijlstra
2018-02-20 14:51 ` Paul Moore
2018-02-20 15:18 ` Peter Zijlstra
2018-02-20 17:06 ` Paul Moore
2018-02-21 8:46 ` Ingo Molnar [this message]
2018-02-21 9:15 ` Peter Zijlstra
2018-02-21 23:04 ` Paul Moore
2017-03-28 12:30 ` [PATCH 4.10 071/111] mmc: sdhci-of-at91: Support external regulators Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 072/111] mmc: sdhci-of-arasan: fix incorrect timeout clock Greg Kroah-Hartman
2017-03-28 12:30 ` [PATCH 4.10 073/111] mmc: sdhci: Do not disable interrupts while waiting for clock Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 074/111] mmc: sdhci-pci: Do not disable interrupts in sdhci_intel_set_power Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 075/111] hwrng: amd - Revert managed API changes Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 076/111] hwrng: geode " Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 077/111] clk: sunxi-ng: sun6i: Fix enable bit offset for hdmi-ddc module clock Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 078/111] clk: sunxi-ng: mp: Adjust parent rate for pre-dividers Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 079/111] mwifiex: pcie: dont leak DMA buffers when removing Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 080/111] ath10k: fix incorrect wlan_mac_base in qca6174_regs Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 081/111] crypto: ccp - Assign DMA commands to the channels CCP Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 082/111] fscrypt: remove broken support for detecting keyring key revocation Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 083/111] vfio: Rework group release notifier warning Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 084/111] xen/acpi: upload PM state from init-domain to Xen Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 085/111] iommu/vt-d: Fix NULL pointer dereference in device_to_iommu Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 086/111] iommu/exynos: Block SYSMMU while invalidating FLPD cache Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 087/111] iommu/exynos: Workaround FLPD cache flush issues for SYSMMU v5 Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 088/111] Revert "ARM: at91/dt: sama5d2: Use new compatible for ohci node" Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 089/111] ARM: at91: pm: cpu_idle: switch DDR to power-down mode Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 090/111] arm64: kaslr: Fix up the kernel image alignment Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 091/111] cpufreq: Restore policy min/max limits on CPU online Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 092/111] cgroup, net_cls: iterate the fds of only the tasks which are being migrated Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 093/111] blk-mq: dont complete un-started request in timeout handler Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 094/111] libceph: force GFP_NOIO for socket allocations Greg Kroah-Hartman
2017-03-29 8:09 ` Michal Hocko
2017-03-30 7:31 ` Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 095/111] cpsw/netcp: cpts depends on posix_timers Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 096/111] drm/amdgpu: reinstate oland workaround for sclk Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 097/111] drm/amd/amdgpu: add POLARIS12 PCI ID Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 098/111] auxdisplay: img-ascii-lcd: add missing sentinel entry in img_ascii_lcd_matches Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 099/111] jbd2: dont leak memory if setting up journal fails Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 100/111] intel_th: Dont leak module refcount on failure to activate Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 101/111] Drivers: hv: vmbus: Dont leak channel ids Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 102/111] Drivers: hv: vmbus: Dont leak memory when a channel is rescinded Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 103/111] mmc: block: Fix is_waiting_last_req set incorrectly Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 104/111] libceph: dont set weight to IN when OSD is destroyed Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 105/111] device-dax: fix pmd/pte fault fallback handling Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 106/111] scsi: sd: Check for unaligned partial completion Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 107/111] cpuidle: Validate cpu_dev in cpuidle_add_sysfs() Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 108/111] xen: do not re-use pirq number cached in pci device msi msg data Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 109/111] drm: reference count event->completion Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 110/111] fbcon: Fix vc attr at deinit Greg Kroah-Hartman
2017-03-28 12:31 ` [PATCH 4.10 111/111] crypto: algif_hash - avoid zero-sized array Greg Kroah-Hartman
2017-03-28 19:37 ` [PATCH 4.10 000/111] 4.10.7-stable review Shuah Khan
2017-03-29 5:47 ` Greg Kroah-Hartman
2017-03-29 2:59 ` Guenter Roeck
2017-03-29 5:47 ` Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180221084601.scnvgiiv32s2pgye@gmail.com \
--to=mingo@kernel.org \
--cc=dvyukov@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-audit@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=peterz@infradead.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).