Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1184155pxb; Fri, 21 Jan 2022 11:42:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJyG6Sgd8o75PvCAntDB7NYv9pma83y3sxlc54tbdeuQxRqQ52QYvBZtdAJn6FGfu6Ujt9mL X-Received: by 2002:a63:7148:: with SMTP id b8mr4026840pgn.616.1642794167708; Fri, 21 Jan 2022 11:42:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642794167; cv=none; d=google.com; s=arc-20160816; b=F3seyb5tUSBNz0ndL41R69X+oBkrNlv/z8bFa2SiNI5CI3ClUObkbwhs3FDE77D1d1 9G8JoyVPnRYZ1BJPR5aPMdqH+TazuFntsnpSn/z8puwdzikbGUMtQxTiqpvVy7rGktGo t73E3dATHb4x0UuOZj0nFMKBrzmTxBxi0V+H8Y3cSHUQxo4DQ17bHf6emBLofEp6siF4 yLEVR8kKSLOSSgWnKpD7x+yHD9khNlLpYoI0VUeGJPayoFhZGNRxI9NIDSsEQOPrKXqv PbKdt8IDc9jzm+g1XLr8Xo5VmluJbWbi6Zs2ST783YMYMRtfj/+dj+jMiNjkXL9leLe8 Q4tA== 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=QbbEs7xlljJ9OZYiN3yevk0GUCKL84eHLAEdoItRUt8=; b=WJ6jZmT4faeN7sgcmRwJaYW/TQobgpozXSVD+FzPo6nrHt7xMrKlir1eEnQEY6DPHo 7jndSQTiS4OSI9a/o5VBpHx4QAJZt+uy4Nq/YL3zkFhNv7dlXbuDL3PC3q4Zz7Qcs1JG NZM+8cKqdwPKb+lC/6cFVlTBTFC1OjUE/1jf63JuG1v+YmzrMVvzXq5z2r3UOcy1ibMB MVmpQFTHU8vDnFlr5SFY7ciyTeapZfKECd/4YKMRQBCeXi1BnHYxnv7LsBh8MGYsQDPI 2u+znD2Xlr96WEk7EW+Sr/Vt4aUMlsKsef1JBq0JY5Z0Flkz2Gy4VTBv7viTBNvsl54m IZ4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=l4QeBCm+; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y7si7362701pge.313.2022.01.21.11.42.35; Fri, 21 Jan 2022 11:42:47 -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=@gmail.com header.s=20210112 header.b=l4QeBCm+; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355841AbiASP5G (ORCPT + 99 others); Wed, 19 Jan 2022 10:57:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242656AbiASP5F (ORCPT ); Wed, 19 Jan 2022 10:57:05 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73A29C061574; Wed, 19 Jan 2022 07:57:05 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id m11so14028638edi.13; Wed, 19 Jan 2022 07:57:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=QbbEs7xlljJ9OZYiN3yevk0GUCKL84eHLAEdoItRUt8=; b=l4QeBCm+hbgu0GoZPBuNcRqAXRwJDC5yrKIxYx3BRU+swXLgSwzGDZ3GanbQrt1LSa ax0ibom1VT/HNROBH3mpdlZCzMevr7AaQnIKvXuaJbVeC/X1C0WDA+1CGqYMaJotOAex g/KxhtBEUOintFV0oZJ+yDk2TttlA9SirUxACzvwi8+xkLCU7iG9KsSJ7Ph4nHSSJEPx sqBDttdvimcNrPjbCHqN7Xh4oJ3z1PzLeODN/lFEc7ZH2x18LgS3CzvSGWKwnSEjxKTn c48SwLK9M39mMZDImYXGZ3ScjZsTTL8brzAJneGqUXgdQKVZ+VbKuJFQUcRg5ssBeZ4Q N02g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=QbbEs7xlljJ9OZYiN3yevk0GUCKL84eHLAEdoItRUt8=; b=IKyywdhOnGvI71hVLT7Dr/+EzRxoSZfzxYTfvI/yRkvA5Hz8qN8YAzPe1lDxdAFxy3 FzKMpiZbqpR+FmZKh9YxC2hL3xMzVE2JPnMrDxvFpBfLGsa9Z1jbNEa/htTxsSBeKeQO kHfUFORZMvw4V6WJeCZEw1ANMQ77G7ciAvXdFDhkrGlXSp9BS9k2vQP26DmElD0r7YvY HwQBqG7+TH1PBVANe26vrjqZLH8ST8wAZ39AQ86VFnuZEsfC5TWYFGaUxmhQt1arUl5X MQKPARTiWVNAhwTWfoGdqI4weX/hOJjsOFx+9eqzHofdm/+e0mqegfYcKGOYNP9LCR43 iguQ== X-Gm-Message-State: AOAM531827exmcbKtvVAh7GIcDezUE219niChcWrcWo/47zTysxwfOQW aI6p3JmnSS/9sO09iXgCe8ZS/Xq+eQ== X-Received: by 2002:a50:8ad2:: with SMTP id k18mr1509163edk.166.1642607824141; Wed, 19 Jan 2022 07:57:04 -0800 (PST) Received: from localhost.localdomain ([46.53.251.254]) by smtp.gmail.com with ESMTPSA id gz19sm30426ejc.10.2022.01.19.07.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jan 2022 07:57:03 -0800 (PST) Date: Wed, 19 Jan 2022 18:57:02 +0300 From: Alexey Dobriyan To: stephen.s.brennan@oracle.com Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, stephen.s.brennan@oracle.com, legion@kernel.org, viro@zeniv.linux.org.uk, ebiederm@xmission.com, akpm@linux-foundation.org Subject: Re: [PATCH v2] proc: "mount -o lookup=" support Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 19, 2022 at 06:48:03PM +0300, Alexey Dobriyan wrote: > # mount -t proc -o lookup=/ proc /proc > +static int proc_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc) > +{ > + struct proc_fs_context *src = fc->fs_private; > + struct proc_fs_context *dst; > + > + dst = kmemdup(src, sizeof(struct proc_fs_context), GFP_KERNEL); > + if (!dst) { > + return -ENOMEM; > + } > + > + dst->lookup_list = kmemdup(dst->lookup_list, dst->lookup_list_len, GFP_KERNEL); > + if (!dst->lookup_list) { > + kfree(dst); > + return -ENOMEM; > + } > + get_pid_ns(dst->pid_ns); > + > + fc->fs_private = dst; > + return 0; > +} Stephen, sorry for not replying earlier. I don't pretend to understand fully what ->dup() is supposed to do. And the above code was not tested. In particular p->a = kmemdup(p->a, ...) reads like "MEMORY LEAK" on the first glance but it is not. Understanding ->dup is the next thing.