From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 6A89B385840D for ; Thu, 13 Jan 2022 21:57:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6A89B385840D 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-49-L8FNEgkdMraDDmpSMaBG_A-1; Thu, 13 Jan 2022 16:57:28 -0500 X-MC-Unique: L8FNEgkdMraDDmpSMaBG_A-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 62A1F1853028; Thu, 13 Jan 2022 21:57:26 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 013154698C; Thu, 13 Jan 2022 21:57:22 +0000 (UTC) From: Florian Weimer To: Andy Lutomirski Cc: 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, linux-kernel@vger.kernel.org, Dave Hansen , Kees Cook , Andrei Vagin Subject: Re: [PATCH v3 3/3] x86: Add test for arch_prctl(ARCH_VSYSCALL_CONTROL) References: <3a1c8280967b491bf6917a18fbff6c9b52e8df24.1641398395.git.fweimer@redhat.com> <54ae0e1f8928160c1c4120263ea21c8133aa3ec4.1641398395.git.fweimer@redhat.com> <564ba9d6b8f88d139be556d039aadb4b8e078eba.1641398395.git.fweimer@redhat.com> <4db8cff9-8bf8-0c45-6956-4b1b19b53b2f@kernel.org> Date: Thu, 13 Jan 2022 22:57:20 +0100 In-Reply-To: <4db8cff9-8bf8-0c45-6956-4b1b19b53b2f@kernel.org> (Andy Lutomirski's message of "Thu, 13 Jan 2022 13:31:04 -0800") Message-ID: <87pmovxprz.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.12 X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jan 2022 21:57:33 -0000 * Andy Lutomirski: > On 1/5/22 08:03, Florian Weimer wrote: >> Signed-off-by: Florian Weimer > > This seems like a respectable test case, but why does it work so hard > to avoid using libc? Back when this was still a true lockout and not a toggle, it was necessary to bypass the startup code, so that the test still works once the (g)libc startup starts activating the lockout. The /proc mounting is there to support running as init in a VM (which makes development so much easier). I could ditch the /proc mounting, perform some limited data gathering in a pre-_start routine, undo a potential lockout before the tests, and then use libc functions for the actual test. It would probably be a bit less code (printf is nice), but I'd probably have to use direct system calls for the early data gathering anyway, so those parts would still be there. Thanks, Florian