Received: by 2002:ab2:6f44:0:b0:1fd:c486:4f03 with SMTP id l4csp172537lqq; Wed, 12 Jun 2024 22:16:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXDoFOuIuxfTbxQ4/v+2/TCM7KHw2wOIAagzzeSvb/zBPwSgFrA0aY6/1Zgc7FhuRAyYPE5FxLxcSPQqyBvoJe6uq5vAUzgp3SV2ZmW7g== X-Google-Smtp-Source: AGHT+IFufTGWW6DwIef02IKqrM8R4cr7SSOYdOAguSlXlfAmRaeuLxObI17NwRoqMwsayOW2Pv1b X-Received: by 2002:a17:902:d508:b0:1f7:19d6:fb0 with SMTP id d9443c01a7336-1f83b716593mr42502545ad.45.1718255781377; Wed, 12 Jun 2024 22:16:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718255781; cv=pass; d=google.com; s=arc-20160816; b=s3tmL9oEZHQj7py5eWxJ2ADYP05dP1r7+VehWUkaGMSVhrodjy48bRC/TxCzLSK9VF QYMFghoQ3oOH/h2gFVr5Vleku+SHpdkBWtkHJPv+LZheYCEaTv8en46Ym7NNUw9QmVfi vxJ9yANV9I8x+kEhr0aL/EDcCqO7pQap5nPXMT/kQNUj7Vi9c0x54PB0sQZgnKBa6IHC ZlbSgG4Lj9SFcyXb+w9nDRwZT4A36kRBtReX8oM8WGzIW/wJnpFAB5w/DTI327niRovB GO1CrgpSTW1LWS6zPQn3PMA6rUP6FNw/Ts/ETvHrbhJwvSWp/edeeoE3i8XhNhkWxmIa BLrA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:subject:cc:to:from:date:dkim-signature; bh=EtfUUHuwzr569t6VOnXEXdZrMXfWjbd0r5DYKCbZN/4=; fh=a/LS3QIaGL4mfbHYYE/02mmUGHQMUcWEbIl3nehG++c=; b=z1n0Wo25Ax/aM6KhIl46B7L24QoCuGxW4Juo6esoNy3C5h5lfCeRQx6Sy1fi/oOYsV Be7Qes/UJJXr381G27oWFwy57tqJsY3pr50LhkFo16sEQVT7UTtySqy9jeUf9GzkO2n0 4yV8ho80sdUtCB75CcRenvp6rtimhGTNcmreROOuIt+Z3E3IchGRrpGvFI4MdNhjhHao VX0SaV8K+mzbycqkdEb4I8TvDitjF+Joog7mVxFUnscPAnIuGo4AQS4H93XzWORFwclI MfLdqlTlYk2xI6Mc4TRfbx5z0hNV0oQwmuXm1Z0s5A+39g9zWoxvKdvgEQHQjycW9tm0 JQEA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZSqQmfR3; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-212568-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212568-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f855e3c6ccsi5606625ad.121.2024.06.12.22.16.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 22:16:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212568-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZSqQmfR3; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-212568-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212568-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8700EB232DD for ; Thu, 13 Jun 2024 05:16:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55349136648; Thu, 13 Jun 2024 05:16:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZSqQmfR3" Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 779EE86246 for ; Thu, 13 Jun 2024 05:16:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718255765; cv=none; b=mNzPrdsQz8qGuuKTkef82uUUwcjU124hIrpZhf82+UrUPrSEEvtywX5D8Irm7Xbhl6MUAri5F0WsjWm9qqt03gLxv8Rw9/89H0df0AGJtwIWc7XbsQPjQ+8JP2QVwOownuOHNyzWVPQ1T4TeqodeZFjIHV8gmbiT2znrZ2o8DsQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718255765; c=relaxed/simple; bh=QUdxVsVlxJfG4mzBixKpG9z8qTNGFWMGeRu4fJuo5gs=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=YNKY1BdOzsuEsQzL4CTsuubd9XeFVyjNEOK0XX1L7t+C8lJeW9Eb/syZCt5Li0H6QgLxzEQYNuQhgTINOlyNtpMRo5hb/Qg0e3WNE6b7V9d/pvwhiQ6vjw3/hx+sLsJ8w8GGQ36htUkZLfp4wDHOAhBHxO2ijox80SP23BQvl1A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ZSqQmfR3; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-35f23f3da44so705538f8f.0 for ; Wed, 12 Jun 2024 22:16:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718255762; x=1718860562; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=EtfUUHuwzr569t6VOnXEXdZrMXfWjbd0r5DYKCbZN/4=; b=ZSqQmfR31d7anHMztU6KBYny0Fp3Ie0GO7VTDVNg7vQfZ4AQ38/9iU2FkqodujOqn+ 9AQi6CDg0JDy4mog1JvECamvHtnTWgq3c20Yj3v5gDMa7XPV5GKMzHKKZJ7w8uHH+AHj aBikZ1cffFr+T9hJuxVvmwcYyY/OETH/aA5uIeWRNTiUU+suyvLqZzVclf0g+Y3mJDTV 8X7B0J//bGiNfVwuTz+rs9OY8PzMJjrlHyrmw4P7KLhK3gRH+mGv6aoyvtcvswbB0JOs 9pdapVwX4mETnWtyNqjy+4jvL9GlE8+4HdB0bLG3xfBWaFhEXL2hgUmc3+5KL4aNId1H d3+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718255762; x=1718860562; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=EtfUUHuwzr569t6VOnXEXdZrMXfWjbd0r5DYKCbZN/4=; b=bKAogNBbitHyMvrNJzKcQ4eNhWQSiv7pqITungqWmJo6f8wHwD4STznWH5OzB4Fsdb KESjt0fjqHdjX6TdwiurKXeT7SdElHMDG0hRHNriFsLo4V2aZs4Nldn26Is6pcrABqg9 4xiihRhIXj23WqG0i7+F+OLjHBTjaZpM9rqQBDNQmtndy5TWlsomRvaQKYERN7aHO/rR CwCo5p6BFYcvHqQ9e5CLpHrlnfyehPsoYdZJpPcMmg7YMrNeamgOSYLlaqiM/+W7oFKW GWGj42hVWW9u5T5esoZd3TOWuZNNKfvA9BuGIuK9dtXlOvQPNzB7Vn0uOiG6fuUbAfXG Ohnw== X-Forwarded-Encrypted: i=1; AJvYcCWXj4WAaTtJAfGFm5dc7wgtXPj9/uWbhxx2UladZpykVVbXmHm6puuZlsC8erLSmuFTB+M1WypZpRL5bZDf63OM3yVr2TMfuIOpsuGR X-Gm-Message-State: AOJu0YzYFkfmitQTfnuSiGDaYkJXk9nSFVbl/8kXoRgkfAvSIX3SeJQR 8Qc1uu3aE+rB+aH89Tydq+PMiH/F4lT8eUkYK3DGoeosbPBZ/zXAlysWgquiFUw= X-Received: by 2002:a5d:45c1:0:b0:360:73f4:7937 with SMTP id ffacd0b85a97d-36073f479bdmr610203f8f.6.1718255761516; Wed, 12 Jun 2024 22:16:01 -0700 (PDT) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36075104c17sm573903f8f.106.2024.06.12.22.16.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 22:16:01 -0700 (PDT) Date: Thu, 13 Jun 2024 08:15:53 +0300 From: Dan Carpenter To: oe-kbuild@lists.linux.dev, Martin Oliveira , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev, Jason Gunthorpe , Leon Romanovsky , Greg Kroah-Hartman , Tejun Heo , Andrew Morton , Linux Memory Management List , Logan Gunthorpe , Martin Oliveira , Mike Marciniszyn , Shiraz Saleem , Michael Guralnik , Artemy Kovalyov Subject: Re: [PATCH v2 1/4] kernfs: remove page_mkwrite() from vm_operations_struct Message-ID: <11acf031-a778-4ed9-8ece-c6d9aa0bce3f@moroto.mountain> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240611182732.360317-2-martin.oliveira@eideticom.com> Hi Martin, kernel test robot noticed the following build warnings: url: https://github.com/intel-lab-lkp/linux/commits/Martin-Oliveira/kernfs-remove-page_mkwrite-from-vm_operations_struct/20240612-023130 base: 83a7eefedc9b56fe7bfeff13b6c7356688ffa670 patch link: https://lore.kernel.org/r/20240611182732.360317-2-martin.oliveira%40eideticom.com patch subject: [PATCH v2 1/4] kernfs: remove page_mkwrite() from vm_operations_struct config: i386-randconfig-141-20240612 (https://download.01.org/0day-ci/archive/20240613/202406130357.6NmgCbMP-lkp@intel.com/config) compiler: gcc-12 (Ubuntu 12.3.0-9ubuntu2) 12.3.0 If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot | Reported-by: Dan Carpenter | Closes: https://lore.kernel.org/r/202406130357.6NmgCbMP-lkp@intel.com/ smatch warnings: fs/kernfs/file.c:462 kernfs_fop_mmap() error: we previously assumed 'vma->vm_ops' could be null (see line 459) vim +462 fs/kernfs/file.c c637b8acbe079e Tejun Heo 2013-12-11 416 static int kernfs_fop_mmap(struct file *file, struct vm_area_struct *vma) 414985ae23c031 Tejun Heo 2013-11-28 417 { c525aaddc366df Tejun Heo 2013-12-11 418 struct kernfs_open_file *of = kernfs_of(file); 414985ae23c031 Tejun Heo 2013-11-28 419 const struct kernfs_ops *ops; 414985ae23c031 Tejun Heo 2013-11-28 420 int rc; 414985ae23c031 Tejun Heo 2013-11-28 421 9b2db6e1894577 Tejun Heo 2013-12-10 422 /* 9b2db6e1894577 Tejun Heo 2013-12-10 423 * mmap path and of->mutex are prone to triggering spurious lockdep 9b2db6e1894577 Tejun Heo 2013-12-10 424 * warnings and we don't want to add spurious locking dependency 9b2db6e1894577 Tejun Heo 2013-12-10 425 * between the two. Check whether mmap is actually implemented 9b2db6e1894577 Tejun Heo 2013-12-10 426 * without grabbing @of->mutex by testing HAS_MMAP flag. See the c810729fe6471a Ahelenia ZiemiaƄska 2023-12-21 427 * comment in kernfs_fop_open() for more details. 9b2db6e1894577 Tejun Heo 2013-12-10 428 */ df23fc39bce03b Tejun Heo 2013-12-11 429 if (!(of->kn->flags & KERNFS_HAS_MMAP)) 9b2db6e1894577 Tejun Heo 2013-12-10 430 return -ENODEV; 9b2db6e1894577 Tejun Heo 2013-12-10 431 414985ae23c031 Tejun Heo 2013-11-28 432 mutex_lock(&of->mutex); 414985ae23c031 Tejun Heo 2013-11-28 433 414985ae23c031 Tejun Heo 2013-11-28 434 rc = -ENODEV; c637b8acbe079e Tejun Heo 2013-12-11 435 if (!kernfs_get_active(of->kn)) 414985ae23c031 Tejun Heo 2013-11-28 436 goto out_unlock; 414985ae23c031 Tejun Heo 2013-11-28 437 324a56e16e44ba Tejun Heo 2013-12-11 438 ops = kernfs_ops(of->kn); 414985ae23c031 Tejun Heo 2013-11-28 439 rc = ops->mmap(of, vma); b44b2140265ddf Tejun Heo 2014-04-20 440 if (rc) b44b2140265ddf Tejun Heo 2014-04-20 441 goto out_put; 414985ae23c031 Tejun Heo 2013-11-28 442 414985ae23c031 Tejun Heo 2013-11-28 443 /* 414985ae23c031 Tejun Heo 2013-11-28 444 * PowerPC's pci_mmap of legacy_mem uses shmem_zero_setup() 414985ae23c031 Tejun Heo 2013-11-28 445 * to satisfy versions of X which crash if the mmap fails: that 414985ae23c031 Tejun Heo 2013-11-28 446 * substitutes a new vm_file, and we don't then want bin_vm_ops. 414985ae23c031 Tejun Heo 2013-11-28 447 */ 414985ae23c031 Tejun Heo 2013-11-28 448 if (vma->vm_file != file) 414985ae23c031 Tejun Heo 2013-11-28 449 goto out_put; 414985ae23c031 Tejun Heo 2013-11-28 450 414985ae23c031 Tejun Heo 2013-11-28 451 rc = -EINVAL; 414985ae23c031 Tejun Heo 2013-11-28 452 if (of->mmapped && of->vm_ops != vma->vm_ops) 414985ae23c031 Tejun Heo 2013-11-28 453 goto out_put; 414985ae23c031 Tejun Heo 2013-11-28 454 414985ae23c031 Tejun Heo 2013-11-28 455 /* 414985ae23c031 Tejun Heo 2013-11-28 456 * It is not possible to successfully wrap close. 414985ae23c031 Tejun Heo 2013-11-28 457 * So error if someone is trying to use close. 414985ae23c031 Tejun Heo 2013-11-28 458 */ 414985ae23c031 Tejun Heo 2013-11-28 @459 if (vma->vm_ops && vma->vm_ops->close) ^^^^^^^^^^^ If ->vm_ops is NULL 414985ae23c031 Tejun Heo 2013-11-28 460 goto out_put; 414985ae23c031 Tejun Heo 2013-11-28 461 927bb8d619fea4 Martin Oliveira 2024-06-11 @462 if (vma->vm_ops->page_mkwrite) ^^^^^^^^^^^^^^^^^^^^^^^^^ then we're in trouble 927bb8d619fea4 Martin Oliveira 2024-06-11 463 goto out_put; 927bb8d619fea4 Martin Oliveira 2024-06-11 464 414985ae23c031 Tejun Heo 2013-11-28 465 rc = 0; 05d8f255867e31 Neel Natu 2024-01-27 466 if (!of->mmapped) { a1d82aff5df760 Tejun Heo 2016-12-27 467 of->mmapped = true; bdb2fd7fc56e19 Tejun Heo 2022-08-27 468 of_on(of)->nr_mmapped++; 414985ae23c031 Tejun Heo 2013-11-28 469 of->vm_ops = vma->vm_ops; 05d8f255867e31 Neel Natu 2024-01-27 470 } 414985ae23c031 Tejun Heo 2013-11-28 471 vma->vm_ops = &kernfs_vm_ops; 414985ae23c031 Tejun Heo 2013-11-28 472 out_put: c637b8acbe079e Tejun Heo 2013-12-11 473 kernfs_put_active(of->kn); 414985ae23c031 Tejun Heo 2013-11-28 474 out_unlock: 414985ae23c031 Tejun Heo 2013-11-28 475 mutex_unlock(&of->mutex); 414985ae23c031 Tejun Heo 2013-11-28 476 414985ae23c031 Tejun Heo 2013-11-28 477 return rc; 414985ae23c031 Tejun Heo 2013-11-28 478 } -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki