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 X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 7928CC43463 for ; Thu, 17 Sep 2020 20:00:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0435020725 for ; Thu, 17 Sep 2020 20:00:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="B5tBJsAp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0435020725 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 30F466B0037; Thu, 17 Sep 2020 16:00:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C1006B0055; Thu, 17 Sep 2020 16:00:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1FD6A6B005C; Thu, 17 Sep 2020 16:00:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0003.hostedemail.com [216.40.44.3]) by kanga.kvack.org (Postfix) with ESMTP id 0985B6B0037 for ; Thu, 17 Sep 2020 16:00:13 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id BB9C98249980 for ; Thu, 17 Sep 2020 20:00:12 +0000 (UTC) X-FDA: 77273619864.29.stop35_5d0df8527125 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id 8F6C4180868E6 for ; Thu, 17 Sep 2020 20:00:12 +0000 (UTC) X-HE-Tag: stop35_5d0df8527125 X-Filterd-Recvd-Size: 3625 Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Thu, 17 Sep 2020 20:00:11 +0000 (UTC) Received: by mail-qv1-f52.google.com with SMTP id cv8so1636411qvb.12 for ; Thu, 17 Sep 2020 13:00:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=FcATxbYZBMVHEkuKO14eQwM2nyrA3jRYaXynFTRak5A=; b=B5tBJsApi6nF74pOFNLqnSm2IXAw95bOf1OlXK6TLWge3s+kYLbxmJudGkkiDmHeRr ClTMyt4c/TTBjOUiJoEpoewPD5CPOsoeIz4qfiMVih+85UK/wvUdsQDGIk4O0NClgC3G SN9SVFg/k2zqVGhwVQszJeUn5V6flliB/588ldJTgA7ttvOX2kyBk/fXKSvCpi58LRnx BUWW06aqYbwTRDej/hZwUNFOYwcMi+ONAFeNSp4+KIxf7OlMa6eUMNXIQewSPp368kdy ME5wHrDEYSTNMKBCzYTT5p7fD3luBddh+D/LxONoEIlX9o9spM2/Pz1wh0omPxrXi2wP gyrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=FcATxbYZBMVHEkuKO14eQwM2nyrA3jRYaXynFTRak5A=; b=GFvs15xeOhnyqqWXHNp5A9jz8gJwyjmU2ScMP6PkctNbbP2T1UsyY8BpUNDPDrIynZ P1mDWkbYkDtfiWLBHKfUhtLfmcTRmtDvQ9V4acVyYP5+TLUTLaqHTbzPWYeikONO01aI 2R267losqBHMV2FT91Phq+7H5gHpQ4SCaDHNxcZG+p1m7sVQrRxdIVJENKUNoZREJwIn dr3TpTwP3hw0Huxpvni4u2T5o73OX+UVXz6rVzIV2eOzQrACl+YMO6FpuHmPrv6Hxqmq DrPxRzYS+5mHOUk87t4aYoEsVztQpJnbpUIvmp4qqBe4GYVWh/O2dOoyk54Ys0MeB5pU 5BIA== X-Gm-Message-State: AOAM533DT1lQf4e1bv0a6dyC/AMDNYDoQySnzuRWG1QlheU0TmKVOEw8 RZZLyDoEQklH3poAsG34FfYgtbAwIzgFvRf3d/2CK2iy4Y+wJw== X-Google-Smtp-Source: ABdhPJxXrZzYEHv3eLIvtEmVKEqs38c/1qGDRMfi2fyFRmbSAfdS164Ht844ELYjeGSk9okwX+CbM3jxR23GwmlE0D8= X-Received: by 2002:a0c:90f1:: with SMTP id p104mr30577891qvp.15.1600372810859; Thu, 17 Sep 2020 13:00:10 -0700 (PDT) MIME-Version: 1.0 From: Derrick McKee Date: Thu, 17 Sep 2020 16:00:00 -0400 Message-ID: Subject: Mapping two KVAs to the same page To: Linux Memory Management List Cc: davem@redhat.com Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.011871, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi, I am trying to make a research prototype that compartmentalizes kernel modules. Part of my design involves embedding an ID number in a kernel address, which I extract when I need to check for proper pointer access. I've modified the module loader to place the module in an address that contains the ID. However, when the kernel invokes one of the kernel API functions the module implements (e.g., inet6_create), I'd also like any pointer input arguments to also have the ID embedded. Instead of doing a deep copy of objects to an address that I allocate, my thought is that I find a page aligned address that contains my ID, and have that address map to the same page as the input pointer uses. I then can use the new address as input to the API function. Is this possible, and if so, how? I have tried using __get_vm_area_caller() to get a free address in a location I want, and then map_kernel_range() to tie the input pointer page to the new address. This results in a segfault in mte_sync_tags() (called by vmap_pte_range()). I also tried __vmalloc_node_range() along with map_kernel_range(), but this triggers the warning on mm/vmalloc.c:211. Any insight is appreciated, thanks! -- Derrick McKee Phone: (703) 957-9362 Email: derrick.mckee@gmail.com