Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp318707ybl; Thu, 30 Jan 2020 23:02:48 -0800 (PST) X-Google-Smtp-Source: APXvYqyx/PCdFCAtZ/Nguf6XbRFwsbvgB+UA1eiYB2KirSiSEbguiEzR35goykeUHjE70vSLS4uJ X-Received: by 2002:a9d:7ccc:: with SMTP id r12mr6888509otn.22.1580454168033; Thu, 30 Jan 2020 23:02:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580454168; cv=none; d=google.com; s=arc-20160816; b=OjsLPfCV1L99fqmAm8cPluP3vTECEAZyc4k72cK2KWQphkcW6QInWs5636n7Pb0r+y HTZHKTfUEU0lY6atDSLEXE51T7X3e7jpieJnKM2KR+xHRg9oMNbF7Tsc8X+JPP3AZOqZ 8e+bePNJf/0TcC77u9EzuOwmknkcaTgOwEflpluwmbEcXVxnRh7TOhWxdgU+9qHICZ1B AXE2xqLPhi/dKmRfw1UuhsiP+W6nE8G9tqJK8KRUGKuO2oXsx2tuqqk4XGRqVicLUCXA CJC9d4dZcMqtLUpDZDYV16OHrMPo9AAkwtxrT/R4/GYABS3WaHrobi6IuqQCn5xHiftp hbIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature:dkim-signature; bh=t/GpK6YsM5srRFf7eFpXme57d41WlX9+o+qAquTPbfY=; b=VSf4RioUTnTpZv5mRuuQ34D3fL5EiXFvVdjBLlBzNPJNPN593OfcQyaOKQT6GbV5ZH vNCye5eeDDdWRG8YJtnu15i7+jRRRVkONtP+fJtQrlJvAurPQVoS4fLyKywh83Rv9fs0 IoBiwrIp+tut5S7SImbbfBCpuAKrlkrnXRkP+8AcwGJhC++K+Phmh4SvmuUWloExoi+m 7UFzz1o9yTgyspGJH+cbeT6TRG3hSDQtieOfV1NCRVAM+2I+/7H/d5zq1jcYkMzejCjn 4i96QQfvA2AqbDkg28RAAHhUjE/Czvi/gpJe+ZEeKgtdiD1gR5WhAOaPkrwQMpDVdlBu WQfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@russell.cc header.s=fm1 header.b=WUnP55PU; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=eWMqdOV0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x23si3741570oie.50.2020.01.30.23.02.35; Thu, 30 Jan 2020 23:02:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@russell.cc header.s=fm1 header.b=WUnP55PU; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=eWMqdOV0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728035AbgAaHBj (ORCPT + 99 others); Fri, 31 Jan 2020 02:01:39 -0500 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:51655 "EHLO wout1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726127AbgAaHBi (ORCPT ); Fri, 31 Jan 2020 02:01:38 -0500 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id B98E372C; Fri, 31 Jan 2020 02:01:37 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 31 Jan 2020 02:01:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=russell.cc; h= message-id:subject:from:to:cc:date:in-reply-to:references :content-type:mime-version:content-transfer-encoding; s=fm1; bh= t/GpK6YsM5srRFf7eFpXme57d41WlX9+o+qAquTPbfY=; b=WUnP55PUGNZUnNgg nCC6+Xby2ixN1VG0TnMXE0MGmvManZHvl4QjoRSIWlWn501h0A97hT86h/W3Vv0d /SyDesb9JQeXveIte5GJuz+jHsDasy459cDE+iAskHk1r1qnVNSZeMoNwU3K1hhR 75g9mWhEQXTLd91Md+saO87sl9mnSkrPcM1+GGxzlhmL2gRIEn7fAy+GdqBPQv0n Y6ppTNw5CCLL2NQaOcrVVL48LW3MeoY1Li8UzZSTRwmppBv42rXqoMF5sspgfvBF 5agO1T+IDNV+BnFtE4sy62gRy5DvPvTYcTMiZbQSrlSMJlD8BEOoEXxMNO1FYOyz iqlLwQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=t/GpK6YsM5srRFf7eFpXme57d41WlX9+o+qAquTPb fY=; b=eWMqdOV0wHgRiduKdiglB1u/pBpJaQMLLyYLQ1mA2ovG2/QAoJ18iTR+c z2q5mVR5mdF3stI2oRU658zN3PMKmC0hMkhHEwbhvgwxCjHFCRdqlql55RwC1ADa l5ODIF4jsBWsiUslco2kQgWJN8xsHV0EMNuySn9cMf+Cz36HsXWo13JoeYCdStk8 r8NmqBlFp93DSeApXK4zmj600vjkOR2jpT7Us2nEu43PEuomXlei7PMjYs7U/lYc r04jLCxy3xbG4jUDfJuXJ4S1n4Z/1Y6GaNSTTyU2pe8KlORAIcWkJwSeqNmSk4JS ecuXaUuHMgY5U/w/khTGLLmo2oivg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrfeelgdeljecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdeftddmnecujfgurhepkffuhffvffgjfhgtfggggfesthekredttder jeenucfhrhhomheptfhushhsvghllhcuvehurhhrvgihuceorhhushgtuhhrsehruhhssh gvlhhlrdgttgeqnecukfhppeduvddvrdelledrkedvrddutdenucevlhhushhtvghrufhi iigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehruhhstghurhesrhhushhsvghllh drtggt X-ME-Proxy: Received: from crackle.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id 403D53060A08; Fri, 31 Jan 2020 02:01:34 -0500 (EST) Message-ID: <9edd517d0238dc3319788a23d708b68102cdbc2f.camel@russell.cc> Subject: Re: [PATCH] lkdtm: Test KUAP directional user access unlocks on powerpc From: Russell Currey To: Christophe Leroy , keescook@chromium.org, mpe@ellerman.id.au Cc: linux-kernel@vger.kernel.org, dja@axtens.net, kernel-hardening@lists.openwall.com, linuxppc-dev@lists.ozlabs.org Date: Fri, 31 Jan 2020 18:01:32 +1100 In-Reply-To: References: <20200131053157.22463-1-ruscur@russell.cc> <1b40cea6-0675-731a-58b1-bdc65f1e495e@c-s.fr> <0b016861756cbe27e66651b5c21229a06558cb57.camel@russell.cc> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2020-01-31 at 07:58 +0100, Christophe Leroy wrote: > > Le 31/01/2020 à 07:53, Russell Currey a écrit : > > On Fri, 2020-01-31 at 07:44 +0100, Christophe Leroy wrote: > > > Le 31/01/2020 à 06:31, Russell Currey a écrit : > > > > + pr_info("attempting bad read at %px with write > > > > allowed\n", > > > > ptr); > > > > + tmp = *ptr; > > > > + tmp += 0xc0dec0de; > > > > + prevent_write_to_user(ptr, sizeof(unsigned long)); > > > > > > Does it work ? I would have thought that if the read fails the > > > process > > > will die and the following test won't be performed. > > > > Correct, the ACCESS_USERSPACE test does the same thing. Splitting > > this > > into separate R and W tests makes sense, even if it is unlikely > > that > > one would be broken without the other. > > > > Or once we are using user_access_begin() stuff, we can use > unsafe_put_user() and unsafe_get_user() which should return an error > instead of killing the caller. Even better, and thanks for your work on all this stuff. - Russell > > Christophe