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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 678AED2F7D8 for ; Thu, 17 Oct 2024 00:59:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B3B26B007B; Wed, 16 Oct 2024 20:59:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 93CA26B0082; Wed, 16 Oct 2024 20:59:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7DD596B0083; Wed, 16 Oct 2024 20:59:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 5B9586B007B for ; Wed, 16 Oct 2024 20:59:03 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B018540E46 for ; Thu, 17 Oct 2024 00:58:56 +0000 (UTC) X-FDA: 82681284672.24.6542656 Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.46]) by imf28.hostedemail.com (Postfix) with ESMTP id 3915EC0009 for ; Thu, 17 Oct 2024 00:58:52 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=XKa4naYa; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf28.hostedemail.com: domain of jeffxu@chromium.org designates 209.85.160.46 as permitted sender) smtp.mailfrom=jeffxu@chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729126634; a=rsa-sha256; cv=none; b=V6GXK7vjdVM7imk6yS+tLjDokgRhhBZoE2fpYySweflc2JefQpDjfpjbTsqcx+cF38xvHE RyC2lvWGu0fSe24wwo4ypnUpzpvpWa3gKJAKVuyRk/a9ERbeYKefR7a7A5rrwhrZLaXAGo /BxaG4JnF31/zWn44AgQSNIW3hmWya4= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=XKa4naYa; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf28.hostedemail.com: domain of jeffxu@chromium.org designates 209.85.160.46 as permitted sender) smtp.mailfrom=jeffxu@chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729126634; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0vVJYK2PYMGKwOP4Lxha8ImE5MYqQ8EQdHVxhSS48hw=; b=cvKm+FDf+GowaHUyzzd7c9MuHMZEwcc76ClSs7+OBVeAfggb2RC3b+g24uNEHXLjZ9HbFQ 0oAbe9LDowqHIQ5NZWkySjKNejPT/uees8HJOHynUs0EswdurAx10e5Mc3tl61z7RKfJHE C1OUhxO5aueW7B76TbTQYu/HA0ShLlk= Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-288fec398f8so22061fac.3 for ; Wed, 16 Oct 2024 17:59:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1729126740; x=1729731540; darn=kvack.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=0vVJYK2PYMGKwOP4Lxha8ImE5MYqQ8EQdHVxhSS48hw=; b=XKa4naYa0rdj84aKs6gYjafonb0Z4ez+WqNp+PhuFMnFsN84GyPDQ2z3S4ppROn3Qh /LAmzYGanZ3Yke3UfqSvNfrSn2LaYRz7HfZ90zHD93Ra17pvDN+9RCFipL3fxDR+x8hP RuChkUZ3dMyPiSast7HkKr+xTUnJpP87sF+eg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729126740; x=1729731540; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0vVJYK2PYMGKwOP4Lxha8ImE5MYqQ8EQdHVxhSS48hw=; b=fGRPraRMqyjX78gsUH4Z+UnAGmN4XELMbBbDXlHnwoYaJCYcWx20wa46kXVakHWC33 ssL6JeiS5jTofUsLO3WBNrMgJSkMjC1vY6goSrIKMETs8YkpSxECUex7S7twZIxdalT4 tv4CUbkkyBWBs1RpzUtE/TfnSh9So3GBd0kj/Yh3sAAsVb0XyQSfPZU5hERUqa2LGdYX /CgMR5+eYRaVU9Ux8n7SNeOOHaS42z0rhCVgoXU2PibaURQPI3i+3PPDkQXAPCvMP8hN DQA002biT7O2CQRo44oswEkZj1j3PqBmxXHTOdw++3dmEiuHSLYUiW7bDQqqfCVEZZ3b BNcA== X-Forwarded-Encrypted: i=1; AJvYcCVCvlyOryc5k1qWC8IGbseubw5HWYpNf4KCpQEfo84PQIGyHyETnMxm049cSxnBOSYjWSH31XjgRw==@kvack.org X-Gm-Message-State: AOJu0YwlzjrqyX8ujtPWxxW3tZ8c+Sr4NI/9eNdGaxHf5VSoug+NDjJO zJMkDfyDlICntpKYIal0XhURfBlldisWsR6NHFCRQWlm/oOznv2SoFRJo0Zr3IsyqRSKQmWfYwC W7KQAyxQBIah4hDTVQeBKYTOO8WTAZ+XLcjaz X-Google-Smtp-Source: AGHT+IFkJK5vW7UTiyaQakVeuzZ8LAyOMeE0oL/OgRN/Lgn0cZ0pGepPtXKIgu6x4o4k21vyPhR1shJYcp3eX+BVu+c= X-Received: by 2002:a05:6870:2012:b0:287:2cbc:6c9 with SMTP id 586e51a60fabf-2890c6d885cmr432437fac.8.1729126740267; Wed, 16 Oct 2024 17:59:00 -0700 (PDT) MIME-Version: 1.0 References: <20241014215022.68530-1-jeffxu@google.com> <2durheir3u7uv7y5d3zsuxgkxbfhyj6gbef6xiktp2nybf7os2@zppt55ut7f57> In-Reply-To: <2durheir3u7uv7y5d3zsuxgkxbfhyj6gbef6xiktp2nybf7os2@zppt55ut7f57> From: Jeff Xu Date: Wed, 16 Oct 2024 17:58:48 -0700 Message-ID: Subject: Re: [RFC PATCH v2 0/1] seal system mappings To: "Liam R. Howlett" , jeffxu@chromium.org, akpm@linux-foundation.org, keescook@chromium.org, jannh@google.com, torvalds@linux-foundation.org, adhemerval.zanella@linaro.org, oleg@redhat.com, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, linux-mm@kvack.org, jorgelo@chromium.org, sroettger@google.com, ojeda@kernel.org, adobriyan@gmail.com, anna-maria@linutronix.de, mark.rutland@arm.com, linus.walleij@linaro.org, Jason@zx2c4.com, deller@gmx.de, rdunlap@infradead.org, davem@davemloft.net, hch@lst.de, peterx@redhat.com, hca@linux.ibm.com, f.fainelli@gmail.com, gerg@kernel.org, dave.hansen@linux.intel.com, mingo@kernel.org, ardb@kernel.org, mhocko@suse.com, 42.hyeyoo@gmail.com, peterz@infradead.org, ardb@google.com, enh@google.com, rientjes@google.com, groeck@chromium.org, lorenzo.stoakes@oracle.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 3915EC0009 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: a7qaeoa3xs34gtbkc4zyh1ktohaqdssn X-HE-Tag: 1729126732-897880 X-HE-Meta: U2FsdGVkX1+znXH59S5BPE2tsPEd3ozdVOqJz1sEbE3tJpRFC8X33CvRp42ipHfMaM9Zr57aFT96zyd3HJUPkEsXGPicvv640GSVXk6cfTVGZfdcjZtH97JUNJGVs6AwBKRwfCxAwYAb7FkG0v7k8yVDeq+9tqRXXXofxEDOciDGNxa88l2iw5Ns7bPmPsb/m3gkKwV8Mn96EqA8+RbAypGBkd2zpMgPEIJt49OcUs8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aWmoZ44QmqKmpvZKHZXrha9UhizlISxUjrlda11z7I+TOicj6y5/Nl7H8= 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: On Wed, Oct 16, 2024 at 4:18=E2=80=AFPM Liam R. Howlett wrote: > > * jeffxu@chromium.org [241014 17:50]: > > From: Jeff Xu > > > > Seal vdso, vvar, sigpage, uprobes and vsyscall. > > > > Those mappings are readonly or executable only, sealing can protect > > them from ever changing during the life time of the process. For > > complete descriptions of memory sealing, please see mseal.rst [1]. > > > > System mappings such as vdso, vvar, and sigpage (for arm) are > > generated by the kernel during program initialization. These mappings > > are designated as non-writable, and sealing them will prevent them > > from ever becoming writeable. > ^ or ever removed. > > This is a pretty big deal. Platforms are trying to make it so that vdso > is the fast path, but if they are removed then things stop using them > and it's not a problem. This description is robbing them of the > information they need to know that, and it's not in your change log > either. > > I had said before that you need to be clear about the inability to > remove the mappings that are sealed, as the description above heavily > implies that it is only stopping them from becoming writeable. > The mseal.rst has the full description about memory sealing, I don't see the point to repeat all the blocked operations in the commit message here. I don't know why you would think this heavily implies that only stopping them from becoming writable, There is already reminder: ** For complete descriptions ** of memory sealing, please see mseal.rst > > > > Unlike the aforementioned mappings, the uprobe mapping is not > > established during program startup. However, its lifetime is the same > > as the process's lifetime [2], thus sealable. > > > > The vdso, vvar, sigpage, and uprobe mappings all invoke the > > _install_special_mapping() function. As no other mappings utilize this > > function, it is logical to incorporate sealing logic within > > _install_special_mapping(). This approach avoids the necessity of > > modifying code across various architecture-specific implementations. > > > > The vsyscall mapping, which has its own initialization function, is > > sealed in the XONLY case, it seems to be the most common and secure > > case of using vsyscall. > > > > It is important to note that the CHECKPOINT_RESTORE feature (CRIU) may > > alter the mapping of vdso, vvar, and sigpage during restore > > operations. Consequently, this feature cannot be universally enabled > > across all systems. To address this, a kernel configuration option has > > been introduced to enable or disable this functionality. Note, uprobe > > is always sealed and not controlled by this kernel configuration. > > > > I tested CONFIG_SEAL_SYSTEM_MAPPINGS_ALWAYS with ChromeOS, > > which doesn=E2=80=99t use CHECKPOINT_RESTORE. > > > > [1] Documentation/userspace-api/mseal.rst > > [2] https://lore.kernel.org/all/CABi2SkU9BRUnqf70-nksuMCQ+yyiWjo3fM4XkR= kL-NrCZxYAyg@mail.gmail.com/ > > > > History: > > V2: > > Seal uprobe always (Oleg Nesterov) > > Update comments and description (Randy Dunlap, Liam R.Howlett, Oleg N= esterov) > > The only update to the comment I see is the pointer to mseal.rst for a > complete description? > > > Rebase to linux_main > > > > V1: > > https://lore.kernel.org/all/20241004163155.3493183-1-jeffxu@google.com/ > > > > Jeff Xu (1): > > exec: seal system mappings > > > > .../admin-guide/kernel-parameters.txt | 10 ++++ > > arch/x86/entry/vsyscall/vsyscall_64.c | 9 +++- > > fs/exec.c | 53 +++++++++++++++++++ > > include/linux/fs.h | 1 + > > kernel/events/uprobes.c | 2 +- > > mm/mmap.c | 1 + > > security/Kconfig | 26 +++++++++ > > 7 files changed, 99 insertions(+), 3 deletions(-) > > > > -- > > 2.47.0.rc1.288.g06298d1525-goog > >