Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751889AbbBUHFA (ORCPT ); Sat, 21 Feb 2015 02:05:00 -0500 Received: from mail-db3on0064.outbound.protection.outlook.com ([157.55.234.64]:47168 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750746AbbBUHE5 (ORCPT ); Sat, 21 Feb 2015 02:04:57 -0500 Message-ID: <54E803FB.901@ezchip.com> Date: Fri, 20 Feb 2015 23:05:15 -0500 From: Chris Metcalf User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Catalin Marinas CC: Bamvor Jian Zhang , , , , , "dingtianhong@huawei.com" , , "linux-kernel@vger.kernel.org" , Will Deacon , , "lizefan@huawei.com" , , , , , , , , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH] compat: Fix endian issue in union sigval References: <1423563011-12377-1-git-send-email-bamvor.zhangjian@huawei.com> <20150210122718.GC32052@e104818-lin.cambridge.arm.com> <54DB3B60.4050100@huawei.com> <20150211154054.GD9058@e104818-lin.cambridge.arm.com> <54DDAF2B.2070707@huawei.com> <20150213104455.GA3508@e104818-lin.cambridge.arm.com> <54DE730D.3090100@ezchip.com> <20150214112220.GB10246@MBP.local> In-Reply-To: <20150214112220.GB10246@MBP.local> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [173.76.21.154] X-ClientProxiedBy: DM2PR11CA0020.namprd11.prod.outlook.com (25.160.91.30) To AM3PR02MB0533.eurprd02.prod.outlook.com (25.160.6.139) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=cmetcalf@ezchip.com; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:AM3PR02MB0533; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005003);SRVR:AM3PR02MB0533; X-Forefront-PRVS: 049486C505 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(6009001)(164054003)(377454003)(24454002)(199003)(189002)(479174004)(66066001)(50466002)(65956001)(65806001)(92566002)(46102003)(97736003)(93886004)(101416001)(117156001)(19580395003)(23746002)(15975445007)(106356001)(65816999)(122386002)(68736005)(77096005)(50986999)(54356999)(76176999)(40100003)(64706001)(110136001)(33656002)(105586002)(36756003)(42186005)(83506001)(86362001)(64126003)(77156002)(87976001)(47776003)(2950100001)(62966003)(7059030)(18886065003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM3PR02MB0533;H:[192.168.1.160];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:AM3PR02MB0533; X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2015 07:02:16.3486 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR02MB0533 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1329 Lines: 28 On 2/14/2015 6:22 AM, Catalin Marinas wrote: > 1. user populates sival_int compat_sigevent and invokes > compat_sys_mq_notify() > 2. kernel get_compat_sigevent() copies compat_sigevent into the native > sigevent. compat and native sival_int are the same, no problem so > far. The other half of 64-bit sival_ptr is zeroed by a memset in this > function (this other half can be top or bottom, depending on > endianness) > 3. signal is about to be delivered to user via arch code. The > compat_ptr(from->si_ptr) conversion always takes the least > significant part of the native si_ptr. On big endian 64-bit, this is > zero because get_compat_sigevent() populated the top part of si_ptr > with si_int. Thanks, that makes sense. I was missing the fact that the conversion issue was actually around the in-kernel 64-bit version of the structure. Using si_int consistently does seem like it should do the right thing; I'll post a patch for tilegx32 big-endian to do the right thing here. -- Chris Metcalf, EZChip Semiconductor http://www.ezchip.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/