Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3050708pxk; Mon, 28 Sep 2020 07:13:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzqp/5XZAgExGy2Mmb6rCcrHsi/dTrHF1A1H7zQmgevMXAgi9JH3x9IlSwrm2GPG8A9NGJ/ X-Received: by 2002:a17:906:e18:: with SMTP id l24mr1855726eji.334.1601302433752; Mon, 28 Sep 2020 07:13:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601302433; cv=none; d=google.com; s=arc-20160816; b=FJzVpYPW5YBfnWREPYd2EGAk8mr4CMxxcCdCzy/5TNZ7sGf1qPYfkdcW1ItGoI5vaq JyIzM9CrKL8a+d9SP1JXE2vJc37FrS8qIRaWNRuL9u8nH/cX2xjLWxgN7GbziQAMO9MU 5s31bjw615hk5QqHBw1/U1yoTdZwm+aACXATjS0J9eVuWHLhWbzqP+LczIgavtKPYCW9 ByWv/otN7HVtSvE6Tx9B41UAGOq7dDHyDh06XKcc6d9Ll6BIQBJdHPpIwAx9/liey/KH zVJErkNL/o+eH97TDxaZpgj9kvS9dR0CXaYtfzQTa3yE4+iKj3pWBN6gRRb46Mp1Z1ZO EENg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Tefr7BiFg39dwwsMVzHhoZjOTiYyT1GtzIbXqdzA3RQ=; b=CKWAsigrwdw35/HYYIO/CcAWBUhARC/c9A1twx1hWZXm0rV9G2qcabkIjuxBHJkhAW oZb4EPXVuV2MTNbuDrJcOPo1pLK25p86hYon8akOiNXJ8iy3G4S4MV5naHKWuIasRHyQ 6i1Dt/iPwO4NU9jvSNya1DyBUT4Eztq3RuqvxFrfCQvqC7GmZR8SIXOqJtUjsGk4ants +88MgtX0XXDe/qPep7Z0QDT67A9nY+eNOwdvEWnLqHrTYts7ezNRH58dbjPXvMpUeLr+ myVqgp3NTF1IebUVq69L80iWDGb6OTZmTBbOMVdshzbhPd9li/2OV2berTY0xjKnGU/F 5Fxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cXl8XE2U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d7si702293ejc.635.2020.09.28.07.13.30; Mon, 28 Sep 2020 07:13:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cXl8XE2U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726594AbgI1OL1 (ORCPT + 99 others); Mon, 28 Sep 2020 10:11:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725290AbgI1OL0 (ORCPT ); Mon, 28 Sep 2020 10:11:26 -0400 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80E45C061755 for ; Mon, 28 Sep 2020 07:11:26 -0700 (PDT) Received: by mail-ej1-x642.google.com with SMTP id gx22so8743772ejb.5 for ; Mon, 28 Sep 2020 07:11:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Tefr7BiFg39dwwsMVzHhoZjOTiYyT1GtzIbXqdzA3RQ=; b=cXl8XE2U4M1Uq5WJZJO+7kQtPfIkT7190lUQPtIRikXcIVUCIifzMHW932m5pjfAaW 0Tb49s8LXw6flO8kvaqPRkA/68nTljoblmBx87fY2t+GKGsAJUuKE29SNGbc/E0eomfN GP44GTROn2cLLqVB2CTbgR6PTIW4aIfK46QKSuQ9BUDmrDjgIlS3TLD25IpWqvyibf0s aDIGop+wujTvC8qBgG+gIcia3TMfAxM1IMG5CvVPfkbmILuuHqMjjDarHTWmumyRToW/ gc0NVTasRm3wnPL2oBdiB5shLfc/qm/Bq/tT8enqX0rtIFnnDvDrcisZq40p6nYb8SP+ kpfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Tefr7BiFg39dwwsMVzHhoZjOTiYyT1GtzIbXqdzA3RQ=; b=eSPL6yQJgACFzZ+ZQ1hHdP0wU1ace2YFi0PbNUaz1Wu/GwSKStHGLH9cNlYK7HAarv B/Dcft5y9ut9/uNTiux8vyCwP3RIlt9FQKkxQkHC27ZZYYOq92T7ytFhGkVoWIbTaglC xrxarG51cA0zH0c0DIRKiIz1pz6R3IvUuTd8oq1Ug8EIOAR0o0uSWwwTrlZa4S6p7GB/ zTyN3Oz7zITX3EQHwLDnglSoVRAoSi2rAzXU7DIB6BeCCjeVPDaMDyi1Xoa+crYpqC1D ZnRtT6+NEaezaivnZ2coDhBsrNinTiJfb7s2pzZZ1hHmEtLXs1Plxwdft9WOqDqJTlVU EvIA== X-Gm-Message-State: AOAM531mBDAVPEIvIJysp73loIvOOtSdTB+lFybyWYOhFP5SliffGxPz ZpS2HSk1Id1nXMe2enAmsCgWSIhC7tjRQRnNSXI= X-Received: by 2002:a17:906:e24d:: with SMTP id gq13mr1789288ejb.152.1601302285000; Mon, 28 Sep 2020 07:11:25 -0700 (PDT) MIME-Version: 1.0 References: <202009251301.A1FD183582@keescook> <202009251338.D17FB071@keescook> <202009251647.FD8CECD4@keescook> <202009260933.C603CD8@keescook> In-Reply-To: From: Pintu Agarwal Date: Mon, 28 Sep 2020 19:41:13 +0530 Message-ID: Subject: Re: KASLR support on ARM with Kernel 4.9 and 4.14 To: Kees Cook Cc: Ard Biesheuvel , Mark Rutland , Arnd Bergmann , Ard Biesheuvel , Marc Zyngier , Dave Martin , Kernelnewbies , Russell King - ARM Linux , open list , Tony Lindgren , matt@codeblueprint.co.uk, nico@linaro.org, Thomas Garnier , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 28 Sep 2020 at 19:15, Pintu Agarwal wrote: > > On Sat, 26 Sep 2020 at 22:10, Kees Cook wrote: > > > > >> I wonder if this is an Android Common kernel? > > > It uses the below kernel for 4.14: > > > https://gitlab.com/quicla/kernel/msm-4.14/-/tree/LE.UM.3.4.2.r1.5 (or > > > similar branch). > > > > Okay, so yes. And this appears to have the hashing of %p backported. I > > cannot, however, explain why it's showing hashed pointers instead of > > just NULL, though. > > > > It might be related to these commits but they're not in that kernel: > > 3e5903eb9cff ("vsprintf: Prevent crash when dereferencing invalid pointers") > > 7bd57fbc4a4d ("vsprintf: don't obfuscate NULL and error pointers") > > > > > ==> The case where symbol addresses are changing. > > > > > > kptr_restrict is set to 2 by default: > > > / # cat /proc/sys/kernel/kptr_restrict > > > 2 > > > > > > Basically, the goal is: > > > * To understand how addresses are changing in 4.14 Kernel (without > > > KASLR support)? > > > * Is it possible to support the same in 4.9 Kernel ? > > > > Try setting kptr_restrict to 0 and see if the symbol addresses change? I > > suspect Ard is correct: there's no KASLR here, just hashed pointers > > behaving weird on an old non-stock kernel. :) > > > > Okay. Thank you so much for your comments and suggestions. > You mean to say, setting kptr_restrict to 0 may avoid changing symbol > addresses in 4.14 ? > And, sorry, I could not understand the thing about this "hashed pointers". > How can I check this behavior in source code to understand better? > Is it possible to give some reference ? > I wanted to disable this hash pointer on 4.14 kernel and check the behavior. > Also if possible, we would like to make this similar change on 4.9 > kernel as well. > Okay, I found these changes in 4.14 kernel: https://gitlab.com/quicla/kernel/msm-4.14/-/commit/e63732dbfe017aa0dbabac9d096b5fde8afbd395 Are we talking about this? I cound not find this in 4.9 kernel. I will disable kptr_restrict and check or, I will enable CONFIG_DEBUG_CONSOLE_UNHASHED_POINTERS and check. Thanks, Pintu