From patchwork Fri Sep 13 14:06:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13803550 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 556EBEEE27C for ; Fri, 13 Sep 2024 14:06:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B93786B00C5; Fri, 13 Sep 2024 10:06:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B42DA6B00C6; Fri, 13 Sep 2024 10:06:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 96DF76B00C7; Fri, 13 Sep 2024 10:06:56 -0400 (EDT) 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 779B16B00C5 for ; Fri, 13 Sep 2024 10:06:56 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 3D05E1A1F51 for ; Fri, 13 Sep 2024 14:06:56 +0000 (UTC) X-FDA: 82559891232.04.24E6B6E Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf27.hostedemail.com (Postfix) with ESMTP id DBCC540015 for ; Fri, 13 Sep 2024 14:06:52 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=FY8vGHNx; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=UQ+oCMSA; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf27.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1726236306; 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: references:dkim-signature; bh=SXBnQ98f/f7P9ZdQa4POAoPEVxiDNUZRkS+JU2o9jyw=; b=QK0ytneuKSs+H7d3cty9jJnoehRBTuiv0YIw6FS+w1m3M+yqtcPrtE71zIzbhFM4rR7qsu pPjz/XCalRkX41oTBzwardCDTUvp62IEusYzuQ+9WXzZI7/FTMqLzVsr0mgi4kpf+I7/WN 97w1IAfbYkW57E2II9gggJMjsYzuNnU= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1726236306; a=rsa-sha256; cv=pass; b=UeqrBmrC7F8WASXT87h/9DhkYdnNudHLw1/nQMX5WgvUzRseSHli1zs+TfswTt4057FJ/R N3ScGdfhnFZEw+fjmiWTJlUk/qFHK23nqWMHMIupspdlfeZqj2LJsSrsTh095WOHc0zVx7 9YzCgr+SHZgj+AbxWcX4eTfG0rJd0Bg= ARC-Authentication-Results: i=2; imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=FY8vGHNx; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=UQ+oCMSA; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf27.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48D9YKeT012300; Fri, 13 Sep 2024 14:06:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= from:to:cc:subject:date:message-id:content-transfer-encoding :content-type:mime-version; s=corp-2023-11-20; bh=SXBnQ98f/f7P9Z dQa4POAoPEVxiDNUZRkS+JU2o9jyw=; b=FY8vGHNx5Y8bc0xfc/MXzcxJQaP4su 2tGr3wrlgUIaNvt2pfx4D7liRqTv4ppYmlpZvqMaiGBL7i9g+9wyMnevWOYbzYFY RPPRfay/RGQXGwx/uRBBRqFik8kA6Ol+5Rn8gfAzH+RjhiQ1hQilRgt37tg4CpPO vpU5satBVt6DjqRhy59ouyuvVhu1t5rqrrPqR7bo3l5Y3iL6O5n+3jcmo36ui6tj DkjhgKOkWVYbF9M5js99C+zpnaHLnpQvqPExvIK+gZI7KtFW7+jcNZeqY2Vzenm+ ylYNhCrvudpv/bvCVYVuCKcZPGmemh7Or9k8mgp3S/6AKxS+sKth9PjA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 41gfctnq9q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Sep 2024 14:06:49 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 48DCuGNU031606; Fri, 13 Sep 2024 14:06:48 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 41gd9d5y1b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Sep 2024 14:06:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pfFpQ7qNTd0VzAUgqfQ3xCgbBuZMmQrR8X1cGSTlC/4EjqnDIaBwMhWQrumQmeG+tGUxTkzFS2KD0KQeIYs+Hn16+gsn0mVHG2FxB2lPRWDhT3xvnwd//N+wZyg0Ku/hUgs96dWdXAo/K7angtNJYfdICIyWlzQKTAi8aE/z+wmbBAPLBBkmAP1EpIObtJrXiRKm0D1xwKPW6S6o4YHspuFFTn6vb7wZVRQR7iiiKs/J+2GQ7ZOp4Sw1lN7O0jlYvWz4WZBRFChkWla/NviPVrs5mQ7Ix2sW2T18XZ3cC/Q2gcoCNJZjTUp0k+SPonSZZns9quVnJcc8ZCUoHi4NZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SXBnQ98f/f7P9ZdQa4POAoPEVxiDNUZRkS+JU2o9jyw=; b=cr11nmH0AVMQUdzG58N15xfCe/B8iaYpOPgFViCzRYfby3RkU1ezLWBqX9m31l2xxjbeUWIyAk9erzn2b7wUBh+EXaYhlWuOyIuRfHGdVutqfAgBg/livvCiYwLnguhwhGMFYdYl+11JI58LvO/mgtSSqTHyCta/p1anVbG6WZks01phBxgxDFhlPQdjmJbdI3ZdtOTCeHA9w3J9Lj3A9SiO+tzU71PNu8IMRyHvqOzc4NLCN2ixCBs0BC9o0pfDNDEVtzAjxfFnlQScBh4N9JCuiYBeCuBYYINqGTlj6t6zhT2aAuoPbBA9Y9ZsCr60M7jz3EaNrzYtB7EQBrtciQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SXBnQ98f/f7P9ZdQa4POAoPEVxiDNUZRkS+JU2o9jyw=; b=UQ+oCMSAsq3gBuJBUsTJRbxqMn5suvFRqrbYzWBsGU5hb2I/hwMqIWJMno5x0uGQSUensC5pxoxydSb619+3K0t/TV/QmEh67gDhizIOFIyof8VYQefhMn2AIoSR4DiU51OkwUei4ksT2RsCQ8aqzCFR0GnmZmNcsX4uNLRPxDc= Received: from SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) by SA6PR10MB8208.namprd10.prod.outlook.com (2603:10b6:806:435::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.18; Fri, 13 Sep 2024 14:06:45 +0000 Received: from SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e]) by SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e%5]) with mapi id 15.20.7962.018; Fri, 13 Sep 2024 14:06:45 +0000 From: Lorenzo Stoakes To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Vlastimil Babka , Liam Howlett , Shakeel Butt , Suren Baghdasaryan Subject: [PATCH] mm/madvise: process_madvise() drop capability check if same mm Date: Fri, 13 Sep 2024 15:06:28 +0100 Message-ID: <20240913140628.77047-1-lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.46.0 X-ClientProxiedBy: LO4P265CA0126.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2c6::17) To SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR10MB5613:EE_|SA6PR10MB8208:EE_ X-MS-Office365-Filtering-Correlation-Id: 862e0321-f14c-4db6-4a11-08dcd3fd4d1a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016; X-Microsoft-Antispam-Message-Info: G9mdYFHnTReNJ34NjcZmIY5YSwYqo5X6Ui3vKGoZ9RUOwbur1j1+yrMyi8UI67wLxYWaYIOgXaQOTh/Gy7m+eLQJ01vviTb+3asNp07Fa/69Lr0sersJYXGqjJU8vwcdKd3It0UqGCGXnS4a4Mvzksw6/TvIO63bpcLx2FeDKM/C4HSCCtiI6ZpYVKEYYu0kCf7x6ZF81azRv380HjKO+DpJw5to721l6Bw6QdsugRK55UZ17sdLxZ4odqYphATah2PNP8xOUl8+vh0mcplhGgUkKctOrz5G9pHYjPncyFC5LRiJEFjQC5ETbjtlJX+rLSgMCuJC0etPFxu7tcLq6pM+G9e+fseEEVMjI8OS2XefHMhFf/Z4/qrLgWkAv4llgnD8KIUiewPj0uanVfohw4bv4OghHOpDCr0b2zpojPGWh6jxOlercnrJRVvdYFkwNPgU7pwk4ne5J/g+dfZzdQwkGxmFPohl80s1jVjAmpSp4H6xJyAd2cY2CuDcbNNfKraWo86/CYnTZyI2NLsam3owKtCacm2Uos1hn/02riWYAlHasopNw6dtfRNuTObemfgV3NFt9UDg1ZNGcbUtK9NsWZOaytF1r37Dp9/2lOpzkoTF3vDmfIVxNPEp2K8BxJrbjcAEFrlssX31tVZo9Gi3k+eJBfukMJ6TWnMDVy9ER1sX0B0LL2g6UhCckKGEKFOLOCFCtcyODnwg+aHqawP4wk279tLXqzt3jZGng0c2wZYANy9SuiN1v3tQoVr5PCp8cy3EKJJUaRlFvky2rPis6n9Uy6XWj11ukYPKObChFQ8QyZbl/owwBDoKkKWBkpohxT8KczAd6Gfx5uTJolXDczdoR2QsjTx0WiqaccRW2X9tO3WNMU3rIaaT7PHSf9kbzxDbC5q0LQG0GLsvrMT+f1JEm4RCSY13YCMlc0Y/SK7QIVDppJFaYDeZwgtDndyrbzKyyU3LC3FfrT05iip6YygoNvBsk3xPkWOJhdAv8UthhzOpPlwPdbPbIYuxfbgxdcicFLn4JvcjwNK+9WK84T1W9xCwY+In260mkuzNJMjXuL63VJKFrnCGWC7oRX8A6Mo0y3fLEgtlAk01W8fPB2DrektclFUQ0Avk8arK6x4Vh5tazWXOAikBlAgZB416ZOQNWfc5JMRmh/s0Yigcqoup8S5+3fPiHY8RhpTVdLYNQiGsevB1b13+uJQG2oUzpeiNGzkQYfZyEKJm8VwOtraYLcdDkkQfbG6CxIZ4b947zEja+o23CBBJin4N97cW65gjzMVvJ4nYHjv2UR/BqhWo3uotxmX86bRxbWpNVBj3Mvf9TSgdrZCMIPCvb7/98BkRPQwRi53RumyMqw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR10MB5613.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GTNODCaKjEc3yL1xUmBA7arGivakCBD7/Ql/qRlA1O+rnErxHb9kBt3tN4wDxTbGyWs+COwMg8VxOsIfYlhljGIS43XQdiJIUQaPMhhrx9w6oBsa2QDMWEQhiw6RlOsJ/qVMRCgWgT7EewFDubrjtNdUHmCiulcXHKVU92GFzefLV9plHMt+BVQ3lhBIZPvoJ0kiUlJTzNKMzIIDrqPZ7J8B5XdaT1UDT1pHh2X7V52cVaESXWYsspXSojl8LASkDBVn+A6xYMZ0bw70eB/yZwX4btPgAHcdOGw8vStS2/Y69RDKwAgfBWFkJoCwhJW2i7hXzoIk5UQfSdyY6dPHOKK7qlga6Q3nPxXmMgwsTWf1s3MNvMlqt68GaqHxtmEOyIOOjlMFTwUAVBisk4rKLh2rpB7UP6eJwnzJVFVsVpkPlyXODF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qF4zQYckn8YFVwdzzR1BvR8jO8L6Wp85VNS/StrPjt5Bhxr6DQYZr/CIJbXCSUUL/Tv0BATROGbpT50ZczuhIZBgdkokWTIkGhhOPBlDQyVn0ZK8gv9V6BGYC3gx2ca1cbuPlLgejf/YAvi59cmuUhB7B6gysrgQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ub1dl3obWcEfNzpScaDzDwaspxgZ8IFV4gl5Yv75TSnzqoUKxpY1gdyh6gfGHnd2qhWMQBLPV9WU0XBNv4zYjdd4ia2CaoRgPBTVzgfsyE71NULbFkWcVsass0I/0zIVrXgLaLeReyTpn4Z8LJ9K4DRSDYgPRTPrhGhoZkh10sn/7iimMofHlUyv35eaMWC7a6Hi9EzFZwhu5sYLNGk6CogXXBRsEzAhzbT/fHU5ybaJ1zVkVFxmetgPm4hyTnXH8HTRDbQwDfGNZyyMKJ9rOknVdS/+3pG+xpIQxlz0WtKD7zl0sQyT0h9GL5mV9zdIkL0+n0nQFgW4LpmQ8lshmKRBrjYe96jVo/HsTm/sjw+D2up97DA4UMYdPmPT/Rtgt3SWr69Bco4wD3fgF49aiUgNXyki7Gwn4QPnz1QaoMIyQ5d1nxy5s+hgOkmNTfFvJpYIyrFidcYr//rhHD90rAqMmu70U6Hc8TjAxn92KtA5bMxN0BsBuqeurGnKFdWZmLegOXXRLvsMnozRLLIZ7S0bg6nxc2Hbs21ZeLC9WeNs74n5qo6Wrlu0zQAcx/+XoRszSeXMct7f913N85jUucTdsGF9bPYynX4AhkYXxkM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 862e0321-f14c-4db6-4a11-08dcd3fd4d1a X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5613.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2024 14:06:45.7441 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: b/cNBAjnFOL97ebhbVSOb7PkHm0BCz1L3vqBPIFtLHXCZerK2BIl3G2GA2prSF0fTPqQP3cij7nMMq9iIJu2rQEE1fwU0q3gn7UzuPq3iXo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA6PR10MB8208 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-13_11,2024-09-13_02,2024-09-02_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 phishscore=0 mlxscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2408220000 definitions=main-2409130098 X-Proofpoint-GUID: KDQA3dLV31MLXXYP01x9HwFc3C3-jqOw X-Proofpoint-ORIG-GUID: KDQA3dLV31MLXXYP01x9HwFc3C3-jqOw X-Stat-Signature: 6cpg6zrntam8cs5ax89p46qto5xdsawf X-Rspamd-Queue-Id: DBCC540015 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1726236412-803397 X-HE-Meta: U2FsdGVkX1+fzIe76yYm3rC6s+9/o5oCPVGT/xIUqGFsc57eBJ7gFxiOJQOmQipZRAfRQEzQbqDwdyh2bzGU54QaiblAi8BNd1K19CHqW1XWtTQc8NtnwFoenm9XVod8ulUEvm9WicnxoamkTsAo9xhWBFDbjQiQ6D1DqYkpO5c4WEDjfyO/hN4hURiHApBgkqwnVIgRB92GRH9pkgAIyhVJMam8PZAi6sTLRC7gr5WAv2xowFXBgIauzlHuGma4YG9lt5rYhygvTa5IlnSmUBxhC/AD8wrGaRu1c8kptqvCT1PZhCCwF9S5tH26So8zSa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xzvXVQH40+2p/6dGzCXABHiW3ZzFNEGSAnQBV4BCXy7M6lkX8FuhpgCHa8DiqjT/zFjbRz0i8WKfEVA== 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: In commit 96cfe2c0fd23 ("mm/madvise: replace ptrace attach requirement for process_madvise") process_madvise() was updated to require the caller to possess the CAP_SYS_NICE capability to perform the operation, in addition to a check against PTRACE_MODE_READ performed by mm_access(). The mm_access() function explicitly checks to see if the address space of the process being referenced is the current one, in which case no check is performed. We, however, do not do this when checking the CAP_SYS_NICE capability. This means that we insist on the caller possessing this capability in order to perform madvise() operations on its own address space, which seems nonsensical. Simply add a check to allow for an invocation of this function with pidfd set to the current process without elevation. Signed-off-by: Lorenzo Stoakes Reviewed-by: Liam R. Howlett Acked-by: Vlastimil Babka Acked-by: Shakeel Butt Acked-by: David Rientjes --- mm/madvise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/madvise.c b/mm/madvise.c index 4e64770be16c..ff139e57cca2 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -1520,7 +1520,7 @@ SYSCALL_DEFINE5(process_madvise, int, pidfd, const struct iovec __user *, vec, * Require CAP_SYS_NICE for influencing process performance. Note that * only non-destructive hints are currently supported. */ - if (!capable(CAP_SYS_NICE)) { + if (mm != current->mm && !capable(CAP_SYS_NICE)) { ret = -EPERM; goto release_mm; }