Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp14025rdb; Wed, 18 Oct 2023 16:16:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEcyd+v2vtfKn7zFgem593CPbEp/kUUP18kPdE8fUoeYNhERXvSICQucVvnchajW/pyJhd7 X-Received: by 2002:a05:6a20:3d1e:b0:13c:988c:e885 with SMTP id y30-20020a056a203d1e00b0013c988ce885mr625102pzi.56.1697670979492; Wed, 18 Oct 2023 16:16:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697670979; cv=none; d=google.com; s=arc-20160816; b=xkxOyXHV4Mk+W8/kPI8VMkrgO6LA1OkZLVuIdESutB+xe3RqGgI5DdL8jb3tWdX20L H1cXukuWvnrjIJ4t2rFI43sj8WJ3tU8w2D4SiJMpF32b7KZfTT9xF6wk3IPZ6eNj6WiF kTr1KORqGQTZuvW+BfJepBUb7EzqEEzybA8Yggx8QVrCSagCZIMz9XaWo7xmNPvWOzZF LeJFtH+9Ac7U01VszQdtjw9U+qWi9LNZOozlVHu9UWHPZmwCb/1UKvKAC18oUO6oVInf 1mbStZJ3PkgXCrum4ZfTFgA4/c5VjFh8CHUUF7C0Kr4Da7m7OUFXGp+eO/rLoCKBwsQJ 5P+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RiaZftp2sTY9F+anMpEkbmYxNf1b1ZMPyR9wBMotkjE=; fh=c14xs3LzuOi0SDa3e3EE/saoAB4BBu1dd3vVEr54aXo=; b=XkiAntmnX2kL5E+g27lcpb1KkYnRYUkyt6issIdU4vWCNyAAT9uxi0K7lay8qqIMvB g/1fCB4hEj0eAosbTLn+55hOlufBmFhPfMmKozfVbtX3Za3F7o4g+ovyXQxVsBzS5LeA KZLfAT30t47PPSaOcb1a5W8oevuvue4DX+nYs+K6J597b9Aq/Brb/h2miBSMPjp9InHQ AsydFJZriIRiu8OOKzboKO4FugyZGogyTVLFJzPh87ySaV3Gk7/6O/zq7seB0aGSA9Xa dQCnPGeo1SwLOwdymyLqXW2PrX4pe9SsNsEjwxevwnaU52rReEIHPbvVhgdtQ41sNUoa 5Jmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cA4+hEAt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id mh14-20020a17090b4ace00b00263c23a5693si954485pjb.13.2023.10.18.16.16.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 16:16:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cA4+hEAt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 948788073DC7; Wed, 18 Oct 2023 16:15:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229456AbjJRXP1 (ORCPT + 99 others); Wed, 18 Oct 2023 19:15:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbjJRXPZ (ORCPT ); Wed, 18 Oct 2023 19:15:25 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A336113 for ; Wed, 18 Oct 2023 16:14:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697670881; 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: in-reply-to:in-reply-to:references:references; bh=RiaZftp2sTY9F+anMpEkbmYxNf1b1ZMPyR9wBMotkjE=; b=cA4+hEAtZNmDqk5LYxEvV+BUzACf2OsnW6nTW3xy+Ec61Ov22/C+t2U4AXJI4goUEqu4pq MmWAsx5HRgCay0Zkk7s54gKJVBTphP3p2T2uRN2bO+E9h+l95jR7nlVhYg3i/+bKOQv9id ZRjRNxlgZ2Hk6mcuxdllmgegYMUZb5k= Received: from mail-yb1-f200.google.com (mail-yb1-f200.google.com [209.85.219.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-580-ldraqc9MOzOcQAgHtS0tig-1; Wed, 18 Oct 2023 19:14:29 -0400 X-MC-Unique: ldraqc9MOzOcQAgHtS0tig-1 Received: by mail-yb1-f200.google.com with SMTP id 3f1490d57ef6-d9a3942461aso10783315276.2 for ; Wed, 18 Oct 2023 16:14:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697670869; x=1698275669; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RiaZftp2sTY9F+anMpEkbmYxNf1b1ZMPyR9wBMotkjE=; b=ROSxkPPxMFFfJDy9lavQ5cB5ZOzi+mJqEtPWXP8UzVcSwyoa1MMmrDSa6tWSxF77tN PtVOtvl7R0DFmVakVZU/1Uj4Mp8rd2TG5Qs+rozH6fqcbPXkZSbo6nq26XJLy2C9PPMo 2S9hHobxQrm6+J6QTCfoYVzZTTKP5iDUwLd/F6S1axC3vA1T9QYL+Xk50AtSqC9WPsr+ H4CTMlAb96IEcKpwaV1sGu1cKWPwTd1KASp58LrzKxeJ4IzuPw3DG+D8dO6cg1/RLDS8 Q+oH40xab3E5EkFtrsIl35jwCzcI3QaG65VHArM6jO8JpcJlXoQhhUC2tuN8QYBIxvX1 r2xA== X-Gm-Message-State: AOJu0YwD3SCc4sSDWyU2uTSUPNMAbF3vCsBD4EfKdKuskgntL7TlbdDz NSyNSmn2ne/PotKN16eZt+dNFUb24yX5EMyN3UEbhSNBMPRB9PX5MJhtGtbdSc+hRndYXiOTYwF JUF7CsxLm772BjR8/YxKARzeY X-Received: by 2002:a5b:849:0:b0:d9a:c946:bb47 with SMTP id v9-20020a5b0849000000b00d9ac946bb47mr779962ybq.5.1697670869380; Wed, 18 Oct 2023 16:14:29 -0700 (PDT) X-Received: by 2002:a5b:849:0:b0:d9a:c946:bb47 with SMTP id v9-20020a5b0849000000b00d9ac946bb47mr779947ybq.5.1697670869063; Wed, 18 Oct 2023 16:14:29 -0700 (PDT) Received: from localhost (ip98-179-76-75.ph.ph.cox.net. [98.179.76.75]) by smtp.gmail.com with ESMTPSA id ef10-20020a0562140a6a00b00656506a1881sm314623qvb.74.2023.10.18.16.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 16:14:28 -0700 (PDT) Date: Wed, 18 Oct 2023 16:14:27 -0700 From: Jerry Snitselaar To: Robin Murphy Cc: joro@8bytes.org, will@kernel.org, iommu@lists.linux.dev, jgg@nvidia.com, baolu.lu@linux.intel.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 3/7] iommu: Validate that devices match domains Message-ID: <4syngx7peypqkc6aakw7ybapuoqkww5kv3drujkysvywuj7wzw@6cnaldhvqx3l> References: <4e8bda33aac4021b444e40389648deccf61c1f37.1697047261.git.robin.murphy@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4e8bda33aac4021b444e40389648deccf61c1f37.1697047261.git.robin.murphy@arm.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 18 Oct 2023 16:15:37 -0700 (PDT) On Wed, Oct 11, 2023 at 07:14:50PM +0100, Robin Murphy wrote: > Before we can allow drivers to coexist, we need to make sure that one > driver's domain ops can't misinterpret another driver's dev_iommu_priv > data. To that end, add a token to the domain so we can remember how it > was allocated - for now this may as well be the device ops, since they > still correlate 1:1 with drivers. We can trust ourselves for internal > default domain attachment, so add checks to cover all the public attach > interfaces. > > Reviewed-by: Lu Baolu > Reviewed-by: Jason Gunthorpe > Signed-off-by: Robin Murphy > > --- > > v4: Cover iommu_attach_device_pasid() as well, and improve robustness > against theoretical attempts to attach a noiommu group. > --- Reviewed-by: Jerry Snitselaar