4 ms·
If any Ubuntu maintainers are listening: PLEASE STOP DOING THIS
- cozzyd 6y agoUbuntu's gcc also randomly makes me need to add -Wl,--no-as-needed to my flags. Probably because I'm doing something slightly wrong, but whatever it is I'm doing works fine on Fedora/EL.
- ilammy 6y agoI imagine why would Ubuntu developers do it like that: to 'fix' the 'broken' build systems which do not respect CFLAGS.
- nerdponx 6y agoHow many build systems are that broken, and unpatchably so?
- jdsalaro 6y agoHow can anyone possibly think this is a good idea? This is such a bad decision that it almost disappoints me more than Ubuntu's relentless push of the badly broken and poorly designed Snap ecosystem.
- est31 6y agoWhy should it not? For the most part this flag seems to be working. And it improves security. Windows can't do something like that for most of the software targeting it because it's all in binary form. For the software available through the default Ubuntu repos, source is available, so Ubuntu can offer this.
- worik 6y ago"If any Ubuntu maintainers are listening".... You'd be lucky, in my experience. They Know Better
- necovek 6y agoDo you have a case in point? I've seen plenty of things were they couldn't meet the demand, but were they were simply taking the high ground?
- worik 6y agoI cannot give you details, like dates or version numbers, but I can give you a anecdote about when I lost the trust. When they introduced Unity (? Their version of Gnome Shell, I think that is what it was called). I found unity after I did a `full-upgrade`. Suddenly my user interface was something that I could not understand, had no idea of how to use, and did not work very well. There was no path back to the user interface I knew well. I had to stop everything I was doing with the computer, way beyond what I had allocated for the upgrade. I grizzled on our local Linux users email group (I vented I think) which was interesting because two people who worked for Canonical (Ubuntu's maker) and took it personally that I would call their employer a whole lot of bad things, for giving me "free software". I was furious. Turns out I found later that Unity was not even ready for release and had been rushed out (I think I remember the reasons, but not sure enough to relate them). All they needed to do was do a parallel release then I could have learnt it, evaluated it, they could have debugged it. I went back to Ubuntu when they adopted the Gnome Shell - it is a good interface, I am convinced now. But wind on several years and software I needed to have, but not use often, had to be installed in snaps was the final straw. Not just the waste (I want my laptop to be a integrated system, not a mess of different walled off packages) but the fact that I would no longer be in control of the updates. After the debacle of having a very buggy user interface foisted on me I am not ready to give them such control. I understand what snaps are good for, but I am headed in a different direction.
- necovek 6y agoIt's a funny anecdote: at the time half-baked Unity was rolled out, Gnome Shell was introduced as well, and it was worse (no really: even if you liked the UX design, it was so buggy to be really unusable; Unity was simply a plugin for Compiz trying to turn off all features that were buggy). And that's coming from someone with "emeritus" @gnome.org email address. So basically you were going to get an entirely unfamiliar interface anyway. You could get unpolished Red Hat contraption of Gnome Shell, or unpolished Canonical contraption of Unity. If anything, Unity had more resemblance to the interface of old (eg you had static virtual desktops, which you only kinda have even today with Gnome), and if you ever used a spatial grid of workspaces (to leverage your human spatial memory: I used 3x3 grid with Emacs in the centre one and task-based workspaces around it), you were out of luck with Gnome 3. I think Gnome 3 has become significantly more robust even before Unity's demise, but UX design-wise, Unity is much better even today after being unmaintained for years (though buggy as hell).
- wmf 6y agoIf anyone like me is wondering what -fcf-protection=full means: https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.h... Enable code instrumentation of control-flow transfers to increase program security by checking that target addresses of control-flow transfer instructions (such as indirect function call, function return, indirect jump) are valid. This prevents diverting the flow of control to an unexpected target. This is intended to protect against such threats as Return-oriented Programming (ROP), and similarly call/jmp-oriented programming (COP/JOP).
- dmw_ng 6y agoThe introduction of https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf https://software.intel.com/sites/default/files/managed/4d/2a... has as much detail as I could ask for. Seems the GCC flag only enables the Intel implementation for now
- ufo 6y agoDo you know what this flag considers to be a "valid" control flow transfer? The documentation makes it sound that this feature can safely be enabled all the time. But the linked article suggests otherwise...
- mlyle 6y agoIt's safe almost always, unless A) you're doing something really undefined-behavior-ish and strange... or, here, for iPXE, I'm guessing the problem is B) you're running code that it emits assuming it's running on the Linux kernel in a fully initialized environment in a preboot/embedded environment.. and still expect setjmp/longjmp to work. That is, it doesn't make sense with -ffreestanding, but Ubuntu enables it in that case.
- amluto 6y agoThe GCC docs seem basically useless. I have no idea if GCC plans to keep it like this forever but, right now, this is about x86's CET features. CET is an Intel spec that adds two very loosely related features: Indirect Branch Tracking (IBT) and Shadow Stacks (SHSTK). Neither is supported yet by upstream Linux. IBT is a rather weak indirect-branch-and-call protection scheme. IMO it's weak enough that it has dubious value, and software-only schemes can be a lot stronger. The main benefits of IBT are that it can guarantee that a program won't, even when attacked, jump to the middle of an instruction and that, since IBT is a hardware mitigation, it can provide a degree of protection against Spectre-like attacks. Specifically, the CPU won't speculatively branch to an address that isn't an indirect branch target. SHSTK is a very strong return address protection. With SHSTK on, it's really quite difficult to convince the CPU to let RET branch to anywhere other than were the original CALL came from. This even integrates with the page tables -- the memory it uses cannot be written by normal stores. The latter part is a large part of why this isn't upstream yet: the x86 pagetable format is already a technically-indebted mess, and SHSTK makes it worse in ways that are quite nasty. It'll get sorted out eventually. You can find SHSTK in Zen 3 (yes, AMD brought Intel's feature to market before Intel -- go AMD!) and, apparently, in one Tiger Lake part. The latter also supports IBT. You can play with the GCC support by compiling a trivial program like this: void test(void (*fn)()) { fn(); } (no Godbolt link because I didn't figure out how to extract the right output from Godbolt.) If you compile with -S -fcf-protection=branch, the indirect jump is unchanged but the function itself gets an endbr64 (or endbr32) instruction at the beginning. That's a new special NOP that means "this is a valid indirect branch target". The CPU will only allow indirect branches that land on an endbr64 instruction, so the actual indirect jump in this function is unchanged. I think GCC is clever enough to omit the endbr64 if it can prove that the address of the function is not taken. The other interesting thing that GCC does is to emit this: .section .note.gnu.property,"a" .align 8 .long 1f - 0f .long 4f - 1f .long 5 0: .string "GNU" 1: .align 8 .long 0xc0000002 .long 3f - 2f 2: .long 0x3 3: .align 8 The 0x3 changes depending on the -fcf-protection option. This is a magic incantation for the benefit of the linker and kernel declaring whether this object supports IBT and/or SHSTK. This way you don't crash if you link a non-endbr-instrumented file into a IBT-using program. Note that SHSTK support doesn't affect the code at all. The CALL and RET magic is handled by the CPU, and library functions like setjmp use special new instructions in order to keep working. There is also CPU support for CET and IBT in the kernel. SHSTK in the kernel is a huge mess. Specifically, the x86 architecture is starting to fall apart -- there are various ill-conceived features like SYSCALL, NMI, the machine check architecture, and some fancy virtualization features that, collectively, conspire to make it extremely complicated to correctly handle all types of interrupts and interrupt-like events. SHSTK-in-kernel makes it worse, and I don't think anyone wants to try to deal with this yet. I and others have been badgering Intel and AMD for quite some time to do something about the mess that x86 kernel entries have become, and so far there are no results.
- amluto 6y ago(Kernel person here. I have nothing to do with Ubuntu or gcc, but I can maybe help fix the problem.) It would be great if this came with an explanation of what broke. CET should not break setjmp.
- mlyle 6y agoI'd imagine the problem is that iPXE is preboot firmware, so the emitted setjmp/longjmp builtins assume a shadow stack that's set up, etc. Ubuntu should not enable the flag when -ffreestanding is set.
- amluto 6y agoI'm not sure what causes gcc to emit the builtin setjmp/longjmp, but I tried compiling this: #include <setjmp.h> void __attribute__((noinline)) test(jmp_buf buf) { __builtin_longjmp(buf, 1); } int main() { jmp_buf buf; if (__builtin_setjmp(buf) == 0) test(buf); return 0; } and ran it on a non-CET machine. It works fine. It does contain a CET fixup, but that CET fixup is smart enough to work regardless of whether CET is enabled. However, gcc does generate non-working code if the setjmp and the longjmp are in different files and only one is compiled with -fcf-protection=full. Ouch. I'll file a bug. edit: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98997 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98997
- mlyle 6y agoThe issue isn't a non-CET machine. The CET becomes NOPs on non-CET machines. The issue is expecting it to work in a freestanding environment.
- amluto 6y agoIt ought to work in a freestanding environment. If it doesn’t, then it’s IMO a gcc bug. I found a GCC bug which may or may not be the ipxe issue. Are you seeing another failure in a freestanding environment? If so, I don’t suppose you either have a reproducer or can point at a problem in the generated code?
- testmasterflex 6y agoWhat’s the best alternative to Ubuntu? Debian?
- macksd 6y agoDepends what you're looking for. If you're used to Ubuntu you'll find Debian to be similar: just a less-polished, less-branded UI and maybe slightly older (perhaps more stable) packages. You might also like Fedora as a pretty mainstream, up to date desktop distro, but under the hood you'll find more differences like rpm instead of apt. edit: I'd add that Linux distros are complicated: the issue in this article is hardly a reason to leave Ubuntu if it's otherwise working well for you.
- shmerl 6y agoDon't use Debian stable for desktop. Debian testing or unstable is a much better option.
- shadowofneptune 6y agoI have found the one big feature of Ubuntu that I miss in Debian is PPAs. Other than that it's largely the same. Configuring the system requires more file editing and command line work than I remember with Ubuntu, but the documentation helps quite a bit. EDIT: By default, non-free drivers are placed in a separate repository, and receive less support. In my case the biggest pain has been Nvidia drivers. I needed a cheap card to drive an HDMI display and all they had at the store was a GT710. That meant installing the proprietary drivers, since the free alternative had poor performance last time I checked. Every few updates it breaks, and I need to reinstall it and sign the kernel module each time. That is something to watch out for if you switch over.
- dheera 6y agoUgh. I rebooted my machine last week and VirtualBox and CUDA broke because Ubuntu upgraded the kernel. When can we have a system that updates itself without breaking stuff?
- throwawaygulf 6y ago>When can we have a system that updates itself without breaking stuff? We did, it was called CentOS.
- tluyben2 6y agoAnecdotal but we left centos for debian because it kept failing after kernel upgrades (machine would not come back / kernel hang: we had it so many times that we migrated completely off it): never had that issue with debian (or ubuntu) and I use both fulltime on servers and desktops (laptops). We had other issues with broken deps with yum as well. I think GPUs might be a different story but we have not needed those beyond the trivial usage, and those were not discrete.
- colechristensen 6y agoWere you using funny third party repositories?
- tluyben2 6y agoNope, then it would be logical. Especially on servers it was all standard stuff.
- dTal 6y agoYou probably installed those things with some third-party installer, instead of through the package manager. You can't expect Ubuntu to know about that. The only way it could not break those things is by never upgrading the kernel.
- 6y ago
- IgorBog61650384 6y agoI get that breaking packages is a bad user experience, but the Linux community at large should start paying more notice to security-first software engineering. Learn a little bit from Microsoft's experience - they made 100% backward compatibility their mantra for years, and look where it got them - a reputation as an unsecure platform with lots of exploits. Linux has many exploits too, its just a less popular platform for research by security researchers so less security bugs are found then Windows. But when those are found - its catastrophic like the last SUDO bug. They way to forward is to understand that even great software developers have bugs with security implementation, as writing reasoning about the correctness of software is very hard, and start implementing wide reaching mitigations by default. Control flow mitigations made implementing exploits on Windows much much harder, raising the bar of "bug to real-world exploit" significantly. Ubuntu setting CF protections to default will encourage many maintainers to finally fix their code.
- deleted 6y ago[deleted]
- Karunamon 6y agoIt also gained them a reputation as literally the only operating system that cares one whit for backwards compatibility, which is one of the reasons it has such high penetration, especially in enterprise. Linux explicitly has no kernel ABI guarantees, and Apple gleefully breaks shit between minor releases.
- AnssiH 6y agoFor what its worth, they do seem to patch the documentation as well: https://salsa.debian.org/toolchain-team/gcc/-/commit/2f9aefe0591fde4386985f2d3da2f9a403c3a465 https://salsa.debian.org/toolchain-team/gcc/-/commit/2f9aefe...
- darig 6y agoIf any Ubuntu users are listening: STOP USING INTEL CPUS
- pabs3 6y agoThe documentation about this flag is on this Ubuntu wiki page: https://wiki.ubuntu.com/ToolChain/CompilerFlags https://wiki.ubuntu.com/ToolChain/CompilerFlags
- rognjen 6y agoWhy not put the "THIS" in the title?