From patchwork Fri Mar 30 14:47:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tonghao Zhang X-Patchwork-Id: 36781 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 710384C93; Fri, 30 Mar 2018 16:47:12 +0200 (CEST) Received: from mail-oi0-f67.google.com (mail-oi0-f67.google.com [209.85.218.67]) by dpdk.org (Postfix) with ESMTP id AB5604C93 for ; Fri, 30 Mar 2018 16:47:10 +0200 (CEST) Received: by mail-oi0-f67.google.com with SMTP id q71-v6so7967967oic.6 for ; Fri, 30 Mar 2018 07:47:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=bQZMpB5Cs18DVt5n83pft+H5y0RleZnkHRTK+OdLdNQ=; b=oPcOI3V2Yzct588kWsnOaLry+/0TMrbVk8TSsmcgdjk+MVqnqsrbtIEKfq7GIqQy37 UQdgWtDdnBKmVW6j93NxkLoOU9hym2RHj7sl5GMxMDYffjF+h/JAlE8VIy0DirCsWSIt yY7oubUF8JvE7tjWBbI1J69ZZiujrHqhAuZH5Vmj+ghgBTvH2qCBgGCi2egL3oqpjWw+ CI2Qnw+8UXWFcZG+lM4K8dC5ytZdLkBL4voHQpK9+TELrYPocoLzMkhGOwlJkT6Arenp M3mwXmH6dvXlYxY3V/6MYxGwTC8rbhMTuDj0XZlGmnjcHim0F0EttWiRcmwn4i3X9HfX ZlRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=bQZMpB5Cs18DVt5n83pft+H5y0RleZnkHRTK+OdLdNQ=; b=SrMU/PtSVBpn2n3FPwKBX4IrUqxu0rSbMdtcDiblfcHwDCFhgxziBgVVhcnrctBz8L tfxaT70JQFMrQcgSsjRRFiWKcNi9MdF7ZaIAxabC1KquPL9CbdAxdM1OIH33PWzhiLss w3byGm5N6suKbAXijo9SURf5/bQUb0j/LE/M+M7t5yQrODH4SGfmBbWutP/uVS08LK+5 BisnE3rCMg9VVnlfhY3pzBbPaBHUupKOKZifl7cGj2O2n0Ne4sqIfH2er+J08lvz5quq DdlSehq51mIWrAu3FxQtSaPVED0PdqyG6GWInRG+D1OHpSMfJs52nNpkizoBbZabtxuD IEgw== X-Gm-Message-State: ALQs6tDCaB8XsEUG6PJ1+oAEy+XLVAWIlyapTiP/O5xR3bnrDxnfrDDK gUIFcRyE1yZnL0LbIPE2sYUoXAHtFmULM2ZkT8Q= X-Google-Smtp-Source: AIpwx4+IuxM6J+Y6mPQyeXV/F8HFbNNYs5h54z6hY7sHB8fHbXOrXyo0dob00cRvbIFRCPOBDV7blNuZNiz0HFji9wk= X-Received: by 10.202.234.130 with SMTP id i124mr7449050oih.82.1522421229834; Fri, 30 Mar 2018 07:47:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.198.16 with HTTP; Fri, 30 Mar 2018 07:47:09 -0700 (PDT) In-Reply-To: <20180330162830.1d7ccba2@redhat.com> References: <93d00a28-d52d-25b3-42d0-84b1d95c756a@redhat.com> <20180330162830.1d7ccba2@redhat.com> From: Tonghao Zhang Date: Fri, 30 Mar 2018 22:47:09 +0800 Message-ID: To: Timothy Redaelli Cc: Maxime Coquelin , Andrew Rybchenko , "dev@dpdk.org" , Ferruh Yigit , Thomas Monjalon Subject: Re: [dpdk-dev] Build is broken in dpdk-next-net X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" I rebuild it on ubuntu 17.10 and cash it. I use the 'RTE_SET_USED' to fix it. On Fri, Mar 30, 2018 at 10:28 PM, Timothy Redaelli wrote: > On Fri, 30 Mar 2018 15:27:55 +0200 > Maxime Coquelin wrote: > >> Hi Andrew, >> >> On 03/30/2018 03:18 PM, Andrew Rybchenko wrote: >> > Hi all, >> > >> > Build is broken in dpdk-next-net for me on Ubuntu 16.04.4: >> > >> > lib/librte_vhost/fd_man.c: In function ‘fdset_pipe_read_cb’: >> > lib/librte_vhost/fd_man.c:284:2: error: ignoring return value of >> > ‘read’, declared with attribute warn_unused_result >> > [-Werror=unused-result] read(readfd, charbuf, sizeof(charbuf)); ^ >> > lib/librte_vhost/fd_man.c: In function ‘fdset_pipe_notify’: >> > lib/librte_vhost/fd_man.c:324:2: error: ignoring return value of >> > ‘write’, declared with attribute warn_unused_result >> > [-Werror=unused-result] write(fdset->u.writefd, "1", 1); ^ >> > >> > $ gcc --version >> > gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609 >> >> Thanks for reporting, I don't catch it with my Fedora build system: >> $ gcc --version >> gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5) > > Those kind of warnings are enabled by "-D_FORTIFY_SOURCE=2" (enabled by > default in Ubuntu [1]). > > To have the same behavior on Fedora you need to set -D_FORTIFY_SOURCE=2 > by hand, for example with: > > # make EXTRA_CFLAGS="-D_FORTIFY_SOURCE=2" > > Usually I build dpdk with the flags we also use when we build the > Fedora/RHEL package. To do that I have in my .bashrc (all in one line): > > export EXTRA_CFLAGS="-O2 -g -pipe -Werror=format-security > -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong > --param=ssp-buffer-size=4 -grecord-gcc-switches > -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic > -fasynchronous-unwind-tables -Wformat" > >> > >> > As I understand it is broken in >> > ad94ade905454401b705be9e06b19e54a1c78148 vhost: add pipe event for >> > optimizing negotiating >> >> I confirm it is this patch. >> >> Xiangxia, can you provide a fix please? >> >> Ferruh, how do you want to proceed? >> Would you revert it? >> >> Thanks, >> Maxime >> > Andrew. >> > > > [1] > https://wiki.ubuntu.com/ToolChain/CompilerFlags#A-D_FORTIFY_SOURCE.3D2 > diff --git a/lib/librte_vhost/fd_man.c b/lib/librte_vhost/fd_man.c index 771675718..f11803191 100644 --- a/lib/librte_vhost/fd_man.c +++ b/lib/librte_vhost/fd_man.c @@ -279,7 +279,8 @@ fdset_pipe_read_cb(int readfd, void *dat __rte_unused, int *remove __rte_unused) { char charbuf[16]; - read(readfd, charbuf, sizeof(charbuf)); + int r = read(readfd, charbuf, sizeof(charbuf)); + RTE_SET_USED(r); } void @@ -319,5 +320,6 @@ fdset_pipe_init(struct fdset *fdset) void fdset_pipe_notify(struct fdset *fdset) { - write(fdset->u.writefd, "1", 1); + int r = write(fdset->u.writefd, "1", 1); + RTE_SET_USED(r); }