Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2446091imd; Fri, 2 Nov 2018 11:31:34 -0700 (PDT) X-Google-Smtp-Source: AJdET5d87F+2/EVynXOhTw4CLw1uRcf4jURXJXEdvFaRVDeUl9Koe4WvXVXfYZawCr3JBTDftHjp X-Received: by 2002:a65:608f:: with SMTP id t15-v6mr12027848pgu.382.1541183494330; Fri, 02 Nov 2018 11:31:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541183494; cv=none; d=google.com; s=arc-20160816; b=dqtsTHAggeeDrgJYA06USNhNXa5p0wmnruQwWHHYDw32ANVS+CrusVbzv4zu4gIWTf TIljVHUe82R35C2xLNOP9/W9c4abVyVq+X6oCgLSa5pkVeKpwFKSAvgP+mi1romhOV7b DEoVNFWLKDrb/ali6FIAMq/98CV2dV5iUA/9c1zBM1N+qJ7Ep4qKqZAsrSQtP2iU0mUU N9Vr8Y20us4VufOTUyCSmvxqByIVe2OVBfD3FF3QSBnr7vVc2aLUI9WjkdsvDa/TIX+p O38TFR4CXbgqw4kSJmb1WBB11Ht7pm6EHdx0QuP0+Mz1QLLM3iRnC2yZ/f+lJZMr0J51 k8Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=2ahMHxKGKYMjaGxqaMVpVzq2WKsWaxnbo1kxK4Oyu3Q=; b=aoDy10zttWPSfsmeumJNoeNXABh6CtQy1j+HqA4Zw/mARzDF6pb9YMoxp+MOLoIXpI z2V6vcFwIlJ7/sEWypz7ObU938BdRFyzn9l01iQJWQTrvY/my6h0ZSktcx1036IvRIKP YA/J5jU4olt6Hkok4OdaBcHth+CYNAXPnX5ccXfmJSEG/rgF5NC1vCyGbVcPnEX4dpeo J+MhOrxtYdSCMK2agkef8EqFTdJ4OpFwldpHC7hluJ4Ck3bN51uPmJZMr7b7DkGD4YTR 2a0G07cjCZlxgDQy8GiOBmVmrm6Xi6rLoQujRpzFL4VKpPMQ5I4y3GL5W7Ogkqp1SGXM eTQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HPdwoSnb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b124-v6si27669955pfa.135.2018.11.02.11.31.18; Fri, 02 Nov 2018 11:31:34 -0700 (PDT) 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=@linaro.org header.s=google header.b=HPdwoSnb; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728273AbeKCDhb (ORCPT + 99 others); Fri, 2 Nov 2018 23:37:31 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:46985 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726700AbeKCDhb (ORCPT ); Fri, 2 Nov 2018 23:37:31 -0400 Received: by mail-io1-f68.google.com with SMTP id y22-v6so2005288ioj.13 for ; Fri, 02 Nov 2018 11:29:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2ahMHxKGKYMjaGxqaMVpVzq2WKsWaxnbo1kxK4Oyu3Q=; b=HPdwoSnbb3151ydw3dRNtCWjVITmHiZRIwVhK8oNO0gveC0uxLZS60Z/liCg0H/eOZ mfSvl9fBeVs3NMNWMaKB3TbmlXUTVFrnrmePpmqbg92xjGPjZL/3Fw672VptpWk2arMp 6N9O/L4IW8aSuNsI727n8TgHBuMaHBpTLPzow= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=2ahMHxKGKYMjaGxqaMVpVzq2WKsWaxnbo1kxK4Oyu3Q=; b=LD3RQR550OQt83GKJZo6mo7rhjvkuWYW6EW+o8ZF86B8cT16omyxoXicZA4fAd1z2Y 9A5iHQHA3/id3VMvTuRWfZRb/UOby61lDTvRTWAEvrfFvW79dcRqbY16Gag8sTwGRXEN GJs/3qlL6pwgU0V/XCKRKJxU8T8QaXk56UoJUdmO9Gru7b4dEXI4eGyW8oFhJwLvSTcc 9eeZ0euphOdoex/eUprTegDLoWNlhL7V5lzR422bPKaKa1YK2xz1YSPWV8wB8X2ny8/w WZYtbY6gK6fT5nrvRBtzEuxVjA781kaD+oQXE/YwhJlRnQk1ggDEmDz3YP/xjWCpZERb oCbg== X-Gm-Message-State: AGRZ1gIZZ4Ymw28g6zl9NDtj1LwkNfE93pOqii8c+LnMecgpuBhN5MVt 08VzClG5+aAiXUA7Pl4/P3JZKGaeJ/eD8SBeQgTvlA== X-Received: by 2002:a6b:5d18:: with SMTP id r24-v6mr9481662iob.170.1541183362061; Fri, 02 Nov 2018 11:29:22 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:4f16:0:0:0:0:0 with HTTP; Fri, 2 Nov 2018 11:29:21 -0700 (PDT) In-Reply-To: <20181102174051.GH218059@arrakis.emea.arm.com> References: <20181030113850.31150-1-anders.roxell@linaro.org> <20181102174051.GH218059@arrakis.emea.arm.com> From: Ard Biesheuvel Date: Fri, 2 Nov 2018 19:29:21 +0100 Message-ID: Subject: Re: [PATCH v2] arm64: kprobe: make page to RO mode when allocate it To: Catalin Marinas Cc: Anders Roxell , Arnd Bergmann , Masami Hiramatsu , Will Deacon , Linux Kernel Mailing List , Laura Abbott , linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2 November 2018 at 18:40, Catalin Marinas wrote: > On Tue, Oct 30, 2018 at 11:10:51AM -0300, Ard Biesheuvel wrote: >> On 30 October 2018 at 08:49, Ard Biesheuvel wrote: >> >> On 30 Oct 2018, at 08:38, Anders Roxell wrote: >> >> >> >> Commit 1404d6f13e47 ("arm64: dump: Add checking for writable and exectuable pages") >> >> has successfully identified code that leaves a page with W+X >> >> permissions. >> >> >> >> [ 3.245140] arm64/mm: Found insecure W+X mapping at address (____ptrval____)/0xffff000000d90000 >> >> [ 3.245771] WARNING: CPU: 0 PID: 1 at ../arch/arm64/mm/dump.c:232 note_page+0x410/0x420 >> >> [ 3.246141] Modules linked in: >> >> [ 3.246653] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.0-rc5-next-20180928-00001-ge70ae259b853-dirty #62 >> >> [ 3.247008] Hardware name: linux,dummy-virt (DT) >> >> [ 3.247347] pstate: 80000005 (Nzcv daif -PAN -UAO) >> >> [ 3.247623] pc : note_page+0x410/0x420 >> >> [ 3.247898] lr : note_page+0x410/0x420 >> >> [ 3.248071] sp : ffff00000804bcd0 >> >> [ 3.248254] x29: ffff00000804bcd0 x28: ffff000009274000 >> >> [ 3.248578] x27: ffff00000921a000 x26: ffff80007dfff000 >> >> [ 3.248845] x25: ffff0000093f5000 x24: ffff000009526f6a >> >> [ 3.249109] x23: 0000000000000004 x22: ffff000000d91000 >> >> [ 3.249396] x21: ffff000000d90000 x20: 0000000000000000 >> >> [ 3.249661] x19: ffff00000804bde8 x18: 0000000000000400 >> >> [ 3.249924] x17: 0000000000000000 x16: 0000000000000000 >> >> [ 3.250271] x15: ffffffffffffffff x14: 295f5f5f5f6c6176 >> >> [ 3.250594] x13: 7274705f5f5f5f28 x12: 2073736572646461 >> >> [ 3.250941] x11: 20746120676e6970 x10: 70616d20582b5720 >> >> [ 3.251252] x9 : 6572756365736e69 x8 : 3039643030303030 >> >> [ 3.251519] x7 : 306666666678302f x6 : ffff0000095467b2 >> >> [ 3.251802] x5 : 0000000000000000 x4 : 0000000000000000 >> >> [ 3.252060] x3 : 0000000000000000 x2 : ffffffffffffffff >> >> [ 3.252323] x1 : 4d151327adc50b00 x0 : 0000000000000000 >> >> [ 3.252664] Call trace: >> >> [ 3.252953] note_page+0x410/0x420 >> >> [ 3.253186] walk_pgd+0x12c/0x238 >> >> [ 3.253417] ptdump_check_wx+0x68/0xf8 >> >> [ 3.253637] mark_rodata_ro+0x68/0x98 >> >> [ 3.253847] kernel_init+0x38/0x160 >> >> [ 3.254103] ret_from_fork+0x10/0x18 >> >> >> >> kprobes allocates a writable executable page with module_alloc() in >> >> order to store executable code. >> >> Reworked to that when allocate a page it sets mode RO. Inspired by >> >> commit 63fef14fc98a ("kprobes/x86: Make insn buffer always ROX and use text_poke()"). >> >> >> >> Cc: Laura Abbott >> >> Cc: Catalin Marinas >> >> Co-developed-by: Arnd Bergmann >> >> Co-developed-by: Ard Biesheuvel >> >> Signed-off-by: Arnd Bergmann >> >> Signed-off-by: Ard Biesheuvel >> > >> > Please remove these SOBs, Arnd and I provided input to this patch >> > but you are the one sending it (sob does not assert authorship or >> > anything like that, it just asserts that the code in the patch was >> > made available under a compatible license) >> >> As Anders points out in a private communication, the Documentation/ >> explicitly requires signoffs for Co-developed-by credits. Perhaps we >> should enhance that document to clarify that that does not mean you >> can simply add signoffs on someone else's behalf. > > I think I'll rename co-developed-by with suggested-by to keep things > simpler. Are you ok with this (or are you providing an explicit > signed-off-by)? > Either is fine with me.