From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.2 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,FORGED_GMAIL_RCVD, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 8F3AF1F463 for ; Wed, 11 Sep 2019 21:06:44 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; q=dns; s=default; b=hhEkRJxo DVmZzPMxnkFRYwhPPinF5U6SJjR4vb5zuiwZpi5o28gL7fNRiSlKL3NTbXV0z1il NUPAkOKM7c4kLPCwk1vOgJBGII8Ucp5uAAt3WkvxYpmCtgN4vYbUK4lwRExZnnd1 uNXBO2a8+3kna3NrqlmBfC2lTPRzRfgesnU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; s=default; bh=UhVkTu+PNeQHJ3 wcz2zJpLLyb1I=; b=g3BMAWFhw0cRIAQQ3wJD0OM6zpL/J+veYx4tPQ9W7wsLRd QME02Eg5hULjMmgfA/J31Zud3+H6c3XyLvkKB7oa9jFP0pUG84dtsz09Y/TRICGY Qps84aShxp/JLydIx9iFicaHHzyFamakdb26wL2oqUvDadPOrRTxlV8bxgvxM= Received: (qmail 96093 invoked by alias); 11 Sep 2019 21:05:23 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 95935 invoked by uid 89); 11 Sep 2019 21:05:23 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-pf1-f195.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=O+yIotQ42Ra4NKGYXBcYELer1gdy9/NUqb72jC5x3mc=; b=c+Ed04thsMPXFv9ydUmVgd9dFbFp5CmROu3oUiESiymvEfbIm4JVVdlqiYpVuVIWPW k3q0TuNSyWM8GGciKJ2e7N2lvoScBpXpvVCHCAFgCKbwfvfxf0on9DL9A63QYGfSn/VB LyAAmJMY1CjcOU/xGb7RJNAsE+gntZJZpS6gWv5qG22LftYhBGyuLPK6dAfgAW4TZLtr NmEuQ/CshJi6CmmoTCvq/Hc7m5VsuiBr3O702ZWGLYvc+IBYlq/RmBUfAOxo25CD1ct1 DJT9VUPCnGSgUr3lytjojelCGgNEAvcWzboCbUZCPjpNXHmFpKbO6kLndt4tAhkEPTO+ cPHQ== From: Isaku Yamahata To: libc-alpha@sourceware.org Cc: isaku.yamahata@intel.com, Isaku Yamahata Subject: [RFC PATCH 10/11] x86-64: make the number of nops after syscall configurable Date: Wed, 11 Sep 2019 14:04:08 -0700 Message-Id: In-Reply-To: References: In-Reply-To: References: This is tentative patch for convenience. This patch make it configurable how many nops are inserted after syscall instruction. Once the consensus on the number of nops is made, this patch can be removed. Signed-off-by: Isaku Yamahata --- configure.ac | 19 +++++++++++++++++++ sysdeps/unix/sysv/linux/x86_64/sysdep.h | 15 ++++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index aa902787f0..150570dd54 100644 --- a/configure.ac +++ b/configure.ac @@ -480,6 +480,25 @@ AC_ARG_ENABLE([cet], [enable_cet=$enableval], [enable_cet=no]) +AC_ARG_ENABLE([libos-num-nops], + AC_HELP_STRING([--enable-libos-num-nops=NUM-NOPS], + [specify the number of nops for syscall, x86-64 only + only mealingful when libos support enabled.]), + [libos_num_nops=$enableval], + [libos_num_nops='']) +if test -n "$libos_num_nops"; then + case "$libos_num_nops" in + *[!0-9]*) + AC_MSG_ERROR([--enable-libos-num-nops requires a number]) + ;; + *) + ;; + esac + AC_DEFINE_UNQUOTED(ENALBE_LIBOS_NUM_NOPS, $libos_num_nops, [libos num nops]) + libos_nops=$(printf 'nops;%.0s' $(seq $libos_num_nops)) + AC_DEFINE_UNQUOTED(ENALBE_LIBOS_NOPS, "$libos_nops", [libos nops]) +fi + # We keep the original values in `$config_*' and never modify them, so we # can write them unchanged into config.make. Everything else uses # $machine, $vendor, and $os, and changes them whenever convenient. diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h index d958c1ca7a..8da5e4e154 100644 --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h @@ -26,11 +26,17 @@ /* Defines RTLD_PRIVATE_ERRNO. */ #include -#ifdef __ASSEMBLER__ +#ifdef ENABLE_LIBOS_NOPS +# define NOP_REPEAT ENABLE_LIBOS_NOPS +#else +# define NOP_REPEAT nop;nop;nop;nop;nop;nop;nop;nop;nop;nop +#endif + +# ifdef __ASSEMBLER__ .macro SYSCALL_INST 551: syscall - nop;nop;nop;nop;nop;nop;nop;nop;nop;nop + NOP_REPEAT 552: .pushsection .libos.instructions.syscall, "a" .balign 8 @@ -39,10 +45,13 @@ .popsection .endm #else +#define STRINGIFY(name) STRINGIFY_1(name) +#define STRINGIFY_1(name) #name #define SYSCALL_INST \ "551:\n\t" \ "syscall\n\t" \ - "nop;nop;nop;nop;nop;nop;nop;nop;nop;nop\n\t" \ + STRINGIFY(NOP_REPEAT) \ + "\n\t" \ "552:\n\t" \ ".pushsection .libos.instructions.syscall, \"a\"\n\t" \ ".balign 8\n\t" \ -- 2.17.1