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 8FEC4C433FE for ; Mon, 27 Dec 2021 17:40:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E3BA36B0072; Mon, 27 Dec 2021 12:40:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DC4826B0073; Mon, 27 Dec 2021 12:40:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C8C2F6B0074; Mon, 27 Dec 2021 12:40:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0196.hostedemail.com [216.40.44.196]) by kanga.kvack.org (Postfix) with ESMTP id B52616B0072 for ; Mon, 27 Dec 2021 12:40:52 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 6D79B181AC9C6 for ; Mon, 27 Dec 2021 17:40:52 +0000 (UTC) X-FDA: 78964289544.17.6122959 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf08.hostedemail.com (Postfix) with ESMTP id 8C52C16001B for ; Mon, 27 Dec 2021 17:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1640626851; 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=YAHdEgA4vBfChhqcXFr18t3cp4WP7TtGCi10QnGN9O0=; b=GUas0yw6GFfw8OeL62q1eucxiwNMdorPJzKLuvgroxDdoh8TytFtMwDDcLs9WfRAKevfpI CSAl2Cu2UHfURezSsnYXZiANYERVfD556HJYcz9JoNIMDkge75CLfuyychdqjAcJx1Et9H SAGh7j+bKXEJe7Ye4xRlvdGWgg51+Cc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-664-N8MuQBfBMpGw50_ypxFLLA-1; Mon, 27 Dec 2021 12:40:45 -0500 X-MC-Unique: N8MuQBfBMpGw50_ypxFLLA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 121B0801B2F; Mon, 27 Dec 2021 17:40:44 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5800D8CB24; Mon, 27 Dec 2021 17:40:40 +0000 (UTC) From: Florian Weimer To: Andrei Vagin Cc: Andy Lutomirski , linux-arch@vger.kernel.org, Linux API , linux-x86_64@vger.kernel.org, kernel-hardening@lists.openwall.com, linux-mm@kvack.org, "the arch/x86 maintainers" , musl@lists.openwall.com, libc-alpha@sourceware.org, LKML , Dave Hansen , Kees Cook Subject: Re: [PATCH v2] x86: Implement arch_prctl(ARCH_VSYSCALL_CONTROL) to disable vsyscall References: <878rwkidtf.fsf@oldenburg.str.redhat.com> Date: Mon, 27 Dec 2021 18:40:38 +0100 In-Reply-To: (Andrei Vagin's message of "Mon, 27 Dec 2021 08:49:38 -0800") Message-ID: <87o8520wvd.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 8C52C16001B X-Stat-Signature: ra1ci3ox4usodtkfy8fwxs3hant8iiwf Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GUas0yw6; spf=none (imf08.hostedemail.com: domain of fweimer@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=fweimer@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1640626842-838998 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: * Andrei Vagin: >> diff --git a/arch/x86/entry/vsyscall/vsyscall_64.c b/arch/x86/entry/vsyscall/vsyscall_64.c >> index fd2ee9408e91..8eb3bcf2cedf 100644 >> --- a/arch/x86/entry/vsyscall/vsyscall_64.c >> +++ b/arch/x86/entry/vsyscall/vsyscall_64.c >> @@ -174,6 +174,12 @@ bool emulate_vsyscall(unsigned long error_code, >> >> tsk = current; >> >> + if (tsk->mm->context.vsyscall_disabled) { >> + warn_bad_vsyscall(KERN_WARNING, regs, >> + "vsyscall after lockout (exploit attempt?)"); > > I don't think that we need this warning message. If we disable > vsyscall, its address range is not differ from other addresses around > and has to be handled the same way. For example, gVisor or any other > sandbox engines may want to emulate vsyscall, but the kernel log will > be full of such messages. But with vsyscall=none, such messages are already printed. That's why I added the warning for the lockout case as well. >> diff --git a/tools/testing/selftests/x86/vsyscall_control.c b/tools/testing/selftests/x86/vsyscall_control.c >> new file mode 100644 >> index 000000000000..ee966f936c89 >> --- /dev/null >> +++ b/tools/testing/selftests/x86/vsyscall_control.c > > I would move the test in a separate patch... I can do that if it simplifies matters. Thanks, Florian