Received: by 10.223.164.202 with SMTP id h10csp1183917wrb; Tue, 7 Nov 2017 23:38:50 -0800 (PST) X-Google-Smtp-Source: ABhQp+R5dkoDOGD+8mc5Tufn0Gq+Q4Gt/We/ctyrkQYtmhDWfiOPYyOs/D01m49kWT2Em+nF7HlC X-Received: by 10.99.114.19 with SMTP id n19mr1439907pgc.356.1510126730175; Tue, 07 Nov 2017 23:38:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510126730; cv=none; d=google.com; s=arc-20160816; b=fj0ivtGExFPxtd7aZKRBAZChNr4ZzB5ddrLaT9W6WB0rpeOqyR9v8Me5ija7a7kuJ5 RgQlrIX5AuwIJWCF+dThRTn6Kcp/nefclqWa1Sk48rUosKPiwd7nQsFgk38kvhgiQzr3 A48Kj+g1HCKBM3GyoiOE7rtJpM0evYDMExUjPCsexSOTErCjQGQq4ec5Ug33YhFo4rI4 gmM2olqqFqZTyhhDOplUDG/FiwGjqPqRNek10PsKEVQpQWYlR2yPOj1nFLTUEAqW8Baj 0KfkDZTFXS6M83Z2+S1rNW3oy4F4I3vI3H305oe30ebkMSSF0jPAgP82gKhqmuIwnDz8 bApQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature:dkim-signature:arc-authentication-results; bh=tfvv4uAd5mXuQiVvyLxXbbnYYworCWKtF5uPzgIaUuY=; b=KXP3IQkn1xwBZKZMEy5FTx+Ar8cMz+zn2qjvDi9pHX1VVckIzZjid/sYB6Ju5WOvAf 1vIB88Co69VaMcPBUK2UJ69xTLyAcpvW5napWwI1+qGzbRqKDVn3CNxLhh9OX3vft6PZ n7TUfaNeetzHaEnkZ8GfV6LCO9D0JeH/guKzBMY+NW2O9209Ww4ELmZQutki/W9UIuxG lsIRzUcI+34QK5IkxBUMVwJrfqHXDJ7GCSDMmJxIkBqNZPMpn362X1JXXmRb1lnx8iYb xPXHc6V4FnChO9atdbQJFmReM+tHGTaOIiAsQNYTJ8RQchB1eWosbpg7N2FcSj2tPgGD +JBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=M2CxEvZi; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=LQ68URnc; 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=NONE dis=NONE) header.from=fb.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k70si3111751pgc.344.2017.11.07.23.38.37; Tue, 07 Nov 2017 23:38:50 -0800 (PST) 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=@fb.com header.s=facebook header.b=M2CxEvZi; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=LQ68URnc; 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=NONE dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932436AbdKGWEv (ORCPT + 90 others); Tue, 7 Nov 2017 17:04:51 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:41190 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754183AbdKGWEt (ORCPT ); Tue, 7 Nov 2017 17:04:49 -0500 Received: from pps.filterd (m0044008.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vA7M4OwO013113; Tue, 7 Nov 2017 14:04:31 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=subject : to : references : cc : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=facebook; bh=tfvv4uAd5mXuQiVvyLxXbbnYYworCWKtF5uPzgIaUuY=; b=M2CxEvZiX2hyMjycaRXMOHDDBTLEkg5EnfLaphQ5s/6IEg7pCblL8XNYHVHvgI9ZoqQa nGgMZbRIW+EVj+e1+lb+L0/WBtIqAAjb7BHGOnyd1f758Qg9bBrDHtEGbD3fgsULKvP/ Y41ecS5zZCMO4eYeJL5jZBirEWl7yAXZpKs= Received: from maileast.thefacebook.com ([199.201.65.23]) by mx0a-00082601.pphosted.com with ESMTP id 2e3k3ygrab-4 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 07 Nov 2017 14:04:31 -0800 Received: from NAM03-CO1-obe.outbound.protection.outlook.com (192.168.183.28) by o365-in.thefacebook.com (192.168.177.24) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 7 Nov 2017 17:04:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.onmicrosoft.com; s=selector1-fb-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=tfvv4uAd5mXuQiVvyLxXbbnYYworCWKtF5uPzgIaUuY=; b=LQ68URncpmVbgkUCUC58Uvy/nuo2pkSfJh3CtHey06N2JLVq5qnqEToUxz4fkW4g8vbA5MfPXSNtvoc/aDGC3P1PxpecyDGuXMt+thGj0SbCl1MwRXT0tFw6FYTNUth0hoPqASLh8QiUIpyI5NIw9IKCyv2PQ2C7x/2l0rbGt2s= Received: from [IPv6:2620:10d:c0e1:1110::1004] (2620:10d:c094:180::1:23e4) by BL2PR15MB0961.namprd15.prod.outlook.com (2603:10b6:201:15::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Tue, 7 Nov 2017 22:04:21 +0000 Subject: Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members To: Y Song References: <20171103065833.8076-1-sandipan@linux.vnet.ibm.com> <94a4761f-1b51-8b70-fb7f-3cea91c69717@fb.com> <1509815348.8zu63uatdo.naveen@linux.ibm.com> <4acdc081-341d-ee91-a591-b1d331a8c8d5@fb.com> <1509982000.092la4257a.naveen@linux.ibm.com> <1510042830.62prnydrlw.naveen@linux.ibm.com> CC: "Naveen N. Rao" , netdev , Sandipan Das , Brendan Gregg , Daniel Borkmann , Martin KaFai Lau , Kees Cook , From: Alexei Starovoitov Message-ID: <328c2dff-7d6d-0dc0-46cf-ae715845903e@fb.com> Date: Wed, 8 Nov 2017 07:04:02 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [2620:10d:c094:180::1:23e4] X-ClientProxiedBy: HK2PR02CA0172.apcprd02.prod.outlook.com (2603:1096:201:1f::32) To BL2PR15MB0961.namprd15.prod.outlook.com (2603:10b6:201:15::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a431223b-07bf-4c6c-e788-08d5262b81cd X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603249);SRVR:BL2PR15MB0961; X-Microsoft-Exchange-Diagnostics: 1;BL2PR15MB0961;3:twkhrOjuBpzgkSLyizEr3DshoWkwf7JeJlApwAYi84r+PiH2uGmgAnSKlRQBoYc5t8X+rkKYpIUGU47jHbxT+/mz/h0nMi3Z3pySxVAGBISeMftOZHrHNxbnQlrWIH6yUzJ2Ht14w/7BobITO7Ym7qv9/4sHF0WE7tN5v3bn7m4ZE96Z5xy23D7MgpmSqKQx3kYBlt279afFnMUwvHmo7RoSx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CTd7/H4M7a9EiJUt5ddeZybEEgaGio3Y2VGxXd1jRWUgyukM9r5eTdf0MRK3Upd+/AQaza5Lgc/rwS2v4/Yy21/kLafURuWjOsNiYMnxQSyrr6t1zZZCEyx1p4TojxTJ;4:99+VpxYLFxd+SItx8hnVYjOpsfyUVTPDvgGfxLJ3tP3Zha51h2Gt9me6g+lA3vVeJPIWyZp5tEDhkSWAw1DHAFrYnOrDF/gELOGmuWBr5PqnvJCKjPg+5sSI/X5k0IuHjrYPiCvfNjUn03btEp71mk6dHyujF/RsvnU/LpUs2Exs9m1tJzmtV7oueNt4gaW6pRXYaI0NOxe2JU3UOxGPG24O4oqmPMz7X3R+KIg+38bpbrV8ofoaR+26d1yI/3UeyRa4PKtZacO+NE4mJX15qCaegxQo0ZvFvT5CdafWUdlNnbaWi+UyGh6JM4Mt2PKWiv8S+mJ9VMUSwiv8aHorAUP/fVdxsy3VQKTTL9GOreE= X-Exchange-Antispam-Report-Test: UriScan:(67672495146484)(104084551191319); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(11241501159)(6040450)(2401047)(8121501046)(5005006)(3231021)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(3002001)(6041248)(20161123555025)(20161123564025)(20161123560025)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BL2PR15MB0961;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BL2PR15MB0961; X-Forefront-PRVS: 0484063412 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(376002)(346002)(199003)(189002)(24454002)(33646002)(106356001)(31686004)(1706002)(105586002)(6116002)(1411001)(478600001)(5660300001)(53546010)(2950100002)(6916009)(6666003)(6246003)(4326008)(53936002)(65826007)(8676002)(81156014)(81166006)(83506002)(68736007)(8936002)(25786009)(2906002)(229853002)(65956001)(65806001)(50466002)(6486002)(64126003)(39060400002)(47776003)(230700001)(36756003)(97736004)(305945005)(23676003)(7736002)(86362001)(189998001)(31696002)(67846002)(76176999)(54906003)(54356999)(58126008)(93886005)(316002)(50986999)(101416001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:BL2PR15MB0961;H:[IPv6:2620:10d:c0e1:1110::1004];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: fb.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTDJQUjE1TUIwOTYxOzIzOmhFaklhMUdUamk0c2trRUdMS0I2dnZ2NVk1?= =?utf-8?B?V2daTm12Z2ltQ1NwTUJIUVVnL0YrdjZobllyUmFVZGFmQ2FGSFhva1NqeWdT?= =?utf-8?B?cjkwblN3M3JLdW1zSFVOOTdHYzVLRW5JMExPYURoTnUzN0JVNjMzbVlRbDRo?= =?utf-8?B?QkszRk0wZ2ltdkkzelpPeG5QZFVhRzQzbG41c1BPc1VOOG85SGpOWi9mYjgv?= =?utf-8?B?SDNBNUN2NGRvMGFIbXRHR0VFOExDNlNQTTBSNDBZL2VXTmZPdGlHZmR0dlR2?= =?utf-8?B?YlhwVHg0bjNWQmJvdEIvRWg4WTRqSDEvYkwyekp6ck9USG5QT0pzZEJtU3JJ?= =?utf-8?B?U05jNWRjaFhTZGEwUGF0aGlYVlluVm5acURtbE00SjFobjlWa3c2RWlUcmU2?= =?utf-8?B?UFRxSlF0Tmx0VjRReDBHellkS2xQSklWZTU4MmNVUzlwNmNTZnh2UlRvTEdV?= =?utf-8?B?SjVjU1pRREFEazQ1cFFLbDBlNFZHcEQvSXR4azZVcmJ1ZVcvN0RVM29hdWlp?= =?utf-8?B?Y1UxM1pFQ0ZLbjFWZmFma21XVll3S2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AzeXiAUHTsV8in+YlBwqOseRVgiOG0q2lx5ZPwU9LTK1xvf52yMOKzc=;7:439cERteqDLzGcE6wS9WzpUr5byIaJuSVelh7ldaed9kykvptGE35U7cTIuWfeNSumOwnfDBqNRgCDtBlx1QlcIkEXCaWzWPo2pbD8K/ix9+K2ySzidi/5UHmmOlflD724ngUpnv+BNX9+JLaTTZUfXiQa87dn6CloD90/J6EyxvKG3xy7grYzpnhnlNnhkIm/K7MJBAybSwn5UA3VcMIomC8XSxSLcFU4awmJAXPici8TEebc4Mxgtix2EiqWTD SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BL2PR15MB0961;20:iJUBz/FmhOSL1zqM63Ufz/b26Pm4eWJQqpl1pZr/jI88uT8qK3/hIO44oxy9KnnVNvdhNbFp8O3mgqpZR+LBCkxaLmoRrdpen3XugAvnwWIb3T/3bm7nHIjn0BtARdmf2VPfLzxmPhn1nWSfa1oX2FrI7DnktNcqwNERQSze7qA= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2017 22:04:21.0058 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a431223b-07bf-4c6c-e788-08d5262b81cd X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR15MB0961 X-OriginatorOrg: fb.com X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-07_07:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/8/17 6:47 AM, Y Song wrote: > On Tue, Nov 7, 2017 at 1:39 PM, Alexei Starovoitov wrote: >> On 11/8/17 6:14 AM, Y Song wrote: >>> >>> On Tue, Nov 7, 2017 at 12:37 AM, Naveen N. Rao >>> wrote: >>>> >>>> Alexei Starovoitov wrote: >>>>> >>>>> >>>>> On 11/7/17 12:55 AM, Naveen N. Rao wrote: >>>>>>> >>>>>>> >>>>>>> I thought such struct shouldn't change layout. >>>>>>> If it is we need to fix include/linux/compiler-clang.h to do that >>>>>>> anon struct as well. >>>>>> >>>>>> >>>>>> >>>>>> We considered that, but it looked to be very dependent on the version >>>>>> of >>>>>> gcc used to build the kernel. But, this may be a simpler approach for >>>>>> the shorter term. >>>>>> >>>>> >>>>> why it would depend on version of gcc? >>>> >>>> >>>> >>>> From what I can see, randomized_struct_fields_start is defined only for >>>> gcc >>>>> >>>>> = 4.6. For older versions, it does not get mapped to an anonymous >>>> >>>> structure. We may not care for older gcc versions, but.. >>>> >>>> The other issue was that __randomize_layout maps to __designated_init >>>> when >>>> randstruct plugin is not enabled, which is in turn an attribute on gcc >= >>>> v5.1, but not otherwise. >>>> >>>>> We just need this, no? >>>>> >>>>> diff --git a/include/linux/compiler-clang.h >>>>> b/include/linux/compiler-clang.h >>>>> index de179993e039..4e29ab6187cb 100644 >>>>> --- a/include/linux/compiler-clang.h >>>>> +++ b/include/linux/compiler-clang.h >>>>> @@ -15,3 +15,6 @@ >>>>> * with any version that can compile the kernel >>>>> */ >>>>> #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), >>>>> __COUNTER__) >>>>> + >>>>> +#define randomized_struct_fields_start struct { >>>>> +#define randomized_struct_fields_end }; >>>>> >>>>> since offsets are mandated by C standard. >>>> >>>> >>>> >>>> Yes, this is what we're testing with and is probably sufficient for our >>>> purposes. >>> >>> >>> Just tested this with bcc. bcc actually complains. the rewriter >>> is not able to rewrite prev->pid where prev is "struct task_struct *prev". >>> I will change bcc rewriter to see whether the field value is correct or >>> not. >>> >>> Not sure my understanding is correct or not, but I am afraid that >>> the above approach for clang compiler change may not work. >>> If clang calculates the field offset based on header file, the offset >>> may not be the same as kernel one.... >> >> >> why is that? >> When randomization is off both gcc and clang must generate the same >> offsets, since it's C standard. > > The patch changed compiler-clang.h, so gcc still do randomization. gcc_plugins are off by default and randomization will not be turned on for any sane distro or datacenter that cares about performance and stability. So imo above compiler-clang.h patch together with bcc fix would be enough. From 1583467998156655033@xxx Wed Nov 08 03:46:00 +0000 2017 X-GM-THRID: 1583027203607239623 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread