Opened 3 years ago

Last modified 3 weeks ago

#7635 new feature request

SafeHaskell implying other options

Reported by: shachaf Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.6.1
Keywords: SafeHaskell Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: GHC accepts invalid program Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


There have been several type checker bugs -- including #7453 and #7354 -- that have led to type-checker unsafeCoerce/panic/etc., which is a problem under SafeHaskell. In many cases the issue is caught by -dcore-lint. I'm not sure how much overhead core-linting has, but it seems like it could be a good idea to turn it on by default at least when SafeHaskell is on.

Right now it's listed as a "compiler debugging option", but it seems that common wisdom is that you should use it if you care about security. Should you also use stg-lint/cmm-lint? Any other options? This should be clearly documented.

Relatedly: Earlier today someone was running a Haskell-evaluating IRC bot. It was running with SafeHaskell, but also happened to have GeneralizedNewtypeDeriving turned on, which made it possible to derive unsafeCoerce. Should more care be taken that unsafe options are never turned on at the same time as SafeHaskell?

(Continued from #7354.)

Change History (7)

comment:1 Changed 3 years ago by ezyang

I approve of this idea generally, but because SafeHaskell can also be used as a "coding style" helper, it probably makes more sense to introduce another flag. For good reason too: for example, we also want to turn on -fno-omit-yields to make sure untrusted user code from getting infinite non-allocating loops. (Actually, it's even tougher than that, because we need to compile all our libraries with -fno-omit-yields too!)

comment:2 Changed 3 years ago by igloo

  • difficulty set to Unknown
  • Milestone set to 7.8.1

comment:3 Changed 22 months ago by thoughtpolice

  • Milestone changed from 7.8.3 to 7.10.1

Moving to 7.10.1

comment:4 Changed 14 months ago by thoughtpolice

  • Milestone changed from 7.10.1 to 7.12.1

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:5 Changed 5 months ago by thoughtpolice

  • Milestone changed from 7.12.1 to 8.0.1

Milestone renamed

comment:6 Changed 3 weeks ago by thomie

  • Keywords SafeHaskell added

comment:7 Changed 3 weeks ago by thomie

  • Milestone 8.0.1 deleted
Note: See TracTickets for help on using tickets.