From owner-freebsd-net@FreeBSD.ORG Mon Jul 15 13:03:27 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C9AD2D7; Mon, 15 Jul 2013 13:03:27 +0000 (UTC) (envelope-from oshogbo.vx@gmail.com) Received: from mail-ie0-x229.google.com (mail-ie0-x229.google.com [IPv6:2607:f8b0:4001:c03::229]) by mx1.freebsd.org (Postfix) with ESMTP id 89675968; Mon, 15 Jul 2013 13:03:27 +0000 (UTC) Received: by mail-ie0-f169.google.com with SMTP id 10so25652522ied.14 for ; Mon, 15 Jul 2013 06:03:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=64Z5T4A2R8Dm63YuwfCC3nv754OMoEFtx0yzbtGhbTQ=; b=pOtLTw9Ckrwc0GT7n9b6wwL9/FFIdPkNXM8J8C1r8mL10222BucsymzbDwNMxajW4D lnEObjovrhHom7904WZZyRnSN347haE++PNeVGBDg6+P6sK4zL7oIQqtjjtmJwd6BW+C n6UCdQCDIqRlnk77IyBVpWKgBXL5qDbmhD7NMKJLWKwdn0HrRxMnkezBvjyK0K58/9Lk S534ekkV953J9TJ+ugpI42rJ2koJJtZDnFd1xEtgXWZAofLb6WtbdLHYLjUZXq3LQ6Lb UIqDlWY3wdiiukIyl/hGfbmg1U5OCAQIa4Qutw2UJysMDQJkQphOG7DhBD8sreuoatwX /4SQ== MIME-Version: 1.0 X-Received: by 10.42.202.144 with SMTP id fe16mr17567450icb.72.1373893407134; Mon, 15 Jul 2013 06:03:27 -0700 (PDT) Sender: oshogbo.vx@gmail.com Received: by 10.50.147.72 with HTTP; Mon, 15 Jul 2013 06:03:27 -0700 (PDT) Date: Mon, 15 Jul 2013 15:03:27 +0200 X-Google-Sender-Auth: j7nIElG8MOe8AbK634bMO7cT3lA Message-ID: Subject: soreceive_generic and soreceive_dgram error checking From: Mario Oshogbo To: freebsd-net@freebsd.org Content-Type: multipart/mixed; boundary=20cf301af5c57ddfc904e18c7ccb Cc: mjguzik@gmail.com, andre@FreeBSD.org X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Jul 2013 13:03:28 -0000 --20cf301af5c57ddfc904e18c7ccb Content-Type: text/plain; charset=ISO-8859-1 Hi, I'm a student working in GSoC project. My task on this summer is to write some new features for capsicum framework. Currently I working on writing two new rights (CAP_SEND_RIGHTS and CAP_RECV_RIGHTS). I have some questions about error checking in the soreceive_generic and the soreceive_dgram. I noticed that after calling dom_externalize function there was no explicit error checks. After code analysis of soreceive_generic is likely that error will be returned property. But still, are we need some more things to do after calling dom_externalize or we could simply jump to the release if we got some error from that function? The more puzzling situation is with sorecive_dgram. After calling dom_externalize we don't check the error anywhere. We also don't return the error on the end of the function. Even if we change "return 0" to the "return error" there is still the chance that error will be override by other function (like uimove). Its there any contraindications to add after calling dom_externalize simply check returned value and handle error? I also attach diff with my proposal of error checking in both functions. Should we apply it for both function or we should only change soreceive_dgram or ma by none? Should we make some other changes in soreceive_dgram? I will be very grateful for any help, oshogbo --20cf301af5c57ddfc904e18c7ccb Content-Type: application/octet-stream; name="uipc_socket.diff" Content-Disposition: attachment; filename="uipc_socket.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hj5og57s0 LS0tIHVpcGNfc29ja2V0LmMJMjAxMy0wNi0yOCAxMToxNDoyMi4wMDAwMDAwMDAgKzAyMDAKKysr IHVpcGNfc29ja2V0LmMJMjAxMy0wNy0xNSAxNDo1MzoxNS4wMDAwMDAwMDAgKzAyMDAKQEAgLTE3 MjgsNiArMTcyOCw4IEBAIGRvbnRibG9jazoKIAkJCQlWTkVUX1NPX0FTU0VSVChzbyk7CiAJCQkJ ZXJyb3IgPSAoKnByLT5wcl9kb21haW4tPmRvbV9leHRlcm5hbGl6ZSkKIAkJCQkgICAgKGNtLCBj b250cm9scCwgZmxhZ3MpOworCQkJCWlmIChlcnJvciAhPSAwKQorCQkJCQlnb3RvIHJlbGVhc2U7 CiAJCQkJU09DS0JVRl9MT0NLKCZzby0+c29fcmN2KTsKIAkJCX0gZWxzZSBpZiAoY29udHJvbHAg IT0gTlVMTCkKIAkJCQkqY29udHJvbHAgPSBjbTsKQEAgLTIzNjMsNiArMjM2NSwxMCBAQCBzb3Jl Y2VpdmVfZGdyYW0oc3RydWN0IHNvY2tldCAqc28sIHN0cnVjCiAJCQlpZiAocHItPnByX2RvbWFp bi0+ZG9tX2V4dGVybmFsaXplICE9IE5VTEwpIHsKIAkJCQllcnJvciA9ICgqcHItPnByX2RvbWFp bi0+ZG9tX2V4dGVybmFsaXplKQogCQkJCSAgICAoY20sIGNvbnRyb2xwLCBmbGFncyk7CisJCQkJ aWYgKGVycm9yICE9IDApIHsKKwkJCQkJbV9mcmVlbShtKTsKKwkJCQkJcmV0dXJuIChlcnJvcik7 CisJCQkJfQogCQkJfSBlbHNlIGlmIChjb250cm9scCAhPSBOVUxMKQogCQkJCSpjb250cm9scCA9 IGNtOwogCQkJZWxzZQo= --20cf301af5c57ddfc904e18c7ccb--