All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: linux-bcachefs@vger.kernel.org, linux-bcache@vger.kernel.org,
	Coly Li <colyli@suse.de>
Subject: Re: [PATCH] closures: CLOSURE_CALLBACK() to fix type punning
Date: Wed, 29 Nov 2023 12:13:16 -0800	[thread overview]
Message-ID: <202311291212.7955AF30D1@keescook> (raw)
In-Reply-To: <20231120030729.3285278-1-kent.overstreet@linux.dev>

On Sun, Nov 19, 2023 at 10:07:25PM -0500, Kent Overstreet wrote:
> Control flow integrity is now checking that type signatures match on
> indirect function calls. That breaks closures, which embed a work_struct
> in a closure in such a way that a closure_fn may also be used as a
> workqueue fn by the underlying closure code.
> 
> So we have to change closure fns to take a work_struct as their
> argument - but that results in a loss of clarity, as closure fns have
> different semantics from normal workqueue functions (they run owning a
> ref on the closure, which must be released with continue_at() or
> closure_return()).
> 
> Thus, this patc introduces CLOSURE_CALLBACK() and closure_type() macros
> as suggested by Kees, to smooth things over a bit.
> 
> Suggested-by: Kees Cook <keescook@chromium.org>
> Cc: Coly Li <colyli@suse.de>
> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>

Thanks for doing this! This looks reasonable to me. I look forward to
being able to do fancier CFI prototype partitioning in the future...

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

-- 
Kees Cook

      parent reply	other threads:[~2023-11-29 20:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-20  3:07 [PATCH] closures: CLOSURE_CALLBACK() to fix type punning Kent Overstreet
2023-11-20  7:58 ` kernel test robot
2023-11-20  7:58 ` kernel test robot
2023-11-29  6:13 ` Coly Li
2023-11-29 20:13 ` Kees Cook [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202311291212.7955AF30D1@keescook \
    --to=keescook@chromium.org \
    --cc=colyli@suse.de \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-bcachefs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.