From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5244DC48260 for ; Thu, 25 Jan 2024 21:27:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DDA2F8D0005; Thu, 25 Jan 2024 16:27:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D8A798D0001; Thu, 25 Jan 2024 16:27:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C52CE8D0005; Thu, 25 Jan 2024 16:27:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B57A68D0001 for ; Thu, 25 Jan 2024 16:27:51 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 89679805B3 for ; Thu, 25 Jan 2024 21:27:51 +0000 (UTC) X-FDA: 81719120742.21.8999206 Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) by imf10.hostedemail.com (Postfix) with ESMTP id C6B64C000F for ; Thu, 25 Jan 2024 21:27:48 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=0S5Hbt5i; spf=pass (imf10.hostedemail.com: domain of surenb@google.com designates 209.85.128.172 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706218068; a=rsa-sha256; cv=none; b=BxBYveUgdrvO7Wb5ashYLOtcGKCoVNKxDooIj60xUI5FZrAhrnFGgn5BeHpPbu7nLJjBRg deWIvhN8qCfPzD+pN3BK4TR3q5CQaMK47XkbUwZ9zjQfThDNfzi9kxOKmDxBKeVIbuf7S8 +qwCtXfuvmwtYlccAhQ9+eZxTJ68WwE= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=0S5Hbt5i; spf=pass (imf10.hostedemail.com: domain of surenb@google.com designates 209.85.128.172 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706218068; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=cZctJ95roOKUuWfU+NSbWQYCqifmeEOmcfFL1+Y6gjI=; b=nPVAme8zFVkcmkL0xzzHHK8+z4UCrIJqYZi76p/1zliF+2LTprxHTjg64dKr243dxgUgCT R08I59uI8TwVxPi6KJnFBxSLiean6nfP9V/r4ergCfKXR6iXMjAjgyJRe0JWLtEF02opo5 CZ5VFhvhJZwo0lgLcKKk/aKluZV7+L8= Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-5ff84214fc7so70626227b3.0 for ; Thu, 25 Jan 2024 13:27:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706218068; x=1706822868; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=cZctJ95roOKUuWfU+NSbWQYCqifmeEOmcfFL1+Y6gjI=; b=0S5Hbt5i+CYZ9EA16sEKycxveTvICvXQ1Q0OSkTF16i1G1+/S76+qxeuIpZlmoQCjm rjOYSjG88m3q6gLLZBNSirkFqcYz1F2Evc3PDOr3056+FxRW0TEbtt64Lx6MMZuwUHxm diK+z5Hr0taLJ2c8jR33lzXBf+cycMV1xi18xYigFHPsWGmLSo8yGgwdPxDsoWo5R5PB uz02TrBV6NXPaqljkQwXnT+r7fncbqt3Ek1v9G2yUcw3ETrUnrNVEgs8u7wD0VYe5P7L cBZI3/Tdd3Bf0QQv1RUCYciBXBrHq1OfRpie62EiGF4+tijzw4WaT1g+0jUBuHaaZSer fZXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706218068; x=1706822868; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cZctJ95roOKUuWfU+NSbWQYCqifmeEOmcfFL1+Y6gjI=; b=ciPx+dyStPXPIE26aq63DztH5pDoGr/nR5RAP3Pn3RhyNDXA4g9uEK4cz2MYx8/dWR mrMINCj6xg21jYQ08woo+y4ze4CNMENfij+3M64RWUWjRviNe5q0NYGpeeQTbOmaMf7V P6+ZGv1SsRjGrqKDNa0aTm32YAasUe/hSbj/cD4eVfAnUh4Xf2BPVviB4/teszyglpM2 o4Ih3Z5hEv9HkfVJ2+XW+z0E+/vwBoVDwb8FIqj522B9SqUPvmbJdD2NlqR5ZoO5dgSJ BT2sTBGpEIdcSFsH3+6NyGo/paSmPA0uishqgdbrcxiCb9bzbftyhKxvq09eyo1XPMt1 qxqg== X-Gm-Message-State: AOJu0Yy5yhob5Y+KAiKXWOj1LZ1d7z0e+GyAx5LGlCztZGYKY3aRYJQo CHzTRlpMH2CzXIqaDZ0gczA4Ljz39hjdhICT2gRkOf8dcBII2A0Ul7V/vAtL34lMGbIIT78CCDg ruQvn8s/y/j4LJEjOdsoyUeTmZv/3uX9wVmN6 X-Google-Smtp-Source: AGHT+IEmXticjPa3FlG2Dh2lBl+AYHgKS+ho3uKdSCnB1DWm+1E3AGTlt0wqECyf2xPiOu8a/A8HBbfQHTi7c+RZpTg= X-Received: by 2002:a81:af19:0:b0:5d7:1941:2c29 with SMTP id n25-20020a81af19000000b005d719412c29mr448275ywh.86.1706218067540; Thu, 25 Jan 2024 13:27:47 -0800 (PST) MIME-Version: 1.0 References: <202401251829.0m6Eo4LI-lkp@intel.com> In-Reply-To: <202401251829.0m6Eo4LI-lkp@intel.com> From: Suren Baghdasaryan Date: Thu, 25 Jan 2024 13:27:34 -0800 Message-ID: Subject: Re: [linux-next:master 1589/1892] fs/proc/task_mmu.c:143:45: sparse: sparse: incorrect type in argument 1 (different address spaces) To: kernel test robot , Matthew Wilcox , "Paul E . McKenney" Cc: oe-kbuild-all@lists.linux.dev, Linux Memory Management List , Andrew Morton Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: C6B64C000F X-Stat-Signature: 4ype79bjrr1rfg6ir4kgmhyjhmqipg43 X-Rspam-User: X-HE-Tag: 1706218068-248017 X-HE-Meta: U2FsdGVkX19c7yloMLPN7/sUErWxBv3vqsQJXzJmVsBWB7xsc4jbfVkLizvq3Xr0+U2UiJpDT0+A2pbLWCdO+R4+ZM5F5fx1Sls43mYOKepaFLA+uuh0hFxmfG2Yc6S3ll5K/92VKNad2RWb1RdmRwV4zrD06miaBqc20W7LH4WuWd2H/H4wp2pgstuWp1+IfQDzAIlogUpd4ndIiT+VkloKxzz0LiC0i/EQS1dSstH5u9KzI8u0he5KwTr3Ta8Cyq/r940Hegnr4RqL8oU0tkg38BE0P7PaxEOR4v0j9wONng77PvkEnQqVOtsdwfksLDSHQ2C0jkJFffJp910Om2g6hYbvNgePUGvtBME2p7nTwvkaQm4JytTnxyo/KCI/LA7ceuJkDbV0rsX1nAEsBNBjm44y4azwr+nJtKVphTzEYlXvfpVjiths2iAd4ZXxb00aX/3rfMAVPJGt0ONn/RduOjmJCfqaUoO26MUIV40FHfIIECRfE3VuHWByprWv6dDPWrXKng41Hbovm1s1rrGJWB2yCtgB9lACwWJEae3cwAV1AtkhPar5SEcS4gVeJfnGXMZPxpQQ7pbQdSkAa1RFoaI5KdRpMLxgt3EUZcdGUC6eUbTYRYJyLbMs4pEhjE86zxhpAzTP38CXUBPR+I8cvZITm+NeCMNmfsvJuo2PLXXDdKNdsRMDhDUWroKhkRoHVUhghSaEahJ4TzaYl84M1ZGymYhH8wgfaNnKm8JTqg8g9fGpPhAH5Mr8HajS0qZlubMu4ZTciCsN6CIFUaNvsIzjucVyLtSQc8U0jEtihxGVMTfBNGBLzIx9a3quBmj3+juIye6bHdhSlMCi0j/+4RW+T5fIAnHh/KywgEURMjh/QadetDD1Hpr1gEptOEQz8ET3T4z3+bJS7ICVYQjVpSJpQXvDbp1IsJ6earEh/2DmYiRXothQjGDLQ94XQ3eOsq6YESFgAi3GplW 8jH9hM92 0360L7yeSXo8+TjQJJmDn/q1KtZqXARAW0IhAUleSisJ3d96kaTm4sR0GIQ/Tk4YvIWKk5YdHnDnDKqYI9J0zXSf9Km2B17HKuSyA9yiK+m5L+ExXqTzsj/mzRYv16tWybAeQVk5Gy/ak5erPf+dQ/1DtIOxaGXevcEIy8mgiswtL4NY2YS+7DABl5Ev1OZT9gEqZGd9Pkno6crABiUGFOS20mqqEahLTQz40jhVNfBKjjsDfoxVug5iJac4h1FNq+RPUEUXXjKDuhe5Su1UnBoo42ec727PmYlsWQVrAn6YEKlKPwmU4ddTak1qhQzmTll87HdO+4TcyBbrJwuLa6QvqhUMXo+U2S6pFCDxhQUPYm6hWVlSnlm2wEAl5lIKFIWG62lDcYp75azFGaofWDdfJQdQhpl38wI6VQpCYbW2ZPCfC+NoebFBhHA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, Jan 25, 2024 at 2:23=E2=80=AFAM kernel test robot w= rote: > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.g= it master > head: 01af33cc9894b4489fb68fa35c40e9fe85df63dc > commit: 0c30c4cd953025979b7689e49844837f762303ec [1589/1892] mm/maps: rea= d proc/pid/maps under RCU > config: x86_64-randconfig-121-20240125 (https://download.01.org/0day-ci/a= rchive/20240125/202401251829.0m6Eo4LI-lkp@intel.com/config) > compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009= 708b4367171ccdbf4b5905cb6a803753fe18) > reproduce (this is a W=3D1 build): (https://download.01.org/0day-ci/archi= ve/20240125/202401251829.0m6Eo4LI-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new vers= ion of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot > | Closes: https://lore.kernel.org/oe-kbuild-all/202401251829.0m6Eo4LI-lkp= @intel.com/ > > sparse warnings: (new ones prefixed by >>) > >> fs/proc/task_mmu.c:143:45: sparse: sparse: incorrect type in argument = 1 (different address spaces) @@ expected struct file [noderef] __rcu **= f @@ got struct file ** @@ Uh, this is a problem. I missed that get_file_rcu() is used only with mm->exe_file and vma->vm_file is not really RCU-safe. It's freed via a call to fput() which schedules its freeing using schedule_delayed_work(..., 1) but I don't think that constitutes RCU grace period. Paul, Matthew, could you please confirm? In the meantime I'm going to ask Andrew to remove my patchset from mm-unstable to be safe. > fs/proc/task_mmu.c:143:45: sparse: expected struct file [noderef] = __rcu **f > fs/proc/task_mmu.c:143:45: sparse: got struct file ** > fs/proc/task_mmu.c: note: in included file (through include/linux/rbtr= ee.h, include/linux/mm_types.h, include/linux/mmzone.h, ...): > include/linux/rcupdate.h:781:9: sparse: sparse: context imbalance in '= get_vma_snapshot' - unexpected unlock > fs/proc/task_mmu.c:264:22: sparse: sparse: context imbalance in 'm_sta= rt' - different lock contexts for basic block > include/linux/rcupdate.h:781:9: sparse: sparse: context imbalance in '= m_stop' - unexpected unlock > include/linux/rcupdate.h:781:9: sparse: sparse: context imbalance in '= smaps_pte_range' - unexpected unlock > include/linux/rcupdate.h:781:9: sparse: sparse: context imbalance in '= clear_refs_pte_range' - unexpected unlock > include/linux/rcupdate.h:781:9: sparse: sparse: context imbalance in '= pagemap_pmd_range' - unexpected unlock > include/linux/rcupdate.h:781:9: sparse: sparse: context imbalance in '= pagemap_scan_pmd_entry' - unexpected unlock > fs/proc/task_mmu.c: note: in included file (through arch/x86/include/a= sm/uaccess.h, include/linux/uaccess.h, include/linux/sched/task.h, ...): > arch/x86/include/asm/uaccess_64.h:88:24: sparse: sparse: cast removes = address space '__user' of expression > arch/x86/include/asm/uaccess_64.h:88:24: sparse: sparse: cast removes = address space '__user' of expression > > vim +143 fs/proc/task_mmu.c > > 132 > 133 /* > 134 * Take VMA snapshot and pin vm_file and anon_name as they are us= ed by > 135 * show_map_vma. > 136 */ > 137 static int get_vma_snapshot(struct proc_maps_private *priv, struc= t vm_area_struct *vma) > 138 { > 139 struct vm_area_struct *copy =3D &priv->vma_copy; > 140 int ret =3D -EAGAIN; > 141 > 142 memcpy(copy, vma, sizeof(*vma)); > > 143 if (copy->vm_file && !get_file_rcu(©->vm_file)) > 144 goto out; > 145 > 146 if (!anon_vma_name_get_if_valid(copy)) > 147 goto put_file; > 148 > 149 if (priv->mm_wr_seq =3D=3D mmap_write_seq_read(priv->mm)) > 150 return 0; > 151 > 152 /* Address space got modified, vma might be stale. Wait a= nd retry. */ > 153 rcu_read_unlock(); > 154 ret =3D mmap_read_lock_killable(priv->mm); > 155 mmap_write_seq_record(priv->mm, &priv->mm_wr_seq); > 156 mmap_read_unlock(priv->mm); > 157 rcu_read_lock(); > 158 > 159 if (!ret) > 160 ret =3D -EAGAIN; /* no other errors, ok to retry = */ > 161 > 162 anon_vma_name_put_if_valid(copy); > 163 put_file: > 164 if (copy->vm_file) > 165 fput(copy->vm_file); > 166 out: > 167 return ret; > 168 } > 169 > > -- > 0-DAY CI Kernel Test Service > https://github.com/intel/lkp-tests/wiki