From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) by sourceware.org (Postfix) with ESMTPS id BAB753857C6B for ; Mon, 14 Sep 2020 19:49:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BAB753857C6B Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08EJhW8G107210 for ; Mon, 14 Sep 2020 19:49:04 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 33gnrqrs75-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 14 Sep 2020 19:49:03 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08EJjNoR081366 for ; Mon, 14 Sep 2020 19:49:03 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 33h882ebrm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Sep 2020 19:49:03 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 08EJn23K008013 for ; Mon, 14 Sep 2020 19:49:02 GMT Received: from sequence.us.oracle.com (/10.159.155.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 14 Sep 2020 19:49:02 +0000 From: David Faust To: binutils@sourceware.org Subject: [PATCH] bpf: use the expected instruction for NOPs Date: Mon, 14 Sep 2020 12:48:41 -0700 Message-Id: <20200914194841.163176-1-david.faust@oracle.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9744 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 adultscore=0 suspectscore=0 phishscore=0 malwarescore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009140154 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9744 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 bulkscore=0 suspectscore=0 clxscore=1015 mlxlogscore=999 adultscore=0 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009140154 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, KAM_STOCKGEN, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2020 19:49:06 -0000 The BPF ISA does not have a no-op instruction. There are different ways to achieve no-op, but in practice the Linux kernel verifier expects a particular form, namely "ja 0". Update the define md_single_noop_insn for BPF to reflect this. For more detail, see the corresponding GCC back end patch: https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553893.html gas/ * config/tc-bpf.h (md_single_noop_insn): Use 'ja 0' for no-op. --- gas/config/tc-bpf.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gas/config/tc-bpf.h b/gas/config/tc-bpf.h index cb02d6c1338..e7e505cfaa5 100644 --- a/gas/config/tc-bpf.h +++ b/gas/config/tc-bpf.h @@ -48,4 +48,6 @@ /* Values passed to md_apply_fix don't include the symbol value. */ #define MD_APPLY_SYM_VALUE(FIX) 0 -#define md_single_noop_insn "mov %r1,%r1" +/* The Linux kernel verifier expects NOPs to be encoded in this way; + a jump to offset 0 means jump to the next instruction. */ +#define md_single_noop_insn "ja 0" -- 2.26.2