Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp316062ybl; Thu, 30 Jan 2020 22:59:53 -0800 (PST) X-Google-Smtp-Source: APXvYqyDrOj8B0HN6FbpJRmdN/UKL8QHqQPraFKwD39N1rE9rA95lnKv7C6wwGuhdPvUshhH74jH X-Received: by 2002:a05:6830:1248:: with SMTP id s8mr6501761otp.202.1580453993548; Thu, 30 Jan 2020 22:59:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580453993; cv=none; d=google.com; s=arc-20160816; b=ibEQ1/JkckQhEuFhUh6s9R3ODZNY5cK1x3IwqUs+ifi3azhEOJdPxE2vGjfVah/9I0 9wPud9gc9/Y3rVXLVpCm692evlAzu7WH1vY74TCSDd2Zmds4nMNe33E+ndHwWzJX4kHL OCYuoB6OJlBe07IWvZDlesGVGzU1mKnC7hhW5Hs9KpzPu2KWFK/kbqtZW1sRnxyYw8Dt ekCALkjAHl19gcwJb9/DtbDGTCd79vxW83eyk5wbDslLGfd/Qukw5FiwpCMqZ6kttUco ndOfTsURcldXpO0DJ1sHz90N6jgSWskR3R9Ljm/5x33bYhb9tosAT/g56v9/Xp1hoCW7 JUbA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=E/UTGg1s6b1EYySKa+amKSGPOfF0kUbXPz2zxvIF7cg=; b=hvk9tzzXhVsyiWXC/7BPgV96mUMRwOnYHaCEiDLetVIxBMyKXVzw1l6UtK7B4jfzUp 8FBpPIkvmTHDI20O0dWd14FoRRIv8gkVtP9Pa+1XkLfIG66bwQLeH9A4aB4D79Sq/BrJ 8JCe4NzgI9FUUZ14rs30jEq+SRS2UTVJ7wrfOdfSA1+q/xgBOLjqXdN1rC3p7I7JpFMH zRtpQkSM1PA3ZhBIA0Lpu7Xy8JHiryaMKx/uLStq85Q4CnBWdE5Sg50QXzzzkr4aeIqR qEDUuQLJW7JmtbW8kYKVJivT39VXYqGhZZMkQ8mm1WBzEOkTRBYDY/WeBMva0bHsiwtW bPYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=jTZK3fEZ; 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 g10si4409026otn.12.2020.01.30.22.59.41; Thu, 30 Jan 2020 22:59:53 -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=@c-s.fr header.s=mail header.b=jTZK3fEZ; 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 S1728079AbgAaG6S (ORCPT + 99 others); Fri, 31 Jan 2020 01:58:18 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:57397 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726127AbgAaG6S (ORCPT ); Fri, 31 Jan 2020 01:58:18 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4887N76kRdzB09ZD; Fri, 31 Jan 2020 07:58:15 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=jTZK3fEZ; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id TQmu1wzwnnpb; Fri, 31 Jan 2020 07:58:15 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4887N75VM7zB09ZC; Fri, 31 Jan 2020 07:58:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1580453895; bh=E/UTGg1s6b1EYySKa+amKSGPOfF0kUbXPz2zxvIF7cg=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=jTZK3fEZYE6QtuREWRsaTnslBL9ihw9XPwf4Edt2vBlM2x00xoUnbwKN4NDbsaxbY wp3Dmd2jnsnWrHOYKD3qWZL/Q2l+IESBAsZJczmCo2kQY8GolXsCzlejesZFBXFn5q i/drXngqIiYsyxR2Vzbe11BWcYLeUOEIwha/Z4SA= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 9DBDB8B88A; Fri, 31 Jan 2020 07:58:16 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 1xrAjDn3g1SS; Fri, 31 Jan 2020 07:58:16 +0100 (CET) Received: from [172.25.230.105] (po15451.idsi0.si.c-s.fr [172.25.230.105]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 78AF38B884; Fri, 31 Jan 2020 07:58:16 +0100 (CET) Subject: Re: [PATCH] lkdtm: Test KUAP directional user access unlocks on powerpc To: Russell Currey , 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 References: <20200131053157.22463-1-ruscur@russell.cc> <1b40cea6-0675-731a-58b1-bdc65f1e495e@c-s.fr> <0b016861756cbe27e66651b5c21229a06558cb57.camel@russell.cc> From: Christophe Leroy Message-ID: Date: Fri, 31 Jan 2020 07:58:16 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <0b016861756cbe27e66651b5c21229a06558cb57.camel@russell.cc> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Christophe