From nobody Sat Nov 23 20:35:03 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C9651A0B12 for ; Mon, 11 Nov 2024 13:05:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731330313; cv=none; b=DQ7qQ+Ii0FH21m71pgfZFAw2JVfTHQBeRD6Pnr4BIt1kJmIDjP5L1oO4QUqfX1xX1zyzRN+PGvoMmWs2VYZOxwDzIJSMhw4DF07a6nKNGrlw+NwBKALXFogLOJuTsVFbFmg5AnCn2RGICL3Y4Bm7Rqrx0yiv+dx/Zq/gkyp+Q9k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731330313; c=relaxed/simple; bh=SVHh1fatO0oQO4UReWs7wXWXGCXs6Dml1ZS/FKUTm/g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=sjsG2w++hMj9/HimvJvkrfHPFPy3FselN3ge6dShtCqlZBn+nHu5ZMOtNOIxZw67oXVAvyimst+yIZ7D5elqe1SWdHctmR0+FC5mSrozjm9NZpjzhgiRZHS01lJVoAg0y2O7tpMu18ziCoVfGZlGg6AG8bk0NtXB8suM8nkfn6Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=VyghVp8f; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VyghVp8f" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731330311; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1cOooKZkaMPDXtuTp8ptu0pElUOFrvu05o1tdMQaEFY=; b=VyghVp8f2v/WAu90OKu9ndtfSnI7FQUqsj+AYmz8q6c728qnz9U6pRtyvYSsZSTydG0OPR MUgmfjhjtzPdYpz7cwQXk/cDhJuZLfJgdpDStKtZFsideUt6FJMxYgB6/frsnCrPLskI8t jXUwuQ1z7lGxwX/E3Ki7k+nDAZIFH9U= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-635-ppjqHuYlMm2SY4kQiRg0TQ-1; Mon, 11 Nov 2024 08:05:05 -0500 X-MC-Unique: ppjqHuYlMm2SY4kQiRg0TQ-1 X-Mimecast-MFC-AGG-ID: ppjqHuYlMm2SY4kQiRg0TQ Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8950B1953945; Mon, 11 Nov 2024 13:05:04 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.45.224.51]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 723E31956086; Mon, 11 Nov 2024 13:05:01 +0000 (UTC) From: Jan Stancek To: donald.hunter@gmail.com, kuba@kernel.org Cc: pabeni@redhat.com, davem@davemloft.net, edumazet@google.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jstancek@redhat.com Subject: [PATCH 1/2] tools: ynl: add script dir to sys.path Date: Mon, 11 Nov 2024 14:04:44 +0100 Message-ID: <97c08d1fdbd374ec6216a59d3b08f03d376ce2aa.1730976866.git.jstancek@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Content-Type: text/plain; charset="utf-8" Python options like PYTHONSAFEPATH or -P [1] do not add script directory to PYTHONPATH. ynl depends on this path to build and run. [1] This option is default for Fedora rpmbuild since introduction of https://fedoraproject.org/wiki/Changes/PythonSafePath Signed-off-by: Jan Stancek Acked-by: Jakub Kicinski --- tools/net/ynl/cli.py | 3 +++ tools/net/ynl/ethtool.py | 2 ++ tools/net/ynl/ynl-gen-c.py | 3 +++ 3 files changed, 8 insertions(+) diff --git a/tools/net/ynl/cli.py b/tools/net/ynl/cli.py index b8481f401376..873463dbdcc0 100755 --- a/tools/net/ynl/cli.py +++ b/tools/net/ynl/cli.py @@ -3,9 +3,12 @@ =20 import argparse import json +import pathlib import pprint +import sys import time =20 +sys.path.append(pathlib.Path(__file__).resolve().parent.as_posix()) from lib import YnlFamily, Netlink, NlError =20 =20 diff --git a/tools/net/ynl/ethtool.py b/tools/net/ynl/ethtool.py index 63c471f075ab..ebb0a11f67bf 100755 --- a/tools/net/ynl/ethtool.py +++ b/tools/net/ynl/ethtool.py @@ -3,11 +3,13 @@ =20 import argparse import json +import pathlib import pprint import sys import re import os =20 +sys.path.append(pathlib.Path(__file__).resolve().parent.as_posix()) from lib import YnlFamily =20 def args_to_req(ynl, op_name, args, req): diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py index 717530bc9c52..a86e88019e22 100755 --- a/tools/net/ynl/ynl-gen-c.py +++ b/tools/net/ynl/ynl-gen-c.py @@ -4,12 +4,15 @@ import argparse import collections import filecmp +import pathlib import os import re import shutil +import sys import tempfile import yaml =20 +sys.path.append(pathlib.Path(__file__).resolve().parent.as_posix()) from lib import SpecFamily, SpecAttrSet, SpecAttr, SpecOperation, SpecEnum= Set, SpecEnumEntry =20 =20 --=20 2.43.0 From nobody Sat Nov 23 20:35:03 2024 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D99C31A0BEC for ; Mon, 11 Nov 2024 13:05:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731330316; cv=none; b=M9wUfw223kTYg6q/jEkdg7+eTUC5npqDz0A3v1NTLYEt6YcMTYnhYDh2WjFWH4FgXb5WUiS4jS8pqNKutkvy/WfCd6Mv7EuTrEsArFZgvjMg7N6azwj4vA4yYwr7q09bREtFGTe1qWmSfvSbYgy7xOgIvvGSn3yLTbWvzsYGm8I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731330316; c=relaxed/simple; bh=uG/pFbMdG0e8ZG2tWJC+Gb85Mz0eh9fzdCCob6utzRk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-type; b=UJjTQPVJGs33n0+83CzX+erDfeMd5SNoQJ1HL3sH69DfiVefDdiVMzc2qa+O79lyvf6PXP4qncQp2USFELu688INt5FsMJkREffqpyUcmUnM5TP8S+IEENH5z7pkxFWXKpCOR+1feVpiHXQTzRCZpDJk3EYfXhpimYmdictVH+0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=dHNcfzDL; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="dHNcfzDL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731330312; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KmezhH3dme05Z9rNAI3jZBuchcKR9CtW8TfuwIxI3EE=; b=dHNcfzDLFTNd91ggiE/Oa408qPFXwU1ZX92KySOnrmXPd9Vxu2DGIN5GgE230W52JDmIBc 7VPXVJ90lyDTQe+NmfyZ/bgNz1sfVfz/du5CkkvYUGHoZfM4WRGvGnKSMybIBcdlozUEpY XpXGPCDKnpyC3ELfWe+cbONmGRj+M3Y= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-303-cyZ7HJ9TMwCS9_8Vz4IjXA-1; Mon, 11 Nov 2024 08:05:09 -0500 X-MC-Unique: cyZ7HJ9TMwCS9_8Vz4IjXA-1 X-Mimecast-MFC-AGG-ID: cyZ7HJ9TMwCS9_8Vz4IjXA Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 096A91955D62; Mon, 11 Nov 2024 13:05:08 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.45.224.51]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 151E71956089; Mon, 11 Nov 2024 13:05:04 +0000 (UTC) From: Jan Stancek To: donald.hunter@gmail.com, kuba@kernel.org Cc: pabeni@redhat.com, davem@davemloft.net, edumazet@google.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jstancek@redhat.com Subject: [PATCH 2/2] tools: ynl: extend CFLAGS to keep options from environment Date: Mon, 11 Nov 2024 14:04:45 +0100 Message-ID: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 Content-Type: text/plain; charset="utf-8" Package build environments like Fedora rpmbuild introduced hardening options (e.g. -pie -Wl,-z,now) by passing a -spec option to CFLAGS and LDFLAGS. ynl Makefiles currently override CFLAGS but not LDFLAGS, which leads to a mismatch and build failure: CC sample devlink /usr/bin/ld: devlink.o: relocation R_X86_64_32 against symbol `ynl_devlin= k_family' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: failed to set dynamic section sizes: bad value collect2: error: ld returned 1 exit status Extend CFLAGS to support hardening options set by build environment. Signed-off-by: Jan Stancek Acked-by: Jakub Kicinski --- tools/net/ynl/generated/Makefile | 2 +- tools/net/ynl/lib/Makefile | 2 +- tools/net/ynl/samples/Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/net/ynl/generated/Makefile b/tools/net/ynl/generated/Mak= efile index 713f5fb9cc2d..7db5240de58a 100644 --- a/tools/net/ynl/generated/Makefile +++ b/tools/net/ynl/generated/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 =20 CC=3Dgcc -CFLAGS=3D-std=3Dgnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow \ +CFLAGS +=3D -std=3Dgnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshad= ow \ -I../lib/ -idirafter $(UAPI_PATH) ifeq ("$(DEBUG)","1") CFLAGS +=3D -g -fsanitize=3Daddress -fsanitize=3Dleak -static-libasan diff --git a/tools/net/ynl/lib/Makefile b/tools/net/ynl/lib/Makefile index 2887cc5de530..94c49cca3dca 100644 --- a/tools/net/ynl/lib/Makefile +++ b/tools/net/ynl/lib/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 =20 CC=3Dgcc -CFLAGS=3D-std=3Dgnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow +CFLAGS +=3D -std=3Dgnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshad= ow ifeq ("$(DEBUG)","1") CFLAGS +=3D -g -fsanitize=3Daddress -fsanitize=3Dleak -static-libasan endif diff --git a/tools/net/ynl/samples/Makefile b/tools/net/ynl/samples/Makefile index e194a7565861..c9494a564da4 100644 --- a/tools/net/ynl/samples/Makefile +++ b/tools/net/ynl/samples/Makefile @@ -3,7 +3,7 @@ include ../Makefile.deps =20 CC=3Dgcc -CFLAGS=3D-std=3Dgnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow \ +CFLAGS +=3D -std=3Dgnu11 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshad= ow \ -I../lib/ -I../generated/ -idirafter $(UAPI_PATH) ifeq ("$(DEBUG)","1") CFLAGS +=3D -g -fsanitize=3Daddress -fsanitize=3Dleak -static-libasan --=20 2.43.0