From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933185AbcFOSSY (ORCPT ); Wed, 15 Jun 2016 14:18:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47398 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753155AbcFOSST (ORCPT ); Wed, 15 Jun 2016 14:18:19 -0400 Date: Wed, 15 Jun 2016 13:18:17 -0500 From: Josh Poimboeuf To: Mathieu Desnoyers Cc: lttng-dev , Linux Kernel Mailing List Subject: Re: stack validation warning on lttng-modules bytecode interpreter Message-ID: <20160615181817.vvnf66z6cpwcraq7@treble> References: <1074038231.37468.1466009716273.JavaMail.zimbra@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1074038231.37468.1466009716273.JavaMail.zimbra@efficios.com> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 15 Jun 2016 18:18:19 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 15, 2016 at 04:55:16PM +0000, Mathieu Desnoyers wrote: > Hi Josh, > > I notice that with gcc 6.1.1, kernel 4.6, with > CONFIG_STACK_VALIDATION=y, building lttng-modules master > at commit 6c09dd94 gives this warning: > > lttng-modules/lttng-filter-interpreter.o: warning: objtool: > lttng_filter_interpret_bytecode()+0x58: sibling call from callable instruction with changed frame pointer > > this object implements a bytecode interpreter using an explicit > jump table (see https://github.com/lttng/lttng-modules/blob/master/lttng-filter-interpreter.c) > > If I define "INTERPRETER_USE_SWITCH" at the top of the file, > thus using the switch-case fallback implementation, the > warning vanishes. > > We use an explicit jump table rather than a switch case whenever > possible for performance reasons. > > I notice that tools/objtool/builtin-check.c needs to be aware of > switch-cases transformed into jump tables by the compiler. Are > explicit jump tables supported by the stack validator ? Do we > need to add annotation to our code ? Hi Mathieu, Unfortunately objtool doesn't know how to validate this type of jump table. So to avoid the warning you'll need to add an annotation to tell objtool to ignore it: STACK_FRAME_NON_STANDARD(lttng_filter_interpret_bytecode); We had to annotate __bpf_prog_run() in the kernel for the same reason. -- Josh