[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aBFUqR/UF+20A8s6@Asurada-Nvidia>
Date: Tue, 29 Apr 2025 15:37:29 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: Pranjal Shrivastava <praan@...gle.com>
CC: <jgg@...dia.com>, <kevin.tian@...el.com>, <corbet@....net>,
<will@...nel.org>, <bagasdotme@...il.com>, <robin.murphy@....com>,
<joro@...tes.org>, <thierry.reding@...il.com>, <vdumpa@...dia.com>,
<jonathanh@...dia.com>, <shuah@...nel.org>, <jsnitsel@...hat.com>,
<nathan@...nel.org>, <peterz@...radead.org>, <yi.l.liu@...el.com>,
<mshavit@...gle.com>, <zhangzekun11@...wei.com>, <iommu@...ts.linux.dev>,
<linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <linux-tegra@...r.kernel.org>,
<linux-kselftest@...r.kernel.org>, <patches@...ts.linux.dev>,
<mochs@...dia.com>, <alok.a.tiwari@...cle.com>, <vasant.hegde@....com>
Subject: Re: [PATCH v2 20/22] iommu/tegra241-cmdqv: Do not statically map
LVCMDQs
On Tue, Apr 29, 2025 at 10:32:19PM +0000, Pranjal Shrivastava wrote:
> On Fri, Apr 25, 2025 at 10:58:15PM -0700, Nicolin Chen wrote:
> > To simplify the mappings from global VCMDQs to VINTFs' LVCMDQs, the design
> > chose to do static allocations and mappings in the global reset function.
> >
> > However, with the user-owned VINTF support, it exposes a security concern:
> > if user space VM only wants one LVCMDQ for a VINTF, statically mapping two
> > LVCMDQs creates a hidden VCMDQ that user space could DoS attack by writing
> > ramdon stuff to overwhelm the kernel with unhandleable IRQs.
> >
>
> Nit: I think it's worth mentioning that the current HW only supports 2
> LVCMDQs. Since it's not clear from the driver as it calculates this by:
>
> regval = readl_relaxed(REG_CMDQV(cmdqv, PARAM));
> cmdqv->num_vintfs = 1 << FIELD_GET(CMDQV_NUM_VINTF_LOG2,regval);
> cmdqv->num_vcmdqs = 1 << FIELD_GET(CMDQV_NUM_VCMDQ_LOG2, regval);
> cmdqv->num_lvcmdqs_per_vintf = cmdqv->num_vcmdqs / cmdqv->num_vintfs;
This is a SW choice. HW supports more LVCMDQs than 2 per VINTF.
> Or maybe, re-word it to "if user space VM only wants one LVCMDQ for a
> VINTF, the current driver statically maps num_lvcmdqs_per_vintf which
> creates hidden vCMDQs [..]"
But yea, this makes sense. Will change.
Thanks
Nicolin
Powered by blists - more mailing lists