<html><head><style>body{font-family:Helvetica,Arial;font-size:13px}</style></head><body style="word-wrap:break-word"><div id="bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto">On March 22, 2017 at 8:41:25 PM, Joe Groff (<a href="mailto:jgroff@apple.com">jgroff@apple.com</a>) wrote:</div> <div><blockquote type="cite" class="clean_bq" style="font-family:Helvetica,Arial;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span><div><div></div><div><br>> On Mar 22, 2017, at 4:07 PM, Elijah Johnson <<a href="mailto:ejrx7753@gmail.com">ejrx7753@gmail.com</a>> wrote:<span class="Apple-converted-space"> </span><br>><span class="Apple-converted-space"> </span><br>> Hi,<span class="Apple-converted-space"> </span><br>><span class="Apple-converted-space"> </span><br>> Note that this thread has branched off a bit, so my latest proposal and the “head” of this thread can be found at <a href="https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170320/034189.html">https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170320/034189.html</a><span class="Apple-converted-space"> </span><br>><span class="Apple-converted-space"> </span><br>><span class="Apple-converted-space"> </span><br>><span class="Apple-converted-space"> </span><br>> Can you give an example of this corruption which would be exploitable in a web server context? An example where, having caught the force-unwrap or other precondition fatalError, that the web server would face more danger from continued execution that it would loose by crashing?<span class="Apple-converted-space"> </span><br>><span class="Apple-converted-space"> </span><br>> The optional has been triggered, the request has been stopped, and incoming requests are going to a new process, but there are a few threads open still finishing what they were doing - I’d like to see a good example of the danger caused by a real “inconsistency”. Lets assume also that all objects shared between threads are Swift objects and not “UnsafePointers”, which is a very fair assumtion for a web server. Java even allows native access and they don’t even crash there.<span class="Apple-converted-space"> </span><br><br>When considering security threats, we have to take the presence of an exploit as given until we prove otherwise. A precondition failure indicates a logic error somewhere in the program, and while safe Swift abstractions are intended not to lead to memory unsafety in the face of precondition failures, there's plenty of relatively young, unsafe code below the hood in the implementations of those abstractions, written by humans who make mistakes. Whatever lurking security bugs there may be, they're more likely to be exploitable if you're already in a situation where assumptions have been violated.<span class="Apple-converted-space"> </span><br><br>> I’m sorry, but I completely fail to grasp the danger as being > crashing.<span class="Apple-converted-space"> </span><br><br>Crashing is inconvenient. The user may have to retry their request or relaunch their app. Security breaches or data corruption are disasters that can have unbounded impact and cost—you can't undisclose sensitive data.<span class="Apple-converted-space"> </span><br><br>> I’d be interested to know who these web server developers (ex. Kitura, Vapor) are targeting without any form of crash handling and if they read these threads. It really limits the pool of developers more so than on apps because a single crash on the app ie equivelant to a failed request, not a crashed web server. I realize you are not competing with Java, but I do not see yet the compelling reason for no crash handling.<span class="Apple-converted-space"> </span><br>><span class="Apple-converted-space"> </span><br>> The “actors” with thread pool and proccesses is one idea, but I think these servers are aiming also for speed and scaleability - don’t know if they would accept this model. I know that it does get used, and do work for a company that uses it on their backend (just plain Java, not sep. processes). Their front-end probably runs like a pre-fork server, but Java is so stable that there is simply no need for that.<span class="Apple-converted-space"> </span><br><br>You can use processes for fault isolation today, and that will have some cost. At Swift's current maturity level, that's really probably the only responsible isolation strategy. The goal of "actors" would be to get most of the benefits of processes through language-level isolation without paying the full cost of processes.<span class="Apple-converted-space"> </span><br><br>-Joe</div></div></span></blockquote></div><p><br></p><p>I have no personal objection to actors or processes or anything else. I would just emphasize that the webservers in existence for Swift (and quite well funded) are right now on a “crash the whole thing” model AFAIK. I don’t know if they will be able to get by with catching all the precondition failures in testing - maybe they will - maybe not, but I see people either wisely turning down Swift for web development or getting their first crash as a “zero-day” system down event where some guy has to ssh in and actually start the server back up.</p><p>But whatever the fix is, or nothing, they (developers of Perfect, Kitura, Vapor, etc) will have to like it and implement it. If they’re not interested, I’m not starting a development company to compete. And also the development time is so short on my idea that you basically just have to approve it and the development time for it is hours not months or years. Just add a fatalError function override and any c developer could have it done in minutes like this guy <a href="https://github.com/ankurp/unsafe-swift">https://github.com/ankurp/unsafe-swift</a> (not endorsing the post, just showing evidence that setjmp and longjmp work fine with swift).</p><div></div></body></html>