Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp3975303ima; Tue, 23 Oct 2018 14:37:06 -0700 (PDT) X-Google-Smtp-Source: ACcGV63FMvbRbeLadpQGWhBhW4YSxXBfH4OvM+ii4vNMWbrB+DlPMl0vSjdLqjjwlRuoET8RSa/4 X-Received: by 2002:a62:401:: with SMTP id 1-v6mr51152670pfe.236.1540330626094; Tue, 23 Oct 2018 14:37:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540330626; cv=none; d=google.com; s=arc-20160816; b=kL5UFm8c95pvg9p7Z9SHvg0TYFoRpRs8u2K8fjpGjtx13iegA174GztJWMN+JkD8XD /K67o4bwUXlhE3jH3/rXp86zEYLFWcQEOVAyzYYdnE62JcQp6CK4bfXt74PP9ntF+s+Q BvU1WC8Zr7TzaJp2YS+MN3XD/BHx24tLWMHWwwbgxLN1mgNqhKAaodNOyfcnUWA90pxL n434KRmMXz6Pc5eF1YGTOGv5zdih/igGtUvSP9zWPXbjsM+ffVid1YthRHqC16mvPPQ3 SkSZ/tp2xdBkFEDX5J2/Zf6uS+ojYLGEsAu8ho0Cx8swgkIwKrA4SDjAKu9BA7fpElpS HhsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:reply-to:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=TAyei4tGiwzaEFtWD6qceoBqlcxrR+efj6ojDl9ZulY=; b=Icqlr9zF1e18GiuBddcMIKE7F8/7fVfOS7q57gmzycrHfzd5NryzDA6zntJ/jhGIaD r5naVF9Fapo4vagYaYov172GctTpsJ/TdgZbRQsql8RPmlpl7Vocoly357j7S6aFdgI1 3OyJCQ+BwJtZqEF5L7vv61WVFe0TFv6ZqUHqtrRdd6PCiRLg7uGULjWNMGS76oSV5sIG Fy87hVTafVKHRJ0yUMiTwxDsldrfJeaGCyTRQBBm/K02OFq7LWDTLtemlnGMqiCNaB3T BjF/FRHfO27mitySbVuIHCNkUZFae+I2/vF/GjgGL9I9tkvNJS0WLaESegxadHqvyQT4 aiCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=itzYzOZK; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 32-v6si2501831plc.11.2018.10.23.14.36.50; Tue, 23 Oct 2018 14:37:06 -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=@gmail.com header.s=20161025 header.b=itzYzOZK; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729220AbeJXGBb (ORCPT + 99 others); Wed, 24 Oct 2018 02:01:31 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:42155 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728725AbeJXGB3 (ORCPT ); Wed, 24 Oct 2018 02:01:29 -0400 Received: by mail-lj1-f193.google.com with SMTP id l25-v6so994869lja.9; Tue, 23 Oct 2018 14:36:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references:reply-to; bh=TAyei4tGiwzaEFtWD6qceoBqlcxrR+efj6ojDl9ZulY=; b=itzYzOZKVGSRr5rVXV9w3CTN+HNRtiP2lfwk2bdN5A02HCaZvCEbnax0J9Fu/juSNo EcY511Ql87pqbnb0nQ0U4qlvdE/WGUUTyhGDw3ocKVdXVrH6nq1j+VVbuuQZBZ3Y2I+u 29hbESNI1S7hLjecHmP8IOlcVCaZa30vVsEtLe64Cw9MI0v07p2NrG9jjY3s2KBpm8lg rRfTiwuxjwvwnfNey826fVQVWA/nhe5Q/2Tp+jYyyT3lcto+pe0S34JatMd3V+ebedOk MjWulDt7SOtNxlaCwZMuKPaoMCvmL2XsAbZoMRLzFuGwvYBHmVQ/0nqh9XiTQOyJz+ee 7Qwg== 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:in-reply-to :references:reply-to; bh=TAyei4tGiwzaEFtWD6qceoBqlcxrR+efj6ojDl9ZulY=; b=qmPncgZgYAZ7B5z9r9VkHj7sP3R+Goc+1cjWqvxT+uCPkJ8DpIope5xsWZg2OOmcV7 xLNIrWh1a4Dddfs9dWxkIq9b2KG9l34HKqkhDvqohX0rQQI7qiDLQ6byf9f7eIhoG5sJ TDiBlviZCfsat/Mo+1pFnzmXXHQ9jV6Z1fwd4TJzLr3EoYcblY16CYxAemcZVLdf11lI cqWOIXeOrp5nNUUgK8cTD4BIbzNJJbyuNurzgA/flVxkAR7PBnbqmEP+EXd+4wUpI5HI e66nDUaD3LnhnQ0vAwsw1Ua4CPduAMx5Sl8P6p+0E+iBHa0PTD2l1VmYXklgkvAI3QN5 R23w== X-Gm-Message-State: AGRZ1gJEmDFFjsnpYXaDIE4V21mQYDS0pnMcky6bmnhDm+NhBs6jEjNQ 4E9NubASgMH+e9+XL8fltiI= X-Received: by 2002:a2e:3810:: with SMTP id f16-v6mr13247460lja.77.1540330576357; Tue, 23 Oct 2018 14:36:16 -0700 (PDT) Received: from localhost.localdomain (91-159-62-169.elisa-laajakaista.fi. [91.159.62.169]) by smtp.gmail.com with ESMTPSA id y127-v6sm377950lfc.13.2018.10.23.14.36.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Oct 2018 14:36:15 -0700 (PDT) From: Igor Stoppa X-Google-Original-From: Igor Stoppa To: Mimi Zohar , Kees Cook , Matthew Wilcox , Dave Chinner , James Morris , Michal Hocko , kernel-hardening@lists.openwall.com, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org Cc: igor.stoppa@huawei.com, Dave Hansen , Jonathan Corbet , Laura Abbott , Greg Kroah-Hartman , Andrew Morton , Masahiro Yamada , Alexey Dobriyan , Pekka Enberg , "Paul E. McKenney" , Lihao Liang , linux-kernel@vger.kernel.org Subject: [PATCH 13/17] prmem: linked list: disable layout randomization Date: Wed, 24 Oct 2018 00:35:00 +0300 Message-Id: <20181023213504.28905-14-igor.stoppa@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181023213504.28905-1-igor.stoppa@huawei.com> References: <20181023213504.28905-1-igor.stoppa@huawei.com> Reply-To: Igor Stoppa Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some of the data structures used in list management are composed by two pointers. Since the kernel is now configured by default to randomize the layout of data structures soleley composed by pointers, this might prevent correct type punning between these structures and their write rare counterpart. It shouldn't be anyway a big loss, in terms of security: with only two fields, there is a 50% chance of guessing correctly the layout. The randomization is disabled only when write rare is enabled. Signed-off-by: Igor Stoppa CC: Kees Cook CC: Greg Kroah-Hartman CC: Andrew Morton CC: Masahiro Yamada CC: Alexey Dobriyan CC: Pekka Enberg CC: "Paul E. McKenney" CC: Lihao Liang CC: linux-kernel@vger.kernel.org --- include/linux/types.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/types.h b/include/linux/types.h index 53609bbdcf0f..a9f6f6515fdc 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -187,12 +187,12 @@ typedef struct { struct list_head { struct list_head *next __aligned(sizeof(void *)); struct list_head *prev __aligned(sizeof(void *)); -} __aligned(sizeof(void *)); +} __no_randomize_layout __aligned(sizeof(void *)); struct hlist_node { struct hlist_node *next __aligned(sizeof(void *)); struct hlist_node **pprev __aligned(sizeof(void *)); -} __aligned(sizeof(void *)); +} __no_randomize_layout __aligned(sizeof(void *)); #else struct list_head { struct list_head *next, *prev; -- 2.17.1