Received: by 10.223.164.202 with SMTP id h10csp84484wrb; Tue, 7 Nov 2017 03:19:21 -0800 (PST) X-Google-Smtp-Source: ABhQp+Te3mwl84SJHRAb01t62NHrDwRbCaZNmQHD439ZKjY+CxjMcdMe9QZue/6xwAeB3/Vqy8cJ X-Received: by 10.101.65.200 with SMTP id b8mr18480663pgq.274.1510053561459; Tue, 07 Nov 2017 03:19:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510053561; cv=none; d=google.com; s=arc-20160816; b=DRrZYM9xKDCOK3ua+psD2k5JqhqlVGd58Jxr1svAX7HJcYUlEGOZ+VsE7cJpThGzib yyxcIZKTZifcEsQSNRK6u0Gjhq/mepQ2ieMy4vrSXUH6hP4K4DxOKKktGdWe9crPGXb4 Woiz76C6QFJWC5xSw6er3bCWJ2RixCHfhniAkZbDlfBfh5UK3raLY95W5jI5vJMZfIQT J3QHWSbEUx/5ajJT3redCef45Sl4Jtblr6g9SrjzsxxTlWSbpTQjNHUjCCL5zQ53QIjX ngSQCBmfUH9tGWm5kHETsXz0sHcYMdSmC/vYb9jmgzZPL6Cmo4z1/0PuFVQi6udZ7hed /zDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:user-agent:in-reply-to:references:cc:to:subject:from :date:arc-authentication-results; bh=oVuvz6WqQ8Ps758CfD/cBaxb5KM0eoPmJafeAw/K1aA=; b=jCt6yHoWKRVgIJydEWq9CGZOUCnrbvQQmFDXACBFHR+1RUzymXdM+SyKWlIfvhLJkX JqgJyTmTfuKf4hmBURmHcW7GRbJXLI0hG1bvXrVYUE0KFHK8oAr/AglPU9roATxl4iRY q+z8UQYb0tjkog23bc5Y9WlYvGoEuzZewbFJCe6XK8/Uuj86XL0j8GIiMffiz0Euowqh yeOBIpxC2qu3xx7b4W1wGHWfQwQZmx4Sr6BPX4dr7zuxa/n41uz1dk1fI98j9fImc0Jl gZS17TkeFMNFYapUoJ3rcklpXPzL9POk9lsyrNFHEFBeaOWcAYY/z8pIcFJhmIr2gMJ2 bI8w== ARC-Authentication-Results: i=1; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r84si1038266pfa.352.2017.11.07.03.19.08; Tue, 07 Nov 2017 03:19:21 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933296AbdKGIho convert rfc822-to-8bit (ORCPT + 91 others); Tue, 7 Nov 2017 03:37:44 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49366 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754391AbdKGIhm (ORCPT ); Tue, 7 Nov 2017 03:37:42 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vA78Yq8w043688 for ; Tue, 7 Nov 2017 03:37:41 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 2e38r81st9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 07 Nov 2017 03:37:41 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Nov 2017 08:37:39 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 7 Nov 2017 08:37:36 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id vA78baJR41484404; Tue, 7 Nov 2017 08:37:36 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 51E4A4C040; Tue, 7 Nov 2017 08:32:58 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2AC454C04E; Tue, 7 Nov 2017 08:32:58 +0000 (GMT) Received: from localhost (unknown [9.124.35.254]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 7 Nov 2017 08:32:58 +0000 (GMT) Date: Tue, 07 Nov 2017 14:07:34 +0530 From: "Naveen N. Rao" Subject: Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members To: Alexei Starovoitov , netdev@vger.kernel.org, Sandipan Das Cc: Brendan Gregg , daniel@iogearbox.net, Martin KaFai Lau , Kees Cook , linux-kernel@vger.kernel.org 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> In-Reply-To: User-Agent: astroid/0.10.2 (https://github.com/astroidmail/astroid) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT X-TM-AS-GCONF: 00 x-cbid: 17110708-0008-0000-0000-000004A866E3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17110708-0009-0000-0000-00001E3AFD62 Message-Id: <1510042830.62prnydrlw.naveen@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-07_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711070122 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. - Naveen From 1583383802262978702@xxx Tue Nov 07 05:27:45 +0000 2017 X-GM-THRID: 1583027203607239623 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread