[{"id":1769979,"web_url":"http://patchwork.ozlabs.org/comment/1769979/","msgid":"<CAFEAcA_bpija3nfB2URJbsqyGZfkziszFf16Q2U9TkC9HbnAJQ@mail.gmail.com>","list_archive_url":null,"date":"2017-09-18T08:31:30","subject":"Re: [Qemu-devel] [PATCH] seccomp: Fix build","submitter":{"id":5111,"url":"http://patchwork.ozlabs.org/api/people/5111/","name":"Peter Maydell","email":"peter.maydell@linaro.org"},"content":"On 18 September 2017 at 08:46, Jan Kiszka <jan.kiszka@siemens.com> wrote:\n> From: Jan Kiszka <jan.kiszka@siemens.com>\n>\n> vl.c includes seccomp.h, thus requires the related CFLAGS as well.\n>\n> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>\n> ---\n>  Makefile.objs | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/Makefile.objs b/Makefile.objs\n> index d9cf7ad791..4f1488d65d 100644\n> --- a/Makefile.objs\n> +++ b/Makefile.objs\n> @@ -61,7 +61,7 @@ bt-host.o-cflags := $(BLUEZ_CFLAGS)\n>\n>  common-obj-y += dma-helpers.o\n>  common-obj-y += vl.o\n> -vl.o-cflags := $(GPROF_CFLAGS) $(SDL_CFLAGS)\n> +vl.o-cflags := $(GPROF_CFLAGS) $(SDL_CFLAGS) $(SECCOMP_CFLAGS)\n>  common-obj-y += tpm.o\n>\n>  common-obj-$(CONFIG_SLIRP) += slirp/\n\n...I get the feeling we're going to get a whole bunch of these\ncompile errors and fixups as we switch over to trying to specify\npackage-dependent cflags only on certain source files. Is\nthere anything we can do to make this changeover more reliable?\n\nIn particular I think that just adding a new #include line\nto a source file shouldn't suddenly require us to change\nthe makefile to add a FOO_CFLAGS if we can avoid it. If\nit is necessary, then we need to make sure that's a compile\nerror on all platforms and configurations (including those\nwhere pkg-config happens to set FOO_CFLAGS to the empty string.)\n\nthanks\n-- PMM","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"RG/IEWA/\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xwfPn1dzMz9rxm\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 18:32:13 +1000 (AEST)","from localhost ([::1]:35232 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dtrTP-0007zB-CB\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 04:32:11 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:40426)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dtrT7-0007yD-Mn\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 04:31:54 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <peter.maydell@linaro.org>) id 1dtrT6-0001z7-Ll\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 04:31:53 -0400","from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]:50050)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <peter.maydell@linaro.org>)\n\tid 1dtrT6-0001o2-El\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 04:31:52 -0400","by mail-wm0-x22e.google.com with SMTP id e71so395879wmg.4\n\tfor <qemu-devel@nongnu.org>; Mon, 18 Sep 2017 01:31:52 -0700 (PDT)","by 10.223.139.215 with HTTP; Mon, 18 Sep 2017 01:31:30 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc; bh=60mOP57nsg7wDjIr+HMFr8BmZFJgKVC3AFh2JF0vNCU=;\n\tb=RG/IEWA/I4fOhxTF4n7yFfPOtPbOqArhNVDXBiOw85Z6feGLCiijhlpscxmg2kOQ+p\n\t6Yq/Azea2nSZ4shg3w09J7qVSIh7/i0shehM54wrYMwfenpE6LkSkOmic87zh1QL/fnQ\n\t3MVdriD5P21Oilqieep8Xu9M5rX24U11LUzBg=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=60mOP57nsg7wDjIr+HMFr8BmZFJgKVC3AFh2JF0vNCU=;\n\tb=DoFsUmtvhXQJm5D8QrrBO4uEH1oEHyz+mFFNWuzZH2TPwpdVGoTqMhblYm4LBgurYd\n\ttgBB/URtxZaB5YH3fA/PeKRTydP5LQE9M5bquBbR1tIaioWvNMkKFCoaF+9KGkO2GtVf\n\tMYj/YShfhfZjcR4Rz1GLPtXH6PYmRFDd8xjCMJjbVXxdNUm8vfB9NfE/PLsOKiE0H1AU\n\tu9f6L98XvX/ib9u7kfACP0uamT9vnlK4vDzHq25IsKBk3venNqsGMrpj7fIF5jIzOjvy\n\tIP466SWvVdsBnoNIS3hUp0bVPyT/0lwHcGIQJtNbF7sDL/OmUZLT3CUdq8uAM3WqjjWE\n\t6efQ==","X-Gm-Message-State":"AHPjjUgc51STuGnKfyS7XYRwMJQMNO/MRwb0wi8cNqk9V61j0rvNNFCy\n\tPyIAFtDwE5c6IQ7BeNAy3sZTi8KLptZS6NzMWikEFA==","X-Google-Smtp-Source":"AOwi7QBIonXnduD8vZEwM3I8keeCVS8sx+13DHDNFGaFlfDYaAXT3kag9ydX6zWeOzQYh+35BC77V0vZtZrswZhYYGs=","X-Received":"by 10.28.166.135 with SMTP id p129mr1502186wme.147.1505723511353;\n\tMon, 18 Sep 2017 01:31:51 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<77c55c6c-3397-5a32-6276-6b88f13fa531@siemens.com>","References":"<77c55c6c-3397-5a32-6276-6b88f13fa531@siemens.com>","From":"Peter Maydell <peter.maydell@linaro.org>","Date":"Mon, 18 Sep 2017 09:31:30 +0100","Message-ID":"<CAFEAcA_bpija3nfB2URJbsqyGZfkziszFf16Q2U9TkC9HbnAJQ@mail.gmail.com>","To":"Jan Kiszka <jan.kiszka@siemens.com>","Content-Type":"text/plain; charset=\"UTF-8\"","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2a00:1450:400c:c09::22e","Subject":"Re: [Qemu-devel] [PATCH] seccomp: Fix build","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Eduardo Otubo <otubo@redhat.com>, Fam Zheng <famz@redhat.com>,\n\tqemu-devel <qemu-devel@nongnu.org>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1770129,"web_url":"http://patchwork.ozlabs.org/comment/1770129/","msgid":"<20170918123012.GN15551@lemon.lan>","list_archive_url":null,"date":"2017-09-18T12:30:12","subject":"Re: [Qemu-devel] [PATCH] seccomp: Fix build","submitter":{"id":24872,"url":"http://patchwork.ozlabs.org/api/people/24872/","name":"Fam Zheng","email":"famz@redhat.com"},"content":"On Mon, 09/18 09:31, Peter Maydell wrote:\n> On 18 September 2017 at 08:46, Jan Kiszka <jan.kiszka@siemens.com> wrote:\n> > From: Jan Kiszka <jan.kiszka@siemens.com>\n> >\n> > vl.c includes seccomp.h, thus requires the related CFLAGS as well.\n> >\n> > Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>\n> > ---\n> >  Makefile.objs | 2 +-\n> >  1 file changed, 1 insertion(+), 1 deletion(-)\n> >\n> > diff --git a/Makefile.objs b/Makefile.objs\n> > index d9cf7ad791..4f1488d65d 100644\n> > --- a/Makefile.objs\n> > +++ b/Makefile.objs\n> > @@ -61,7 +61,7 @@ bt-host.o-cflags := $(BLUEZ_CFLAGS)\n> >\n> >  common-obj-y += dma-helpers.o\n> >  common-obj-y += vl.o\n> > -vl.o-cflags := $(GPROF_CFLAGS) $(SDL_CFLAGS)\n> > +vl.o-cflags := $(GPROF_CFLAGS) $(SDL_CFLAGS) $(SECCOMP_CFLAGS)\n> >  common-obj-y += tpm.o\n> >\n> >  common-obj-$(CONFIG_SLIRP) += slirp/\n> \n> ...I get the feeling we're going to get a whole bunch of these\n> compile errors and fixups as we switch over to trying to specify\n> package-dependent cflags only on certain source files. Is\n> there anything we can do to make this changeover more reliable?\n\nI think we should spot those risky headers and clean them up. See below.\n\n> \n> In particular I think that just adding a new #include line\n> to a source file shouldn't suddenly require us to change\n> the makefile to add a FOO_CFLAGS if we can avoid it. If\n> it is necessary, then we need to make sure that's a compile\n> error on all platforms and configurations (including those\n> where pkg-config happens to set FOO_CFLAGS to the empty string.)\n\nMy apologies in advance that I'm not directly answering your question, because I\ndon't know. Anyway..  IMHO being prudent on which library headers to pull in\nfrom a source file is a good thing, so I feel the conversion a worthwhile\neffort.  It also forces developers to fully hide the implementation details\nbehind an internal API:\n\n> qemu-foo.h:\n  void qemu_foo_do_a(void);\n  void qemu_foo_do_b(void);\n> qemu-foo-internal.h:\n  /* A header that includes the library header, if necessary */\n  #include <libfoo.h>\n  #include \"qemu-foo.h\"\n> qemu-foo-a.c:\n  #include \"qemu-foo.h\"\n  #include \"qemu-foo-internal.h\"\n  void qemu_foo_do_a(void)\n  {\n      ...\n  }\n> qemu-foo-b.c:\n  #include \"qemu-foo.h\"\n  #include \"qemu-foo-internal.h\"\n  void qemu_foo_do_b(void)\n  {\n      ...\n  }\n\nSo in general we could clean up non-internal headers (as in the above example\nthe qemu-foo.h versus qemu-foo-internal.h) so that the library headers are not\nincluded there, whenever possible.\n\nIf a library header is indeed wanted by different .c files, it probably should\ngoto QEMU_CFLAGS, like the glib headers.\n\nBut if a .c file does need to include a library header, it probably also wants\nthe libs flag as well. So, commonly -cflags and -libs still go together.\n\nIn the case of this patch, I think we should do this:\n\ndiff --git a/include/sysemu/seccomp.h b/include/sysemu/seccomp.h\nindex e67c2dc840..9b092aa23f 100644\n--- a/include/sysemu/seccomp.h\n+++ b/include/sysemu/seccomp.h\n@@ -21,7 +21,5 @@\n #define QEMU_SECCOMP_SET_SPAWN       (1 << 3)\n #define QEMU_SECCOMP_SET_RESOURCECTL (1 << 4)\n\n-#include <seccomp.h>\n-\n int seccomp_start(uint32_t seccomp_opts);\n #endif","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx04.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=famz@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xwlhx6FG2z9s78\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 18 Sep 2017 22:30:41 +1000 (AEST)","from localhost ([::1]:36322 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dtvCC-00078I-1L\n\tfor incoming@patchwork.ozlabs.org; Mon, 18 Sep 2017 08:30:40 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:58105)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <famz@redhat.com>) id 1dtvBs-00077l-HN\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 08:30:22 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <famz@redhat.com>) id 1dtvBr-000715-BO\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 08:30:20 -0400","from mx1.redhat.com ([209.132.183.28]:34100)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <famz@redhat.com>) id 1dtvBr-00070Q-2D\n\tfor qemu-devel@nongnu.org; Mon, 18 Sep 2017 08:30:19 -0400","from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 1327C85550;\n\tMon, 18 Sep 2017 12:30:18 +0000 (UTC)","from localhost (ovpn-12-141.pek2.redhat.com [10.72.12.141])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id B95995EDE2;\n\tMon, 18 Sep 2017 12:30:14 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 1327C85550","Date":"Mon, 18 Sep 2017 20:30:12 +0800","From":"Fam Zheng <famz@redhat.com>","To":"Peter Maydell <peter.maydell@linaro.org>","Message-ID":"<20170918123012.GN15551@lemon.lan>","References":"<77c55c6c-3397-5a32-6276-6b88f13fa531@siemens.com>\n\t<CAFEAcA_bpija3nfB2URJbsqyGZfkziszFf16Q2U9TkC9HbnAJQ@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<CAFEAcA_bpija3nfB2URJbsqyGZfkziszFf16Q2U9TkC9HbnAJQ@mail.gmail.com>","User-Agent":"Mutt/1.8.3 (2017-05-23)","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.15","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.28]);\n\tMon, 18 Sep 2017 12:30:18 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"Re: [Qemu-devel] [PATCH] seccomp: Fix build","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Eduardo Otubo <otubo@redhat.com>, Jan Kiszka <jan.kiszka@siemens.com>,\n\tqemu-devel <qemu-devel@nongnu.org>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]