Received: by 10.223.164.200 with SMTP id h8csp774449wrb; Sun, 5 Nov 2017 21:17:49 -0800 (PST) X-Google-Smtp-Source: ABhQp+S8Vc3it7fienusLLf9Q0RT3Jwm9XKNZfs7bYK8iFtPEzobvdtU/XFYl5lSH//nHX7KSYEi X-Received: by 10.84.129.195 with SMTP id b61mr13688060plb.82.1509945469018; Sun, 05 Nov 2017 21:17:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509945468; cv=none; d=google.com; s=arc-20160816; b=CUFKM+/jtV6/LrKStnhfGlHGXk82iTWr+n5s+jtof4YRGOB8WghEpvhQSy9F1Jsg0u LbhejBXKR3SOn5t/vafGDEYHwuq7nviG1G0ehf2Fhl3Q985gUgO7xLmBR733pYyekBZZ RWFtduWBNzsKm5pMlLRBiRVK1/ipaYScxDb8ltYFmG/4bYF03eWdQuQL/ii66RGiMT8X DmkmaPKVylTrBeSk9dqBLGAMQYlKfSVm2qxDVwKAxrpqpVTpCuTCxRrcEiOFLPH8ajUd 4H4dCSVJWZrfyK6Bnpy/NGVU7zX7nFsOQ0z8xTWfRiOwJN4DUh8HA+jwR7M0bQU8s2Cf kbPQ== 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 :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject:arc-authentication-results; bh=JZjj2dCVQhGstj6S/veDv4t0OAd1xvhbJIPhq3j1zjg=; b=SJwCd1NP+SJDTVMqdr3b8BRUnP6JaiPZfB+G7GvnR+3RSHY/Bm3cDpVSZ0vL7QISe2 WK5YMI3i7vtNJKSGZcFRd21DIOIF9Jv4ukRdiih4hdgM4pm0L8YH0xYk3HTX/hUH4bPR gP0StvpxvBTr42xjjdgK8KuWJwwGZyJ8o3hwwdE/bO2vKIyiI76GM4Tt2GNXaetu2pKm 7UO4GlGoj2QcoIElAVVHsgpKAGYl+dEnpi9JkGq+IH8KIOSXCiX1YDEiMktxg93bYWXN 1D5hOaXRgBnZ5mlQ0dKRH/1plAebPeS029+xzaBDdDJJmrZWLZXnfI2uAEwZq89s+PKC pA/w== 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 t9si11315032pgf.185.2017.11.05.21.17.32; Sun, 05 Nov 2017 21:17:48 -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 S1750953AbdKFFQ4 (ORCPT + 99 others); Mon, 6 Nov 2017 00:16:56 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49558 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750728AbdKFFQy (ORCPT ); Mon, 6 Nov 2017 00:16:54 -0500 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id vA65EPKk078292 for ; Mon, 6 Nov 2017 00:16:54 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2e219q7y5w-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 06 Nov 2017 00:16:54 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 6 Nov 2017 05:16:51 -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; Mon, 6 Nov 2017 05:16:49 -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 vA65GmX732637176; Mon, 6 Nov 2017 05:16:48 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 75C2A4C04A; Mon, 6 Nov 2017 05:12:11 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 12EA74C05A; Mon, 6 Nov 2017 05:12:10 +0000 (GMT) Received: from [9.124.31.156] (unknown [9.124.31.156]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 6 Nov 2017 05:12:09 +0000 (GMT) Subject: Re: [RFC PATCH] bpf: Add helpers to read useful task_struct members To: "Naveen N. Rao" , Alexei Starovoitov , netdev@vger.kernel.org Cc: daniel@iogearbox.net, Martin KaFai Lau , linux-kernel@vger.kernel.org, Kees Cook , Brendan Gregg References: <20171103065833.8076-1-sandipan@linux.vnet.ibm.com> <94a4761f-1b51-8b70-fb7f-3cea91c69717@fb.com> <1509815348.8zu63uatdo.naveen@linux.ibm.com> From: Sandipan Das Date: Mon, 6 Nov 2017 10:46:46 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <1509815348.8zu63uatdo.naveen@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 17110605-0008-0000-0000-000004A7DE5E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17110605-0009-0000-0000-00001E3A6FEB Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-06_01:,, 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-1711060072 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alexei, Naveen, On 11/04/2017 11:01 PM, Naveen N. Rao wrote: > > I think the offsets described in dwarf were incorrect with CONFIG_GCC_PLUGIN_RANDSTRUCT, but I'll let Sandipan confirm that. > I think that the offsets described in dwarf are probably incorrect when CONFIG_GCC_PLUGIN_RANDSTRUCT is enabled. To verify this, I used perf to attach a probe to try_to_wake_up() which is the also the function to which waker() is attached in the previously mentioned kernel sample. So, if the run the following: # perf probe "try_to_wake_up" "p->pid" # perf record -a -e probe:try_to_wake_up # perf script The value of p->pid is reported as 0. Similarly, if I try to read p->comm, it is reported to be an empty string. The same problem is seen with systemtap as well. Also, if I do a printk with offsetof(struct task_struct, pid) and offsetof(struct task_struct, comm) inside the kernel code and then compare the values with the offsets reported by pahole, they are completely different. - Sandipan From 1583171416177892701@xxx Sat Nov 04 21:11:58 +0000 2017 X-GM-THRID: 1583027203607239623 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread