Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1913291pxf; Fri, 19 Mar 2021 21:19:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmUg7uCdvPOAaR0OGKU2TDoP9EArs0qz8MszTiZ9egPfBqN8D/RoTJu56DqqtSJCDDRd60 X-Received: by 2002:a17:906:dfcc:: with SMTP id jt12mr7949849ejc.31.1616213947101; Fri, 19 Mar 2021 21:19:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616213947; cv=none; d=google.com; s=arc-20160816; b=muTXWhqDNdKmx3hbIEP5g7W0iYgw6RSOq4y5kej5o8zkQo/TRh3wp0UQ7ps0B52xXt DHGlcnX3x0jIWchwZkIWCM4Ey2vuznjT1Wmtot5Dt+8RmTPDsx1Pa7303TWpKnFctOjs hU6zuK2J5VU5Q0Q6WE/i5nTm2zbqHcm/6gcJ6qJW+zHh/69u87KhQPOr+qVz6wP/kp06 z/Krek/BERW0uUtbRYJKT1gMaHLLR0ErkgcLUMfgwx0DunoHxexYlOBI9mnYUYvK259W v9ge8O8kZ0DUSj44wmQbS4pQeF1pPVN360n/+YDJWZNqfoS8cPToBgaglh6MZx+lUYTK Vuqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=AnMg47T8Z7mVw2QYcNj+ca1PflwjFpQ0knP09yHBQe8=; b=LKpcnU/sxMU7WOMaLNrG/3FmZCH1T70dr+wBs5+JuenYIWwgCep/gEp1dX4uetioTM b+zsrlv7vOrr9pNMOjCsGMdMe//zkLlD/w98sxNh9asjGoDTwFefJlnaNZ/WWmI3Ka+r KsqaIjK48hL6Qyo327e+PWJUdZTOm5ILV7Ow6Q/xjIMT2kSPBhbEFpuTbXeNba24+Yq6 rTMFR4iLS/xqAle70o5dGweLo+ZrK5l/7Og1l2Lk9oJRdFDMZHtPvA/VZ5pcC/cnGkAK u8Xra9rF9kMIdRB28kRg/85/lckkFTdEv4Cg3SllRKJxUFmTAhZlO4RAoA7xgTSHiUcG omig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PrfZRsmz; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t10si5694408edq.420.2021.03.19.21.18.44; Fri, 19 Mar 2021 21:19:07 -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=@chromium.org header.s=google header.b=PrfZRsmz; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229748AbhCTERD (ORCPT + 99 others); Sat, 20 Mar 2021 00:17:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbhCTEQf (ORCPT ); Sat, 20 Mar 2021 00:16:35 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B60CC061762 for ; Fri, 19 Mar 2021 21:16:35 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id j6-20020a17090adc86b02900cbfe6f2c96so5803103pjv.1 for ; Fri, 19 Mar 2021 21:16:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AnMg47T8Z7mVw2QYcNj+ca1PflwjFpQ0knP09yHBQe8=; b=PrfZRsmz3UsByLzMgIDUIzCr+LhjgOYA+Nh9/H13Agb9hHJi7ziHDjVe3JuOzAL2FX xUiC3V+PT+eCW5XYT+iDKAAQ0o3CxYXpEdi8GCRjDUw/U5Of+RBSi7tmM31+HWvwZ7Fm XIU5+XedKEFeMg9zmn1ExdTrB4wQMwqm98ODw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=AnMg47T8Z7mVw2QYcNj+ca1PflwjFpQ0knP09yHBQe8=; b=ZfJSVhCHLz+ygttja5RDqMHrfdMT1gjyOr6Z5beKmd4GrycOKmmdTjiUOWXmXsdQZX 2oLdK5D9yyFUdAHdD42diNbhgsOdYiB9CW75PzjkAMKfnDqNBN2FG1mRDx6uJ99FMjAn s5Pxn/8Jf2edJSHB1Nu2bPGda6MGFLuBYHerLziMflDBmRXBFKeCtA5v91JbqLsj3zDB WdODZxVw3fwZNaVAVmwQJa34Fu7DfyrkqNLd+zJuZP4uVPl8Wq3lxeqhKJY2YAB19VP5 38y53EZqlIHudB3WsmzoIrueFx1MjYHeaJ+B9R2LfdLeV8uCTUjylsibmGGXLvvxCK5s 4plA== X-Gm-Message-State: AOAM530edBcSRIXl3ZRBKC5gS9ddQYu3RLOg7SfaDiuvshFA+82XjS/X 8kDPaL193PuDaj9xtbk+Q5BPJg== X-Received: by 2002:a17:90a:ab09:: with SMTP id m9mr1910002pjq.122.1616213794673; Fri, 19 Mar 2021 21:16:34 -0700 (PDT) Received: from drinkcat2.tpe.corp.google.com ([2401:fa00:1:b:f0c7:e1f7:948e:d8d5]) by smtp.gmail.com with ESMTPSA id s62sm6998869pfb.148.2021.03.19.21.16.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 21:16:34 -0700 (PDT) From: Nicolas Boichat To: stable@vger.kernel.org Cc: groeck@chromium.org, Nicolas Boichat , Alexandre Chartre , Arnd Bergmann , Benjamin Herrenschmidt , Christopher Li , Daniel Axtens , Greg Kroah-Hartman , Kees Cook , Masahiro Yamada , Michael Ellerman , Michal Marek , "Naveen N. Rao" , Nicholas Piggin , Paul Mackerras , Peter Zijlstra , Thomas Gleixner , clang-built-linux@googlegroups.com, linux-arch@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sparse@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [for-stable-4.19 PATCH v2 0/2] Backport patches to fix KASAN+LKDTM with recent clang on ARM64 Date: Sat, 20 Mar 2021 12:16:24 +0800 Message-Id: <20210320041626.885806-1-drinkcat@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Backport 2 patches that are required to make KASAN+LKDTM work with recent clang (patch 2/2 has a complete description). Tested on our chromeos-4.19 branch. Also compile tested on x86-64 and arm64 with gcc this time around. Patch 1/2 adds a guard around noinstr that matches upstream, to prevent a build issue, and has some minor context conflicts. Patch 2/2 is a clean backport. These patches have been merged to 5.4 stable already. We might need to backport to older stable branches, but this is what I could test for now. Changes in v2: - Guard noinstr macro by __KERNEL__ && !__ASSEMBLY__ to prevent expansion in linker script and match upstream. Mark Rutland (1): lkdtm: don't move ctors to .rodata Thomas Gleixner (1): vmlinux.lds.h: Create section for protection against instrumentation arch/powerpc/kernel/vmlinux.lds.S | 1 + drivers/misc/lkdtm/Makefile | 2 +- drivers/misc/lkdtm/rodata.c | 2 +- include/asm-generic/sections.h | 3 ++ include/asm-generic/vmlinux.lds.h | 10 ++++++ include/linux/compiler.h | 54 +++++++++++++++++++++++++++++++ include/linux/compiler_types.h | 6 ++++ scripts/mod/modpost.c | 2 +- 8 files changed, 77 insertions(+), 3 deletions(-) -- 2.31.0.rc2.261.g7f71774620-goog