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 7F2F8C021B8 for ; Wed, 26 Feb 2025 18:02:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E5DE16B0085; Wed, 26 Feb 2025 13:02:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E0B8E280001; Wed, 26 Feb 2025 13:02:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CAE3A6B0089; Wed, 26 Feb 2025 13:02:38 -0500 (EST) 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 AAEDE6B0085 for ; Wed, 26 Feb 2025 13:02:38 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3AA29803BC for ; Wed, 26 Feb 2025 18:02:38 +0000 (UTC) X-FDA: 83162865996.26.CD19A7A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf25.hostedemail.com (Postfix) with ESMTP id 45588A001F for ; Wed, 26 Feb 2025 18:02:35 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Aw4UMCvi; spf=pass (imf25.hostedemail.com: domain of oleg@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=oleg@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1740592955; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=saipoHpMrYA1d7u1DAL6sNSJSJ6bf1mRMJvo8EMj3Vo=; b=pISq534JCm791Il4D9QHlaKUg1wf0cVePHOHg8ZB+yjDpnypUqJzncaU2JZhcv7gE29Xsz lPpwewmj00LMrcngqQG0v8zfOdm7SIOJke/hcgkcAEp8QTocWOfgq8NGGXCQOnZfUcHElX 4PVYz/WO9vEHX40YSI1PhLN1JkxgmI4= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Aw4UMCvi; spf=pass (imf25.hostedemail.com: domain of oleg@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=oleg@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1740592955; a=rsa-sha256; cv=none; b=19RwsHJwUvUaq7RM9ksg67mDRSsZb6QHHttphdZ1j5TObJHcKJe58RLZeLGx/HAG04FbS1 Gb9BprTXrWP4p6bNiaMPqz93/IM5551rPAmqwSyd/07z4QT5KfSdo4Rss8sbq8ZPOChfte QxycfKpAvZ5L0LiMYt2BQ6s+blOT8T4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740592954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=saipoHpMrYA1d7u1DAL6sNSJSJ6bf1mRMJvo8EMj3Vo=; b=Aw4UMCviDFlgp3PqRrEYg4qDlilpOHUJGAh/4aJhm/7dkV+sxKL0m0PZWvbKb3eTeGFRgX 9JgdMHm0YFTfHlmwAWYtceTPp16C4iC4t0s8bT++w0oiGBP0Cojn1b1v9Phe2AKpwvKRYt st8r225f0pNzW9USv8HYPxqinI4+WDA= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-643-1NuXJJeyNLC8G461PmoNOA-1; Wed, 26 Feb 2025 13:02:29 -0500 X-MC-Unique: 1NuXJJeyNLC8G461PmoNOA-1 X-Mimecast-MFC-AGG-ID: 1NuXJJeyNLC8G461PmoNOA_1740592945 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EF24418EB2D3; Wed, 26 Feb 2025 18:02:22 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.226.247]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 77D981955BD4; Wed, 26 Feb 2025 18:02:07 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 26 Feb 2025 19:01:52 +0100 (CET) Date: Wed, 26 Feb 2025 19:01:36 +0100 From: Oleg Nesterov To: Lorenzo Stoakes Cc: jeffxu@chromium.org, akpm@linux-foundation.org, keescook@chromium.org, jannh@google.com, torvalds@linux-foundation.org, vbabka@suse.cz, Liam.Howlett@oracle.com, adhemerval.zanella@linaro.org, avagin@gmail.com, benjamin@sipsolutions.net, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, linux-mm@kvack.org, jorgelo@chromium.org, sroettger@google.com, hch@lst.de, ojeda@kernel.org, thomas.weissschuh@linutronix.de, adobriyan@gmail.com, johannes@sipsolutions.net, pedro.falcato@gmail.com, hca@linux.ibm.com, willy@infradead.org, anna-maria@linutronix.de, mark.rutland@arm.com, linus.walleij@linaro.org, Jason@zx2c4.com, deller@gmx.de, rdunlap@infradead.org, davem@davemloft.net, peterx@redhat.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, mpe@ellerman.id.au, aleksandr.mikhalitsyn@canonical.com, mike.rapoport@gmail.com Subject: Re: [PATCH v7 6/7] mseal, system mappings: uprobe mapping Message-ID: <20250226180135.GI8995@redhat.com> References: <20250224225246.3712295-1-jeffxu@google.com> <20250224225246.3712295-7-jeffxu@google.com> <20250226162604.GA17833@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 45588A001F X-Stat-Signature: bt615fjd4wrpydd6qkkd3u11ro93nu98 X-Rspam-User: X-HE-Tag: 1740592955-594000 X-HE-Meta: U2FsdGVkX1/52bVq6XW4myuE9iHEFHdEXTfAcfe8vZYE4pdsbWdtfVsI4/19Twq/RXCZRqNVnpWVsLDq+A/e+xBC+Vunt5ic/GkabCtR9EtHxmuzgcWzgIW+rf7wP3l50gUBvR01tKKZxK8Cr7MXeCd4KjnOh3RpNM1V8s2yiO+gtwxZ0lASHVH0k1PDD6aczQkgH/GEwHNOzajHmqv/chd8CFAOhQTJ8WsfclcZ9xUcWZU7X4C7WxMlPxqGEUjsQEGmkdBqYMCuI+8ZuOrZ3cNAIvWH0vvgHiBt/bxjwfbw4qImSAlDV+aQ0wgMNYgrqlDCZrD0noAyeVmUyPZCXVM9WqaCEhNvqeYV/xbyZzdOBVEmGDTIp9XowyB63A0WDIFqrV4AWDdbe04Toi+Vmdr5k3lgJ3cFMJX6Sj71+ghoT0J31RagFQaSnOq3+GUNwh4WnOEdoVFMB9vhknaUMYQWK6s3zw/0SbsKmSx+BlehG70rkgi/x2AHGzQcLbaCJ5BoIQuvk9UTsdKRnvlFU9lkGJDaWmJPSl8iGKZnbbhg9WPBc8WobTupPYUJnZ7WcOxMWHVm2/NiQOuDO+ro3f8+Xt2yfVA19BZjxRur0nRTzPIEvNGgbOGItP8PtBO+G8ixnLxuNrZFvOQjOrC+s9SScOi6i8jhEKm4EQE3zPyF0x62x2Ju/zyZmgtREonKkgj+WnI/4DgGfcYDOxbM/1QrSzOteT4obbqOB++rxxpc/vkysFbLNjV7TFBPxkDlvjtbzx3X4h3kxZAjk8wu/xbZKX0hLw7/pWiWWN5fJoJ7w19S+RDoo/FUc83MGzLpklqXszBpuC++H1tOuldss+IAzDoxMPcIAmylixFntQpOaovgNnd5x/cDeSBwy2pJS7IvYrpChgdz/wrVEsRWnpeSs8hBVe1cWmvQdIxZPyWggtM+4/Y3wFbFjKiJo/NFv64vMHtB+0FM63KxIPY f8tR5eUk K09iWbEQ897/xK6SSrpzXrcihCxLAtcXSdAh6Leps1itRCnXDdvIcFrVkHDIuK+3tOdNlnz+ekDGkt3WGwUpdutLxW2QsETX9jklTlwbvVtwmSZ8/wenx4gx7YMEe3xHOdGFSv+TSzEQQIuqoQY3MFI+qZ+Bdt5VoiCYarbY7tQCeyxbFqBKVVFpSUjWIanuM5OERFbs5E6xtJuMMRjkcjrwYCgiTaLbL0lLzzs9Eru2r0ITvNzqZalCmpkP+7F1HJaYWHfQYp1HecmwbAr7l8R/s+5DILCCyjlPmGJAUXqngG/+S/LhZyIIFC5+6kixnwzncW3WYSJEI9eb9CF529JeA69RXNVuoW/aEDbc5KDSrOVUTUkZ1Ek8BnsNZ/P68vcMsFs53BlpMOmyYh6O4nGymBg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000037, 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 02/26, Lorenzo Stoakes wrote: > > On Wed, Feb 26, 2025 at 05:26:04PM +0100, Oleg Nesterov wrote: > > On 02/24, jeffxu@chromium.org wrote: > > > > > > Unlike other system mappings, the uprobe mapping is not > > > established during program startup. However, its lifetime is the same > > > as the process's lifetime. It could be sealed from creation. > > > > Agreed, VM_SEALED should be always for the "[uprobes]" vma, regardless > > of config options. > > If you think this ought to be the case generally, then perhaps we should > drop this patch from the commit and just do this separately as a > permanent-on thing, if you are sure this is fine + want it? See below... > An aside - we _definitely_ cannot allow this -system mapping stuff- to be > enabled without a config option, This is clear. But as for uprobes in particular I do think that VM_SEALED is always fine. Do we really want it? I dunno. If a task unmaps its "[uprobes]" vma it will crash when it hits the uprobes bp next time. Unless the probed insn can be emulated and it is not ret-probe. Do we really care? Again, I don't know. Should this change come as a separate patch? I don't understand why it should but I am fine either way. In short. please do what you think is right, VM_SEALED can't hurt uprobes ;) > > #ifdef CONFIG_64BIT > > /* VM is sealed, in vm_flags */ > > #define VM_SEALED _BITUL(63) > > + #else > > + #define VM_SEALED 0 > > #endif > > This has been raised a few times. Jeff objects to this OK, > > and then simply > > > > vma = _install_special_mapping(mm, area->vaddr, PAGE_SIZE, > > - VM_EXEC|VM_MAYEXEC|VM_DONTCOPY|VM_IO, > > + VM_EXEC|VM_MAYEXEC|VM_DONTCOPY|VM_IO|VM_SEALED, > > > > ? > > Nah you'd have to do: > > > > vma = _install_special_mapping(mm, area->vaddr, PAGE_SIZE, > VM_EXEC|VM_MAYEXEC|VM_DONTCOPY|VM_IO > #ifdef CONFIG_64BIT > VM_SEALED > #endif > , Why??? With the proposed change above VM_SEALED == 0 if !CONFIG_64BIT. Oleg.