Received: by 10.223.164.202 with SMTP id h10csp976228wrb; Tue, 7 Nov 2017 18:54:11 -0800 (PST) X-Google-Smtp-Source: ABhQp+Rbyx6GICD0CFglVVEfbMwzP6bfzU3Tokl3QA7X/77nZZXc4V3L0nuzaJ/VGwI9qlJVahfC X-Received: by 10.99.115.4 with SMTP id o4mr770231pgc.371.1510109651043; Tue, 07 Nov 2017 18:54:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510109650; cv=none; d=google.com; s=arc-20160816; b=YH9Uv2i//EMrl0SqorN83At6pH9MZSZugBnrns6kwPh4kToe/TDhPRF/mc2iv7IkL1 4QRGidvjO/dbqG5TreCfymEi+DyCjRt7+dK+UywVNVfiRCDczcP97pprUF1bwbPurRpy WbX++utoe1N241l8Z3VX5g2WLoTCF2niTNUGG+VqHTXQ8MQjxgPXrsSWmPJKxy2hmq84 Qjq2djnIhtuGb9EXlovoZJ+lFPrMbGM0nnKVbvvJasDm8nSN5OnpENGLAWVOCxG7ijbG qkOb9pFLDwGpr6b6v8gCL1EKhf/euEhVikn78y0iEKvvcFUNHXnew66oNxYCHZuqY5TO meRg== 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=xEhPLjnuNr8geE94VOc82xdBYWmjaziPtzLmO38wQvI=; b=HTloSjTb7xxUpl4E/9FaFBEv87NGL8YFHrcml8kBvoFlokO4psN1MGSo9ku8kboLIQ Gws2krASkKNe+Msi7hmWUDweHQgDGTvHqpIuG15UFUDOTxbH8h3C4OghVipEmRXBF5Xx r+9qupIO3IJqMVfGzlKjRc9FsO97pOUNgXcHKXKSTkn/bPGyKFTLSrXZsfAhJobtqMxK bGKeOGElxzvjY2GOrVV1N37IuZ0dvG5hQgEE5E5VKhvhgZYpHeTwV4QbMqGVR5o9YWHk GHf4XMR963/5QkIwedE3fQczF0T+P1mQv0jqdzXaEwK1zRTT5SAxPL5tCV6Z+waZm29G Xq5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=kJTJXsJ/; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=Uxwpp6sm; 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 q15si2561172pgc.21.2017.11.07.18.53.57; Tue, 07 Nov 2017 18:54:10 -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=kJTJXsJ/; dkim=fail header.i=@fb.onmicrosoft.com header.s=selector1-fb-com header.b=Uxwpp6sm; 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 S1755678AbdKGVkr (ORCPT + 90 others); Tue, 7 Nov 2017 16:40:47 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:38198 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755163AbdKGVkp (ORCPT ); Tue, 7 Nov 2017 16:40:45 -0500 Received: from pps.filterd (m0109334.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vA7Le0WO032329; Tue, 7 Nov 2017 13:40:29 -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=xEhPLjnuNr8geE94VOc82xdBYWmjaziPtzLmO38wQvI=; b=kJTJXsJ/rWOBvi+aZwBRb8+vfRKMoFJY7GT7K8wrzv1+59oVjaXBF27vcjjdOu5B/tQQ 0riEBubxMi1bjmUe4uODGkmQBLDWWoMKeRDVf0WI/qBgOPTgHU1nSnj1KkqEFUXwQSxH 9mWzMs6ABkwLAYx8DPxPwyCB06V6+/vGcLU= Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2e3mxug02p-3 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 07 Nov 2017 13:40:29 -0800 Received: from PRN-CHUB02.TheFacebook.com (2620:10d:c081:35::11) by PRN-CHUB07.TheFacebook.com (2620:10d:c081:35::16) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 7 Nov 2017 13:39:53 -0800 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (192.168.54.28) by o365-in.thefacebook.com (192.168.16.12) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 7 Nov 2017 13:39:53 -0800 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=xEhPLjnuNr8geE94VOc82xdBYWmjaziPtzLmO38wQvI=; b=Uxwpp6sm9IubFMSlCgFB2IfC0pFD7RR+Spvqvujt3TqpdmTAzDWtT5OPkaWpPNp8tI5V5g5i1/3BfQh/appginCv/CiUECF9mytEOzMk0j1W/wT0XeWTmfNd4N3bJUljl0BLC6xOlRWVsyCs8twVqC18mo1kLAsL4KTJjtreO9U= Received: from [IPv6:2620:10d:c0e1:1110::1004] (2620:10d:c094:180::1:23e4) by DM3PR15MB0969.namprd15.prod.outlook.com (2603:10b6:0:10::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 21:39:47 +0000 Subject: Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members To: Y Song , "Naveen N. Rao" 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: netdev , Sandipan Das , Brendan Gregg , Daniel Borkmann , Martin KaFai Lau , Kees Cook , From: Alexei Starovoitov Message-ID: Date: Wed, 8 Nov 2017 06:39:28 +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: SG2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:3:1::20) To DM3PR15MB0969.namprd15.prod.outlook.com (2603:10b6:0:10::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c749c825-67fb-42e1-e5ac-08d526281393 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199);SRVR:DM3PR15MB0969; X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB0969;3:/KjG2WTYY3q97zUdXIBdG4N0ac+KG4MvoZCb4KMdox3Zoy6a2PaCTkw5LOpJawk0LeZXK/+156RbZmdeW2hm9r/wPNUERttsbD06+OEOL11nf73Txn2nAnCnZULta94g1cXsOFighQ2pniBWADvoYFb3maGeW0hR1C1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EhVvieUIJG7CO3boT8xbN6AWFgkG9+kypuz/HT+vKmKDMIlyC8gZkJZLOzuyXnuqWOedVhZu5LeL5iK3wsGByZhZFFcIwTb2ilDTn4MSBKqKapXEzknVDqMG/I8JbLqaJm3pnTMfsD2FZSw8AIONJFL1JISgmxaWj5qXassZScTNFSXqxj;4:HsBO8+Bmnw3v9H24824UJTtxBRMtf4E11c06/i6fvDOSS56qHsMbwQ2r1eY6ABfbN0RjOF6ECJQngL16uFNZEH3e+EGl68iE5Ixvd+BCQnmYoRGv0WfEjcGtrq8b/P+xKa786oZeB2pCEBV6MYgRlQKW9XMcEzFoQ3aqeI4ne7cGDmECBu0/eDIYv9nrFJG9JyEPrejh83fTLwIB9/i9AelDDZ/W9hC10XRzkNj5U1FuRpDZijqVU0PVs4JalsOzxENxd1L0Udo5BECWdT8TNhUQ9RsnYAeLJN8PEMSwttHRwJNWMwmWtiJ11+v9gbp2 X-Exchange-Antispam-Report-Test: UriScan:(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)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(3002001)(3231021)(6041248)(20161123564025)(20161123558100)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DM3PR15MB0969;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM3PR15MB0969; X-Forefront-PRVS: 0484063412 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6009001)(346002)(376002)(24454002)(199003)(189002)(316002)(58126008)(50986999)(53546010)(110136005)(54356999)(81156014)(229853002)(54906003)(81166006)(76176999)(86362001)(6666003)(25786009)(8936002)(31696002)(8676002)(2950100002)(4326008)(65956001)(230700001)(6116002)(478600001)(6246003)(33646002)(64126003)(93886005)(106356001)(101416001)(23676003)(47776003)(97736004)(6486002)(65826007)(2906002)(67846002)(105586002)(65806001)(5660300001)(53936002)(50466002)(31686004)(7736002)(36756003)(83506002)(305945005)(68736007)(189998001)(39060400002)(1706002)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:DM3PR15MB0969;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?MTtETTNQUjE1TUIwOTY5OzIzOlRkcDFscDNENVlCam1BdG9nOFZlN0dpNEJF?= =?utf-8?B?bTc3Y212Z3FwZjhMVEhYblB5Wi9vL3R4b0xqSXZ5UnJGZEtGQWVVY3ZPMEhR?= =?utf-8?B?UUU4YWE5aTRrczRYRGhYOWhtRzNtV0N2Zmg3N21Rb3pDTUliUSs5Zkk2bGtJ?= =?utf-8?B?dDFPV0lGOWFWdk1ibzlTbnNQQjIzOFUwOGhLaXVvckRqdnMvemh1OVU4c3R6?= =?utf-8?B?Z2p2dzZZQU1QLzRyZUl2a21CajhRMUV0b2pYb1J6NUJVUEtBdlRLcXNrYXRQ?= =?utf-8?B?Wnh6Smw5VEFVT2pVY3FKWXN5M3dCTFF3RkNpalV4K0ZnTE1TVUNha1NtRTlH?= =?utf-8?B?UFEvRXRLSUhCWlZkMWppQUxHMVYwTEF2a1RTZjB4MGlWc3h3UWo0Sk1VWjNR?= =?utf-8?B?cUFUWGEyeHJLRG0xWmhmN05NMXlnek5PWjQwOUpERnRURmNLaSt6OVdNZmJU?= =?utf-8?B?RVhIRWpEc2RaWHlZdzB5SU5hNmkzWHFWTzNDYUtGbXQwUUdmNUV5VGh4OUFV?= =?utf-8?B?MEdjbzFYQ05FUW5lZGpiOERzTG5rUm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16LJgqQyOWLPEEE6OutBf16It/i5B65h455A=;7:bo/d+trdh4CDXcWqrcQrabe/p27/jfpjgPg3qih2dsm0oME/sSGHJCazozyKRyBd5MapdkAp/oMKvEDQNipSLQEFpC4AA5CLQ1MYO2h5IBhWOhn4xYaXKfAXJIbbIAnVnmlZRyuuv3eE7b4FVrfxTIqmYV/dpPB1Tl6mfrN+Np4fxvWlpbkSHW4FbcJopn1wF7ULGxPT2DDLNPPN+usY5oBqopNleORIBk5aLyjn7j+kUk8vE0tREwQFvI6cUPb8 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DM3PR15MB0969;20:WweZf02NTzti4bywOdkqGhor7syyoMpzNhR07PWAyRNYq7n8ZbBxZhmlPJ3T1etz6NVfiuSvtQagJt9lHLJjOez4ALlXFMCERfTzkQWUlGKdcD5mVPaybiEf8z1L2xAiwrdBIkhzwjpTOhoSDseC6MRrN8KYjpKb5Pw+bScvU4M= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2017 21:39:47.8517 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c749c825-67fb-42e1-e5ac-08d526281393 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR15MB0969 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: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. bcc rewriter issue is odd. I suspect it was broken from day one. Meaning that bcc didn't support poking into anonymous union and structs. > I verified that the drawf info with randomized structure config does not > match randomized structure member offset. Specifically, I tried > linux/proc_ns.h struct proc_ns_operations, > dwarf says: > field name: offset 0 > field real_ns_name: offset 8 > But if you print out the real offset at runtime, you get 40 and 16 respectively. thanks for confirming. It means that gcc randomization plugin is broken and has to be fixed with regard to adjusting debug info while randomizing the fields. From 1583464602098398281@xxx Wed Nov 08 02:52:01 +0000 2017 X-GM-THRID: 1583027203607239623 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread