Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp59569ybl; Wed, 21 Aug 2019 14:51:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5uH5iKeKQdy3Gl6uhxN/HRxKNHZg2FtpAalmo4VQ80D+ENkTEYXLcESex8p6PKqcyPnOe X-Received: by 2002:aa7:8189:: with SMTP id g9mr38450736pfi.143.1566424271784; Wed, 21 Aug 2019 14:51:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566424271; cv=none; d=google.com; s=arc-20160816; b=lpPVolTOoTDnaBwoNzgs0KNMKAhUXdMsB71xEH+GHSWWgG6rGrdg3EJYaiEY6ury2/ iNgbcp+d3Xj70ELfbmJy1i69odnrzUybi01gbbOomrkcdiBBDH2UUh169haC0CKVULaq iL6GC2V7R72B1g81+DOALnk5LBs/Qk2NghzzgJlsPQo6HMoirs0mJ7w56G9OK0m2i62y k166HCBKCp3JqiyE8HYc1uXmkPyqYVseMVXZgKaCjtGz0uRCpLAFjJ1EH8aG2md6ua+k zffNjxXnCsWD5Tnp1td46k/UA21/vz0T54iYdp3Ke6JFcNan+Zc9jVxXtZZrMAHAJjbG Jy3Q== 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 :user-agent:mime-version:in-reply-to:references:cc:to:subject:from :date; bh=OEXVBJCVIz6/T6arViyYhBK0su7ohYNRTETqtsc/B0w=; b=LRNRt//Qb58K1tYnD0zqmccy06izYs60X0dXF7J7QwU1Q7BDORmU7hKyo2pF18ff1c WF8BqBG1hSjB7/RBNZvCtcfdnFAJyCgti05EmoppYCscdQ2oB2XZ+U6oX3S3mZNLfDa7 i0eu956OEGXImCRubineE/uilR9YLK8izsbCykSgwucnM20VejtoZkMDSM1HdkIAuyI2 h8GJr88hfzJolhCN7TXIVUk9mXduPe9SlxibGoicMSrGbTkGa0K7Ie96CgCOKR2fqLKW 55uYCzTAfSQQXVgExMOD646cuhB0pI8tZrk9RI+cKvYJNfAUMOUEJBKoBEIjsWuDcKxf KDwg== 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 d35si15999120pla.90.2019.08.21.14.50.55; Wed, 21 Aug 2019 14:51:11 -0700 (PDT) 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 S1729486AbfHUTM1 convert rfc822-to-8bit (ORCPT + 99 others); Wed, 21 Aug 2019 15:12:27 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:14762 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727685AbfHUTM1 (ORCPT ); Wed, 21 Aug 2019 15:12:27 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x7LJCQ8a027579 for ; Wed, 21 Aug 2019 15:12:26 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2uhb5y1q1h-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 21 Aug 2019 15:12:25 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 21 Aug 2019 20:12:17 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 21 Aug 2019 20:12:15 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x7LJCE5f48169192 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 21 Aug 2019 19:12:14 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9D7D64C044; Wed, 21 Aug 2019 19:12:14 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3280F4C040; Wed, 21 Aug 2019 19:12:14 +0000 (GMT) Received: from localhost (unknown [9.85.72.179]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 21 Aug 2019 19:12:13 +0000 (GMT) Date: Thu, 22 Aug 2019 00:42:12 +0530 From: "Naveen N. Rao" Subject: Re: Regression fix for bpf in v5.3 (was Re: [RFC PATCH] bpf: handle 32-bit zext during constant blinding) To: Jiong Wang , Michael Ellerman Cc: Alexei Starovoitov , bpf@vger.kernel.org, Daniel Borkmann , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org References: <20190813171018.28221-1-naveen.n.rao@linux.vnet.ibm.com> <87d0gy6cj6.fsf@concordia.ellerman.id.au> <87k1b6yeh1.fsf@netronome.com> In-Reply-To: <87k1b6yeh1.fsf@netronome.com> MIME-Version: 1.0 User-Agent: astroid/0.15.0 (https://github.com/astroidmail/astroid) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT X-TM-AS-GCONF: 00 x-cbid: 19082119-0028-0000-0000-0000039234C0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19082119-0029-0000-0000-000024545D62 Message-Id: <1566414605.l9kcxxdjo7.naveen@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-21_06:,, 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 mlxscore=0 impostorscore=0 mlxlogscore=781 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908210184 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jiong Wang wrote: > > Michael Ellerman writes: > >> "Naveen N. Rao" writes: >>> Since BPF constant blinding is performed after the verifier pass, there >>> are certain ALU32 instructions inserted which don't have a corresponding >>> zext instruction inserted after. This is causing a kernel oops on >>> powerpc and can be reproduced by running 'test_cgroup_storage' with >>> bpf_jit_harden=2. >>> >>> Fix this by emitting BPF_ZEXT during constant blinding if >>> prog->aux->verifier_zext is set. >>> >>> Fixes: a4b1d3c1ddf6cb ("bpf: verifier: insert zero extension according to analysis result") >>> Reported-by: Michael Ellerman >>> Signed-off-by: Naveen N. Rao >>> --- >>> This approach (the location where zext is being introduced below, in >>> particular) works for powerpc, but I am not entirely sure if this is >>> sufficient for other architectures as well. This is broken on v5.3-rc4. >> >> Any comment on this? > > Have commented on https://marc.info/?l=linux-netdev&m=156637836024743&w=2 > > The fix looks correct to me on "BPF_LD | BPF_IMM | BPF_DW", but looks > unnecessary on two other places. It would be great if you or Naveen could > confirm it. Jiong, Thanks for the review. I can now see why the other two changes are not necessary. I will post a follow-on patch. Thanks! - Naveen