Better HN
topnewbestaskshowjobs
Log inSign up

codedokode

9,867 karma · joined Aug 20, 2015 (11y ago) · 5,528 submissions

PHP developer from Russia.
Submissions

comment 4y ago · link · parent

The presentation was interesting; but I would like to write an idea that is tangentially related to this CPU.

I noticed that modern CPUs are optimized for legacy monolith OS kernels like Linux or Windows. But having a large, multimegabyte kernel is a bad idea from a security standpoint. A single mistake or intentional error in some rarely used component (like a temperature sensor driver) can get attacker full access to the system. Again, an error in any part of the monolith kernel can cause system failure. And Linux kernel doesn't even use static analysis to find bugs! It is obvious that using microkernels could solve many of the issues above.

But microkernels tend to have poor performance. One of the reasons for this could be high context switch latency. CPUs with high context switch latency are only good for legacy OSes and not ready for better future kernels. Therefore, either we will find a way to make context switches fast or we will have to stay with large, insecure kernels full of vulnerabilities.

So I was thinking what could be done here. For example, one thing that could be improved is to get rid of address space switch. It causes flushes of various caches and it hurts performance. Instead, we could always use the single mapping from virtual to physical addresses, but allocate each process different virtual address range. To implement this, we could add two registers, which would hold minumum and maximum accessible virtual addresses. It should be easy to check the address against them to prevent speculative out of bounds memory accesses.

By the way, 32-bit x86 architecture had segments, that could be used to divide single address space between processes.

Another thing that can take time is saving/restoring registers on context switch. One way to solve the problem could be to use multiple banks (say, 64 banks) of registers that can be quickly switched, another way would be to zero out registers on return from kernel and let processes save them if they need it.

Or am I wrong somewhere and fast context switches cannot be implemented this way?

comment 4y ago · link · parent

I like UI minimalism and launch screen, but I don't like some features that they copy from MacOS. For example, separate keys for switching between windows of one application and between different applications. So inconvenient. Poor Mac users.

Also I don't like "(un)natural scrolling", a feature when the content is scrolled in the wrong direction.

Gnome seems to be optimized for high resolution (expensive) displays. On a normal laptop display, everything (buttons, window headers, input fields) seems too large.

Also, Gnome needs better discoverability for its features. For example, on first launch there is an empty desktop and it is not clear that you need to press Windows key to access launch screen.

comment 4y ago · link · parent

I don't see how hash truncation prevents the attack.

Regarding timestamp, precise timestamp is sent in clear text in another event field (currentTime_ms) so its presence doesn't prevent message content recovery.

comment 4y ago · link · parent

> How are you assuming a known dictionary

If the user is from country A, there is high probability that they use language of country A. Regarding word count, you don't need to know it. First, try to calculate hashes of all one-word messages. Then, all hashes of two-word messages. And so on.

Google also can collect statistics on which words and word combinations are used more often (for example, from gmail messages) and use this to accelerate bruteforce.

> And for the other examples, you’re somehow assuming a fully precalculated rainbow table of all possible such PII. Seriously…?

Let's take phone numbers as an example. Russian phone number starts with +7 which is followed by 10 random digits. Therefore, there can be maximum of 10^10 = 10 billions numbers. This answer [1] states that a GPU can calculate up to 10 billion MD5 or SHA1 hashes per second. Therefore, recovering a phone number from a hash would take approximately one second on a typical consumer hardware.

Note that one could build a custom CPU optimized for calculating hashes and get higher throughput.

Regarding credit card numbers, there is larger search space: you have to guess 15 digits (16th digit is a checksum). But it is not like there are 10^15 credit cards in the world. This search space can be significantly reduced, for example, by filtering by BIN (first 6 digits that identify the issuer bank).

This is why hashing short identifiers (like phone number or card number) doesn't make much sense and such hash can be easily reversed.

[1] https://security.stackexchange.com/a/38135

comment 4y ago · link · parent

Yes, it is 128-bit hash. 128 bits are enough to recover a message made of 3-4 words. Some messages are build by template, for example, a message from a bank saying "Your PIN code is XXXX". In this case, it is possible to recover the PIN code using 128-bit hash as the number of possible PIN codes is less than 2^128.

comment 4y ago · link · parent

Messages are usually composed from words, not from random letters, so you don't need to bruteforce all letter combinations.

Also, some messages use a template, for example, a message from an online store like "Your order number XXXXX is ready for pickup" or a message from a bank saying "Your PIN code is XXXX". In this case, all you need to guess is a number.

comment 4y ago · link · parent

> a hash of the message text

This allows to restore the message if it is short. Let's say a typical user knows 2×10^4 words and the message contains 3 words. If each word can be chosen with equal probability independently of others then one can guess the message content after an average of 4×10^12 attempts. And of course, one can check all the hashes at the same time.

So the hash function is effectively reversible for short pieces of data, like phone numbers, DOB, card numbers, emails and so on.

comment 4y ago · link · parent

I guess that the only solution for malicious packages problem would be to have someone review the code. As there's lot of code and reviewing takes time, this has to be a paid service - for a pay you get access to a "safe" repository.

I am not sure if it could be viable business model though. People who use open source got used that it is free and are unlikely to pay.

comment 4y ago · link · parent

In theory, IDs can be verified against government-owned database. That's how online ID verification for payment systems works in Russia.

comment 4y ago · link · parent

Regarding adult content, don't you think that there is a better solution? Websites could add a HTTP header containing content rating; if the header is missing then it is considered 18+ content. Browsers use this header to restrict access according to OS settings.

This way the problem can be solved without any IDs and credit cards.

Also I don't understand why age verification is needed for Google Play. Isn't adult content already banned there?

comment 4y ago · link · parent

Meld might be useful for comparison, but in my opinion it is inconvenient as a git merge tool. For git merge I need four panels: original file, version A, version B, merged result. Meld has only three panels.

Currently I am using KDiff3. It is a little buggy and doesn't have a nice UI but it is the best open source merging tool that I am aware of. It allows choosing lines from original file, from A, B and manual editing.

I noticed that certain popular and highly praised commercial IDE also provides only 3-panel interface for merging. This makes resolving conflicts more difficult and prone to errors.

comment 4y ago · link · parent

> Russian oligarchs have donated millions of pounds to the Conservative Party

I don't understand how this is possible. Is it legal in Britain for foreigners to finance political parties?

comment 4y ago · link · parent

As we are discussing layouts, I would like to point to a bigger problem (in my opinion) with keyboards: they don't have enough keys.

Let me explain. While Latin alphabet has only 26 letters, many languages have more of them. For example, Russian alphabet has 33 letters. Therefore, to fit these letters there must be 7 more keys. But we also need two keys to switch layouts - so in total there should be 9 extra keys.

Sadly, manufacturers (including Apple that claims to "think different", but in this case thinks exactly the same as PC vendors) don't want to add even a single key, instead they put extra letters onto keys with symbols, so you have to switch layouts to type those symbols. Furthermore, several characters like period or comma are located on different keys in different layouts. Guess, how easy it becomes to make a mistake.

Switching layouts is inconvenient. Instead of having two dedicated keys for switching to each language, OS vendors add single switching combination like Shift + Alt (Windows) or Cmd + Space (Mac). Also, on keyboard itself there is no indication that these keys can switch layout.

One could argue that it is difficult to find more space on laptops. Well, I think that this can be solved somehow. For example, one could add an extra row. But it is absolutely possible on desktop PC keyboards, and yet nobody is doing this.

comment 4y ago · link · parent

I don't understand why we should compare performance in artificial benchmarks to power consumption. Electricity is cheap and I assume that most laptop users have a wall socket nearby. Instead, it makes sense to compare typical user performance (not CPU instruction count) versus price.

For example, let's say CPU A has 32 cores each capable to perform 1B instructions and costs $1000, and CPU B has 4 cores with same speed, but costs $100. Let's say typical task for a machine is browsing social network sites. If this task uses only 4 cores and a user can browse same number of web pages per unit time then effectively both A and B have the same performance, but CPU A has 10 times worse typical performance per dollar.

A metric in this case should be not the count of executed instructions, but for example, a count of web pages viewed by user per unit time, or share of time spent actually viewing pages (and not waiting for them to load).

Of course, you can make similar metrics for other uses - for example, a time taken by illustrator to draw a picture, or count of written lines of code per unit time for a programmer. All divided by hardware cost.

That's the type of comparison I would like to see. Would Apple be winning in such fair and realistic benchmark is an open question. I doubt that.

comment 4y ago · link · parent

I don't understand the motivation to remove MSI support. The document says:

> Microsoft is slowly moving away from MSI in favor of Windows 10 Apps (AppX) as a new deployment model

First, MSI has better OS support than AppX, second, many users are still using Windows 7 and won't be able to use AppX. MSI is not some 30-years old deprecated standard.

comment 4y ago · link · parent

Yes, it is definitely Dostoyevsky's fault that he didn't get up from his tomb and didn't oppose Putin.

comment 4y ago · link · parent

But one does not need citizenship to explode a bomb. How is the law going to help here?

comment 4y ago · link · parent

So-called "DNR" region of Ukraine was created with the help of Russian army. There was nothing similar to Israel-Palestine situation. So your analogy is wrong.

comment 4y ago · link · parent

This was a stupid decision. Thawte is helping Russian government here and gives them a valid excuse to force switching Russian internet to national-issued certificates. It won't hurt Russian economy or Russian army.

comment 4y ago · link · parent

Interesting. I thought only authoritarian regimes decide for citizens what they should or should not watch.

comment 4y ago · link · parent

Yes, I also noticed that while modern monitors tend to become larger, they still have the same 0.3 or 0.2 mm pitch (80-120 dpi) as many years ago. Even on cheap smartphones the text looks better than on monitors.

comment 4y ago · link · parent

All phone calls and text messages in Russia must be recorded and stored for at least 6 months according to the law. Also, about 1 month worth of Internet traffic is also recorded.

comment 4y ago · link · parent

Probably "everything stops" because tabs consume too much memory and OS starts swapping data to disk.

comment 4y ago · link · parent

You cannot install "cheap" memory into older laptops. Battery life doesn't matter for laptops as they are mostly used at home.

comment 4y ago · link · parent

I think that browser developers are optimizing the wrong thing. Specifically: they optimize for execution speed while they better optimize for minimum memory usage instead. Let me explain why this is more important.

Let's say I am visiting a properly made website and it takes 10% of CPU to render. Even if browser devs make their browser twice faster, it will only save 5% of CPU time - and that would be completely unnoticeable. You might ask, what about modern websites, built with D*t compiled to webassembly, GPU acceleration, reactive frameworks, material design and capable to load the multi-core CPU at 100%? I am not using such sites so I don't care.

Now let's look at memory usage. Optimizing for speed usually causes increased memory consumption, and this increases the chance of invoking swapping. If the system starts swapping, it becomes orders of magnitude slower. No speed optimizations will matter in this case.

Therefore if you are targeting wide audience, and not only mac users, then you should be optimizing for memory usage. If the browser could use two times less memory while using twice amount of CPU time that would be perfect. Just think how many laptops with 2 or 4 Gb of RAM would become usable again.

comment 4y ago · link · parent

I also noticed that digit keys on keyboard in desktop calculators are useless - why would you type in numbers by clicking? It's very slow.

3447.

Do Russians Want War? A Poll(dorussianswantwar.com ↗)

1 points · by codedokode · 4y ago · discuss

comment 4y ago · link · parent

But I think that Russian and US military policy sometimes is similar. Let's take Syria as an example. Syria had good relations with Russia and as a trustworthy and reliable ally allowed to build a Russian base there. I guess that US didn't like the idea of having a foreign military base in the Middle East so they supported the opposition trying to overthrow the government. And Russia didn't like the idea of losing a base and a good ally so they supported the government.

Am I wrong here? It looks like nobody really cared about Syrian people and that's what's similar in US and Russia foreign policy. Wars are usually waged for land or for power, not to protect someone's liberties.

You are right though that America recently didn't annex land; but they did so earlier, see history of Panama Canal Zone for example [1]:

> In March 1902 Colombia set its terms for such a treaty: Colombia was to be sovereign over the canal, which would be policed by Colombians paid for by the United States. The host nation would receive a larger percentage of the tolls than provided for in earlier draft treaties.

> The draft terms were quickly rejected by American officials.

> A Frenchman who had worked on his nation's canal efforts, Philippe Bunau-Varilla, represented Panamanian insurgents; he met with Roosevelt and with Secretary of State John Hay, who saw to it that his principals received covert support. When the revolution came in November 1903, the United States intervened to protect the rebels, who succeeded in taking over the province, declaring it independent as the Republic of Panama.

> negotiated a treaty, giving the United States a zone 20 miles (32 km) wide and full authority to pass laws to govern that zone.

The same trick that US, USSR and Russia have repeated multiple times since: support the opposition against the government; get something valuable (like land or permission to build military bases) in return. Repeat if the opposition you have helped stops being grateful.

[1] https://en.wikipedia.org/wiki/Panama_Canal_Zone

comment 4y ago · link · parent

Please note that according to the article, 70% rating was before the war (which, by the way, Russian mass media are not allowed to call a "war"; it is a "special military operation"). It is unclear how the war could change people's mind.
1
114115116
185