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 45F64C433FE for ; Thu, 13 Jan 2022 21:57:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8FA346B0072; Thu, 13 Jan 2022 16:57:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8A9EE6B0073; Thu, 13 Jan 2022 16:57:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 798986B0074; Thu, 13 Jan 2022 16:57:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0094.hostedemail.com [216.40.44.94]) by kanga.kvack.org (Postfix) with ESMTP id 6B0936B0072 for ; Thu, 13 Jan 2022 16:57:33 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 2653D9636E for ; Thu, 13 Jan 2022 21:57:33 +0000 (UTC) X-FDA: 79026625986.27.66A6ABF Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf12.hostedemail.com (Postfix) with ESMTP id AEADC40003 for ; Thu, 13 Jan 2022 21:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642111052; 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=TMX/kWIlUA1AE1kmxxn6oC9JgTpebsg3ohbjH9GEsvI=; b=QCy0z4QKlCt2xk5bhBdER2Um5YkPf6Fu8Tba23UZaZXhCp/Zc1iQompjvFpPRrBHr2i8a0 AsFFdIbvsBLZPAaZZsxKMiODaivolV/fRy4FB3pz8+e5ikzTJrW+ByQ3ulSnnspGEJqy+G vYbuENM8MWr0Yt5+DWAol7lqFtwl8K0= 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-Rspamd-Queue-Id: AEADC40003 X-Stat-Signature: 4nobma5g4sor5zn1zbjpky1udearomxw Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QCy0z4QK; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf12.hostedemail.com: domain of fweimer@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=fweimer@redhat.com X-Rspamd-Server: rspam06 X-HE-Tag: 1642111052-156618 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: * 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