From nobody Fri Jan 20 17:30:49 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Nz63V3Yz1z2t4vc for ; Fri, 20 Jan 2023 17:31:02 +0000 (UTC) (envelope-from melifaro@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Nz63V37Nvz4J1k; Fri, 20 Jan 2023 17:31:02 +0000 (UTC) (envelope-from melifaro@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674235862; 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=qmmQ2eNzD5zR2f1kNJCwkWA0h76XpPaq/vldstC93hQ=; b=Kru5sBdLh8bjUyVtWawLZs6WBCab4TVA7gP58QC2+d0mwu+SLaNAoeRArTQSc4/ODAErxz IwmmMA0VeCIhGGubYFSOgNri1NoUtpSIHGwU0g56UthVCsy3kiZQb6metXecOF7JgZiTSF SS2NOCSqP38SJrA/2Y8ODsnk487Gbdwu2lb5VSoIvcQcvH2TqlIAaY2j7OZIfxw70iHR8c 68xRdyTSvQakMoCsOfSiF4gjWEC4Z33vJZW7jVvItzFJmJn60jN/JTUkyXR5ZsUuUQ2Nof xpPCa9+o37w5GdaHTtg37Ksvtw1TnTBJFSKVicTfen1OHHNlBlocPAEXdy80Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674235862; 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=qmmQ2eNzD5zR2f1kNJCwkWA0h76XpPaq/vldstC93hQ=; b=CpMOtOUj9ydC1hoKxHcYVMJvEY5KBfR33OZOeFwi6lOCZGQnL9OjfQe3zEKdaSvCxHTabi naYq7BVEWxGiEtXBXzyefsHY3q8faaHGrPRYY5Et7eaNIDe1NbUoaCKnyyeD4dceMqC8e9 VeV02Fl+PJaOu7q2271O2dfZQcpcfKftWqmd+jp35Q3MymHbLu5MzAv9HcSRcozrdxtcSY Qc4smxCsBHJC+njdPak2OB3URshQzRcGNhB/Sew6znT2QrE9I5YMNFrL3h4FnPwk1eTxuH bI+iK7EOOJ9rNC68FaxjdAdnx5rGWUED1v0ghplX/hHsOfBwJrJDaWyC0d9jdg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674235862; a=rsa-sha256; cv=none; b=WDS5ns4bz96/nPkO5WKABthEKUzN0H/DNY2voWWQra1z4zG+n1tS7L6f5d8OWBfBlAULL8 fA8Cpk1e+Hq12JdiM2eMQvEpSmNPS3n0CaBHN4MMoih5QGY8wXum+U1qszF+anNG4zSd2R P3LGU88vrrYOs0JUBQwh6a3Eg8B3t3DkYWIi+a8ebcNI9RQVMJ6OFNvcFSkr3+yNIzilnb xG6BSK+sMn17kokP8R+a5G0FDhDWQof19dqQa3CfnIvRBdwXppQ7ATg2hf6f6RDOevRktf MuZCTIwo7eX71cD11Z/qtUDwmvnqSFunjpMY79WZx5z0cT3VonSAaRYyaWRFpw== Received: from smtpclient.apple (unknown [IPv6:2a02:8084:d6bb:510:2daa:c4ca:2eed:fc35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: melifaro/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Nz63T5dsQz1GC3; Fri, 20 Jan 2023 17:31:01 +0000 (UTC) (envelope-from melifaro@freebsd.org) Content-Type: text/plain; charset=utf-8 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.200.110.1.12\)) Subject: Re: git: 2c24ad3377a6 - main - ifconfig: abort if loading a module fails other than for ENOENT From: Alexander Chernikov In-Reply-To: Date: Fri, 20 Jan 2023 17:30:49 +0000 Cc: Alan Somers , "Danilo G. Baio" , dev-commits-src-all@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <202301091857.309Iv87L068285@gitrepo.freebsd.org> <2f4e4ccf-b19a-4f8f-a9e0-72298e500d7c@app.fastmail.com> <1E9FAE83-B5C2-4E1F-8D04-CF4F477F76C7@freebsd.org> To: Gleb Smirnoff X-Mailer: Apple Mail (2.3731.200.110.1.12) X-ThisMailContainsUnwantedMimeParts: N > On 20 Jan 2023, at 16:49, Gleb Smirnoff wrote: >=20 > On Fri, Jan 20, 2023 at 11:04:33AM +0000, Alexander Chernikov wrote: > A> I think another question is that if if should be done by = ifconfig(8) at all. Kernel can take care of trying to load the required = modules, checking the privileges. > A> I=E2=80=99m considering adding such code for the netlink-based = interface creation. >=20 > This is already done in netgraph, but I won't call this solution a > pretty one. You ask kernel to do some network related ioctl(2), but > it actually does kldload(2). Partially I agree. Let me try to rephrase it. The intent is to create a network interface = and it is implemented using SIOCIFCREATE[2] and, potentially, = kldload(2). As the idea behind many ioctl=E2=80=99s is to do a single thing at a = time, coupling it with kldload may indeed not look pretty. For Netlink, it=E2=80=99s different - it=E2=80=99s meant to be a broker = and provide a higher-level interfaces. You can ask it to create an = interface, set its flags, description, fib, mtu and so on via a single = request. >=20 > At what stage of the syscall we understand that kldload(2) needs to > be done? Are we free of network locks at this stage? Cause kldload For example, if one decide to enhance `SIOCIFCREATE`, it can be done = somewhere around `if_clone_create()`. No locks are held in `ifioctl()` = that handles it. Also, we=E2=80=99re in the sys call and can sleep. For Netlink, - probably in the netlink = sys/netlink/route/iface.c:create_link before using the generic cloner. = Netlink handlers run in dedicated taskques and can sleep as well. > will take a very different set of locks, possibly creating a LOR, > and in an edge case will go into NFS taking network locks. >=20 > --=20 > Gleb Smirnoff