Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1560637lqa; Mon, 29 Apr 2024 11:55:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUtjhW1CjbEXuC7dWX6AozBnRJThNiamMG9LZl7W/gpXEfWTaXhCYh+0Z4zXNtGnKpMrRg7mlfQw/BIKBiwYDXL6klI4PC/691XRAt7Ag== X-Google-Smtp-Source: AGHT+IGPIQMzbRpbjr2mvu8kAWUMBz+tCYQAF1OOtQ965QzjQC3T0l429qhezJR/DxSvGxP6V8bE X-Received: by 2002:a05:6871:a505:b0:233:4685:aea3 with SMTP id wc5-20020a056871a50500b002334685aea3mr11811028oab.41.1714416940807; Mon, 29 Apr 2024 11:55:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714416940; cv=pass; d=google.com; s=arc-20160816; b=BriPaMKrjRHPtf7ZsOEFEY8PyH36lc7Sxt9cCXBY/VUb/7okEvdxfDGrZonxRw738n czKdJ9qQkYcNUjuVEvUy7SqBO//OwNss+n0AtTFOv/gz9x33b+NXFuQNnDgAzt6jkK8M D0GLCiPmmk1prFb6+QgAaaoiN+RmTYgDtk3Wkveq/1cb0iWrxoOEqte/fUiQN/UjLaat ue7AvPhlSRrYqXBOS9nL/F0zX13BnI0mQCndEL5CzdANDQluqdmino5GO/BWyVBqtJa0 Zgyf//K71GKA+zouH69CUWkNIJfrw3anTYyAuxIfxJmlK5TDZAP1WC3ihUmCYAgL9Bu3 ZW+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=gYXEmIPmKlUCv4MlmDP09ZBKONhIZhGPFSWq4/CxW8A=; fh=xGH1+7+CZYmVU/U/VYzrohLINGhsxYRjnkwId0RLiWk=; b=sdBNT0fjJ88GZbNjqCtaajBvRmJf/WFvmieYgUYJWruJmb+JD9gX8GD/mwwmDOX/YF 56Wz+gmew6OFqNXKWYMo/oq+n6+KDLDW7JU7X7zq+sesjF1HwIsdLsbGXokVQy8rSY88 XHtOFlgwQdePMiXkB/lGsImdUJg1nW+uJG64SoGsFuFRaAXysa2utvB/764/+zFYuICk s2c6S4LvoPzJhC60/pVZPAGEbWPxWj8OBzHIVx1zI3DYE1CJ1lxIQ2K3Tzg0k4DPSQo/ bMMNYmmlGbA2+BBsThbCgKWpBi1OSZjQb2u04M80181alrvi2R12hG2bGRuCLzwzmalh SzMg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=H73aODyz; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-162856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162856-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id m20-20020a635814000000b005dc82dde3b2si19791557pgb.793.2024.04.29.11.55.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 11:55:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=H73aODyz; arc=pass (i=1 spf=pass spfdomain=linuxfoundation.org dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-162856-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162856-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E4A14B23AED for ; Mon, 29 Apr 2024 18:49:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1126813AD3E; Mon, 29 Apr 2024 18:48:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="H73aODyz" Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77C1613AD13 for ; Mon, 29 Apr 2024 18:48:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714416491; cv=none; b=RxjSZ//AIVXDhx5qy5LGzRJS3jBdDi+U1RMNLFd8soX8I+KxAe+jjVTVmk93ju4rnHIkKfJn5PRMyzdIG5RaTy7GUEDAyLfvwqkUzmFiuLcrguW3zB7NMfSCAituKNuJ5t5XAFmUNy3+iprvmmKyyVj+uB32Igy9kEdrfZOaifI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714416491; c=relaxed/simple; bh=u7kw+FkzxObVPiQnaVCOnkmZSnrlks2HiY7Vm3Bnv1Y=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=elzNSHtCcupVzFR/3/MtLPgQ+dUFiEHWYKs3urbe0BjZECRRsdIyZqXuMT/FzHsiGHijbmG1bU6jUOTTOZsQJvKRmqbRkj8UZdPZ5mUf56HwTMrdliHcH/EeZ0jW5kRtffKbhItUMd/eKQQes+Rf+lwale5Ljm1PBrNLX6B/rjE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=H73aODyz; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-516ef30b16eso5424278e87.3 for ; Mon, 29 Apr 2024 11:48:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1714416487; x=1715021287; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=gYXEmIPmKlUCv4MlmDP09ZBKONhIZhGPFSWq4/CxW8A=; b=H73aODyzgVy1GR4fRWCCb6np4mwVRvKwNR60n1Lm15rPYKNVxkTUnTg2SaIf9jWSR+ ft6fd8t685k/ASTc/H88RQ3i9gaGNuOuPL74YDzGU2eD82rlqO2fmpGTwAupwD0Cc0FJ kyk6e2Tqlfdp1Ly2yb//VpqISs3nuPYKC+hBQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714416487; x=1715021287; h=cc: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=gYXEmIPmKlUCv4MlmDP09ZBKONhIZhGPFSWq4/CxW8A=; b=R9ZJGQnHgDK+EUzRmONteYxFdFb7oWy4KpWQ6u0WevFuWfOS8VohMwiohzYFZ+NaiH BXsoP1HaibuKS5kigZd1heRZne1YKcW3kJdndWPGqBPTgjlZh73mzc1gP1tfd7BnImhw oQBvX6Rbx0aHAXLO80/zBxp6V91jIAjUa6evyfhtcx0YnSTDOGeIDJ0g/CN1w95K65e5 T+tSciDaHpWIPpcEFosf0NG2qe+SwXYJzbqQ+NMK+zwpPdghaExo9diWlvCY/NlH9AJ+ ibs/MfTnaYcrOY/js82vPwQBmPinHGBp3ogJa96G/bMPv6mV7dB7d6i+651X+jkO9553 cenA== X-Forwarded-Encrypted: i=1; AJvYcCX/AXekivrY+f/S5pGJCj0uZizr/rfXX4maTsFCutmpNv/nHbs3DJwTZJd6P+ELEW0cQfLm7/dKg47J9SzwwE9jufMU9HjVs/ELhMp0 X-Gm-Message-State: AOJu0YxyUNoabFl+VjQlgVORxog1YdlKTQpmFxReRR6JaDrFhR5ZvzSD UvY64ekfXl9Z0FPLNbCthkF0XXH7uQhNt127ZnYnrxKa71DSUbTt0Ep/RYUKoAuxzyxgVO/MWzB n6DdhPg== X-Received: by 2002:a05:6512:33d4:b0:51c:32fc:a551 with SMTP id d20-20020a05651233d400b0051c32fca551mr335226lfg.45.1714416487456; Mon, 29 Apr 2024 11:48:07 -0700 (PDT) Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com. [209.85.218.46]) by smtp.gmail.com with ESMTPSA id dq5-20020a170907734500b00a58874312d6sm7236421ejc.212.2024.04.29.11.47.57 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Apr 2024 11:47:57 -0700 (PDT) Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a58e7628aeaso291742466b.2 for ; Mon, 29 Apr 2024 11:47:57 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUAlPs2hWlgk/UexsluZORkec3UffrshOI7GVgmTyQuzNcaVMXoJD7f10AJs0buZJ8yAl6Guz1oL9/QPZshLvJjrM43auPOwMf7Kx8z X-Received: by 2002:a17:906:c252:b0:a52:6fcb:564a with SMTP id bl18-20020a170906c25200b00a526fcb564amr321186ejb.9.1714416477325; Mon, 29 Apr 2024 11:47:57 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <0000000000009dfa6d0617197994@google.com> <20240427231321.3978-1-hdanton@sina.com> <20240428232302.4035-1-hdanton@sina.com> In-Reply-To: From: Linus Torvalds Date: Mon, 29 Apr 2024 11:47:40 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] x86/mm: Remove broken vsyscall emulation code from the page fault code To: Ingo Molnar Cc: Hillf Danton , Andy Lutomirski , Peter Anvin , Adrian Bunk , syzbot , Tetsuo Handa , andrii@kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" On Mon, 29 Apr 2024 at 08:51, Linus Torvalds wrote: > > Well, Hilf had it go through the syzbot testing, and Jiri seems to > have tested it on his setup too, so it looks like it's all good, and > you can change the "Not-Yet-Signed-off-by" to be a proper sign-off > from me. Side note: having looked more at this, I suspect we have room for further cleanups in this area. In particular, I think the page fault emulation code should be moved from do_user_addr_fault() to do_kern_addr_fault(), and the horrible hack that is fault_in_kernel_space() should be removed (it is what now makes a vsyscall page fault be treated as a user address, and the only _reason_ for that is that we do the vsyscall handling in the wrong place). I also think that the vsyscall emulation code should just be cleaned up - instead of looking up the system call number and then calling the __x64_xyz() system call stub, I think we should just write out the code in-place. That would get the SIGSEGV cases right too, and I think it would actually clean up the code. We already do almost everything but the (trivial) low-level ops anyway. But I think my patch to remove the 'sig_on_uaccess_err' should just go in first, since it fixes a real and present issue. And then if somebody has the energy - or if it turns out that we actually need to get the SIGSEGV siginfo details right - we can do the other cleanups. They are mostly unrelated, but the current sig_on_uaccess_err code just makes everything more complicated and needs to go. Linus