Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2929503pxb; Fri, 12 Feb 2021 05:18:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwKDq3xEdX4blbndvmesPaLwbEHZC1CMZXd0B4PypP1fm/V97wANVBnQ+FNQHG63ndI5Ouo X-Received: by 2002:a17:906:32d1:: with SMTP id k17mr3004179ejk.141.1613135924858; Fri, 12 Feb 2021 05:18:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613135924; cv=none; d=google.com; s=arc-20160816; b=daLunNyp5a/3nXUvubedRWHpXFz2NSz5TRBrfdxAXhZ8rBX9HA/isrMjljF5zsFT/Q trKJH3hN90nqet3zSiDsXwS9es+kf2auRw2Y7ptBdBVyegweZ2e6sFa6tP3sLnJkDLPN rbAXQdlRLN6kBTJAcKuYVBGF8KvMydbPqLrahgOnZApk7UNeDBBK80wwYCHgMdBymUYS SlUb/r3i4FZn7cKmPonhB8qDWIk8citSkB0edTc9DnksdK3GgR5Ani5fuYkVVPQbIohN F4hdRaHQFYlopT1bHx/ZV3Baq5QF9uAvxQreFwhivWWDU/W3GpyzSnH+eQjeRkqVBECl 5AYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=3kzHPPEfw1Oh/I2MyZYvqJOoI3OUAOuTBbGYxZ6hJXU=; b=nwz36G85Ow8qdDZIObqbuSjWIXiYPYh3au/M/LqDCucXnqu+nwYLmGfG9MJ1uOizvW FAPdVALCclHklRehMw3lDhhh8ncw/lg7WPWEVkTslXUH/Y98CAfHuAyfw34AyCMNn7mm A86/JetmmYNg0fy+UGyC/bXhBvdnapFOqNM1vlgpV8NW69BShK+i/XwoJ4bdmsxBrD/Y J3VXCNSWV3NUWgr+4bJPKjnTtAZygsTYSj4eHANLPYCWwUHhjLtTQ3BFhcvLSQhS7Msj ip6OokMQKU97dIAeUOL2ETIrtaVBTjCf670fZI3lVjRwFjXnDU3qxSWN4HYy++wByCsO 48AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@emersion.fr header.s=protonmail3 header.b=QJUxtEvM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=emersion.fr Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j21si6204290edh.58.2021.02.12.05.18.21; Fri, 12 Feb 2021 05:18:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@emersion.fr header.s=protonmail3 header.b=QJUxtEvM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=emersion.fr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230482AbhBLNQd (ORCPT + 99 others); Fri, 12 Feb 2021 08:16:33 -0500 Received: from mail1.protonmail.ch ([185.70.40.18]:44315 "EHLO mail1.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232042AbhBLNPZ (ORCPT ); Fri, 12 Feb 2021 08:15:25 -0500 Date: Fri, 12 Feb 2021 13:14:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail3; t=1613135680; bh=3kzHPPEfw1Oh/I2MyZYvqJOoI3OUAOuTBbGYxZ6hJXU=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=QJUxtEvMZXp/osU9H8/N9GbtIb0yBNvkFGeCOL83GaSoAQ4Y5uzywHWQ5KupwWfZZ dxXwtjq9n3nTzUsXXDQpC0e8gEpkSpIsFpQ+g+3LAMSPZmgku7VGXWKhBE9ICCCAdn gGM4UJQ1XQmA4LCV0sNYK7v3dwHFEZOYYryZbtwmFdKey+Sb8bPuM5v/mJs0VMSt5q SATj5yWIEkdvvnpW6dHFbUG3Qy9rcx6t3CLkgA8O6fUkpDg535qZLcMk2Tf4gh6Ysl Pk4V0rUV5z6hgP8HNxDAh1AjvCHYnxiqIqgPy4H8+FjxNRaA+NQi++RR4j6vymslB8 7mfCBayLxA0xA== To: Emil Velikov From: Simon Ser Cc: Chris Wilson , Will Drewry , Kees Cook , Daniel Vetter , Intel Graphics Development , Rasmus Villemoes , "Linux-Kernel@Vger. Kernel. Org" , ML dri-devel , Andy Lutomirski , Cyrill Gorcunov , "# 3.13+" , Andrew Morton Reply-To: Simon Ser Subject: Re: [PATCH v3] kcmp: Support selection of SYS_kcmp without CHECKPOINT_RESTORE Message-ID: In-Reply-To: References: <20210205163752.11932-1-chris@chris-wilson.co.uk> <20210205220012.1983-1-chris@chris-wilson.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday, February 12th, 2021 at 1:57 PM, Emil Velikov wrote: > On Fri, 5 Feb 2021 at 22:01, Chris Wilson wrot= e: > > > > Userspace has discovered the functionality offered by SYS_kcmp and has > > started to depend upon it. In particular, Mesa uses SYS_kcmp for > > os_same_file_description() in order to identify when two fd (e.g. devic= e > > or dmabuf) > > As you rightfully point out, SYS_kcmp is a bit of a two edged sword. > While you mention the CONFIG issue, there is also a portability aspect > (mesa runs on more than just linux) and as well as sandbox filtering > of the extra syscall. > > Last time I looked, the latter was still an issue and mesa was using > SYS_kcmp to compare device node fds. > A far shorter and more portable solution is possible, so let me > prepare a Mesa patch. Comparing two DMA-BUFs can be done with their inode number, I think. Comparing two device FDs is more subtle, because of GEM handle ref'counting. You sometimes really want to check whether two FDs are backed by the same file *description*. See [1] for details. [1]: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/110