On Mon, Dec 04, 2023 at 11:57:55AM -0700, Keith Busch wrote: > On Mon, Dec 04, 2023 at 01:40:58PM -0500, Jeff Moyer wrote: > > I added a CC: linux-security-module@vger > > Keith Busch <kbusch@xxxxxxxx> writes: > > > From: Keith Busch <kbusch@xxxxxxxxxx> > > > > > > The uring_cmd operation is often used for privileged actions, so drivers > > > subscribing to this interface check capable() for each command. The > > > capable() function is not fast path friendly for many kernel configs, > > > and this can really harm performance. Stash the capable sys admin > > > attribute in the io_uring context and set a new issue_flag for the > > > uring_cmd interface. > > > > I have a few questions. What privileged actions are performance > > sensitive? I would hope that anything requiring privileges would not > > be in a fast path (but clearly that's not the case). > > Protocol specifics that don't have a generic equivalent. For example, > NVMe FDP is reachable only through the uring_cmd and ioctl interfaces, > but you use it like normal reads and writes so has to be as fast as the > generic interfaces. But normal read/write pt command doesn't require ADMIN any more since commit 855b7717f44b ("nvme: fine-granular CAP_SYS_ADMIN for nvme io commands"), why do you have to pay the cost of checking capable(CAP_SYS_ADMIN)? Thanks, Ming