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 X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 810F7C2D0A8 for ; Sat, 26 Sep 2020 16:42:19 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1859F21527 for ; Sat, 26 Sep 2020 16:42:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sNL2ORyk"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ktDKhvAE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1859F21527 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=yolWNmrEkPRxAxKWuyof7yypQmDYtYL0K15Ctu3feRU=; b=sNL2ORykoUUxhVzI+Mpd3BgAT lM8FgmFKh3gsgs91gRs4bfIh1WHpoadmYxlqd5Ct9A/NOKo4lAlCSAuJu/Z0UPlf1zwUpQlu6K0ty 6Mq5vV9iHg1YCT//teGJuFChnSa8TiC49SNha0zl2B00csFiCdJ8u2Z896mACvE1Yqkq/6U/ljft+ DJFZOJT+0S2tFocOcpjKsBMPXdbdBXRXUFm6GCjmAfGI4JKRWlK6UjXwIDA9T6tU0TQ3tQ8iki+OC E3b66sfYd8qsUw5Fl0Al6TuPROpy1EXsPdpA7cZK8+4FNVv2lOZnY4vyk6SrDPnSmJrZgn9L+OCy+ BLp9zGRyQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMDFi-0004Ju-Jx; Sat, 26 Sep 2020 16:40:50 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kMDFf-0004JL-NT for linux-arm-kernel@lists.infradead.org; Sat, 26 Sep 2020 16:40:49 +0000 Received: by mail-pg1-x541.google.com with SMTP id y14so4867039pgf.12 for ; Sat, 26 Sep 2020 09:40:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=7e0Ffrwn9v4gwzlKso2h5MvGkrn/JrEHZKg5opwz4OY=; b=ktDKhvAEHwe8lJt6SyzjuD8ysDLH+ZaxKivr7vSNNqfjlMbAkjrRKcjx9FQhBSRv2g avVO6We7wuZu3KPJ1xtiaUSR48eerv6COZCBFaITK0GSQ8hc3sJGryngsQzidOm+8D5k K9RV5zZ17LXhsmdQkw6qPdp9sxLwH/NiksOMc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=7e0Ffrwn9v4gwzlKso2h5MvGkrn/JrEHZKg5opwz4OY=; b=JMkmd+lSteopMqJQ1K7xxxilmE9ONg3DWTV+GpaRZxhLi7D9msvPSCsDQTR0myll62 mdi5Jsrr4mVw2vWKBJNU8RDFO+tqJewxfhrZGcngJsUGIpZ7IMhRjHX5TemTj+Sfu7J0 NEE+F4jJxOTWneELlldEmYYmkHB2N4fAdn+rwM48dBy58pRHW5+ycBPqJy8IiEf8CswN wTJ/54LWiPHk4nAvaJpoFZEvHR4xPnXY3CY0DPaP3hpa62RhlI4xF1CF+Mfy/HkMQpq3 qxsZYo+fONMXKA2okHJ3SjLkG+X/x8Ik2XeKw4jacd7UrLPgTT/7dqLUKMQFxlHk6kqj yVMg== X-Gm-Message-State: AOAM5308Hud+Hm76xeOQDfI/OTUXfzbUjvLc6STo2EDGG3detXUJxBBY OK41EA3PK5czMBPoRyAI7hTXPcgUFNq9+Vqm X-Google-Smtp-Source: ABdhPJxEv3B43fDRIw9oQj67xt/6OOVTGXX9ohHp1ciUHnbEei28ePC/Ydj30i0xIBeY58/VxlmDhQ== X-Received: by 2002:a63:5043:: with SMTP id q3mr3179390pgl.293.1601138445354; Sat, 26 Sep 2020 09:40:45 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h1sm2216562pji.52.2020.09.26.09.40.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Sep 2020 09:40:44 -0700 (PDT) Date: Sat, 26 Sep 2020 09:40:43 -0700 From: Kees Cook To: Pintu Agarwal Subject: Re: KASLR support on ARM with Kernel 4.9 and 4.14 Message-ID: <202009260933.C603CD8@keescook> References: <202009251301.A1FD183582@keescook> <202009251338.D17FB071@keescook> <202009251647.FD8CECD4@keescook> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200926_124048_080924_A44744BC X-CRM114-Status: GOOD ( 31.04 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Thomas Garnier , Arnd Bergmann , Ard Biesheuvel , Marc Zyngier , open list , Kernelnewbies , Russell King - ARM Linux , Ard Biesheuvel , Tony Lindgren , nico@linaro.org, Dave Martin , matt@codeblueprint.co.uk, "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, Sep 26, 2020 at 01:28:02PM +0530, Pintu Agarwal wrote: > On Sat, 26 Sep 2020 at 05:17, Kees Cook wrote: > > > > > > For a 3/1 split ARM kernel of the typical size, all kernel virtual > > > addresses start with 0xc0, and given that the kernel is located at the > > > start of the linear map, those addresses cannot change even if you > > > move the kernel around in physical memory. > > > > I wonder if this is an Android Common kernel? I think there was %p > > hashing in there before v4.15, but with a different implementation... > > > > Hi, > Thank you all for all your reply and comments so far! > Here are some follow-up replies. > > >> What device is this? Is it a stock kernel? > This is a Qualcomm Snapdragon Automotive board one with Linux Kernel > 4.9 and one with 4.14. > > >> Is the boot loader changing the base address? (What boot loader are you > >> using?) > Ohh I did not knew that the bootloader can also change the base address. > I think it uses UEFI. > How to check if bootloader is doing this ? > BTW, both 4.9 board and 4.14 board, uses same bootloader. > > >> 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. :) -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel