Message ID | 20231016143828.647848-5-jeffxu@chromium.org (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 76052C46CA1 for <linux-mm@archiver.kernel.org>; Mon, 16 Oct 2023 14:39:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9878B8D00A9; Mon, 16 Oct 2023 10:39:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 90F788D00A8; Mon, 16 Oct 2023 10:39:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 518D38D00A9; Mon, 16 Oct 2023 10:39:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 375158D00A8 for <linux-mm@kvack.org>; Mon, 16 Oct 2023 10:39:06 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EB0501209D8 for <linux-mm@kvack.org>; Mon, 16 Oct 2023 14:39:05 +0000 (UTC) X-FDA: 81351581850.29.8B9D103 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by imf06.hostedemail.com (Postfix) with ESMTP id CF6CA18001E for <linux-mm@kvack.org>; Mon, 16 Oct 2023 14:39:03 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=nBulV2zF; spf=pass (imf06.hostedemail.com: domain of jeffxu@chromium.org designates 209.85.215.177 as permitted sender) smtp.mailfrom=jeffxu@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697467144; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Ousg6g8beQYrtnIXHdPl+6es+qhdKBwPjUl+0WcHVK4=; b=yENWyAXaewghfADLDzX3nciikG+NKfzH5qMo39q7QEpa70PzTEOJWE32F90rL7BB5F5CKt SjAotjn8vj+XK5/YwaeVXkA4OHeTNC60c7Fony51B7jSGLoi4Il7t6t2zb3wGXZLrFOWPd ia0DRKnkb3P9a8UTf+PzhknYUC4nbC0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1697467144; a=rsa-sha256; cv=none; b=iku6nASkRV5dqkFDVkf+gWD7GhmKYn/rcUI3FgIXzkICR8VmhntJy78FI8zWTUv7igfI3T z8g6FBT4DQqIRedfUEX1Tphhzr0SaEcC88ku90aSH3aF6QyGX9F3EU2lCAJRLNB3JouqFr wiac9rCCfYo1VRnKqi/mqfSR2gcKc10= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=nBulV2zF; spf=pass (imf06.hostedemail.com: domain of jeffxu@chromium.org designates 209.85.215.177 as permitted sender) smtp.mailfrom=jeffxu@chromium.org; dmarc=pass (policy=none) header.from=chromium.org Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-5ab53b230f1so1741261a12.3 for <linux-mm@kvack.org>; Mon, 16 Oct 2023 07:39:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1697467142; x=1698071942; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ousg6g8beQYrtnIXHdPl+6es+qhdKBwPjUl+0WcHVK4=; b=nBulV2zFqOeyeEZKROiB7mIXTcAolVymoP+xrmXWQ/5CH7o9wUojldHW7Lc1VHOLzA yL+UFglkV22nGqk6AVKBoV2KJwDEP6o8aoD7yFJVsN6uuIWyFP6GRT229lao6/lPNr+m lCRM1JD1f7e4T/GFdfQ7YSa8xjyOgrZYTkUeE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697467142; x=1698071942; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ousg6g8beQYrtnIXHdPl+6es+qhdKBwPjUl+0WcHVK4=; b=TIFhdOsk8Cpo7u+TtgYSMR3PvsV4FXlmwhJwZyd+3L9VzwG5Npcq8VloOHBoyITfRi mIRWWCRl2F/uxZeh4EkIftx9fO21DI/LJ/+ncy0e5BwQ99KkyjcKHzwTA9Q/uwzMRkLh jjZ1GVONTm8yBjQfIVpDBAhVMr2gFfbCHaipM38DxyButfDxAPSKplIgiFp0PDsS400k gL/aSP6GrLWCzQr8CmjqeAJSbVBvVja6aIzOErN2wbW9OkNL0MBnTU6Vd5luyRgMTc4i /xdpzebGIQJQ4OIi8a/BO8BZ2UzynsKhxbQ6dRp950PepIjz4lJU4o9KOc6Z0/7Trwlk 0wsw== X-Gm-Message-State: AOJu0YxLmea6c6P7SH/y4abR65RXg5653HpGKq2F8Rc686Af/iDW2gOg pGj9KSI42lR7MnVcVUOZDw5fsA== X-Google-Smtp-Source: AGHT+IGuDFDSElhARtpju/2TKNXZCv0dyrbDcGQSiLi1n6XeXR2D8iMicnP3qR+LojeqcMvPGZ4Uig== X-Received: by 2002:a05:6a21:789c:b0:14b:8b82:867f with SMTP id bf28-20020a056a21789c00b0014b8b82867fmr34279713pzc.50.1697467142619; Mon, 16 Oct 2023 07:39:02 -0700 (PDT) Received: from localhost (9.184.168.34.bc.googleusercontent.com. [34.168.184.9]) by smtp.gmail.com with UTF8SMTPSA id jn21-20020a170903051500b001c726147a45sm8599282plb.190.2023.10.16.07.39.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 16 Oct 2023 07:39:02 -0700 (PDT) From: jeffxu@chromium.org To: akpm@linux-foundation.org, keescook@chromium.org, sroettger@google.com Cc: jeffxu@google.com, jorgelo@chromium.org, groeck@chromium.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, jannh@google.com, surenb@google.com, alex.sierra@amd.com, apopple@nvidia.com, aneesh.kumar@linux.ibm.com, axelrasmussen@google.com, ben@decadent.org.uk, catalin.marinas@arm.com, david@redhat.com, dwmw@amazon.co.uk, ying.huang@intel.com, hughd@google.com, joey.gouly@arm.com, corbet@lwn.net, wangkefeng.wang@huawei.com, Liam.Howlett@oracle.com, torvalds@linux-foundation.org, lstoakes@gmail.com, willy@infradead.org, mawupeng1@huawei.com, linmiaohe@huawei.com, namit@vmware.com, peterx@redhat.com, peterz@infradead.org, ryan.roberts@arm.com, shr@devkernel.io, vbabka@suse.cz, xiujianfeng@huawei.com, yu.ma@intel.com, zhangpeng362@huawei.com, dave.hansen@intel.com, luto@kernel.org, linux-hardening@vger.kernel.org Subject: [RFC PATCH v1 4/8] mseal: seal mprotect Date: Mon, 16 Oct 2023 14:38:23 +0000 Message-ID: <20231016143828.647848-5-jeffxu@chromium.org> X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog In-Reply-To: <20231016143828.647848-1-jeffxu@chromium.org> References: <20231016143828.647848-1-jeffxu@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: 7p58obxzi8g8x8x9tagusou1sqxzixuo X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: CF6CA18001E X-Rspam-User: X-HE-Tag: 1697467143-259807 X-HE-Meta: U2FsdGVkX190wuFAX60k5X+mlnzt/I2D/cPO9ga/pIpW8D+1QX3GdeRb0RPO8ADB2H0Af4lG87HPu7dSzWas+/UESz2uBwJJYeMl1UttU30m6qxrFGZU8BjOOECaT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qRHuSlcTb1DbRCcQcciHbztA9ur7/OfPqkpkPhSZ9oMvwBUNucJl7+pWyY4qbO7L7EMyHimIkJUzxXmlHgJsc9IidNA2RA5UQ 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: <linux-mm.kvack.org> |
Series |
Introduce mseal() syscall
|
expand
|
diff --git a/mm/mprotect.c b/mm/mprotect.c index 130db91d3a8c..5b67c66d55f7 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -753,6 +753,12 @@ static int do_mprotect_pkey(unsigned long start, size_t len, } } + if (!can_modify_mm(current->mm, start, end, MM_ACTION_MPROTECT, + ON_BEHALF_OF_USERSPACE)) { + error = -EACCES; + goto out; + } + prev = vma_prev(&vmi); if (start > vma->vm_start) prev = vma;