From patchwork Tue Feb 7 03:51:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chih-En Lin X-Patchwork-Id: 13130975 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45860C636D3 for ; Tue, 7 Feb 2023 03:56:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230173AbjBGD4N (ORCPT ); Mon, 6 Feb 2023 22:56:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230309AbjBGDzs (ORCPT ); Mon, 6 Feb 2023 22:55:48 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C4103400C; Mon, 6 Feb 2023 19:55:19 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id d6-20020a17090ae28600b00230aa72904fso5367971pjz.5; Mon, 06 Feb 2023 19:55:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=G5f9S6gTvBUR31ijZ1v0NXA88nU2gIARJhf8qkOYPpE=; b=V+9ehS3dUBnDSP754pQJilYnGgspDpamE6axHxsiTDW2FqvQddaZhtzoXahpcQNnWp slKt5OTaFYOnKxD33z7ajrAhO1f5bVaGT6RR4HraIXtm6VzkCVcF66mE5C+d2tMbbaFD +cjxflw1/Gp+nt43vddDQxJgK3gDExiSvTg3IjBGeNMZxBToZEebfadplSSmscanOrCX /FVxoHCFHfslQW1BnfnGGO9BAkv0ye+18mfO6F3hwnyawTP5HH9TkMKxOmk1OXHPn3gD mOqbNky7E02Ec3UOsJc8CO1ricLUh6qtCIFx31yJFispY8zifcyFXGLJSYwBocGdS5P2 vjog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=G5f9S6gTvBUR31ijZ1v0NXA88nU2gIARJhf8qkOYPpE=; b=uY1nFzDCT0mv6GiWxdclJC97kN2mg34z1MrXzH4I9dThRjOiV3hlOCv9/QMMPqesc/ iTOk/F+FTDdkmd+wWgH19rnx3Ouq37c3PXAnErhBk72nzdVW1CIWTiYQKEX4kK+65SCl 7xtjl3pHnD6WjLOOoemaZ8s4RTZxsizJTMIHeZU8ZcHfexjKJOn6z516o//z0s+IJ9ue jyrOs67yUcbvCIUprfE6ClYBsfhiU6bDgTmhtUX82UVmBaNJ4STjv8KAe3Xxj1S470CT 5UA9optixKF/+7IdYjlFrUCjI8Fvhjt7F4/xYASwlA7xs0Ps/AZAi0IgiYAyDUvs7ciD daww== X-Gm-Message-State: AO0yUKU2lgeh/WtU8NQnKK24B/uXPiDsG8xF5OZPFkKwFxhC1hTbVrrN p7UgkWf73rE0TUgZwbv83eA= X-Google-Smtp-Source: AK7set9eFrjrbQaBrX68nI/egeQC5azfC6+Rad48+JSCqX5K0OjrQy1a9sYzZUEJN+SmZpiFte9d5g== X-Received: by 2002:a17:903:1250:b0:196:f82:14b7 with SMTP id u16-20020a170903125000b001960f8214b7mr1531757plh.37.1675742113998; Mon, 06 Feb 2023 19:55:13 -0800 (PST) Received: from strix-laptop.hitronhub.home ([123.110.9.95]) by smtp.googlemail.com with ESMTPSA id q4-20020a170902b10400b0019682e27995sm7647655plr.223.2023.02.06.19.55.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Feb 2023 19:55:13 -0800 (PST) From: Chih-En Lin To: Andrew Morton , Qi Zheng , David Hildenbrand , "Matthew Wilcox (Oracle)" , Christophe Leroy , John Hubbard , Nadav Amit , Barry Song Cc: Steven Rostedt , Masami Hiramatsu , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Yang Shi , Peter Xu , Vlastimil Babka , "Zach O'Keefe" , Yun Zhou , Hugh Dickins , Suren Baghdasaryan , Pasha Tatashin , Yu Zhao , Juergen Gross , Tong Tiangen , Liu Shixin , Anshuman Khandual , Li kunyu , Minchan Kim , Miaohe Lin , Gautam Menghani , Catalin Marinas , Mark Brown , Will Deacon , Vincenzo Frascino , Thomas Gleixner , "Eric W. Biederman" , Andy Lutomirski , Sebastian Andrzej Siewior , "Liam R. Howlett" , Fenghua Yu , Andrei Vagin , Barret Rhoden , Michal Hocko , "Jason A. Donenfeld" , Alexey Gladkov , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Dinglan Peng , Pedro Fonseca , Jim Huang , Huichun Feng , Chih-En Lin Subject: [PATCH v4 13/14] events/uprobes: Break COW PTE before replacing page Date: Tue, 7 Feb 2023 11:51:38 +0800 Message-Id: <20230207035139.272707-14-shiyn.lin@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230207035139.272707-1-shiyn.lin@gmail.com> References: <20230207035139.272707-1-shiyn.lin@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-trace-kernel@vger.kernel.org Break COW PTE if we want to replace the page which resides in COW-ed PTE. Signed-off-by: Chih-En Lin --- kernel/events/uprobes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index d9e357b7e17c..2956a53da01a 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c @@ -157,7 +157,7 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr, struct folio *old_folio = page_folio(old_page); struct folio *new_folio; struct mm_struct *mm = vma->vm_mm; - DEFINE_FOLIO_VMA_WALK(pvmw, old_folio, vma, addr, 0); + DEFINE_FOLIO_VMA_WALK(pvmw, old_folio, vma, addr, PVMW_BREAK_COW_PTE); int err; struct mmu_notifier_range range;