From patchwork Fri Sep 23 17:24:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 76898 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp682229qgf; Fri, 23 Sep 2016 10:24:33 -0700 (PDT) X-Received: by 10.98.141.20 with SMTP id z20mr14595696pfd.165.1474651473316; Fri, 23 Sep 2016 10:24:33 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f186si8710448pfg.101.2016.09.23.10.24.33; Fri, 23 Sep 2016 10:24:33 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761675AbcIWRYa (ORCPT + 27 others); Fri, 23 Sep 2016 13:24:30 -0400 Received: from foss.arm.com ([217.140.101.70]:37252 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752017AbcIWRY3 (ORCPT ); Fri, 23 Sep 2016 13:24:29 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 10EEB14; Fri, 23 Sep 2016 10:24:29 -0700 (PDT) Received: from leverpostej.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2E4413F21A; Fri, 23 Sep 2016 10:24:28 -0700 (PDT) From: Mark Rutland To: linux-kernel@vger.kernel.org Cc: Mark Rutland , Andrew Morton , Andy Lutomirski , Kees Cook Subject: [PATCH] thread_info: use unsigned long for flags Date: Fri, 23 Sep 2016 18:24:07 +0100 Message-Id: <1474651447-30447-1-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The generic THREAD_INFO_IN_TASK definition of thread_info::flags is a u32, matching x86 prior to the introduction of THREAD_INFO_IN_TASK. However, common helpers like test_ti_thread_flag() implicitly assume that thread_info::flags has at least the size and alignment of unsigned long, and relying on padding and alignment provided by other elements of task_struct is somewhat fragile. Additionally, some architectures use more that 32 bits for thread_info::flags, and others may need to in future. With THREAD_INFO_IN_TASK, task struct follows thread_info with a long field, and thus we no longer save any space as we did back in commit affa219b60a11b32 ("x86: change thread_info's flag field back to 32 bits"). Given all this, it makes more sense for the generic thread_info::flags to be an unsigned long. Make it so. Signed-off-by: Mark Rutland Cc: Andrew Morton Cc: Andy Lutomirski Cc: Kees Cook Cc: linux-kernel@vger.kernel.org --- include/linux/thread_info.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) As discussed in the arm64 RFC. Andy, I'm assuming that as with affa219b60a11b32 no x86 assembly fixups are required. An x86_64 defconfig built fine for me. I've based this on your x86/vmap_stack branch. I'm not sure what the plan is for merging that. If I should be using a different branch to base the arm64 work atop of, please let me know! Thanks, Mark. -- 1.9.1 diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index f3837c7..a2c2f88 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h @@ -13,7 +13,7 @@ #ifdef CONFIG_THREAD_INFO_IN_TASK struct thread_info { - u32 flags; /* low level flags */ + unsigned long flags; /* low level flags */ }; #define INIT_THREAD_INFO(tsk) \