From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25219C47E49 for ; Tue, 5 Nov 2019 16:03:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F08B421D6C for ; Tue, 5 Nov 2019 16:03:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DAxnbXOe" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390003AbfKEQDK (ORCPT ); Tue, 5 Nov 2019 11:03:10 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:47854 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389985AbfKEQDJ (ORCPT ); Tue, 5 Nov 2019 11:03:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572969788; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pLj9LlV805f/L7J5FbyPXxXB07oTibsiCCSGb45ogQg=; b=DAxnbXOel7GR/PEe2t6Mrv+03Xuzy/G2FGswsUfLa3WuDKMrcLU58JE3w5zv0Q9mvuNpPY I1VMJVfrzlKq4LH4UyFmZKsbkrhlnt52r9X2+0oUwwfFrHC4TmVAq484vO9YuFSB3J2CDA meGCgBaj17ZWJu0UuOPTyX1me2I6xBY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-350-9SUU8LceOXeOLaVGd4SGTA-1; Tue, 05 Nov 2019 11:03:06 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B43698017DD; Tue, 5 Nov 2019 16:03:03 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-254.rdu2.redhat.com [10.10.120.254]) by smtp.corp.redhat.com (Postfix) with ESMTP id 980C81FA; Tue, 5 Nov 2019 16:03:00 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <157262963995.13142.5568934007158044624.stgit@warthog.procyon.org.uk> References: <157262963995.13142.5568934007158044624.stgit@warthog.procyon.org.uk> To: torvalds@linux-foundation.org, viro@zeniv.linux.org.uk Cc: dhowells@redhat.com, Rasmus Villemoes , Greg Kroah-Hartman , Peter Zijlstra , nicolas.dichtel@6wind.com, raven@themaw.net, Christian Brauner , keyrings@vger.kernel.org, linux-usb@vger.kernel.org, linux-block@vger.kernel.org, linux-security-module@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Details on the UAPI of implementing notifications on pipes MIME-Version: 1.0 Content-ID: <18579.1572969779.1@warthog.procyon.org.uk> Date: Tue, 05 Nov 2019 16:02:59 +0000 Message-ID: <18580.1572969779@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: 9SUU8LceOXeOLaVGd4SGTA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: So to implement notifications on top of pipes, I've hacked it together a bi= t in the following ways: (1) I'm passing O_TMPFILE to the pipe2() system call to indicate that you want a notifications pipe. This prohibits splice and co. from being called on it as I don't want to have to try to fix iov_iter_revert() t= o handle kernel notifications being intermixed with splices. The choice of O_TMPFILE was just for convenience, but it needs to be something different. I could, for instance, add a constant, O_NOTIFICATION_PIPE with the same *value* as O_TMPFILE. I don't think it's likely that it will make sense to use O_TMPFILE with a pipe, but = I also don't want to eat up another O_* constant just for this. Unfortunately, pipe2() doesn't have any other arguments into from whic= h I can steal a bit. (2) I've added a pair of ioctls to configure the notifications bits. They= 're ioctls as I just reused the ioctl code from my devmisc driver. Should= I use fcntl() instead, such as is done for F_SETPIPE_SZ? The ioctls do two things: set the ring size to a number of slots (so similarish to F_SETPIPE_SZ) and set filters. Any thoughts on how better to represent these bits? Thanks, David