From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (unknown [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id 250B6805B2 for ; Fri, 25 Sep 2026 18:00:06 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 68PHwbwP028012; Fri, 25 Sep 2026 20:58:38 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 68PHwbwP028012 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="YjF1J876" Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 68PHwZB9028008 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Fri, 25 Sep 2026 20:58:36 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 68PHwZB9028008 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-49fcd86b8d3so9458965e9.3 for ; Fri, 25 Sep 2026 10:58:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AKwUvBwiLZEy9IKx6jFux5xdx8lZGbUI2nJNCnzcdttinFp/CZdHrqdliia8IbpL944SZm6lWLlJHQ==@openvz.org X-Gm-Message-State: AFuF++nvCdk6+M8N9fUjpfmvFaM16u2BPiZtnKdazMa5E4/Y1kDb5PJg M2ltS4PWXCRzoqf3Q6DeTWuvKoxFvYWRT0eNFVQyBkG8GqCumM4ZI82epMUHFRRv40WmbFK2wDD dd/j56Hzrv4vmQFfUJHe2fcLH4HPjbvWHLVRz8UZgZzQW2vZZvwtskQ== X-Gm-Gg: AYBFou2Mk6OvHPPzcOGOAU46C20CD6p+g/UJhluMucXNG+dQOcyTzpByWgtnhPbOS8B q3ylGl4nZPdhg95Uwl62syrcva2fooPDOEWpPJxgHMaW2vCGnvp/hMGMKi53r6Nk9U5Bjp2Ntl/ TvY7Cw7FTp9pzh0HeGUruuRKBdYwQt0wsNrUAOj7SqnNoqQJ6f/+ClC3S6rkrma1M2TSc7HnIYF Hj+eGVi6LT9NUVzStZ3h37ANc1hJ/7DWh2ggl+gW4ojFhM3kpwMlahCtiEz+qlE0V7jpl/suNfT 4sRQYFb+xXGribzs3VKcaqWwzp7aS5ZauwEtyq4nYyy2NH4iyHbTpuNR2FzGkDlTVNLivSMgTWe 2P8DpE52QH+q+xzJytg== X-Received: by 2002:a05:600c:1907:b0:49e:63cd:31fb with SMTP id 5b1f17b1804b1-49ff06bcd54mr55887025e9.9.1790359115639; Fri, 25 Sep 2026 10:58:35 -0700 (PDT) X-Received: by 2002:a05:600c:1907:b0:49e:63cd:31fb with SMTP id 5b1f17b1804b1-49ff06bcd54mr55886555e9.9.1790359115018; Fri, 25 Sep 2026 10:58:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1790359115; cv=none; d=google.com; s=arc-20260327; b=szyNpvXJqBhm+QGkG6hgYe1P9zitXMHbvTdkaLgKTLho6fIF4ed4HW+7jPREWybszd Gvq+riltsX+iMjPX5fybZPMAbTktoY6lznpbUdJUKKGP6N6/UB+OBKz/EE52NYNCD6BV Od8uGgy4ivemANPgUFoQyvr3BGSvTDDh85N3U/shUt0nozXMEIIgwhvw2MMG39oe4io+ 2HL3cik3Ta3cVC26r5DnSSxj+r8bTA4b0KNGSW7V9vfi8L77M0bPLEY/9B8iVnhs6NKy dImeDnjNhFpum+eFZzk5FLNklmxUzBWuHoGlx7La1Co8M0ksDUnnBf/QeTSfEIUj57Kt W4BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=message-id:date:references:in-reply-to:cc:to:from:subject :content-transfer-encoding:mime-version:dkim-signature; bh=mMbVBSJUmzkP8lV9aUxXtbeGdtv+ItK05HMRlxssvuM=; fh=8+X+w90mdJ6G1WJJJxch/JQtL3s0QC+l1k0I7SQJzmc=; b=PUM97iwoI8ykZImeFkO8ph3V3jgn2wWcspFiqnMps+KqMmdA8rkwK4ylW1oR+n/O0E jiHZWWw7AZgpQ68OrT0xKK7wD1u2FSKuxDyVd7bJTrAa6YMCxhDHaWqUzqwYMLiTvbuP Bj9om6OiIQsm11MDb0b55aSE6hkD4mdX3ZB2cBkdcdhSZcwVyugh3egHaQNt16iY0iQl OLMijNzII7iFzRAFtlkEl/Jz/EJr+tUeQCWQVQQi5sqlLeb1Rmmz4BTrrRJaD0gzdRWq hLGcosWY2S0lx6qCM3yKGgjgkQ6x7JZF3KCCpQxXscNGHub4tAHNwzIAKWDkSbuqqDzs xl/A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=YjF1J876; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id ffacd0b85a97d-4887a35f611si6299140f8f.107.2026.09.25.10.58.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Sep 2026 10:58:34 -0700 (PDT) Received-SPF: pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=YjF1J876; spf=pass (google.com: domain of khorenko@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=khorenko@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=Message-Id:Date:From:Subject:Content-Type: MIME-Version; bh=mMbVBSJUmzkP8lV9aUxXtbeGdtv+ItK05HMRlxssvuM=; b=YjF1J87635/1 +1M+vV/cPTu+KtAKiPa/F1gG3sh5L1omWj+Qk3bOX8T5chQZT++i8ZjXm+6srKUBj35NXwjHe00uJ bWDZdrtTBqLysJsX234V9j18NiH5yO2Vn9QdJmPJt2yqV19bc/jPn9lZtc5NTNrAkCmuK//hEf8Tq g2jNkobPIDMQaTJcC8iTuS911YNDhgVAOLPkFNSgrmmLKYZ3N15vi19HD1TjgXHKNGVQyFIC2v15J v8A7E+pINN7TfI5DWuFgS7MsqD2w7M5aB8cGcLpdJwWdVbwb4Af7j7Zw9XDI4O6c3DS4TC3Sd8dlP 6tAevbFXJlW06axJM3XBSQ==; Received: from ch-demo-asa.virtuozzo.com ([130.117.225.8] helo=f0.sw.ru) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1xAA8w-00DUbU-0U; Fri, 25 Sep 2026 19:58:30 +0200 MIME-Version: 1.0 From: Konstantin Khorenko To: Vladimir Riabchun In-Reply-To: <20260920-ovl-use-orig-ve-v1-2-b3e63f6ff80d@virtuozzo.com> References: <20260920-ovl-use-orig-ve-v1-0-b3e63f6ff80d@virtuozzo.com> <20260920-ovl-use-orig-ve-v1-2-b3e63f6ff80d@virtuozzo.com> Date: Fri, 25 Sep 2026 19:58:31 +0200 Message-Id: <179035911162.3337040.7476455317600827184.b4-review@b4> X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=13297; i=khorenko@virtuozzo.com; h=from:subject:message-id; bh=W1sNZzrJwVEGqxxfE/EunAX6/c3K2ew+Um47y8JtNQ0=; b=owEBbQKS/ZANAwAKAVGWCkf5YVwqAcsmYgBqtrZJ3qTZCsridYZJ0yG0DfPp7r2vWYs0DvMti 90NrA/QrZqJAjMEAAEKAB0WIQRWD23IPcXT0GO9CCxRlgpH+WFcKgUCara2SQAKCRBRlgpH+WFc KrWsD/9XtI5LiG1HMNmu0BiCUbv/nV9Pe2DojHk/5CMdjUQKPI4QasDVJ9UFrHLR92rIa2b2cwc bQXL+8S5GilR8frg9qMz4C2FzpurTsTqayuzUmosFxbPgGAIYMyu7L692FSZFF4T2ioO7yORyK7 SceLDzlo69Nr4Yptwy4vZ7mbMMapNGW+zAYHSy3UN1Q/oPEjGx6T1uV8NvK8y63AFzGxkeDmgg1 sMrKvkhXaTZL9m2hhgB/upHMpuCJPwUkE2pFsuft6uQqSNYU8iTtiv2JzYcegAMCpPbaxaw5NV8 ZU6wXWuBbzaEMjFm1TlB/NtVJXqB9axL5rIs3ib9g/hinrsrJRl6psuZfm6SqhCSjxsNG5aooW7 mPPGtbaNy97YWE6+5sDcvpl5M6JCJMmAUxiKvQYqXIQx0mlSV77fHLcmq+3ekuPGgOSKjRZOWWX oS2tvNg8hIbtZY9j4wWwxJhG2TyQq7Vy+G195Bo0a6CP+e45ZZwsSk5kF8sNTyZqXQbDf8WTieX kD1tHmMMiTDExQOhOPocOQpRTeNuQkn0DAe8NrsJMz5TG/SHN5CQ0Ariia1XFtsgvCL1Xb08t3+ mTD6xsF29AVnqXUHBnHM1NBwQhI7DufpUXVYL/QnBZ/BHnJRnW8q59R7hj9758FVuaw0fKHhwYu aZuLxy+Ve6MqY5w== X-Developer-Key: i=khorenko@virtuozzo.com; a=openpgp; fpr=560F6DC83DC5D3D063BD082C51960A47F9615C2A X-OZ-Fwd: true Cc: devel@openvz.org Subject: Re: [Devel] [PATCH hci-8.1 2/2] ovl: Keep creator VE in overlayfs superblock X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org > We observed a crash in overlayfs when checkpointing a container > with docker running inside: > > [ 2300.870181] BUG: kernel NULL pointer dereference, address: 0000000000000005 > [ 2300.871537] #PF: supervisor read access in kernel mode > [ 2300.872577] #PF: error_code(0x0000) - not-present page > [ 2300.873595] PGD 800000010a18f067 P4D 800000010a18f067 PUD 10730c067 PMD 0 > [ 2300.874900] Oops: Oops: 0000 [#1] SMP PTI > [ 2300.875742] CPU: 1 UID: 0 PID: 5419 Comm: criu ve: 0 Kdump: loaded Not tainted 6.12.0-211.39.1.16.6.vz10.x86_64 #1 16.6 PREEMPT(voluntary) > [ 2300.878057] Hardware name: Acronis OpenStack Compute/Virtuozzo, BIOS 1.16.1-1.vz9.2 04/01/2014 > [ 2300.879684] RIP: 0010:ovl_get_index_name_fh+0x18/0x70 [overlay] > [ 2300.880859] Code: ... > [ 2300.884128] RSP: 0018:ffffd32582e0f7c0 EFLAGS: 00010246 > [ 2300.885153] RAX: 0000000000000010 RBX: 0000000000000000 RCX: ffff8ba4497480a8 > [ 2300.886480] RDX: ffff8ba45535dc00 RSI: 0000000000000dc0 RDI: 0000000000000000 > [ 2300.887824] RBP: ffff8ba68f9daa80 R08: ffff8ba4497480a8 R09: 000000000000030e > [ 2300.889139] R10: 0000000000000000 R11: ffff8ba44862d6d0 R12: ffffd32582e0f800 > [ 2300.890498] R13: 0000000000000000 R14: ffff8ba497cb0110 R15: ffff8ba517548cc0 > [ 2300.891838] FS: 00007f5a2f492880(0000) GS:ffff8bab9fc80000(0000) knlGS:0000000000000000 > [ 2300.893376] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > [ 2300.894476] CR2: 0000000000000005 CR3: 000000033403a005 CR4: 00000000003726f0 > [ 2300.895807] Call Trace: > [ 2300.896397] > [ 2300.896938] ? show_trace_log_lvl+0x1b0/0x2f0 > [ 2300.897854] ? show_trace_log_lvl+0x1b0/0x2f0 > [ 2300.898748] ? ovl_create_index+0x82/0x260 [overlay] > [ 2300.899766] ? __die_body.cold+0x8/0x12 > [ 2300.900582] ? page_fault_oops+0x148/0x160 > [ 2300.901562] ? exc_page_fault+0x7f/0x150 > [ 2300.902406] ? asm_exc_page_fault+0x26/0x30 > [ 2300.903298] ? ovl_get_index_name_fh+0x18/0x70 [overlay] > [ 2300.904435] ovl_create_index+0x82/0x260 [overlay] > [ 2300.905406] ovl_copy_up_workdir+0x30a/0x330 [overlay] > [ 2300.906427] ovl_do_copy_up+0x10d/0x2e0 [overlay] > [ 2300.907387] ovl_copy_up_one+0x456/0x720 [overlay] > [ 2300.908376] ? xa_load+0x7b/0xb0 > [ 2300.909090] ? _raw_spin_unlock+0xe/0x30 > [ 2300.909913] ? list_lru_add+0x11b/0x160 > [ 2300.910736] ovl_copy_up_flags+0x81/0x110 [overlay] > [ 2300.911740] ovl_create_object+0x51/0x130 [overlay] > [ 2300.912719] vfs_mkdir+0x194/0x250 > [ 2300.913470] do_mkdirat+0x14c/0x180 > [ 2300.914223] __x64_sys_mkdir+0x46/0x70 > [ 2300.915019] do_syscall_64+0x7d/0x160 > [ 2300.915798] ? do_sys_openat2+0x9c/0xe0 > [ 2300.916672] ? syscall_exit_work+0xf3/0x120 > [ 2300.917540] ? syscall_exit_to_user_mode+0x32/0x190 > [ 2300.918518] ? do_syscall_64+0x89/0x160 > [ 2300.919316] ? syscall_exit_work+0xf3/0x120 > [ 2300.920181] ? syscall_exit_to_user_mode+0x32/0x190 > [ 2300.921173] ? do_syscall_64+0x89/0x160 > [ 2300.921991] ? exc_page_fault+0x7f/0x150 > [ 2300.922814] entry_SYSCALL_64_after_hwframe+0x76/0x7e > [ 2300.923823] RIP: 0033:0x7f5a2f8de3eb > > The root cause is VE namespace mismatch. Overlayfs was created > inside CT, so ovl_fill_super stored in-container credentials > to ofs->creator_cred. > Those creds are later used in ovl_override_creds to temporarily > swich creds and perform checks using them. > > One of these checks happened in ovl_get_origin_fh/ovl_can_decode_fh. > On fs creation this check passed because we had container VE > and container creds, so overlayfs thought that we support > file handles (ovl_can_decode_fh call in ovl_make_workdir). > > When we tried to do something with the overlayfs from host VE, > ve_capable check was performed with credentials from CT > and with host VE. > ovl_get_origin_fh returned unexpected NULL and all exploded. > > Store creator VE next to creator creds, so we can perform all > ve_capable checks with the correct VE. > > https://virtuozzo.atlassian.net/browse/VSTOR-142405 > > Signed-off-by: Vladimir Riabchun > > diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c > index 4388004a319d0..b7c06ae4beb4c 100644 > --- a/fs/overlayfs/copy_up.c > +++ b/fs/overlayfs/copy_up.c > @@ -478,7 +478,7 @@ struct ovl_fh *ovl_get_origin_fh(struct ovl_fs *ofs, struct dentry *origin) > * so we can use the overlay.origin xattr to distignuish between a copy > * up and a pure upper inode. > */ > - if (!ovl_can_decode_fh(origin->d_sb)) > + if (!ovl_can_decode_fh(origin->d_sb, ofs)) > return NULL; > > return ovl_encode_real_fh(ofs, d_inode(origin), false); > diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c > index efa2a072aa693..e33debf8b1ed8 100644 > --- a/fs/overlayfs/namei.c > +++ b/fs/overlayfs/namei.c > @@ -166,7 +166,7 @@ struct dentry *ovl_decode_real_fh(struct ovl_fs *ofs, struct ovl_fh *fh, > struct dentry *real; > int bytes; > > - if (!ve_capable(CAP_DAC_READ_SEARCH)) > + if (!__ve_capable(ofs->creator_ve, CAP_DAC_READ_SEARCH)) > return NULL; > > /* > diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h > index 8577c7884fb92..9c8dd2f9cac62 100644 > --- a/fs/overlayfs/overlayfs.h > +++ b/fs/overlayfs/overlayfs.h > @@ -427,7 +427,7 @@ static inline const struct cred *ovl_creds(struct super_block *sb) > return OVL_FS(sb)->creator_cred; > } > > -int ovl_can_decode_fh(struct super_block *sb); > +int ovl_can_decode_fh(struct super_block *sb, struct ovl_fs *ofs); > struct dentry *ovl_indexdir(struct super_block *sb); > bool ovl_index_all(struct super_block *sb); > bool ovl_verify_lower(struct super_block *sb); > diff --git a/fs/overlayfs/ovl_entry.h b/fs/overlayfs/ovl_entry.h > index ab78001635e7c..a6ad8b8de48c0 100644 > --- a/fs/overlayfs/ovl_entry.h > +++ b/fs/overlayfs/ovl_entry.h > @@ -77,6 +77,7 @@ struct ovl_fs { > struct ovl_config config; > /* creds of process who forced instantiation of super block */ > const struct cred *creator_cred; > + struct ve_struct *creator_ve; > bool tmpfile; > bool noxattr; > bool nofh; > diff --git a/fs/overlayfs/params.c b/fs/overlayfs/params.c > index 32c58fcfe52f0..c047f1265b8ef 100644 > --- a/fs/overlayfs/params.c > +++ b/fs/overlayfs/params.c > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > #include "overlayfs.h" > #include "params.h" > > @@ -761,6 +762,8 @@ void ovl_free_fs(struct ovl_fs *ofs) > kfree(ofs->config.workdir); > if (ofs->creator_cred) > put_cred(ofs->creator_cred); > + if (ofs->creator_ve) > + put_ve(ofs->creator_ve); > kfree(ofs); > } > > diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c > index fb47711c8fb9a..e87b6684ec70f 100644 > --- a/fs/overlayfs/super.c > +++ b/fs/overlayfs/super.c > @@ -18,6 +18,7 @@ > #include > #include > #include > +#include > #include "overlayfs.h" > #include "params.h" > > @@ -393,7 +394,7 @@ static int ovl_lower_dir(const char *name, struct path *path, > * The inodes index feature and NFS export need to encode and decode > * file handles, so they require that all layers support them. > */ > - fh_type = ovl_can_decode_fh(path->dentry->d_sb); > + fh_type = ovl_can_decode_fh(path->dentry->d_sb, ofs); > if ((ofs->config.nfs_export || > (ofs->config.index && ofs->config.upperdir)) && !fh_type) { > ofs->config.index = false; > @@ -757,7 +758,7 @@ static int ovl_make_workdir(struct super_block *sb, struct ovl_fs *ofs, > } > > /* Check if upper/work fs supports file handles */ > - fh_type = ovl_can_decode_fh(ofs->workdir->d_sb); > + fh_type = ovl_can_decode_fh(ofs->workdir->d_sb, ofs); > if (ofs->config.index && !fh_type) { > ofs->config.index = false; > pr_warn("upper fs does not support file handles, falling back to index=off.\n"); > @@ -1328,6 +1329,8 @@ int ovl_fill_super(struct super_block *sb, struct fs_context *fc) > > sb->s_d_op = &ovl_dentry_operations; > > + ofs->creator_ve = get_ve(get_exec_env()); > + get_ve() pins the ve_struct, but does not keep the VE running: on CT stop ve_drop_context() sets ve->init_cred = NULL, so __ve_capable() falls back to ve0.init_cred, and ns_capable(&init_user_ns, cap) with the in-CT creator creds is false. The check flips after mount again, permanently this time, and the same NULL deref in ovl_create_index() is reachable whenever the sb outlives the VE (host-side bind mount, a held fd, NFS export). After this series both inputs of the check are fixed at mount time (creator_cred, creator_ve), so its result is a mount-time constant. Why not compute ve_capable(CAP_DAC_READ_SEARCH) once in ovl_fill_super() and store a bool in ovl_fs, next to the existing nofh? That closes the stopped-VE window and makes patch 1, creator_ve and the get_ve/put_ve pairing unnecessary. Draft patch instead of both in thise series: diff --git a/fs/overlayfs/ovl_entry.h b/fs/overlayfs/ovl_entry.h --- a/fs/overlayfs/ovl_entry.h +++ b/fs/overlayfs/ovl_entry.h @@ -77,6 +77,8 @@ struct ovl_fs { struct ovl_config config; /* creds of process who forced instantiation of super block */ const struct cred *creator_cred; + /* ve_capable(CAP_DAC_READ_SEARCH) frozen at mount time */ + bool fh_capable; bool tmpfile; bool noxattr; bool nofh; diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -393,7 +393,7 @@ static int ovl_lower_dir(const char *name, struct path *path, * The inodes index feature and NFS export need to encode and decode * file handles, so they require that all layers support them. */ - fh_type = ovl_can_decode_fh(path->dentry->d_sb); + fh_type = ovl_can_decode_fh(path->dentry->d_sb, ofs); if ((ofs->config.nfs_export || (ofs->config.index && ofs->config.upperdir)) && !fh_type) { ofs->config.index = false; @@ -757,7 +757,7 @@ static int ovl_make_workdir(struct super_block *sb, struct ovl_fs *ofs, } /* Check if upper/work fs supports file handles */ - fh_type = ovl_can_decode_fh(ofs->workdir->d_sb); + fh_type = ovl_can_decode_fh(ofs->workdir->d_sb, ofs); if (ofs->config.index && !fh_type) { ofs->config.index = false; pr_warn("upper fs does not support file handles, falling back to index=off.\n"); @@ -1328,6 +1328,8 @@ int ovl_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_d_op = &ovl_dentry_operations; + ofs->fh_capable = ve_capable(CAP_DAC_READ_SEARCH); + err = -ENOMEM; ofs->creator_cred = cred = prepare_creds(); if (!cred) diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c --- a/fs/overlayfs/util.c +++ b/fs/overlayfs/util.c @@ -78,9 +78,9 @@ const struct cred *ovl_override_creds(struct super_block *sb) * Return 1 (FILEID_INO32_GEN) if fs uses the default 32bit inode encoding. * Return -1 if fs uses a non default encoding with unknown inode size. */ -int ovl_can_decode_fh(struct super_block *sb) +int ovl_can_decode_fh(struct super_block *sb, struct ovl_fs *ofs) { - if (!ve_capable(CAP_DAC_READ_SEARCH)) + if (!ofs->fh_capable) return 0; if (!exportfs_can_decode_fh(sb->s_export_op)) diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c --- a/fs/overlayfs/namei.c +++ b/fs/overlayfs/namei.c @@ -166,7 +166,7 @@ struct dentry *ovl_decode_real_fh(struct ovl_fs *ofs, struct ovl_fh *fh, struct dentry *real; int bytes; - if (!ve_capable(CAP_DAC_READ_SEARCH)) + if (!ofs->fh_capable) return NULL; /* diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c --- a/fs/overlayfs/copy_up.c +++ b/fs/overlayfs/copy_up.c @@ -478,7 +478,7 @@ struct ovl_fh *ovl_get_origin_fh(struct ovl_fs *ofs, struct dentry *origin) * so we can use the overlay.origin xattr to distignuish between a copy * up and a pure upper inode. */ - if (!ovl_can_decode_fh(origin->d_sb)) + if (!ovl_can_decode_fh(origin->d_sb, ofs)) return NULL; return ovl_encode_real_fh(ofs, d_inode(origin), false); diff --git a/fs/overlayfs/overlayfs.h b/fs/overlayfs/overlayfs.h --- a/fs/overlayfs/overlayfs.h +++ b/fs/overlayfs/overlayfs.h @@ -427,7 +427,7 @@ static inline const struct cred *ovl_creds(struct super_block *sb) return OVL_FS(sb)->creator_cred; } -int ovl_can_decode_fh(struct super_block *sb); +int ovl_can_decode_fh(struct super_block *sb, struct ovl_fs *ofs); struct dentry *ovl_indexdir(struct super_block *sb); bool ovl_index_all(struct super_block *sb); bool ovl_verify_lower(struct super_block *sb); -- Konstantin Khorenko _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel