Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6360933ybi; Wed, 31 Jul 2019 12:59:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFb5nKdHjdlvu3H3I3mVWVfhqm7d6Vs7GjVQbrzrluA5GCYIM2ZQKCL/jtaQO5jvS0cKDh X-Received: by 2002:a63:f91c:: with SMTP id h28mr23303777pgi.397.1564603187930; Wed, 31 Jul 2019 12:59:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564603187; cv=none; d=google.com; s=arc-20160816; b=F8k1gaxa8VlKsPYVwQFBX8xiKumbJ7IYLuy0Z9olpBmI0XVN68ZFLkjD/ZPge+83n5 PwkDwVz7XrcYXjkXjwnkjq23z/GRRi8nbAhhFfBYnuEYUH2Bu3hVNmoqe7DxARQU34uu lOMNA/RV95Jf2AhduGcRvj6da2uBCMJOR6imPE2Btkeq4ngtJkuoAx8GGWZc0hY667JZ ZF+jhCe3pEF3q/G2arhFRmCFnSog81YJx+1pWXqY0bQ6wxEUS0+UlnFF9aptuhNLqceg zEnWr6YxuWis2euRkXc82S0MwNHPdbjJpTyGPmcx1SP/BLDLm/C+Z2CmdFw+V/ejCIF7 sNcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=dfwzkRB1EXz9VJ9dIrQ8xrDksaj8jIaBGeToAqjBxZk=; b=oSn0k5WtrPidF4YzeLq5o80H/z4Q64o3tKusUlp73e62a5tk6d1ynVlvQUdM7EYVOF rGfObu/+JG9/2RIef+qW00+HPOVc7IJgiVacY9K59YMGXh3kmKJRF+iM1l7x5Ug/wdYt yFNyLB4jhW7gvBYZSmB+CJdziU3bzNZkbXKsjFp7GLrRR5YnojRN8LSskVvw/GEztfKy 0AAUNB5Bdth7W6mrnGh6hP1WUL4kj3420lm2fhk/b7gqztELLQGoBuXpZFprxd2Wx5TE WciZtbmxQQwnrFhGeruLFQb7S59b48TBMcqjTFAyimNUfT1yoh8Nua2qzCIRO2CRfJzm x0qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pzLaZSqD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b41si30912163pla.409.2019.07.31.12.59.33; Wed, 31 Jul 2019 12:59:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pzLaZSqD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730627AbfGaS6d (ORCPT + 99 others); Wed, 31 Jul 2019 14:58:33 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:42762 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726817AbfGaS6c (ORCPT ); Wed, 31 Jul 2019 14:58:32 -0400 Received: by mail-lf1-f68.google.com with SMTP id s19so48213216lfb.9; Wed, 31 Jul 2019 11:58:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=dfwzkRB1EXz9VJ9dIrQ8xrDksaj8jIaBGeToAqjBxZk=; b=pzLaZSqD+v/3JZCkSsk26AW9Eo6y04oP3JAgPhEImxaH9ddeYCWVvB8eE6kmMjRI4d rt4DHIZa2LTcO2qPndNHSZAro2OhrMCdzmtPEK31DeOSt5fIwBfaagONkrDkPNzNWm0X FAtWHZ7xW728jw5/yPivXHvK5zD0DGH8EcceObQX16TopnjWoONXiYxTYxwYLy5d6ksa hJ2RX8Xp/YkcGwbbesTaUJd4lP/xgmxynw9hxATOBhfhZDkYWNnjsnX1pcx1kbl+lR0J xI+0wdN0jW31N0gb918hny0FGKON0xDN90qzGd49fef5J2qL/OdsiyB1Wp9+Ivy3NLQ8 eYhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=dfwzkRB1EXz9VJ9dIrQ8xrDksaj8jIaBGeToAqjBxZk=; b=rB+OfkQXxo3EQtJKPKbtvhCt/QiuoYY6q9q2/InI5+24ptVVv3oQknuOoapHGRFBmX mJySKLvcStxY2EKHoieL42dhLsbcjSIvUJHi5EyNWcS4heMohzGdNND+OjuXGDK+Ew4z X57QnLbvTBjSDel2msX+trogPFoNBQK7I7wuw5JwxKIfRWCpkfnXBccP529OGwlqK6Xw Xbv6RDOZgMqUnsF7IUfz8EQUgOgM3ccF5z8R8xERe8rgt8M6KXnnWBJHDP2XgOjYXqPW 2Nqftpi7KrUKTXHXB3qSyXLLVnz8pJ1r5Q/CDqt2ieAmYmK6m0yD1xSKNFRzkBSTYfuL j+iA== X-Gm-Message-State: APjAAAXX3cfxGQYmm2fhOeAFfY1PzfLvgCnxExYPA/PobJ6yr5Urnfmf XrBe3p2uiFPNB/KrciZ+xGk8flr6VtH4/ELucNI= X-Received: by 2002:ac2:4351:: with SMTP id o17mr38095219lfl.100.1564599510043; Wed, 31 Jul 2019 11:58:30 -0700 (PDT) MIME-Version: 1.0 References: <20190721213116.23476-1-mic@digikod.net> <20190721213116.23476-7-mic@digikod.net> <20190727014048.3czy3n2hi6hfdy3m@ast-mbp.dhcp.thefacebook.com> In-Reply-To: From: Alexei Starovoitov Date: Wed, 31 Jul 2019 11:58:18 -0700 Message-ID: Subject: Re: [PATCH bpf-next v10 06/10] bpf,landlock: Add a new map type: inode To: =?UTF-8?B?TWlja2HDq2wgU2FsYcO8bg==?= Cc: =?UTF-8?B?TWlja2HDq2wgU2FsYcO8bg==?= , LKML , Alexander Viro , Alexei Starovoitov , Andrew Morton , Andy Lutomirski , Arnaldo Carvalho de Melo , Casey Schaufler , Daniel Borkmann , David Drysdale , "David S . Miller" , "Eric W . Biederman" , James Morris , Jann Horn , John Johansen , Jonathan Corbet , Kees Cook , Michael Kerrisk , Paul Moore , Sargun Dhillon , "Serge E . Hallyn" , Shuah Khan , Stephen Smalley , Tejun Heo , Tetsuo Handa , Thomas Graf , Tycho Andersen , Will Drewry , Kernel Hardening , Linux API , Linux-Fsdevel , LSM List , Network Development Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 31, 2019 at 11:46 AM Micka=C3=ABl Sala=C3=BCn wrote: > >> + for (i =3D 0; i < htab->n_buckets; i++) { > >> + head =3D select_bucket(htab, i); > >> + hlist_nulls_for_each_entry_safe(l, n, head, hash_node) { > >> + landlock_inode_remove_map(*((struct inode **)l->k= ey), map); > >> + } > >> + } > >> + htab_map_free(map); > >> +} > > > > user space can delete the map. > > that will trigger inode_htab_map_free() which will call > > landlock_inode_remove_map(). > > which will simply itereate the list and delete from the list. > > landlock_inode_remove_map() removes the reference to the map (being > freed) from the inode (with an RCU lock). I'm going to ignore everything else for now and focus only on this bit, since it's fundamental issue to address before this discussion can go any further. rcu_lock is not a spin_lock. I'm pretty sure you know this. But you're arguing that it's somehow protecting from the race I mentioned above?