From patchwork Thu Sep 2 00:01:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Imran Khan X-Patchwork-Id: 12470571 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 728C0C432BE for ; Thu, 2 Sep 2021 00:02:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EEC196108B for ; Thu, 2 Sep 2021 00:02:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EEC196108B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 4AC058D0002; Wed, 1 Sep 2021 20:02:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 459298D0001; Wed, 1 Sep 2021 20:02:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 25B738D0002; Wed, 1 Sep 2021 20:02:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0046.hostedemail.com [216.40.44.46]) by kanga.kvack.org (Postfix) with ESMTP id 1302D8D0001 for ; Wed, 1 Sep 2021 20:02:17 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C45DB182B0302 for ; Thu, 2 Sep 2021 00:02:16 +0000 (UTC) X-FDA: 78540681072.02.A701960 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf06.hostedemail.com (Postfix) with ESMTP id 53E0E801A89F for ; Thu, 2 Sep 2021 00:02:16 +0000 (UTC) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 181M6kR0004466; Thu, 2 Sep 2021 00:02:14 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-2021-07-09; bh=WYZKuo2MAYemhIEVapj+f/601jsRfCLw0nm1y50cYI0=; b=K4CC64bY7jmfUFgy4saPe6ONsfUxHXlHtjf1rEYAaGa6U6zF/B4JnMjG0Ow6IuI3+dWt lNZW2li7XguazOJfy7dD1bViM4Yf/vQIzVwTU3tyKnreqtwjeB1QoUQQsr/0wuUuQKre +OPy2beg1Dgatm26w0e/lAzShBAguPLVteWrFFBheiiEoK1qy4WvS9ZNJESu+CIdlmAm eoATG7bx6JWjeK4AvZnGLsuhMklqL5kXNStZoaNdgXyd6+XlKD/jmsvaQM/AJtXAbQZR oqNWaN1/0J/KYpLEgAxXhHYfo3wfuZf+qtzCHuI5WD9Yh16mIqIhisxAora9LNbcQeIj fg== 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-2020-01-29; bh=WYZKuo2MAYemhIEVapj+f/601jsRfCLw0nm1y50cYI0=; b=okmAPmgdfAOs98y/HBv2vyx1RsXsOzPVRYnVOqogzMdXIsDdaowmIwa7I2lOn6o6vP7U Dfu2o6ZV1mGN7w8+njEzotA1nGhJpSPyehNtJVLaq1PPc4LvJOF+wfOXL8Z2Kspngl23 ozdhtlAuJjcVl5Jg4QuCRDoOCN2F6jwORr4T4lLyViuyLYQoGMe2vkWzqSnz+LhQJeqS S2Mtt0YYOeqyZNe6hm9bgWEl0C+x3px3xe8pMbYf8e+ZKmAMJi+UxYFuWababpoG9+Vw nWHxI5PIiu91LlZJcURMchzGrZj+02EUeIQ6swEDPnddI10DwimFhvEvc8KxeLBd5Pmh Eg== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3atdw18vs9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 02 Sep 2021 00:02:13 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 18201p6s155792; Thu, 2 Sep 2021 00:02:13 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2109.outbound.protection.outlook.com [104.47.58.109]) by aserp3030.oracle.com with ESMTP id 3atdyw5pgk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 02 Sep 2021 00:02:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KyBy95cGT0/0B29ZiafisAEhkBfvWHPuHWrIgEEhtExNQYlYzc+Xlsa4ZokMzY53iWvpCB6kSIPjtEyLURv+dwX9h1qiH20S0ElsIrFWz41cncLsZPg0hUpkLcvzPkd03lbXID4KW04nfNuMxGeC6ThqBpy40WR29P+t1Mg8QDXrbeQ5NjOuF37Sf8tKYvXVPg0jIXlEkwmg8jGycTY/SvttMwc7oT9tKgwTGyEoauVtq0btzAJZarz1i4DGVWs69zAGdfuE+Hqrc0EU3wMrkM5J4s72Oh6FL0e8Y6hVWxH5yLG/jZrBvyzxpvS6OHOiLpMSENz7CHwPyTM2R75bAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WYZKuo2MAYemhIEVapj+f/601jsRfCLw0nm1y50cYI0=; b=lVoucd18zbg0mvUAltnFjidapt5wIQe1oskTA18C4uOAEikcg5gn1FC/7tXL4l1cjpEaKHiMffi/qBnuLiuROKuMzEGSMnKBttcsExGlxhfmU2AQcMziygRG5GX2NZ88bDrcJRXZKCYhtvz/iGCtygY3uRXdOW1DrwZW/DGkFCJdYucbYLVxJ0ETGCWTM5y+N3SMMHxVUDiFaGadNm0QoALZCM27l0m62DjF0Eow9JtcXz0/nAYUoFJPPNqmtp7tZXudihGpsj/3bxdTMwdVkFU7ckBhhC0c1DxUoVAAN02pmPV2v/ZYHL5MNVovQ7/YS1cpUpCXYgWDi9taQ0Wfmg== 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=WYZKuo2MAYemhIEVapj+f/601jsRfCLw0nm1y50cYI0=; b=rpSoRyUNy13OGuC0K8So9XHyg1lT4Va8QrykeAo11uAcVOWX8TRO8Xst7jmZmzoXvom3OXGx/xHrJiiXrj7nyLEiB35S7Wfpx4vhh/a4V/sabcwVN32ByWHCChIf8tmps1uRVkp1clb9rXaCD+Z8WpgZ4Pe9PaGWiJMAxf0qOtw= Received: from CO1PR10MB4468.namprd10.prod.outlook.com (2603:10b6:303:6c::24) by MWHPR10MB1999.namprd10.prod.outlook.com (2603:10b6:300:10a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.23; Thu, 2 Sep 2021 00:02:11 +0000 Received: from CO1PR10MB4468.namprd10.prod.outlook.com ([fe80::e1f7:a0f4:46c5:3df]) by CO1PR10MB4468.namprd10.prod.outlook.com ([fe80::e1f7:a0f4:46c5:3df%6]) with mapi id 15.20.4478.019; Thu, 2 Sep 2021 00:02:08 +0000 From: Imran Khan To: vbabka@suse.cz, geert@linux-m68k.org, akpm@linux-foundation.org, ryabinin.a.a@gmail.com, glider@google.com, andreyknvl@gmail.com, dvyukov@google.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v2 0/2] lib, stackdepot: check stackdepot handle before accessing slabs Date: Thu, 2 Sep 2021 10:01:52 +1000 Message-Id: <20210902000154.1096484-1-imran.f.khan@oracle.com> X-Mailer: git-send-email 2.30.2 X-ClientProxiedBy: SY6PR01CA0009.ausprd01.prod.outlook.com (2603:10c6:10:e8::14) To CO1PR10MB4468.namprd10.prod.outlook.com (2603:10b6:303:6c::24) MIME-Version: 1.0 Received: from localhost.localdomain (110.33.47.182) by SY6PR01CA0009.ausprd01.prod.outlook.com (2603:10c6:10:e8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.17 via Frontend Transport; Thu, 2 Sep 2021 00:02:06 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d288b9c2-a36d-471c-b2dc-08d96da4e813 X-MS-TrafficTypeDiagnostic: MWHPR10MB1999: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wJeCzcGm+xMYxKOdOrkHhpUbGMEkE9uQw/EdIOUyMM5S9OQJvnpLvopHvZ1kxh4l8HYa9aecWc/Tw8Ip7WMmEMXbHAeravUQsN7tO3+GBV2Lf6if6VoyQ0qHIIVmVbzSnkIdvpqsC35QH7Bn+2qb5dQNgmn5K/eYvc/NKMLBnkPOS9cSLeanTz1eCCF4hPnJL3rM7O7+XDX7NFDcJL1hTppAOwXedglrGzeaNOwwA8jb3yxghcovdCOvvOWrkBpA21Bm0gKJezbGX4GqZOHSVnSQy01IBMNuodZ6wLeVAtaFkFKkKnjEuC/6vooi/ITMrF6HoQbgLx5FL7b3kq5/WRZz75K4/njVo+MrDyHun2+7XD/vBv6sh7jXUdoFkrRaD5wC85BjfJCHNmIABO8nTcRUcGfqvAefEhd0Brfa9zMzISeQp8qdvhzP9AqiWTDvn5X9yTYraIpM9SEtWcdHnwTmw79vhSeDiuitsdT9s7GfsJA3hOQTvmRo21fq6l8kAdOwXV0cvVH+RmJ56BAx21fhQR1UWkPLitDieihC/8eGVN00NtbgMX6mz2lIXow3PGyyhjBxyqH8ZNOiz5MWthN7iP3jvWq9QE5BOmLr3tDky32oTk4A4Z+QeAyVo7V/zLKbXWISV4wsbemj7CYmijhhK41BthnZbghx3JufMfTpNWs/M8ed5NIEmmbcDJPbNLO7qIiz3+Ts6qBhbnBErw2O2NqFaK3cBSNEXlu1Vjy5PJDUDp1f71UmGnrcpDtegBCjTiBPjjei91zczsT8Zmgaif6dzf6GA0+zXGqkFFo= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR10MB4468.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(396003)(376002)(346002)(39860400002)(136003)(66476007)(66556008)(83380400001)(36756003)(1076003)(5660300002)(8936002)(52116002)(6506007)(8676002)(316002)(2906002)(478600001)(966005)(6666004)(6512007)(956004)(103116003)(2616005)(186003)(86362001)(6486002)(38100700002)(38350700002)(66946007)(26005)(4326008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: T+7N7jKLH42+Ih5gVlN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irwYcMNbcQAkA7li4wjH/TmIi5OhjZCxH8Tt7b6fqmymvhLZi+3gi/xryyYghPWpc5u540m65iMs33A3VqzziYGPQpgOlfUTWIqBkr5pra0ikPW+HaHhuGEQQ8mGIX4xI5GbBoiPJBr3kzD1wzPlPM9AuODlcw8RJsnjp6URWR1irg1tN8UNz7HXSngzAn8JWeX2Mc+yw2MBHzCzU6u3XZ1zI9XZUK+ygmDOoqgH3 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d288b9c2-a36d-471c-b2dc-08d96da4e813 X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4468.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2021 00:02:08.8839 (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: Q+bDrk/t9sT/21zuvLCAB8xJ320MPczZKTxc39evlPP5y8wKuKlLv2JwfPmpkBaw/78RcTqEOuXzI5SOdyHqGw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR10MB1999 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10094 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 malwarescore=0 mlxlogscore=725 spamscore=0 phishscore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2108310000 definitions=main-2109010142 X-Proofpoint-GUID: NYJ8E80B7aOJGZVLxexfaWHlNpcC-9uz X-Proofpoint-ORIG-GUID: NYJ8E80B7aOJGZVLxexfaWHlNpcC-9uz Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2021-07-09 header.b=K4CC64bY; dkim=pass header.d=oracle.com header.s=corp-2020-01-29 header.b=okmAPmgd; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=rpSoRyUN; spf=none (imf06.hostedemail.com: domain of imran.f.khan@oracle.com has no SPF policy when checking 205.220.177.32) smtp.mailfrom=imran.f.khan@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 53E0E801A89F X-Stat-Signature: gcup5adep1fpkog4iy3abrekncc7t45w X-HE-Tag: 1630540936-266977 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000019, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Original cover letter --------------------------------------- This RFC patch series addresses suggestion discussed in an earlier RFC [1]. Since earlier RFC was about SLUB subsystem, and current changes only involve stackdepot, I am submitting the patches in a new thread. The changes of this patch set are as follows: PATCH-1: Checks validity of a stackdepot handle before proceeding to access stackdepot slab/objects. PATCH-2: Adds a helper in stackdepot, to allow users to print stack entries just by specifying the stackdepot handle. [1] https://lore.kernel.org/lkml/2772cf56-4183-857f-d070-c54bceb5c8d9@suse.cz/ -------------------------------------- Changes in v2: - remove WARN messages - add declaration of stack_depot_print in stackdepot.h - make current users, which use stack_depot_fetch + stack_trace_print to print stack entries, use stack_depot_print Imran Khan (2): lib, stackdepot: check stackdepot handle before accessing slabs. lib, stackdepot: Add helper to print stack entries. include/linux/stackdepot.h | 2 ++ lib/stackdepot.c | 20 ++++++++++++++++++++ mm/kasan/report.c | 15 +++------------ mm/page_owner.c | 13 ++++--------- 4 files changed, 29 insertions(+), 21 deletions(-)