Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp674187rwb; Thu, 18 Aug 2022 10:08:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR7sut6UbEjFHde5WThmAt+O+/TzCXH2yu5rO0UaDxKyzM2iQQzGjtlvDkllg4yzJir2p812 X-Received: by 2002:a05:6402:5418:b0:435:5a48:daa9 with SMTP id ev24-20020a056402541800b004355a48daa9mr3038884edb.304.1660842508196; Thu, 18 Aug 2022 10:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660842508; cv=none; d=google.com; s=arc-20160816; b=ls/QkJkUZKVrxm6+JgAcreTR171ZYossWY24OgULuIkV0ORGwmWCYpXMVO3EgSRIIm olCzGJFn29i0FXN9CX/6nAw3DdUTAjr90OjYYInj9GKgQ9cYHNqoEc37kqWkN41QUy/b rMSGs+0j7NdEwTATA+qfvN4i99kttZZkpB2RFx2vgR2EAWCr8o8UjUICuj5Nz6boaHHu QbnMXju17d8Sizj4GUa6QCSa0sEXOF8+zTuATbs87yKibfeaYOoVSKh6MKn7qL38P9jO D+XJ7uaZduonaW3omRoFEsNwcLj6wsQ2PcEoNw2/hSpP7uwZC1ZsI4vccSd4ozFwuh/I zm6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=T7igz+JHo+DrCDKUS4xWUJ3/Lp268Fiqe+ivN8o+tCA=; b=sAfCDo5mZpO2sg13+RUjoH07z+STxXKBq6olx4DimvPDTq5mTGhHwUEN//NmxvOz2F u4QFWYMzA1VAQslYZ3kRbEgHsEIZRcWMTACD2Prp27effYQewkZr+C/RbWLSAn8ailjp Cl0kn/IxTH0V3zBGVEfg+WcuMiDz6V+y5yIDaff7NTFKOaffm/6mdn8z+QwXLVd0seVs geszdTq21a7AJMiTdfMDd6Nbo5DQD2q/B/FAc0bKSYu7XHIxTHE96O3esgmIDyNLbhRt CsRkn1/tNo3O86HgY7JCc9joOET1yGgdtT0/uZG0ye3S7clyarXqs/49HV22Fo7J/rcg fxKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mSmp9rHt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id js7-20020a17090797c700b007316ac034a5si1779594ejc.844.2022.08.18.10.07.53; Thu, 18 Aug 2022 10:08:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mSmp9rHt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344122AbiHRRGe (ORCPT + 99 others); Thu, 18 Aug 2022 13:06:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345456AbiHRRD1 (ORCPT ); Thu, 18 Aug 2022 13:03:27 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 873CCCB5F1; Thu, 18 Aug 2022 10:01:37 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id c4so721873iof.3; Thu, 18 Aug 2022 10:01:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=T7igz+JHo+DrCDKUS4xWUJ3/Lp268Fiqe+ivN8o+tCA=; b=mSmp9rHtVwSbvQYUCcl1B6+4w12c4NZupPfwhitjKwp64SgVF4OpQZTM5OjLoTUTq/ bvlbPn/LMeKbRiglU8JNMoyfa9evwumI8CLFupqetQdHEK6ASSyTUQKMARKS6+J8d41C syh/FDLqz69ZOMnbwXYSw27NnA/SdwWXPsCZG/OkbTJ3TeRryGQaM9pefDmG20OB855W Pg/ZEny4IK0cVtgltjxaukuxnPCqRSVwGGN3R+gsz1dnG13VOb8meRsL2IYZz+ic/ZYT 3+DVKOsefTIeUcl4hA+wuKfu9fKsVZ5i0F7XDoWk47lyfxro942KIc/TnSD31+zljHZs 2m+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=T7igz+JHo+DrCDKUS4xWUJ3/Lp268Fiqe+ivN8o+tCA=; b=ZiOJYSEqIf3HoypENj/fCoR7hClsGJda4huvMVs1yEbErtAQ7OylVNpp8b5Vxf0wlX kELR6LhttQ2icRsbEONYu+MV1LH6d8qq4vfPpJBx2SGNifDkgv+fbjiU3ypUvLBUya0c Xa3BTU1gwSZfwrc9oASN8vSru7lwmFsHLRmVkN4sFddieNLL8LVP1HbPSZTIiNekYRGm Dks9nU7aCnNSk0dGpTk1eXy2/HSIrvE/gOE1MRwWv3FhExSTyvJuqlERLN94yNMxBwBd ORkNdzONFGyfJ9k85qCf/Q+FTVRGax0evzlEBLePRySWTaveYEoHVxFn7z9i7CwLlk1t iqQw== X-Gm-Message-State: ACgBeo39bUsoEvVV0rrIo7F0QjrD8DYf2p/a44+JqamBJSNuf7TJ/7i7 wHa1+nNhGQAwJu6VnV0KRbzpbg8jkcnR5LC0g9Q= X-Received: by 2002:a05:6602:2a42:b0:678:84be:c9ec with SMTP id k2-20020a0566022a4200b0067884bec9ecmr1767428iov.64.1660842096984; Thu, 18 Aug 2022 10:01:36 -0700 (PDT) MIME-Version: 1.0 References: <20220805154231.31257-1-ojeda@kernel.org> <20220805154231.31257-7-ojeda@kernel.org> <202208171240.8B10053B9D@keescook> <202208171331.FAACB5AD8@keescook> <202208171653.6BAB91F35@keescook> <202208180905.A6D2C6C00@keescook> In-Reply-To: <202208180905.A6D2C6C00@keescook> From: Miguel Ojeda Date: Thu, 18 Aug 2022 19:01:25 +0200 Message-ID: Subject: Re: [PATCH v9 06/27] rust: add C helpers To: Kees Cook Cc: Miguel Ojeda , Linus Torvalds , Greg Kroah-Hartman , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, patches@lists.linux.dev, Jarkko Sakkinen , Alex Gaynor , Geoffrey Thomas , Wedson Almeida Filho , Sven Van Asbroeck , Gary Guo , Boqun Feng , Maciej Falkowski , Wei Liu , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 18, 2022 at 6:08 PM Kees Cook wrote: > > Please, no UB. I will take a panic over UB any day. It'd be best to > handle things with some error path, but those are the rare exception. > > C is riddled with UB and it's just terrible. Let's make sure we don't > continue that mistake. :) I definitely agree on avoiding UB :) > The simple answer is that if an "impossible" situation can be recovered > from, it should error instead of panic. As long as that's the explicit > design goal, I think we're good. Yes there will be cases where it is > really and truly unrecoverable, but those will be rare and can be well > documented. Yeah, that is the goal and we always take that into account, but there are always tricky cases which is best to consider case-by-case. Cheers, Miguel