Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp3975800ima; Tue, 23 Oct 2018 14:37:44 -0700 (PDT) X-Google-Smtp-Source: ACcGV62lmjtSbthX+nqOk6NWh6o6V/XHd8N8gGYdKV9pwOAQQKLZYecT0Qohww8nyNcob1bUqZwP X-Received: by 2002:a17:902:848f:: with SMTP id c15-v6mr48810155plo.119.1540330663996; Tue, 23 Oct 2018 14:37:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540330663; cv=none; d=google.com; s=arc-20160816; b=yd5Oh66DW4fm1/6jFlxawUNWSZfbEwewhyWtCY1fLqDpJvwn0oc34zYMJrVLVjL5/J TdJotUmU0mRgqtmZqa+KEvQJIKR3Dn/SamIUggMAgZxztNfEecAR1hnwxp+FqFdTyyei eYu+1rodDSVfrJ3uSPFHK+v2C/uqg4Zo5bJuSA8nhcrgFj5HKK1C3MzRFPbsW3AlIS+A ehliKEVB1yPaoRt9xmccKOx+ouC/pzFf7Ba08Q6whZ2sB9bh8VlK+Gdqpmcn18ntWqru Vd9lzSPe2p4IP+SLNolJxM15hfc6JqygIPclngkbChUmmHu6Y9056dALrGGxiQYHeX9z 8BUw== 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=Fg4OaLOHQqrefdjonA6DL8gKc44WsS6YzuIT3EPXPyc=; b=ucIekuO7DWjAlUJInVOCNaAPaWuOfKCNx35q4TJTl7vUKt72dSLKg8S1SSWZgJOfLY fZD00Y0g7/pMZOokJUhn8BxPjMvk9TfxTM82QTP1FgjdrlCI/4ld+XmQqPY2pOwSPs+t lmMPRriJyn+sFsSOCLzSp+OIQ1GhFbUsXyS/qSGsf6uC69COABfVjtSFGKfY3xGO73BI zU+cA3pWwZHhyS3D2g+Yiw2bIPoIW9rztabGzmSBll3YRap/tULacY7WhGzp3Jpc4PiD Edp+YbJaHBu6BXYc3w+0fQG+MeLrWTtLic5+fYkfChjF8QIKZ2Dm9Xbpg2S2mmy8t255 Mh9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=C9E4LDFE; 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 f66-v6si2447447pfc.35.2018.10.23.14.37.28; Tue, 23 Oct 2018 14:37:43 -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=C9E4LDFE; 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 S1729198AbeJXGB3 (ORCPT + 99 others); Wed, 24 Oct 2018 02:01:29 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:42467 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729145AbeJXGB2 (ORCPT ); Wed, 24 Oct 2018 02:01:28 -0400 Received: by mail-lf1-f67.google.com with SMTP id q6-v6so1601181lfh.9; Tue, 23 Oct 2018 14:36:15 -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=Fg4OaLOHQqrefdjonA6DL8gKc44WsS6YzuIT3EPXPyc=; b=C9E4LDFEqa5quLrdvuVRMmj43Vc5eOZNvcS2YZIGdDAwvs+LtTqg/8VaP6Fd6nfz00 6Y+Kc9Ygxx4Hsd3pPwMK8bzJDFnCw4vw2zNaOu+VZoue6LSPaLP8Pj9crYs88OlfR1q+ pgboQVBRzc+cTmFCLpSlyQunl71QSdH3MpNbzWIhwCKldHH79R1k1WZ0T6H66boZOdBV n7mvD9IH+lRIsAMMUZZajrAW5p8MC5rRpTADj8KpIgELHPkKjU6yxSVwgCIBwszpr8xl SUuArLW37lu7ZoI1jQzaAXoh/YeWiB2bfrEDO18NdKo8GXSQzCWIeSwUtgS4Hgnm59MO +k8Q== 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=Fg4OaLOHQqrefdjonA6DL8gKc44WsS6YzuIT3EPXPyc=; b=fNZYhQMLhjcnhuwsigi+3g6Eo9bk00oyJagjei+TAPEA+O7OLY6xICdUC53lD9OCsX YUu6rU8lWdrtY6mcsTM0xYb/Y6NaM59H9AOa/8Rp2Vc0TIdyNqL8HuN/83QD2/eyVWwN YMhKvGDoJ2iaU3wsdNT7qiWDh9zb0vz++8AHsVtLrbkW8nr/8TWW8LDKfY0oxExbWGLw MViYXy4tcACEdPQVesTHMRpC7bR1TEprVzos/y5l6Uc5I4pVib4YNXhqnBBy1RwftIm8 tfsPzfBztygH9MVQu1PyNCYx7Q5uAMzwGIidy89+CXhH+OEyRVv3L9+jihL4SlfO9rFO wToA== X-Gm-Message-State: ABuFfojln3JPvS+pl39sCz+Wsl5QCcaCAJJvUrA0UZF6Z/qu0pXvs0Ob MshUSTfg+fw2/kH6hlmuddM= X-Received: by 2002:ac2:5082:: with SMTP id f2-v6mr12824852lfm.47.1540330574898; Tue, 23 Oct 2018 14:36:14 -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.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Oct 2018 14:36:14 -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 12/17] prmem: linked list: set alignment Date: Wed, 24 Oct 2018 00:34:59 +0300 Message-Id: <20181023213504.28905-13-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 As preparation to using write rare on the nodes of various types of lists, specify that the fields in the basic data structures must be aligned to sizeof(void *) It is meant to ensure that any static allocation will not cross a page boundary, to allow pointers to be updated in one step. Signed-off-by: Igor Stoppa 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 | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/include/linux/types.h b/include/linux/types.h index 9834e90aa010..53609bbdcf0f 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -183,17 +183,29 @@ typedef struct { } atomic64_t; #endif +#ifdef CONFIG_PRMEM struct list_head { - struct list_head *next, *prev; -}; + struct list_head *next __aligned(sizeof(void *)); + struct list_head *prev __aligned(sizeof(void *)); +} __aligned(sizeof(void *)); -struct hlist_head { - struct hlist_node *first; +struct hlist_node { + struct hlist_node *next __aligned(sizeof(void *)); + struct hlist_node **pprev __aligned(sizeof(void *)); +} __aligned(sizeof(void *)); +#else +struct list_head { + struct list_head *next, *prev; }; struct hlist_node { struct hlist_node *next, **pprev; }; +#endif + +struct hlist_head { + struct hlist_node *first; +}; struct ustat { __kernel_daddr_t f_tfree; -- 2.17.1